File: dsapifilter.h

package info (click to toggle)
libapache-mod-jk 1%3A1.2.18-3etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 5,008 kB
  • ctags: 2,664
  • sloc: ansic: 20,014; sh: 8,661; xml: 7,304; perl: 617; makefile: 321; awk: 59
file content (348 lines) | stat: -rwxr-xr-x 9,048 bytes parent folder | download | duplicates (2)
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
/*--------------------------------------------------------------------
 *
 *      File:      dsapifilter.h
 *
 *      Copyright (c)1999 Iris Associates
 *
 *-------------------------------------------------------------------*/

#if !defined(DSAPIFILTER_H)
#define DSAPIFILTER_H

#ifdef __cplusplus
extern "C"
{
#endif

/*---
 *      Types and Defines
 */

#define kInterfaceVersion   2
#define kMaxFilterDesc   255

    typedef unsigned char LMBCS;

    typedef enum
    {
        kFilterNotHandled = 0,
        kFilterHandledRequest = 1,
        kFilterHandledEvent = 2,
        kFilterError = 3
    }
    FilterReturnCode;

/*--
 *      Filter interface
 */

/*---
*      events to register for
*/
    typedef enum
    {
        kFilterRawRequest = 0x01,
        kFilterParsedRequest = 0x02,
        kFilterAuthUser = 0x04,
        kFilterUserNameList = 0x08,
        kFilterMapURL = 0x10,
        kFilterResponse = 0x20,
        kFilterRawWrite = 0x40,
        kFilterEndRequest = 0x80,
        kFilterAny = 0xFF
    }
    EventFlags;

/*---
 *      filter initialization data
 */
    typedef struct
    {
        unsigned int serverFilterVersion;
        unsigned int appFilterVersion;
        unsigned int eventFlags;
        unsigned int initFlags;
        char filterDesc[kMaxFilterDesc + 1];
    }
    FilterInitData;

/*---
 *      request line structure
 */
    typedef struct
    {
        unsigned int method;
        char *URL;
        char *version;
        char *userName;
        char *password;
        unsigned char *clientCert;
        unsigned int clientCertLen;
        char *contentRead;
        unsigned int contentReadLen;
    }
    FilterRequest;

/*---
 *      filter context data included in every call to filter
 */
    typedef struct _FilterContext
    {
        unsigned int contextSize;
        unsigned int revision;
        void *serverContext;
        unsigned int serverReserved;
        unsigned int securePort;
        void *privateContext;

        int (*GetRequest) (struct _FilterContext * context,
                           FilterRequest * request, unsigned int *errID);

        int (*GetRequestContents) (struct _FilterContext * context,
                                   char **contents, unsigned int *errID);

        int (*GetServerVariable) (struct _FilterContext * context, char *name,
                                  void *buffer, unsigned int bufferSize,
                                  unsigned int *errID);

        int (*WriteClient) (struct _FilterContext * context, char *buffer,
                            unsigned int bufferLen, unsigned int reserved,
                            unsigned int *errID);

        void *(*AllocMem) (struct _FilterContext * context, unsigned int size,
                           unsigned int reserved, unsigned int *errID);

        int (*ServerSupport) (struct _FilterContext * context,
                              unsigned int funcType, void *data1, void *data2,
                              unsigned int other, unsigned int *errID);
    }
    FilterContext;

    typedef unsigned int (*FilterInitFuncType) (FilterInitData * initData);
    typedef unsigned int (*FilterEventFuncType) (FilterContext * context,
                                                 unsigned int eventType,
                                                 void *eventData,
                                                 unsigned int *errID);
    typedef unsigned int (*FilterTermFuncType) (unsigned int);

/*---
 *      request methods
 */
    typedef enum
    {
        kRequestNone = 0,
        kRequestHEAD = 1,
        kRequestGET = 2,
        kRequestPOST = 3,
        kRequestPUT = 4,
        kRequestDELETE = 5
    }
    RequestMethod;

/*---
 *      server support function types
 */
    typedef enum
    {
        kWriteResponseHeaders = 1
    }
    ServerSupportTypes;

/*---
 *      'data1' for server support function 'kWriteResponseHeaders'
 */
    typedef struct
    {
        unsigned int responseCode;
        char *reasonText;
        char *headerText;
    }
    FilterResponseHeaders;

/*---
 *      raw request (headers not processed yet)
 */
    typedef struct
    {
        unsigned int requestMethod;

        int (*GetAllHeaders) (FilterContext * context, char **headers,
                              unsigned int *errID);

        int (*GetHeader) (FilterContext * context, char *name, char *buffer,
                          unsigned int bufferSize, unsigned int *errID);

        int (*SetHeader) (FilterContext * context, char *name, char *value,
                          unsigned int *errID);

        int (*AddHeader) (FilterContext * context, char *header,
                          unsigned int *errID);

        unsigned int reserved;
    }
    FilterRawRequest;

/*---
 *      parsed request
 */
    typedef struct
    {
        unsigned int requestMethod;

        int (*GetAllHeaders) (FilterContext * context, char **headers,
                              unsigned int *errID);

        int (*GetHeader) (FilterContext * context, char *name, char *buffer,
                          unsigned int bufferSize, unsigned int *errID);

        unsigned int reserved;
    }
    FilterParsedRequest;

/*---
 *      URL map
 */
    typedef struct
    {
        const char *url;
        char *pathBuffer;
        unsigned int bufferSize;
        unsigned int mapType;
    }
    FilterMapURL;

/*---
 *      URL map types
 */
    typedef enum
    {
        kURLMapUnknown = 0,
        kURLMapPass = 1,
        kURLMapExec = 2,
        kURLMapRedirect = 3,
        kURLMapService = 4,
        kURLMapDomino = 5
    }
    FilterULMapTypes;

/*---
 *      user authentication
 */
    typedef struct
    {
        LMBCS *userName;
        LMBCS *password;
        unsigned char *clientCert;
        unsigned int clientCertLen;
        unsigned int authFlags;
        unsigned int preAuthenticated;
        unsigned int foundInCache;
        unsigned int authNameSize;
        LMBCS *authName;
        unsigned int authType;

        int (*GetUserNameList) (FilterContext * context, LMBCS * buffer,
                                unsigned int bufferSize,
                                unsigned int *numNames, unsigned int reserved,
                                unsigned int *errID);

        int (*GetHeader) (FilterContext * context, char *name, char *buffer,
                          unsigned int bufferSize, unsigned int *errID);
    }
    FilterAuthenticate;

/*---
 *      user authentication types
 */
    typedef enum
    {
        kNotAuthentic = 0,
        kAuthenticBasic = 1,
        kAuthenticClientCert = 2
    }
    FilterAuthenticationTypes;

/*---
 *      authentication configuration flags
 */
    typedef enum
    {
        kAuthAllowBasic = 1,
        kAuthAllowAnonymous = 2,
        kAuthAllowSSLCert = 4,
        kAuthAllowSSLBasic = 8,
        kAuthAllowSSLAnonymous = 16,
        kAuthRedirectToSSL = 32
    }
    FilterAuthConfigFlags;

/*---
 *      user name list
 */
    typedef struct
    {
        const LMBCS *userName;

        int (*GetUserNameList) (FilterContext * context, LMBCS * buffer,
                                unsigned int bufferSize,
                                unsigned int *numNames, unsigned int reserved,
                                unsigned int *errID);

        int (*PopulateUserNameList) (FilterContext * context, LMBCS * buffer,
                                     unsigned int bufferSize,
                                     unsigned int *numNames,
                                     unsigned int reserved,
                                     unsigned int *errID);

        int (*AddGroupsToList) (FilterContext * context, LMBCS * groupNames,
                                unsigned int numGroupNames,
                                unsigned int reserved, unsigned int *errID);

        int (*RemoveGroupsFromList) (FilterContext * context,
                                     unsigned int reserved,
                                     unsigned int *errID);

        unsigned int reserved;
    }
    FilterUserNameList;

/*---
 *      request response
 */
    typedef struct
    {
        unsigned int responseCode;
        char *reasonText;

        int (*GetAllHeaders) (FilterContext * context, char **headers,
                              unsigned int *errID);

        int (*GetHeader) (FilterContext * context, char *name, char *buffer,
                          unsigned int bufferSize, unsigned int *errID);

        int (*SetHeader) (FilterContext * context, char *name, char *value,
                          unsigned int *errID);

        int (*AddHeader) (FilterContext * context, char *header,
                          unsigned int *errID);

        unsigned int reserved;
    }
    FilterResponse;

/*---
 *      write content
 */
    typedef struct
    {
        char *content;
        unsigned int contentLen;
        unsigned int reserved;
    }
    FilterRawWrite;

#ifdef __cplusplus
}
#endif

#endif                          /* DSAPIFILTER_H */