-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebservice_interface.h
163 lines (148 loc) · 11.3 KB
/
webservice_interface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/***
Copyright 2010-2021 by Omar Alejandro Herrera Reyna
Caume Data Security Engine, also known as CaumeDSE is released under the
GNU General Public License by the Copyright holder, with the additional
exemption that compiling, linking, and/or using OpenSSL is allowed.
LICENSE
This file is part of Caume Data Security Engine, also called CaumeDSE.
CaumeDSE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CaumeDSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CaumeDSE. If not, see <http://www.gnu.org/licenses/>.
INCLUDED SOFTWARE
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
This product includes cryptographic software written by
Eric Young ([email protected]).
This product includes software written by
Tim Hudson ([email protected]).
This product includes software from the SQLite library that is in
the public domain (http://www.sqlite.org/copyright.html).
This product includes software from the GNU Libmicrohttpd project, Copyright
© 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009, 2010 , 2011, 2012 Free Software Foundation, Inc.
This product includes software from Perl5, which is Copyright (C) 1993-2005,
by Larry Wall and others.
***/
#ifndef WEBSERVICE_INTERFACE_H_INCLUDED
#define WEBSERVICE_INTERFACE_H_INCLUDED
//Structure to hold connection information to be shared during POST iterations (from 'A Tutorial for GNU libmicrohttpd' v.0.9.8).
struct cmeWebServiceConnectionInfoStruct
{
int connectionType;
struct MHD_Connection *connection;
struct MHD_PostProcessor *postProcessor;
FILE *filePointer;
char *fileName; //required by remove ()
char *answerString; //Note: this will be dynamically allocated! cmeWebServicePOSTIterationCompleted must free it.
char **postArglist; //Note: this will be dynamically allocated! cmeWebServicePOSTIterationCompleted must free it.
int postArgCont;
int answerCode;
int threadStatus; //signal to the thread that it is ok to clean stuff here. 0=in progress, 1=thread done,waiting, 2=thread done, closing.
};
//Structure to hold content reader information to be shared during ContentReader iterations.
struct cmeWebServiceContentReaderStruct
{
FILE *fpResponseFile;
char *fileName;
};
//IN-Callback function to process web services connections from clients.
int cmeWebServiceAnswerConnection (void *cls, struct MHD_Connection *connection, const char *url,
const char *method, const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls);
//IN-Callback function to parse HTTP key pairs (headers, arguments,...) depending on kind.
int cmeWebServiceParseKeys(void *cls, enum MHD_ValueKind kind, const char *key, const char *value);
//IN-Callback function to parse elements of a URI/URL.
int cmeWebServiceParseURL(const char *url, char ***urlElements, int *numUrlElements);
//IN-Callback function to process Web service requests.
int cmeWebServiceProcessRequest (char **responseText, char **responseFilePath, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, int numUrlElements,
const char **headerElements,const char **argumentElements, const char *method,
struct MHD_Connection *connection);
//Function to process user resource requests
int cmeWebServiceProcessUserResource (char **responseText, char **responseFilePath, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements,const char **argumentElements, const char *method);
//Function to process user class resource requests
int cmeWebServiceProcessUserClass (char **responseText, char ***responseHeaders, int *responseCode, const char *url,
const char **urlElements,const char **argumentElements, const char *method);
//Function to process engine resource requests
int cmeWebServiceProcessEngineResource (char **responseText, int *responseCode, const char *url,
const char **argumentElements, const char *method, int *powerStatus);
//Function to process roleTable resource requests
int cmeWebServiceProcessRoleTableResource (char **responseText, char **responseFilePath, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method);
//Function to process organization resource requests
int cmeWebServiceProcessOrgResource (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method);
//Function to process organization class resource requests
int cmeWebServiceProcessOrgClass (char **responseText, char **responseFilePath, char ***responseHeaders, int *responseCode,
const char *url, const char **argumentElements, const char *method);
//Function to process storage resource requests
int cmeWebServiceProcessStorageResource (char **responseText, char **responseFilePath, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method);
//Function to process storage class resource requests
int cmeWebServiceProcessStorageClass (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method);
//Function to process documentType resource requests
int cmeWebServiceProcessDocumentTypeResource (char **responseText, char **responseFilePath, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method);
//Function to process document resource requests
int cmeWebServiceProcessDocumentResource (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method,
const char *storagePath, struct MHD_Connection *connection);
//Function to process document class resource requests
int cmeWebServiceProcessDocumentClass (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements,
const char *method, const char *storagePath);
//Function to process parserScripts resource requests for handling document content
int cmeWebServiceProcessParserScriptResource (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements,
const char *method, const char *storagePath);
//Function to process document content requests
int cmeWebServiceProcessContentClass (char **responseText, char **responseFilePath, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method,
const char *storagePath);
//Function to process contentRow requests and parameters.
int cmeWebServiceProcessContentRowResource (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method,
const char *storagePath);
//Function to process contentColumn requests.
int cmeWebServiceProcessContentColumnResource (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **urlElements, const char **argumentElements, const char *method,
const char *storagePath);
//IN-CALLBACK function to iterate message chunks of POST requests.
int cmeWebServicePOSTIteration (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
const char *filename, const char *content_type,
const char *transfer_encoding, const char *data, uint64_t off,
size_t size);
//IN-CALLBACK function to finish message chunks iteration of POST requests.
void cmeWebServiceRequestCompleted (void *cls, struct MHD_Connection *connection,
void **coninfo_cls, enum MHD_RequestTerminationCode toe);
//Function to get the file path for a specific storageId and organizationId.
int cmeWebServiceGetStoragePath (char **storagePath, const char *storageId, const char *orgResourceId, const char *orgKey);
//Function to confirm that a specific orgId is valid (registered).
int cmeWebServiceConfirmOrgId (const char *orgResourceId, const char *orgKey);
//Function to confirm that a specific userId is valid (registered).
int cmeWebServiceConfirmUserId (const char *userResourceId, const char *orgKey);
//Function to verify client certificate chain in a TLS session.
int cmeWebServiceClientCertAuth (const char *userId, const char *orgId, struct MHD_Connection *connection);
//Function to log connection information to LogsDB.
int cmeWebServiceLogRequest (const char *userId, const char *orgId, const char *requestMethod, const char *requestUrl, const char *requestHeaders,
const char *startTimestamp, const char *endTimestamp, const char *requestDataSize, const char *responseDataSize,
const char *orgResourceId, const char *requestIPAddress, const char *responseCode, const char *responseHeaders,
const char *authenticated, const char *orgKey);
//Wrapper function for cmeWebServiceLogRequest().
int cmeWebServiceLogConnection (struct MHD_Connection *connection, void *con_cls, const time_t startTime,
const char *method, const char *url, const long int requestDSize, const long int responseDSize,
const char **requestHeadersList, const char **responseHeadersList, const char **requestArgumentsList,
const char **urlElements, const int numUrlElements);
// Function to process transaction class requests.
int cmeWebServiceProcessTransactionClass (char **responseText, char ***responseHeaders, int *responseCode,
const char *url, const char **argumentElements, const char *method);
#endif // WEBSERVICE_INTERFACE_H_INCLUDED