Wed, 27 Nov 2024 23:00:07 +0100
add TODO to use a future ucx feature
1 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | |
5 | * | |
6 | * THE BSD LICENSE | |
7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions are met: | |
10 | * | |
11 | * Redistributions of source code must retain the above copyright notice, this | |
12 | * list of conditions and the following disclaimer. | |
13 | * Redistributions in binary form must reproduce the above copyright notice, | |
14 | * this list of conditions and the following disclaimer in the documentation | |
15 | * and/or other materials provided with the distribution. | |
16 | * | |
17 | * Neither the name of the nor the names of its contributors may be | |
18 | * used to endorse or promote products derived from this software without | |
19 | * specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | |
25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | |
33 | ||
34 | #ifndef PUBLIC_NSAPI_H | |
35 | #define PUBLIC_NSAPI_H | |
36 | ||
37 | /* | |
38 | * File: nsapi.h | |
39 | * | |
40 | * Description: | |
41 | * | |
42 | * This file defines an interface for extending the server with | |
43 | * in-process plug-ins. | |
44 | */ | |
45 | ||
46 | #ifdef __cplusplus | |
47 | extern "C" { | |
48 | #endif | |
49 | ||
50 | /* NSAPI version defined by this header file */ | |
51 | #define NSAPI_VERSION 303 | |
52 | ||
53 | /* Define USE_NSAPI_VERSION to use a specific NSAPI version at compile time */ | |
54 | #ifdef USE_NSAPI_VERSION | |
55 | #if USE_NSAPI_VERSION < 300 || USE_NSAPI_VERSION > NSAPI_VERSION | |
56 | #error This header file does not support the requested NSAPI version | |
57 | #else | |
58 | #undef NSAPI_VERSION | |
59 | #define NSAPI_VERSION USE_NSAPI_VERSION | |
60 | #endif | |
61 | #endif | |
62 | ||
63 | /* --- Begin native platform configuration definitions --- */ | |
64 | ||
65 | #if !defined(XP_WIN32) && !defined(XP_UNIX) | |
66 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) | |
67 | #define XP_WIN32 | |
68 | #else | |
69 | #define XP_UNIX | |
70 | #endif | |
71 | #endif | |
72 | ||
73 | #ifdef XP_UNIX | |
74 | #define NSAPI_PUBLIC | |
75 | #define ZERO(ptr, len) memset(ptr, 0, len) | |
76 | #ifdef AIX | |
77 | #define TCPLEN_T size_t | |
78 | #endif | |
79 | #ifdef HPUX | |
80 | #define TCPLEN_T int | |
81 | #endif | |
82 | #ifndef TCPLEN_T | |
83 | #define TCPLEN_T socklen_t | |
84 | #endif | |
85 | #endif /* XP_UNIX */ | |
86 | ||
87 | #ifdef XP_WIN32 | |
88 | #define NSAPI_PUBLIC __declspec(dllexport) | |
89 | struct iovec { | |
90 | char *iov_base; | |
91 | unsigned iov_len; | |
92 | }; | |
93 | #ifndef S_ISDIR | |
94 | #define S_ISDIR(mode) ((mode & S_IFMT) == S_IFDIR) | |
95 | #endif | |
96 | #ifndef S_ISREG | |
97 | #define S_ISREG(mode) ((mode & S_IFMT) == S_IFREG) | |
98 | #endif | |
99 | #ifndef S_ISLNK | |
100 | #define S_ISLNK(x) (0) | |
101 | #endif | |
102 | #define caddr_t PCHAR | |
103 | #define NEED_STRCASECMP | |
104 | #define NEED_STRNCASECMP | |
105 | #define ZERO(ptr, len) ZeroMemory(ptr, len) | |
106 | #define TCPLEN_T int | |
107 | #endif /* XP_WIN32 */ | |
108 | ||
109 | /* --- End native platform configuration definitions --- */ | |
110 | ||
111 | /* --- Begin miscellaneous definitions --- */ | |
112 | ||
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
193
diff
changeset
|
113 | #define WS_TRUE 1 |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
193
diff
changeset
|
114 | #define WS_FALSE 0 |
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
193
diff
changeset
|
115 | |
1 | 116 | /* Used in some places as a length limit on error messages */ |
117 | #define MAGNUS_ERROR_LEN 1024 | |
118 | ||
119 | /* Carriage return and line feed */ | |
120 | #define CR 13 | |
121 | #define LF 10 | |
122 | #ifdef XP_WIN32 | |
123 | #define ENDLINE "\r\n" | |
124 | #else | |
125 | #define ENDLINE "\n" | |
126 | #endif | |
127 | ||
128 | /* mime.types file identification line */ | |
129 | #define NCC_MT_MAGIC "#--Netscape Communications Corporation MIME Information" | |
130 | #define NCC_MT_MAGIC_LEN 55 | |
131 | ||
132 | /* The character which separates extensions with cinfo_find */ | |
133 | #define CINFO_SEPARATOR '.' | |
134 | ||
135 | /* The maximum length of a line in a mime.types file */ | |
136 | #define CINFO_MAX_LEN 1024 | |
137 | ||
138 | /* The maximum length of an error message */ | |
139 | #define MAX_ERROR_LEN 4096 | |
140 | ||
141 | /* | |
142 | * A warning is a minor mishap, such as a 404 being issued. | |
143 | */ | |
144 | #define LOG_WARN 0 | |
145 | ||
146 | /* | |
147 | * A misconfig is when there is a syntax error or permission violation in | |
148 | * a config file. | |
149 | */ | |
150 | #define LOG_MISCONFIG 1 | |
151 | ||
152 | /* | |
153 | * Security warnings are issued when authentication fails, or a host is | |
154 | * given a 403 return code. | |
155 | */ | |
156 | #define LOG_SECURITY 2 | |
157 | ||
158 | /* | |
159 | * A failure is when a request could not be fulfilled due to an internal | |
160 | * problem, such as a CGI script exiting prematurely, or a filesystem | |
161 | * permissions problem. | |
162 | */ | |
163 | #define LOG_FAILURE 3 | |
164 | ||
165 | /* | |
166 | * A catastrophe is a fatal server error such as running out of | |
167 | * memory or processes, or a system call failing, or even a server crash. | |
168 | * The server child cannot recover from a catastrophe. | |
169 | */ | |
170 | #define LOG_CATASTROPHE 4 | |
171 | ||
172 | /* | |
173 | * Informational message, of no concern. | |
174 | */ | |
175 | #define LOG_INFORM 5 | |
176 | ||
177 | /* | |
178 | * Internal diagnostic message. | |
179 | */ | |
180 | #define LOG_VERBOSE 6 | |
181 | ||
166
c07122f66676
adds debug log level
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
182 | // new |
c07122f66676
adds debug log level
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
183 | #define LOG_DEBUG 7 |
c07122f66676
adds debug log level
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
184 | |
1 | 185 | /* |
186 | * The time format to use in the error log | |
187 | */ | |
188 | #define ERR_TIMEFMT "[%d/%b/%Y:%H:%M:%S]" | |
189 | ||
190 | ||
191 | /* The fd you will get if you are reporting errors to SYSLOG */ | |
192 | #define ERRORS_TO_SYSLOG NULL | |
193 | ||
194 | /* Return codes from file I/O routines */ | |
195 | #define IO_OKAY 1 | |
196 | #define IO_ERROR -1 | |
197 | #define IO_EOF 0 | |
198 | #define NETBUF_EOF -1 | |
199 | #define NETBUF_ERROR -2 | |
200 | #define NETBUF_FULL -3 | |
201 | ||
202 | /* The disk page size on this machine. */ | |
203 | #define FILE_BUFFERSIZE 4096 | |
204 | ||
205 | #ifdef XP_UNIX | |
206 | ||
207 | #define FILE_PATHSEP '/' | |
208 | #define FILE_PARENT "../" | |
209 | ||
210 | #elif defined(XP_WIN32) | |
211 | ||
212 | #define FILE_PATHSEP '/' | |
213 | #define FILE_PARENT "..\\" | |
214 | ||
215 | #endif /* XP_WIN32 */ | |
216 | ||
217 | #define NET_INFINITE_TIMEOUT 0 | |
218 | #define NET_ZERO_TIMEOUT -1 | |
219 | ||
220 | #ifdef USE_REGEX | |
221 | /* WILDPAT uses regular expressions */ | |
222 | #define WILDPAT_VALID(exp) regexp_valid(exp) | |
223 | #define WILDPAT_MATCH(str, exp) regexp_match(str, exp) | |
224 | #define WILDPAT_CMP(str, exp) regexp_cmp(str, exp) | |
225 | #define WILDPAT_CASECMP(str, exp) regexp_casecmp(str, exp) | |
226 | #define WILDPAT_USES_REGEXP 1 | |
227 | #else | |
228 | /* WILDPAT uses shell expressions */ | |
229 | #define WILDPAT_VALID(exp) shexp_valid(exp) | |
230 | #define WILDPAT_MATCH(str, exp) shexp_match(str, exp) | |
231 | #define WILDPAT_CMP(str, exp) shexp_cmp(str, exp) | |
232 | #define WILDPAT_CASECMP(str, exp) shexp_casecmp(str, exp) | |
233 | #define WILDPAT_USES_SHEXP 1 | |
234 | #endif | |
235 | ||
236 | /* Define return codes from WILDPAT_VALID */ | |
237 | #define NON_WILDPAT -1 /* exp is ordinary string */ | |
238 | #define INVALID_WILDPAT -2 /* exp is an invalid pattern */ | |
239 | #define VALID_WILDPAT 1 /* exp is a valid pattern */ | |
240 | ||
241 | /* Define return codes from regexp_valid and shexp_valid */ | |
242 | #define NON_SXP NON_WILDPAT /* exp is an ordinary string */ | |
243 | #define INVALID_SXP INVALID_WILDPAT /* exp is an invalid shell exp */ | |
244 | #define VALID_SXP VALID_WILDPAT /* exp is a valid shell exp */ | |
245 | ||
246 | #define NON_REGEXP NON_SXP | |
247 | #define INVALID_REGEXP INVALID_SXP | |
248 | #define VALID_REGEXP VALID_SXP | |
249 | ||
250 | #define SYSTHREAD_DEFAULT_PRIORITY 16 | |
251 | ||
252 | /* The longest line in the configuration file */ | |
253 | #define CONF_MAXLEN 16384 | |
254 | ||
255 | #define HTTP_DATE_LEN 30 | |
256 | #define HTTP_DATE_FMT "%a, %d %b %Y %T GMT" | |
257 | ||
258 | /* HTTP status codes */ | |
259 | #define PROTOCOL_CONTINUE 100 | |
260 | #define PROTOCOL_SWITCHING 101 | |
261 | #define PROTOCOL_OK 200 | |
262 | #define PROTOCOL_CREATED 201 | |
263 | #define PROTOCOL_ACCEPTED 202 | |
264 | #define PROTOCOL_NONAUTHORITATIVE 203 | |
265 | #define PROTOCOL_NO_RESPONSE 204 | |
266 | #define PROTOCOL_NO_CONTENT 204 | |
267 | #define PROTOCOL_RESET_CONTENT 205 | |
268 | #define PROTOCOL_PARTIAL_CONTENT 206 | |
269 | #define PROTOCOL_MULTI_STATUS 207 | |
270 | #define PROTOCOL_MULTIPLE_CHOICES 300 | |
271 | #define PROTOCOL_MOVED_PERMANENTLY 301 | |
272 | #define PROTOCOL_REDIRECT 302 | |
273 | #define PROTOCOL_SEE_OTHER 303 | |
274 | #define PROTOCOL_NOT_MODIFIED 304 | |
275 | #define PROTOCOL_USE_PROXY 305 | |
276 | #define PROTOCOL_TEMPORARY_REDIRECT 307 | |
277 | #define PROTOCOL_BAD_REQUEST 400 | |
278 | #define PROTOCOL_UNAUTHORIZED 401 | |
279 | #define PROTOCOL_PAYMENT_REQUIRED 402 | |
280 | #define PROTOCOL_FORBIDDEN 403 | |
281 | #define PROTOCOL_NOT_FOUND 404 | |
282 | #define PROTOCOL_METHOD_NOT_ALLOWED 405 | |
283 | #define PROTOCOL_NOT_ACCEPTABLE 406 | |
284 | #define PROTOCOL_PROXY_UNAUTHORIZED 407 | |
285 | #define PROTOCOL_REQUEST_TIMEOUT 408 | |
286 | #define PROTOCOL_CONFLICT 409 | |
287 | #define PROTOCOL_GONE 410 | |
288 | #define PROTOCOL_LENGTH_REQUIRED 411 | |
289 | #define PROTOCOL_PRECONDITION_FAIL 412 | |
290 | #define PROTOCOL_ENTITY_TOO_LARGE 413 | |
291 | #define PROTOCOL_URI_TOO_LARGE 414 | |
292 | #define PROTOCOL_UNSUPPORTED_MEDIA_TYPE 415 | |
293 | #define PROTOCOL_REQUESTED_RANGE_NOT_SATISFIABLE 416 | |
294 | #define PROTOCOL_EXPECTATION_FAILED 417 | |
295 | #define PROTOCOL_LOCKED 423 | |
296 | #define PROTOCOL_FAILED_DEPENDENCY 424 | |
297 | #define PROTOCOL_SERVER_ERROR 500 | |
298 | #define PROTOCOL_NOT_IMPLEMENTED 501 | |
299 | #define PROTOCOL_BAD_GATEWAY 502 | |
300 | #define PROTOCOL_SERVICE_UNAVAILABLE 503 | |
301 | #define PROTOCOL_GATEWAY_TIMEOUT 504 | |
302 | #define PROTOCOL_VERSION_NOT_SUPPORTED 505 | |
303 | #define PROTOCOL_INSUFFICIENT_STORAGE 507 | |
304 | ||
305 | #define PROTOCOL_VERSION_HTTP09 9 | |
306 | #define PROTOCOL_VERSION_HTTP10 100 | |
307 | #define PROTOCOL_VERSION_HTTP11 101 | |
308 | #define CURRENT_PROTOCOL_VERSION PROTOCOL_VERSION_HTTP11 | |
309 | ||
310 | /* Definitions for HTTP over SSL */ | |
311 | #define HTTPS_PORT 443 | |
312 | #define HTTPS_URL "https" | |
313 | ||
314 | /* Definitions for HTTP over TCP */ | |
315 | #define HTTP_PORT 80 | |
316 | #define HTTP_URL "http" | |
317 | ||
318 | ||
319 | #define REQ_MAX_LINE 4096 | |
320 | ||
321 | /* | |
322 | * The REQ_ return codes. These codes are used to determine what the server | |
323 | * should do after a particular module completes its task. | |
324 | * | |
325 | * Func type functions return these as do many internal functions. | |
326 | */ | |
327 | ||
328 | /* The function performed its task, proceed with the request */ | |
329 | #define REQ_PROCEED 0 | |
330 | /* The entire request should be aborted: An error occurred */ | |
331 | #define REQ_ABORTED -1 | |
332 | /* The function performed no task, but proceed anyway */ | |
333 | #define REQ_NOACTION -2 | |
334 | /* Tear down the session and exit */ | |
335 | #define REQ_EXIT -3 | |
336 | /* Restart the entire request-response process */ | |
337 | #define REQ_RESTART -4 | |
338 | /* Too busy to execute this now */ | |
339 | #define REQ_TOOBUSY -5 | |
340 | ||
3
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
341 | |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
342 | /**** NSAPI extensions ****/ |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
343 | |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
344 | /* The function is still in progress (async extension) */ |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
345 | #define REQ_PROCESSING -8 |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
346 | |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
347 | /**** END NSAPI extensions ****/ |
137197831306
minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
348 | |
6
ce8fecc9847d
improved request processing
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
349 | |
1 | 350 | /* --- End miscellaneous definitions --- */ |
351 | ||
352 | /* --- Begin native platform includes --- */ | |
353 | ||
354 | #ifdef XP_UNIX | |
355 | #include <unistd.h> | |
356 | #include <sys/file.h> | |
29
e8619defde14
added event handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
23
diff
changeset
|
357 | #include <pthread.h> |
1 | 358 | #ifndef HPUX |
359 | #include <sys/select.h> | |
360 | #endif | |
361 | #include <sys/socket.h> | |
362 | #include <sys/time.h> | |
363 | #include <sys/types.h> | |
364 | #include <sys/uio.h> | |
365 | #include <fcntl.h> | |
366 | #include <dirent.h> | |
367 | #include <pwd.h> | |
368 | #include <netinet/in.h> | |
369 | #endif /* XP_UNIX */ | |
370 | ||
371 | #ifdef XP_WIN32 | |
372 | #include <wtypes.h> | |
373 | #include <winbase.h> | |
374 | #include <direct.h> | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
375 | #include <dirent.h> // TODO: works only with mingw |
1 | 376 | #include <winsock.h> |
377 | #endif /* XP_WIN32 */ | |
378 | ||
379 | #include <sys/stat.h> | |
380 | #include <ctype.h> | |
381 | #include <stdio.h> | |
382 | #include <stdarg.h> | |
383 | #include <stdlib.h> | |
384 | #include <string.h> | |
385 | #include <errno.h> | |
386 | #include <time.h> | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
387 | #include <inttypes.h> |
1 | 388 | |
389 | /* --- End native platform includes --- */ | |
390 | ||
118
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
391 | #ifndef TRUE |
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
392 | #define TRUE 1 |
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
393 | #endif |
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
394 | #ifndef FALSE |
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
395 | #define FALSE 0 |
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
396 | #endif |
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
397 | |
1 | 398 | /* --- Begin type definitions --- */ |
399 | ||
400 | /* NOTE: both SYS_FILE and SYS_NETFD are actually NSPR PRFileDesc * and can */ | |
401 | /* be used with NSPR API calls (after casting them to PRFileDesc *) */ | |
402 | ||
54 | 403 | // NOTE: no they are not NSPR PRFileDesc* |
404 | // they are VFSFile* | |
405 | // TODO: fix NOTE | |
406 | ||
211
2160585200ac
add propfind/proppatch parser and first iteration of the new webdav api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
193
diff
changeset
|
407 | typedef int WSBool; |
54 | 408 | |
1 | 409 | #ifndef SYS_FILE_T |
54 | 410 | typedef struct VFSFile *SYS_FILE; |
1 | 411 | #define SYS_FILE_T void * |
412 | #endif /* !SYS_FILE_T */ | |
413 | ||
54 | 414 | #define SYS_ERROR_FD ((SYS_FILE)-1) // TODO: fix |
1 | 415 | |
416 | #ifndef SYS_NETFD_T | |
417 | typedef void *SYS_NETFD; | |
418 | #define SYS_NETFD_T void * | |
419 | #endif /* !SYS_NETFD_T */ | |
420 | ||
421 | /* Error value for a SYS_NETFD */ | |
422 | #ifndef SYS_NET_ERRORFD | |
423 | #define SYS_NET_ERRORFD ((SYS_NETFD)-1) | |
424 | #endif /* !SYS_NET_ERRORFD */ | |
425 | ||
426 | /* | |
427 | * These structures were originally defined in nsapi.h, but those definitions | |
428 | * were removed in iPlanet Web Server 4.0. The contents of these structures | |
429 | * are now private to the server implementation and must not be accessed | |
430 | * directly. Instead, use the objset_*, object_*, directive_table_*, and | |
431 | * directive_* accessor functions. | |
432 | */ | |
433 | typedef struct directive directive; | |
434 | typedef struct dtable dtable; | |
435 | typedef struct httpd_object httpd_object; | |
436 | typedef struct httpd_objset httpd_objset; | |
437 | ||
438 | /* | |
439 | * Type: filebuffer, filebuf_t | |
440 | * | |
441 | * Description: | |
442 | * | |
443 | * This structure is used to represent a buffered file. On some | |
444 | * systems the file may be memory-mapped. A filebuffer is created | |
445 | * by filebuf_open(), and destroyed by filebuf_close(). | |
446 | * | |
447 | * Notes: | |
448 | * | |
449 | * Direct access to the members of this structure, not using | |
450 | * macros defined here, is discouraged. | |
451 | * | |
452 | * The filebuf alias that used to be defined for this type was | |
453 | * found to conflict with a C++ class of the same name, so it | |
454 | * has been renamed to filebuf_t. | |
455 | */ | |
456 | typedef struct filebuffer filebuffer; | |
457 | ||
458 | /* Version of filebuffer when memory-mapped files are supported */ | |
459 | struct filebuffer { | |
460 | SYS_FILE fd; | |
461 | #ifdef XP_WIN32 | |
462 | HANDLE fdmap; | |
463 | #endif | |
464 | caddr_t fp; | |
465 | int len; | |
466 | ||
467 | unsigned char *inbuf; | |
468 | int cursize; | |
469 | ||
470 | int pos; | |
471 | const char *errmsg; | |
472 | }; | |
473 | ||
474 | /* Return next character or IO_EOF */ | |
475 | #define filebuf_getc(b) ((b)->pos == (b)->len ? IO_EOF : (int)((b)->fp)[(b)->pos++]) | |
476 | ||
477 | #define filebuf_iseof(b) ((b)->pos == (b)->len) | |
478 | ||
479 | /* C++ streamio defines a filebuf class. */ | |
480 | typedef filebuffer filebuf_t; | |
481 | ||
482 | #ifdef XP_WIN32 | |
483 | /* Use a filebuffer to read data from a pipe */ | |
484 | #define pipebuf_getc(b) \ | |
485 | ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : pipebuf_next(b,1)) | |
486 | #endif /* XP_WIN32 */ | |
487 | ||
488 | /* | |
489 | * Type: netbuf | |
490 | * | |
491 | * Description: | |
492 | * | |
493 | * This structure is used to represent a buffered network socket. | |
494 | * It is created by netbuf_open(), and destroyed by netbuf_close(). | |
495 | * | |
496 | * Notes: | |
497 | * | |
498 | * Direct access to the members of this structure, not using | |
499 | * macros defined here, is discouraged. | |
500 | * | |
501 | * The inbuf field used to be (unsigned char *), but is now | |
502 | * simply (char *). The value returned by the netbuf_getc() | |
503 | * macro is (int). | |
504 | */ | |
505 | typedef struct netbuf netbuf; | |
506 | struct netbuf { | |
507 | SYS_NETFD sd; | |
508 | ||
509 | int pos, cursize, maxsize, rdtimeout; | |
510 | #ifdef XP_WIN32 | |
511 | CHAR address[64]; | |
512 | #endif /* XP_WIN32 */ | |
513 | unsigned char *inbuf; | |
514 | char *errmsg; | |
515 | #ifndef XP_WIN32 | |
516 | char address[64]; | |
517 | #endif /* !XP_WIN32 */ | |
518 | }; | |
519 | ||
520 | /* | |
521 | * netbuf_getc gets a character from the given network buffer and returns | |
522 | * it (as an integer). | |
523 | * | |
524 | * It will return (int) IO_ERROR for an error and (int) IO_EOF for | |
525 | * an error condition or EOF respectively. | |
526 | */ | |
527 | #define netbuf_getc(b) \ | |
528 | ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : netbuf_next(b,1)) | |
529 | ||
530 | /* | |
531 | * buffer_error returns the last error that occurred with buffer. Don't use | |
532 | * this unless you know an error occurred. Independent of network/file type. | |
533 | */ | |
534 | #define buffer_error(b) ((b)->errmsg) | |
535 | ||
536 | /* | |
537 | * Type: sendfiledata | |
538 | * | |
539 | * Description: | |
540 | * | |
541 | * This structure is used to pass arguments to the net_sendfile() | |
542 | * function. offset and len may be set to 0 to transmit a file in its | |
543 | * entirety. | |
544 | */ | |
545 | typedef struct sendfiledata sendfiledata; | |
546 | struct sendfiledata { | |
547 | SYS_FILE fd; /* file to send */ | |
104
a8acbb12f27c
implemented range requests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
102
diff
changeset
|
548 | off_t offset; /* offset in file to start sending from */ |
1 | 549 | size_t len; /* number of bytes to send from file */ |
550 | const void *header; /* data to send before file */ | |
551 | int hlen; /* number of bytes to send before file */ | |
552 | const void *trailer; /* data to send after file */ | |
553 | int tlen; /* number of bytes to send after file */ | |
554 | }; | |
555 | ||
556 | /* | |
557 | * Type: NSAPIIOVec | |
558 | * | |
559 | * Description: | |
560 | * | |
561 | * This structure is used to pass arguments to the net_writev() | |
562 | * and FilterWritevFunc() functions. | |
563 | */ | |
65
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
564 | typedef struct iovec NSAPIIOVec; |
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
565 | |
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
566 | /* |
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
567 | //ifdef _LP64 |
1 | 568 | typedef struct NSAPIIOVec NSAPIIOVec; |
569 | struct NSAPIIOVec { | |
570 | char *iov_base; | |
571 | int iov_len; | |
572 | }; | |
65
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
573 | //else |
1 | 574 | typedef struct iovec NSAPIIOVec; |
65
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
575 | //endif |
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
576 | */ |
1 | 577 | |
578 | ||
579 | /* | |
580 | * Type: cinfo | |
581 | * | |
582 | * Description: | |
583 | * | |
584 | * This is a structure that captures the information in the name/value | |
585 | * pairs on one line of a mime.types file. A cinfo structure is | |
586 | * stored in the memory-resident database, indexed by each of the | |
587 | * file extensions specified in the "exts" name/value pair. It | |
588 | * defines various attributes of resources with names containing | |
589 | * the specified file extensions. | |
590 | * | |
591 | * Notes: | |
592 | * | |
593 | * Pointers to cinfo structures returned by this API may or may not | |
594 | * need to freed by the caller. See the individual function | |
595 | * descriptions. | |
596 | * | |
597 | * The strings referenced by the fields of cinfo structures returned | |
598 | * by this API should be considered read-only, and do not need to be | |
599 | * freed by the caller, even when the cinfo structure does. | |
600 | */ | |
601 | typedef struct cinfo cinfo; | |
602 | struct cinfo { | |
603 | char *type; | |
604 | char *encoding; | |
605 | char *language; | |
606 | }; | |
607 | ||
608 | ||
159
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
609 | // nsapi ext begin |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
610 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
611 | #define EVENT_POLLIN 0x1 |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
612 | #define EVENT_POLLOUT 0x2 |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
613 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
614 | typedef struct EventHandler EventHandler; |
185
b4d7ccf4e06d
implements new event handler and aio on linux
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
184
diff
changeset
|
615 | typedef struct Event Event; |
159
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
616 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
617 | typedef int(*eventfunc)(EventHandler*, Event*); |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
618 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
619 | struct Event { |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
620 | eventfunc fn; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
621 | eventfunc finish; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
622 | void *cookie; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
623 | intptr_t object; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
624 | int events; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
625 | int error; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
626 | }; |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
627 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
628 | // nsapi ext end |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
629 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
630 | |
1 | 631 | typedef void* CONDVAR; |
632 | typedef void *COUNTING_SEMAPHORE; | |
633 | typedef void* CRITICAL; | |
634 | ||
635 | #ifdef XP_UNIX | |
636 | typedef DIR* SYS_DIR; | |
637 | typedef struct dirent SYS_DIRENT; | |
638 | #endif /* XP_UNIX */ | |
639 | ||
640 | #ifdef XP_WIN32 | |
641 | ||
642 | typedef struct dirent_s dirent_s; | |
643 | struct dirent_s { | |
644 | char *d_name; | |
645 | }; | |
646 | ||
647 | typedef struct dir_s dir_s; | |
648 | struct dir_s { | |
649 | HANDLE dp; | |
650 | WIN32_FIND_DATA fdata; | |
651 | dirent_s de; | |
652 | }; | |
653 | ||
654 | typedef dir_s* SYS_DIR; | |
655 | typedef dirent_s SYS_DIRENT; | |
656 | ||
657 | #endif /* XP_WIN32 */ | |
658 | ||
659 | typedef struct pb_param pb_param; | |
660 | struct pb_param { | |
661 | char *name,*value; | |
662 | }; | |
663 | ||
664 | typedef struct pb_entry pb_entry; | |
665 | struct pb_entry { | |
666 | pb_param *param; | |
667 | struct pb_entry *next; | |
668 | }; | |
669 | ||
670 | typedef struct pblock pblock; | |
671 | struct pblock { | |
672 | int hsize; | |
673 | struct pb_entry **ht; | |
674 | }; | |
675 | ||
676 | #ifndef POOL_HANDLE_T | |
677 | #define POOL_HANDLE_T | |
678 | typedef void *pool_handle_t; | |
679 | #endif | |
680 | ||
681 | #ifndef SEMAPHORE_T | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
682 | // TODO: fix |
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
683 | //typedef void *SEMAPHORE; |
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
684 | //#define SEMAPHORE_T void * |
1 | 685 | #endif /* !SEMAPHORE_T */ |
686 | ||
687 | #define SESSION_HASHSIZE 5 | |
688 | ||
689 | typedef struct PListStruct_s PListStruct_s; | |
690 | typedef struct ACLListHandle ACLListHandle; | |
54 | 691 | typedef struct VFS VFS; |
692 | typedef struct VFSContext VFSContext; | |
1 | 693 | |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
694 | enum WSConfigNodeType { |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
695 | WS_CONFIG_NODE_OBJECT = 0, |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
696 | WS_CONFIG_NODE_DIRECTIVE |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
697 | }; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
698 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
699 | typedef struct ServerConfiguration ServerConfiguration; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
700 | typedef struct ConfigNode WSConfigNode; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
701 | typedef enum WSConfigNodeType WSConfigNodeType; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
357
diff
changeset
|
702 | |
432
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
703 | // new |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
704 | typedef struct HttpResponseWriter HttpResponseWriter; |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
705 | |
1 | 706 | #ifndef PR_AF_INET |
707 | typedef union PRNetAddr PRNetAddr; | |
708 | #endif | |
709 | ||
710 | typedef struct Session Session; | |
711 | typedef struct Request Request; | |
712 | struct Session { | |
713 | pblock *client; /* client-specific information */ | |
714 | ||
715 | SYS_NETFD csd; /* client file descriptor */ | |
716 | netbuf *inbuf; /* input buffer */ | |
717 | int csd_open; | |
718 | ||
719 | struct in_addr iaddr; | |
720 | ||
721 | pool_handle_t *pool; | |
159
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
722 | |
9ba9f8befa80
makes EventHandler public
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
147
diff
changeset
|
723 | EventHandler *ev; /* event handler instance (new) */ |
1 | 724 | |
725 | void *clauth; /* v2 ACL client authentication information */ | |
726 | struct Session *next; | |
727 | int fill; | |
728 | struct sockaddr_in local_addr; /* local addr for this session */ | |
729 | ||
730 | PListStruct_s *subject; | |
731 | int ssl; /* 0 = SSL OFF, 1 = SSL ON */ | |
732 | int clientauth; /* 0 = client auth OFF, 1 = client auth ON */ | |
733 | ||
734 | PRNetAddr *pr_client_addr; | |
735 | PRNetAddr *pr_local_addr; | |
736 | }; | |
737 | ||
84
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
738 | |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
739 | typedef struct FuncStruct FuncStruct; |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
740 | |
1 | 741 | /* |
742 | * FuncPtr is a pointer to an NSAPI SAF function | |
743 | */ | |
744 | ||
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
745 | // TODO: fix typedefs |
1 | 746 | #ifdef XP_UNIX |
747 | typedef int Func(pblock *, Session *, Request *); | |
84
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
748 | // new func executor |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
749 | typedef int FuncExec(FuncStruct *, pblock *, Session *, Request *); |
1 | 750 | #else /* XP_WIN32 */ |
751 | typedef int _cdecl Func(pblock *, Session *, Request *); | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
752 | typedef int _cdecl FuncExec(FuncStruct *, pblock *, Session *, Request *); |
1 | 753 | #endif /* XP_WIN32 */ |
754 | ||
84
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
755 | typedef Func *FuncPtr; |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
756 | typedef FuncExec *FuncExecPtr; |
1 | 757 | |
758 | /* | |
759 | * FuncStruct is a structure used in the static declaration of the | |
760 | * functions. This static declaration is parsed into a hash table at | |
761 | * startup. | |
762 | */ | |
763 | ||
764 | struct FuncStruct { | |
84
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
765 | const char *name; |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
766 | FuncPtr func; |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
767 | //struct FuncStruct *next; |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
768 | FuncExecPtr func_exec; |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
769 | void *exec_data; |
1 | 770 | unsigned flags; |
771 | unsigned poolID; | |
772 | unsigned pool_resolved; | |
773 | }; | |
774 | ||
19
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
775 | ////// new |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
776 | |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
777 | typedef struct _http_listener HttpListener; |
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
778 | |
272
f210681d9dd0
add minimal working implementation for resourcepool_lookup()
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
779 | typedef struct ResourcePool ResourcePool; |
f210681d9dd0
add minimal working implementation for resourcepool_lookup()
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
780 | |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
781 | typedef struct ResourceType ResourceType; |
269
3dfbd0b91950
add ResourcePool initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
260
diff
changeset
|
782 | typedef struct ResourceData ResourceData; |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
783 | |
270
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
784 | typedef void * (*resource_pool_init_func)(pool_handle_t *, const char *, pblock *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
785 | typedef void (*resource_pool_destroy_func)(void *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
786 | typedef void * (*resource_pool_createresource_func)(void *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
787 | typedef void (*resource_pool_freeresource_func)(void *, void *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
788 | typedef int (*resource_pool_prepare_func)(void *, void *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
789 | typedef int (*resource_pool_finish_func)(void *, void *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
790 | typedef void * (*resource_pool_getresourcedata_func)(void *); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
791 | |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
792 | struct ResourceType { |
270
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
793 | void * (*init)(pool_handle_t *, const char *, pblock *); |
269
3dfbd0b91950
add ResourcePool initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
260
diff
changeset
|
794 | void (*destroy)(void *); |
3dfbd0b91950
add ResourcePool initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
260
diff
changeset
|
795 | void * (*createresource)(void *); |
3dfbd0b91950
add ResourcePool initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
260
diff
changeset
|
796 | void (*freeresource)(void *, void *); |
3dfbd0b91950
add ResourcePool initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
260
diff
changeset
|
797 | int (*prepare)(void *, void *); |
3dfbd0b91950
add ResourcePool initialization
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
260
diff
changeset
|
798 | int (*finish)(void *, void *); |
270
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
799 | void * (*getresourcedata)(void *); |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
800 | }; |
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
801 | |
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
802 | struct ResourceData { |
272
f210681d9dd0
add minimal working implementation for resourcepool_lookup()
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
803 | ResourcePool *resourcepool; |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
804 | void *data; |
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
805 | }; |
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
806 | |
270
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
807 | int resourcepool_register_type(const char *type_name, ResourceType *type_info); |
4cfaa02055cd
add first code for postgresql plugin: resourcepool type implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
808 | |
19
d680536f8c2f
Added configuration manager
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
809 | ////// |
1 | 810 | /* |
811 | * VSInitFunc, VSDestroyFunc, VSDirectiveInitFunc and VSDirectiveDestroyFunc | |
812 | */ | |
813 | typedef struct VirtualServer VirtualServer; | |
814 | typedef int VSInitFunc(VirtualServer *incoming, const VirtualServer *current); | |
815 | typedef void VSDestroyFunc(VirtualServer *outgoing); | |
816 | typedef VSInitFunc *VSInitFuncPtr; | |
817 | typedef VSDestroyFunc *VSDestroyFuncPtr; | |
818 | typedef int VSDirectiveInitFunc(const directive *dir, VirtualServer *incoming, const VirtualServer *current); | |
819 | typedef void VSDirectiveDestroyFunc(const directive *dir, VirtualServer *outgoing); | |
820 | typedef VSDirectiveInitFunc *VSDirectiveInitFuncPtr; | |
821 | typedef VSDirectiveDestroyFunc *VSDirectiveDestroyFuncPtr; | |
822 | ||
823 | /* | |
824 | * Filter is an opaque filter identifier | |
825 | */ | |
826 | typedef struct Filter Filter; | |
827 | ||
828 | /* | |
829 | * FilterContext stores context associated with a particular filter layer | |
830 | */ | |
831 | ||
832 | typedef struct FilterContext FilterContext; | |
833 | ||
834 | struct FilterContext { | |
835 | pool_handle_t *pool; /* pool context was allocated from */ | |
836 | Session *sn; /* session being processed */ | |
837 | Request *rq; /* request being processed */ | |
838 | void *data; /* filter-defined private data */ | |
839 | }; | |
840 | ||
841 | /* | |
842 | * FilterLayer represents one layer of a filter stack | |
843 | */ | |
844 | ||
845 | typedef struct FilterLayer FilterLayer; | |
846 | ||
847 | struct FilterLayer { | |
848 | Filter *filter; /* the filter at this layer in the filter stack */ | |
849 | FilterContext *context; /* context for the filter */ | |
850 | SYS_NETFD lower; /* access to the next filter layer in the stack */ | |
851 | }; | |
852 | ||
853 | /* | |
854 | * Function prototypes for filter methods | |
855 | */ | |
21
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
856 | |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
857 | /* |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
858 | * TODO: modified: added * bevor Filter...Func |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
859 | */ |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
860 | typedef int (*FilterInsertFunc)(FilterLayer *layer, pblock *pb); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
861 | typedef void (*FilterRemoveFunc)(FilterLayer *layer); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
862 | typedef int (*FilterFlushFunc)(FilterLayer *layer); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
863 | typedef int (*FilterReadFunc)(FilterLayer *layer, void *buf, int amount, int timeout); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
864 | typedef int (*FilterWriteFunc)(FilterLayer *layer, const void *buf, int amount); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
865 | typedef int (*FilterWritevFunc)(FilterLayer *layer, const NSAPIIOVec *iov, int iov_size); |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
866 | typedef int (*FilterSendfileFunc)(FilterLayer *layer, sendfiledata *sfd); |
1 | 867 | |
868 | /* | |
869 | * FilterMethods is passed to filter_create() to declare the filter methods for | |
870 | * a new filter. Each instance of the FilterMethods structure should be | |
871 | * initialized using the FILTER_METHODS_INITIALIZER macro. | |
872 | */ | |
873 | ||
874 | typedef struct FilterMethods FilterMethods; | |
875 | ||
876 | struct FilterMethods { | |
877 | size_t size; | |
878 | #if NSAPI_VERSION >= 302 | |
879 | FilterInsertFunc *insert; | |
880 | FilterRemoveFunc *remove; | |
881 | FilterFlushFunc *flush; | |
882 | FilterReadFunc *read; | |
883 | FilterWriteFunc *write; | |
884 | FilterWritevFunc *writev; | |
885 | FilterSendfileFunc *sendfile; | |
886 | #else | |
887 | void *reserved1; | |
888 | void *reserved2; | |
889 | void *reserved3; | |
890 | void *reserved4; | |
891 | void *reserved5; | |
892 | void *reserved6; | |
893 | void *reserved7; | |
894 | #endif /* NSAPI_VERSION >= 302 */ | |
895 | }; | |
896 | ||
897 | #define FILTER_METHODS_INITIALIZER \ | |
898 | { \ | |
899 | sizeof(FilterMethods), \ | |
900 | NULL, /* insert */ \ | |
901 | NULL, /* remove */ \ | |
902 | NULL, /* flush */ \ | |
903 | NULL, /* read */ \ | |
904 | NULL, /* write */ \ | |
905 | NULL, /* writev */ \ | |
906 | NULL /* sendfile */ \ | |
907 | } | |
908 | ||
909 | /* | |
910 | * Filter order definitions for filter_create() | |
911 | */ | |
912 | #define FILTER_CONTENT_GENERATION 0xf0000 | |
913 | #define FILTER_CONTENT_TRANSLATION_HIGH 0xa0000 | |
914 | #define FILTER_CONTENT_TRANSLATION 0x90000 | |
915 | #define FILTER_CONTENT_TRANSLATION_LOW 0x80000 | |
916 | #define FILTER_CONTENT_CODING 0x50000 | |
917 | #define FILTER_TRANSFER_CODING 0x40000 | |
918 | #define FILTER_MESSAGE_CODING 0x30000 | |
919 | #define FILTER_TRANSPORT_CODING 0x20000 | |
920 | #define FILTER_NETWORK 0x10000 | |
921 | ||
922 | typedef struct shmem_s shmem_s; | |
923 | struct shmem_s { | |
924 | void *data; /* the data */ | |
925 | #ifdef XP_WIN32 | |
926 | HANDLE fdmap; | |
927 | #endif /* XP_WIN32 */ | |
928 | int size; /* the maximum length of the data */ | |
929 | ||
930 | char *name; /* internal use: filename to unlink if exposed */ | |
931 | SYS_FILE fd; /* internal use: file descriptor for region */ | |
932 | }; | |
933 | ||
934 | /* Define a handle for a thread */ | |
29
e8619defde14
added event handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
23
diff
changeset
|
935 | //typedef void* SYS_THREAD; |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
936 | |
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
937 | #ifdef XP_UNIX |
29
e8619defde14
added event handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
23
diff
changeset
|
938 | typedef pthread_t SYS_THREAD; |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
939 | #else |
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
940 | typedef void* SYS_THREAD; |
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
941 | #endif |
1 | 942 | |
943 | /* Define an error value for the thread handle */ | |
944 | #define SYS_THREAD_ERROR NULL | |
945 | ||
946 | ||
947 | typedef struct conf_global_vars_s conf_global_vars_s; | |
948 | struct conf_global_vars_s { | |
949 | ||
950 | /* What port we listen to */ | |
951 | int Vport; /* OBSOLETE */ | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
952 | #define server_portnum 80 |
1 | 953 | |
954 | /* What address to bind to */ | |
955 | char *Vaddr; /* OBSOLETE */ | |
956 | ||
957 | /* User to run as */ | |
958 | struct passwd *Vuserpw; | |
959 | ||
960 | /* Directory to chroot to */ | |
961 | char *Vchr; | |
962 | ||
963 | /* Where to log our pid to */ | |
964 | char *Vpidfn; | |
965 | ||
966 | #define pool_max conf_getglobals()->Vpool_max | |
967 | int Vpool_max; | |
968 | #define pool_min conf_getglobals()->Vpool_min | |
969 | int Vpool_min; /* OBSOLETE */ | |
970 | #define pool_life conf_getglobals()->Vpool_life | |
971 | int Vpool_life; /* OBSOLETE */ | |
972 | ||
973 | /* For multiprocess UNIX servers, the maximum threads per process */ | |
974 | #define pool_maxthreads conf_getglobals()->Vpool_maxthreads | |
975 | int Vpool_maxthreads; | |
976 | ||
977 | #define pool_minthreads conf_getglobals()->Vpool_minthreads | |
978 | int Vpool_minthreads; /* OBSOLETE */ | |
979 | ||
980 | char *Vsecure_keyfn; /* OBSOLETE */ | |
981 | char *Vsecure_certfn; /* OBSOLETE */ | |
982 | ||
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
983 | #define security_active 0 |
1 | 984 | int Vsecurity_active; |
985 | int Vssl3_active; /* OBSOLETE */ | |
986 | int Vssl2_active; /* OBSOLETE */ | |
987 | int Vsecure_auth; /* OBSOLETE */ | |
988 | int Vsecurity_session_timeout; | |
989 | long Vssl3_session_timeout; | |
990 | ||
991 | /* The server's hostname as should be reported in self-ref URLs */ | |
47
ce9790523346
server can change uid
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
992 | #define server_hostname "x4" // TODO: fix |
1 | 993 | char *Vserver_hostname; |
994 | ||
995 | /* The main object from which all are derived */ | |
996 | #define root_object conf_getglobals()->Vroot_object | |
997 | char *Vroot_object; | |
998 | ||
999 | /* The object set the administrator has asked us to load */ | |
1000 | #define std_os conf_getglobals()->Vstd_os | |
1001 | httpd_objset *Vstd_os; | |
1002 | ||
1003 | /* The root of ACL data structures */ | |
1004 | void *Vacl_root; | |
1005 | ||
1006 | /* The main error log, where all errors are logged */ | |
1007 | char *Vmaster_error_log; | |
1008 | ||
1009 | /* The server root directory (contains instance subdirectories) */ | |
1010 | #define server_root conf_getglobals()->Vserver_root | |
1011 | char *Vserver_root; | |
1012 | ||
1013 | /* This server's id */ | |
1014 | #define server_id conf_getglobals()->Vserver_id | |
1015 | char *Vserver_id; | |
1016 | ||
1017 | /* Admin server users file */ | |
1018 | char *Vadmin_users; | |
1019 | ||
1020 | /* The installation directory (contains bin and lib subdirectories) */ | |
1021 | char *Vnetsite_root; | |
1022 | ||
1023 | /* Digest authentication stale nonce timeout value */ | |
1024 | int digest_stale_timeout; | |
1025 | ||
1026 | int single_accept; /* OBSOLETE */ | |
1027 | int num_keep_alives; /* OBSOLETE */ | |
1028 | int log_verbose; /* OBSOLETE */ | |
1029 | int mmap_flags; /* OBSOLETE */ | |
1030 | int mmap_prots; /* OBSOLETE */ | |
1031 | int unused1; | |
1032 | int unused2; | |
1033 | ||
1034 | /* Begin Enterprise 3.0 fields */ | |
1035 | int accept_language; /* turn accept-language on/off */ | |
1036 | ||
1037 | char *mtahost; | |
1038 | char *nntphost; /* OBSOLETE */ | |
1039 | ||
1040 | /* The root of ACL data structures */ | |
1041 | void *Vacl_root_30; | |
1042 | ||
1043 | char *agentFilePath; /* OBSOLETE */ | |
1044 | ||
1045 | int Allowed; /* OBSOLETE */ | |
1046 | ||
1047 | pblock *genericGlobals; /* OBSOLETE */ | |
1048 | ||
1049 | char *agentsACLFile; /* OBSOLETE */ | |
1050 | ||
1051 | int wait_for_cgi; /* OBSOLETE */ | |
1052 | int cgiwatch_timeout; /* OBSOLETE */ | |
1053 | int started_by_watchdog; | |
1054 | int restarted_by_watchdog; | |
1055 | int old_accel_cache_enabled; /* OBSOLETE */ | |
1056 | int Vssl_cache_entries; | |
1057 | int blocking_listen_socket; /* OBSOLETE */ | |
1058 | pblock **initfns; | |
1059 | char *vs_config_file; /* OBSOLETE */ | |
1060 | }; | |
1061 | ||
1062 | /* Type used for Request rq_attr bit flags */ | |
1063 | #ifdef AIX | |
1064 | #define RQATTR unsigned | |
1065 | #else | |
1066 | #define RQATTR unsigned long | |
1067 | #endif | |
1068 | ||
1069 | struct Request { | |
1070 | /* Server working variables */ | |
1071 | pblock *vars; | |
1072 | ||
1073 | /* The method, URI, and protocol revision of this request */ | |
1074 | pblock *reqpb; | |
1075 | /* Protocol specific headers */ | |
1076 | int loadhdrs; | |
1077 | pblock *headers; | |
1078 | ||
1079 | /* Server's response headers */ | |
1080 | int senthdrs; | |
1081 | pblock *srvhdrs; | |
1082 | ||
1083 | /* The object set constructed to fulfill this request */ | |
1084 | httpd_objset *os; | |
1085 | /* Array of objects that were created from .nsconfig files */ | |
1086 | httpd_objset *tmpos; | |
1087 | ||
1088 | /* The stat last returned by request_stat_path */ | |
1089 | char *statpath; | |
1090 | char *staterr; | |
1091 | struct stat *finfo; | |
1092 | ||
1093 | /* access control state */ | |
1094 | int aclstate; /* ACL decision state */ | |
1095 | int acldirno; /* deciding ACL directive number */ | |
1096 | char *aclname; /* name of deciding ACL */ | |
1097 | pblock *aclpb; /* OBSOLETE */ | |
1098 | /* 3.0 ACL list pointer */ | |
1099 | ACLListHandle *acllist; | |
52
aced2245fb1c
new pathcheck saf and code cleanup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
47
diff
changeset
|
1100 | uint32_t aclreqaccess; /* new - required access rights */ |
54 | 1101 | |
1102 | VFS *vfs; /* new - virtual file system */ | |
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1103 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1104 | void *davCollection; |
1 | 1105 | |
1106 | int request_is_cacheable; /* */ | |
1107 | int directive_is_cacheable; /* set by SAFs with no external side effects that make decisions based solely on URI and path */ | |
1108 | ||
1109 | char *cached_headers; /* OBSOLETE */ | |
1110 | int cached_headers_len; /* OBSOLETE */ | |
1111 | char *unused; | |
1112 | ||
1113 | /* HTTP/1.1 features */ | |
1114 | #define REQ_TIME(x) (x)->req_start | |
1115 | time_t req_start; /* time request arrived - used for selecting weak or strong cache validation */ | |
1116 | short protv_num; /* protocol version number */ | |
1117 | short method_num; /* method number */ | |
1118 | struct rq_attr { | |
1119 | RQATTR abs_uri:1; /* set if absolute URI was used */ | |
1120 | RQATTR chunked:1; /* chunked transfer-coding */ | |
1121 | RQATTR keep_alive:1; /* connection keep-alive */ | |
1122 | RQATTR pipelined:1; /* request packet is pipelined */ | |
1123 | RQATTR internal_req:1; /* this was an internal request */ | |
1124 | RQATTR perm_req:1; /* don't FREE() this request */ | |
1125 | RQATTR header_file_present:1; /* OBSOLETE */ | |
1126 | RQATTR footer_file_present:1; /* OBSOLETE */ | |
1127 | RQATTR jvm_attached:1; /* OBSOLETE */ | |
1128 | RQATTR req_restarted:1; /* request was restarted */ | |
1129 | RQATTR jvm_request_locked:1; /* used for first-request serialization on some platforms */ | |
1130 | RQATTR default_type_set:1; /* set if default types were set using set-default-type objecttype function */ | |
1131 | RQATTR is_web_app:1; /* OBSOLETE */ | |
1132 | RQATTR ssl_unclean_shutdown:1; /* set if browser requires unclean SSL shutdown */ | |
1133 | RQATTR vary_accept_language:1; /* set if request was restarted based on an accept-language header */ | |
1134 | RQATTR reserved:17; /* if you add a flag, make sure to subtract from this */ | |
1135 | } rq_attr; | |
1136 | char *hostname; /* hostname used to access server (always non-NULL) */ | |
1137 | int allowed; /* OBSOLETE */ | |
1138 | int byterange; /* OBSOLETE */ | |
1139 | short status_num; /* HTTP status code */ | |
1140 | ||
1141 | int staterrno; /* used for rqstat */ | |
1142 | Request *orig_rq; /* original Request - used for internal redirects */ | |
1143 | }; | |
1144 | ||
1145 | /* Request attribute macros */ | |
1146 | #define ABS_URI(x) (x)->rq_attr.abs_uri | |
1147 | #define CHUNKED(x) (x)->rq_attr.chunked | |
1148 | #define KEEP_ALIVE(x) (x)->rq_attr.keep_alive | |
1149 | #define PIPELINED(x) (x)->rq_attr.pipelined | |
1150 | #define INTERNAL_REQUEST(x) (x)->rq_attr.internal_req | |
1151 | #define RESTARTED_REQUEST(x) (x)->rq_attr.req_restarted | |
1152 | #define PERM_REQUEST(x) (x)->rq_attr.perm_req | |
1153 | #define JVM_REQUEST_LOCKED(x) (x)->rq_attr.jvm_request_locked | |
1154 | #define SSL_UNCLEAN_SHUTDOWN(x) (x)->rq_attr.ssl_unclean_shutdown | |
1155 | #define VARY_ACCEPT_LANGUAGE(x) (x)->rq_attr.vary_accept_language | |
1156 | ||
1157 | /* Define methods for HTTP/1.1 */ | |
1158 | #define METHOD_HEAD 0 | |
1159 | #define METHOD_GET 1 | |
1160 | #define METHOD_PUT 2 | |
1161 | #define METHOD_POST 3 | |
1162 | #define METHOD_DELETE 4 | |
1163 | #define METHOD_TRACE 5 | |
1164 | #define METHOD_OPTIONS 6 | |
1165 | /* The following methods are Netscape method extensions */ | |
1166 | #define METHOD_MOVE 7 | |
1167 | #define METHOD_INDEX 8 | |
1168 | #define METHOD_MKDIR 9 | |
1169 | #define METHOD_RMDIR 10 | |
1170 | #define METHOD_COPY 11 | |
1171 | #define METHOD_MAX 12 /* Number of methods available on this server */ | |
1172 | ||
1173 | #define ISMGET(r) ((r)->method_num == METHOD_GET) | |
1174 | #define ISMHEAD(r) ((r)->method_num == METHOD_HEAD) | |
1175 | #define ISMPUT(r) ((r)->method_num == METHOD_PUT) | |
1176 | #define ISMPOST(r) ((r)->method_num == METHOD_POST) | |
1177 | #define ISMDELETE(r) ((r)->method_num == METHOD_DELETE) | |
1178 | #define ISMMOVE(r) ((r)->method_num == METHOD_MOVE) | |
1179 | #define ISMINDEX(r) ((r)->method_num == METHOD_INDEX) | |
1180 | #define ISMMKDIR(r) ((r)->method_num == METHOD_MKDIR) | |
1181 | #define ISMRMDIR(r) ((r)->method_num == METHOD_RMDIR) | |
1182 | #define ISMCOPY(r) ((r)->method_num == METHOD_COPY) | |
1183 | #define ISMTRACE(r) ((r)->method_num == METHOD_TRACE) | |
1184 | #define ISMOPTIONS(r) ((r)->method_num == METHOD_OPTIONS) | |
1185 | ||
1186 | ||
172
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1187 | // new types |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1188 | typedef struct aiocb_s { |
184
a2a15ad6e4b9
fixes async sendfile
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
172
diff
changeset
|
1189 | SYS_FILE filedes; |
172
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1190 | void *buf; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1191 | size_t nbytes; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1192 | off_t offset; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1193 | ssize_t result; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1194 | int result_errno; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1195 | Event *event; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1196 | EventHandler *evhandler; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1197 | } aiocb_s; |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1198 | |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1199 | |
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1200 | typedef struct _thread_pool threadpool_t; |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1201 | typedef struct _threadpool_job threadpool_job; |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1202 | typedef void*(*job_callback_f)(void *data); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1203 | |
127
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1204 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1205 | typedef struct WebSocket WebSocket; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1206 | typedef struct WSMessage WSMessage; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1207 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1208 | struct WebSocket { |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1209 | int (*on_open)(WebSocket *); |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1210 | int (*on_error)(WebSocket *); |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1211 | int (*on_message)(WebSocket *, WSMessage *msg); |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1212 | int (*on_close)(WebSocket *); |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1213 | void *userdata; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1214 | }; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1215 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1216 | struct WSMessage { |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1217 | /* |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1218 | * message data (text or binary) |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1219 | */ |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1220 | char *data; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1221 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1222 | /* |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1223 | * data length |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1224 | */ |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1225 | size_t length; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1226 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1227 | /* |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1228 | * message type (opcode) |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1229 | * 0x0: continuation |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1230 | * 0x1: text |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1231 | * 0x2: binary |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1232 | * 0x3-7: reserved non-control frame |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1233 | * 0x8: close |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1234 | * 0x9: ping |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1235 | * 0xa: pong |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1236 | * 0xb-f: reserved control frame |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1237 | */ |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1238 | int type; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1239 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1240 | /* |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1241 | * if the message is incomplete, next points to the continuation message |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1242 | */ |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1243 | WSMessage *next; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1244 | }; |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1245 | |
1 | 1246 | /* --- End type definitions --- */ |
1247 | ||
1248 | /* --- Begin dispatch vector table definition --- */ | |
1249 | /* --- End dispatch vector table definition --- */ | |
1250 | ||
1251 | /* --- Begin API macro definitions --- */ | |
1252 | ||
1253 | #ifndef INTNSAPI | |
1254 | ||
1255 | #if NSAPI_VERSION >= 301 | |
1256 | ||
1257 | /* | |
1258 | * In Sun ONE Web Server 6.1 and higher, http_parse_request("", NULL, NULL) | |
1259 | * returns the NSAPI version. In previous releases, it returns -1. | |
1260 | */ | |
68
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1261 | //define __NSAPI_RUNTIME_VERSION \ |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1262 | // ((*__nsapi30_table->f_http_parse_request)("", NULL, NULL)) |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1263 | |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1264 | // new: |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1265 | #define __NSAPI_RUNTIME_VERSION nsapi_runtime_version() |
1 | 1266 | |
1267 | /* | |
1268 | * NSAPI_RUNTIME_VERSION returns the NSAPI version the server implements. The | |
1269 | * returned NSAPI version number is reliable only in iPlanet Web Server 6.0, | |
1270 | * Netscape Enterprise Server 6.0, and Sun ONE Web Server 6.0 and higher. | |
1271 | */ | |
68
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1272 | //define NSAPI_RUNTIME_VERSION \ |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1273 | // (__NSAPI_RUNTIME_VERSION > 0 ? __NSAPI_RUNTIME_VERSION : 301) |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1274 | |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1275 | // new: |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1276 | #define NSAPI_RUNTIME_VERSION nsapi_runtime_version() |
1 | 1277 | |
1278 | #endif /* NSAPI_VERSION >= 301 */ | |
1279 | ||
68
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1280 | //define system_version (*__nsapi30_table->f_system_version) |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1281 | // new: |
f5102a892ed4
some fixes for mod_jk
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
67
diff
changeset
|
1282 | NSAPI_PUBLIC char* system_version(); |
1 | 1283 | |
1284 | /* | |
1285 | * Depending on the system, memory allocated via these macros may come from | |
1286 | * an arena. If these functions are called from within an Init function, they | |
1287 | * will be allocated from permanent storage. Otherwise, they will be freed | |
1288 | * when the current request is finished. | |
1289 | */ | |
1290 | ||
1291 | ||
1292 | ||
1293 | #endif /* !INTNSAPI */ | |
1294 | ||
1295 | #ifdef XP_UNIX | |
1296 | #define dir_open opendir | |
1297 | #define dir_read readdir | |
1298 | #define dir_close closedir | |
1299 | #define dir_create(path) mkdir(path, 0755) | |
1300 | #define dir_remove rmdir | |
1301 | #define system_chdir chdir | |
1302 | #define file_unix2local(path,p2) strcpy(p2,path) | |
1303 | #endif /* XP_UNIX */ | |
1304 | ||
1305 | #ifdef XP_WIN32 | |
1306 | #define dir_create _mkdir | |
1307 | #define dir_remove _rmdir | |
1308 | #define system_chdir SetCurrentDirectory | |
1309 | #endif /* XP_WIN32 */ | |
1310 | ||
1311 | /* | |
1312 | * Thread-safe variants of localtime and gmtime | |
1313 | */ | |
1314 | #define system_localtime(curtime, ret) util_localtime(curtime, ret) | |
1315 | #define system_gmtime(curtime, ret) util_gmtime(curtime, ret) | |
1316 | ||
1317 | /* | |
1318 | * pblock_find finds the entry with the given name in pblock pb. | |
1319 | * | |
1320 | * If it is successful, it returns the param block. If not, it returns NULL. | |
1321 | */ | |
1322 | #define pblock_find(name, pb) (pblock_fr(name,pb,0)) | |
1323 | ||
1324 | /* | |
1325 | * pblock_remove behaves exactly like pblock_find, but removes the given | |
1326 | * entry from pb. | |
1327 | */ | |
1328 | #define pblock_remove(name, pb) (pblock_fr(name,pb,1)) | |
1329 | ||
1330 | /* | |
1331 | * session_dns returns the DNS hostname of the client of this session, | |
1332 | * and inserts it into the client pblock. Returns NULL if unavailable. | |
1333 | */ | |
1334 | #define session_dns(sn) session_dns_lookup(sn, 0) | |
1335 | ||
1336 | /* | |
1337 | * session_maxdns looks up a hostname from an IP address, and then verifies | |
1338 | * that the host is really who they claim to be. | |
1339 | */ | |
1340 | #define session_maxdns(sn) session_dns_lookup(sn, 1) | |
1341 | ||
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1342 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1343 | /* nsapi functions */ |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1344 | |
47
ce9790523346
server can change uid
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
1345 | NSAPI_PUBLIC conf_global_vars_s* conf_getglobals(); |
ce9790523346
server can change uid
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
1346 | |
61
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1347 | /* |
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1348 | * Query the VirtualServer* associated with a given Request*. |
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1349 | */ |
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1350 | const VirtualServer* request_get_vs(Request *rq); |
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1351 | #define request_get_vs request_get_vs |
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1352 | |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1353 | struct stat* request_stat_path(const char *path, Request *rq); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1354 | #define request_stat_path request_stat_path |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1355 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1356 | void request_free(Request *rq); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1357 | #define request_free request_free |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1358 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1359 | Request* request_restart_internal(const char *uri, Request *rq); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1360 | #define request_restart_internal request_restart_internal |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1361 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1362 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1363 | char* vs_translate_uri(const VirtualServer *vs, const char *uri); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1364 | #define vs_translate_uri vs_translate_uri |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1365 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1366 | char* servact_translate_uri(char *uri, Session *sn); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1367 | #define servact_translate_uri servact_translate_uri |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1368 | #define request_translate_uri servact_translate_uri |
61
c858850f3d3a
improved configuration reloading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
1369 | |
498
0d80f8a2b29f
fix net_http_write when used with chunked transfer encoding and non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
434
diff
changeset
|
1370 | ssize_t net_write(SYS_NETFD fd, const void *buf, size_t nbytes); |
64
c7f5b062e622
added net_writev
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
1371 | ssize_t net_writev(SYS_NETFD fd, struct iovec *iovec, int iovcnt); |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1372 | ssize_t net_sendfile(SYS_NETFD fd, sendfiledata *sfd); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1373 | ssize_t net_read(SYS_NETFD fd, void *buf, size_t nbytes); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1374 | int net_flush(SYS_NETFD sd); |
110
43a746e905f6
refactored IO system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
109
diff
changeset
|
1375 | void net_close(SYS_NETFD fd); |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1376 | |
64
c7f5b062e622
added net_writev
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
1377 | // NSAPI extension |
23
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1378 | ssize_t net_printf(SYS_NETFD fd, char *format, ...); |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1379 | |
172
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1380 | int net_setnonblock(SYS_NETFD fd, int nonblock); |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1381 | int net_errno(SYS_NETFD fd); |
23
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1382 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1383 | NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1384 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1385 | NSAPI_PUBLIC int INTparam_free(pb_param *pp); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1386 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1387 | NSAPI_PUBLIC pblock *INTpblock_create(int n); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1388 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1389 | NSAPI_PUBLIC void INTpblock_free(pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1390 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1391 | NSAPI_PUBLIC char *INTpblock_findval(const char *name, const pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1392 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1393 | NSAPI_PUBLIC pb_param *INTpblock_nvinsert(const char *name, const char *value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1394 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1395 | NSAPI_PUBLIC pb_param *pblock_nvlinsert(const char *name, int namelen, const char *value, int valuelen, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1396 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1397 | NSAPI_PUBLIC pb_param *INTpblock_nninsert(const char *name, int value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1398 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1399 | NSAPI_PUBLIC void INTpblock_pinsert(pb_param *pp, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1400 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1401 | NSAPI_PUBLIC int INTpblock_str2pblock(const char *str, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1402 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1403 | NSAPI_PUBLIC char *INTpblock_pblock2str(const pblock *pb, char *str); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1404 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1405 | NSAPI_PUBLIC int INTpblock_copy(const pblock *src, pblock *dst); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1406 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1407 | NSAPI_PUBLIC pblock *INTpblock_dup(const pblock *src); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1408 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1409 | NSAPI_PUBLIC char **INTpblock_pb2env(const pblock *pb, char **env); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1410 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1411 | NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1412 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1413 | NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1414 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1415 | NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1416 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1417 | NSAPI_PUBLIC pb_param *INTpblock_fr(const char *name, pblock *pb, int remove); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1418 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1419 | NSAPI_PUBLIC char *INTpblock_replace(const char *name,char * new_value,pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1420 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1421 | NSAPI_PUBLIC int INTpblock_str2pblock_lowercasename(const char *str, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1422 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1423 | //NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1424 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1425 | //NSAPI_PUBLIC const pb_key *pblock_key(const char *name); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1426 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1427 | //NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1428 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1429 | //NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1430 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1431 | //NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1432 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1433 | //NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1434 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1435 | //NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1436 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1437 | //NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1438 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1439 | //NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1440 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1441 | //NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1442 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1443 | //NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, PRInt64 value, pblock *pb); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1444 | |
65
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
1445 | #define pblock_remove(name, pb) (pblock_fr(name,pb,1)) |
14722c5f8856
added chunked transfer encoding
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
64
diff
changeset
|
1446 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1447 | #define param_create INTparam_create |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1448 | #define param_free INTparam_free |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1449 | #define pblock_create INTpblock_create |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1450 | #define pblock_free INTpblock_free |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1451 | #define pblock_findval INTpblock_findval |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1452 | #define pblock_nvinsert INTpblock_nvinsert |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1453 | #define pblock_nninsert INTpblock_nninsert |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1454 | #define pblock_pinsert INTpblock_pinsert |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1455 | #define pblock_str2pblock INTpblock_str2pblock |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1456 | #define pblock_pblock2str INTpblock_pblock2str |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1457 | #define pblock_copy INTpblock_copy |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1458 | #define pblock_dup INTpblock_dup |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1459 | #define pblock_pb2env INTpblock_pb2env |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1460 | #define pblock_fr INTpblock_fr |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1461 | #define pblock_replace INTpblock_replace |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1462 | |
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1463 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1464 | // pool |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1465 | NSAPI_PUBLIC pool_handle_t *INTpool_create(void); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1466 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1467 | NSAPI_PUBLIC void *INTpool_mark(pool_handle_t *pool_handle); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1468 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1469 | NSAPI_PUBLIC void INTpool_recycle(pool_handle_t *pool_handle, void *mark); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1470 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1471 | NSAPI_PUBLIC void INTpool_destroy(pool_handle_t *pool_handle); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1472 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1473 | NSAPI_PUBLIC int INTpool_enabled(void); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1474 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1475 | NSAPI_PUBLIC void *INTpool_malloc(pool_handle_t *pool_handle, size_t size ); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1476 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1477 | NSAPI_PUBLIC void INTpool_free(pool_handle_t *pool_handle, void *ptr ); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1478 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1479 | NSAPI_PUBLIC |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1480 | void *INTpool_calloc(pool_handle_t *pool_handle, size_t nelem, size_t elsize); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1481 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1482 | NSAPI_PUBLIC |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1483 | void *INTpool_realloc(pool_handle_t *pool_handle, void *ptr, size_t size ); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1484 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1485 | NSAPI_PUBLIC |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1486 | char *INTpool_strdup(pool_handle_t *pool_handle, const char *orig_str ); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1487 | |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1488 | #define pool_create INTpool_create |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1489 | #define pool_mark INTpool_mark |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1490 | #define pool_recycle INTpool_recycle |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1491 | #define pool_destroy INTpool_destroy |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1492 | #define pool_enabled INTpool_enabled |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1493 | #define pool_malloc INTpool_malloc |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1494 | #define pool_free INTpool_free |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1495 | #define pool_calloc INTpool_calloc |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1496 | #define pool_realloc INTpool_realloc |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1497 | #define pool_strdup INTpool_strdup |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1498 | |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1499 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1500 | #define MALLOC malloc |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1501 | #define CALLOC(size) calloc(1, size) |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1502 | #define REALLOC realloc |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1503 | #define FREE free |
118
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
1504 | #define STRDUP strdup |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1505 | |
23
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1506 | // func util functions |
a2c8fc23c90e
Added basic authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
1507 | FuncStruct* func_resolve(pblock *pb, Session *sn, Request *rq); |
84
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
1508 | int func_exec(pblock *pb, Session *sn, Request *rq); |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
1509 | struct FuncStruct func_insert(char *name, FuncPtr fn); |
afd57ce39ec9
added initial java plugin code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
82
diff
changeset
|
1510 | #define func_insert func_insert |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1511 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1512 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1513 | void protocol_status(Session *sn, Request *rq, int n, const char *m); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1514 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1515 | int http_start_response(Session *sn, Request *rq); |
1 | 1516 | #define protocol_start_response http_start_response |
432
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1517 | |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1518 | HttpResponseWriter *http_create_response(Session *sn, Request *rq); |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1519 | |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1520 | /* |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1521 | * return: -1: error |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1522 | * 0: finished |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1523 | * 1: EWOULDBLOCK |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1524 | */ |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1525 | int http_send_response(HttpResponseWriter *writer); |
7c9137f9e7f9
add http_send_response function that is usable for non-blocking IO
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
371
diff
changeset
|
1526 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1527 | int request_header(char *name, char **value, Session *sn, Request *rq); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1528 | |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1529 | char *http_uri2url(const char *prefix, const char *suffix); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1530 | char *http_uri2url_dynamic(const char *prefix, const char *suffix, |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1531 | Session *sn, Request *rq); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1532 | #define protocol_uri2url http_uri2url |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1533 | #define protocol_uri2url_dynamic http_uri2url_dynamic |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1534 | |
102
136a76e293b5
added etag and conditional request implementation from Open Web Server
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
1535 | |
136a76e293b5
added etag and conditional request implementation from Open Web Server
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
1536 | NSAPI_PUBLIC void http_format_etag(Session *sn, Request *rq, char *etagp, int etaglen, off_t size, time_t mtime); |
136a76e293b5
added etag and conditional request implementation from Open Web Server
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
1537 | NSAPI_PUBLIC int http_check_preconditions(Session *sn, Request *rq, struct tm *mtm, const char *etag); |
136a76e293b5
added etag and conditional request implementation from Open Web Server
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
1538 | NSAPI_PUBLIC int http_set_finfo(Session *sn, Request *rq, struct stat *finfo); |
345
5832e10fc59a
add optional getetag function to VFS API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
274
diff
changeset
|
1539 | NSAPI_PUBLIC int http_set_finfo_etag(Session *sn, Request *rq, struct stat *finfo, const char *etag); |
102
136a76e293b5
added etag and conditional request implementation from Open Web Server
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
1540 | |
118
38bf6dd8f4e7
adds minimal cgi implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
1541 | NSAPI_PUBLIC char **http_hdrs2env(pblock *pb); |
102
136a76e293b5
added etag and conditional request implementation from Open Web Server
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
1542 | |
127
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1543 | // new websocket API begin |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1544 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1545 | NSAPI_PUBLIC int http_handle_websocket(Session *sn, Request *rq, WebSocket *websocket); |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1546 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1547 | NSAPI_PUBLIC int websocket_send_text(SYS_NETFD csd, char *msg, size_t len); |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1548 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1549 | // websocket API end |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1550 | |
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
118
diff
changeset
|
1551 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1552 | typedef void (*thrstartfunc)(void *); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1553 | SYS_THREAD INTsysthread_start(int prio, int stksz, thrstartfunc fn, void *arg); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1554 | NSAPI_PUBLIC void INTsysthread_sleep(int milliseconds); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1555 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1556 | #define systhread_start INTsysthread_start |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1557 | #define systhread_sleep INTsysthread_sleep |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1558 | |
1 | 1559 | |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1560 | void webserver_atrestart(void (*fn)(void *), void *data); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1561 | #define magnus_atrestart webserver_atrestart |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1562 | #define daemon_atrestart webserver_atrestart |
9
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1563 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1564 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1565 | NSAPI_PUBLIC int INTshexp_match(const char *str, const char *exp); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1566 | #define shexp_match INTshexp_match |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1567 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1568 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1569 | |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1570 | NSAPI_PUBLIC char *session_dns_lookup(Session *s, int verify); |
30e51941a673
Added mod_jk dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
1571 | |
1 | 1572 | |
8
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1573 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1574 | /* netbuf functions */ |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1575 | NSAPI_PUBLIC netbuf *netbuf_open(SYS_NETFD sd, int sz); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1576 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1577 | NSAPI_PUBLIC void netbuf_close(netbuf *buf); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1578 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1579 | NSAPI_PUBLIC unsigned char * netbuf_replace(netbuf *buf, |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1580 | unsigned char *inbuf, int pos, int cursize, int maxsize); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1581 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1582 | NSAPI_PUBLIC int netbuf_next(netbuf *buf, int advance); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1583 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1584 | NSAPI_PUBLIC int netbuf_getbytes(netbuf *buf, char *buffer, int size); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1585 | |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1586 | NSAPI_PUBLIC int netbuf_grab(netbuf *buf, int sz); |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1587 | |
21
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1588 | #define netbuf_open netbuf_open |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1589 | #define netbuf_close netbuf_close |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1590 | #define netbuf_replace netbuf_replace |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1591 | #define netbuf_next netbuf_next |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1592 | #define netbuf_getbytes netbuf_getbytes |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1593 | #define netbuf_grab netbuf_grab |
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1594 | |
58
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
56
diff
changeset
|
1595 | /* file */ |
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
56
diff
changeset
|
1596 | NSAPI_PUBLIC int system_fread(SYS_FILE fd, void *buf, int nbyte); |
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
56
diff
changeset
|
1597 | NSAPI_PUBLIC int system_fwrite(SYS_FILE fd, const void *buf, int nbyte); |
189
a2438f6d1e73
adds vfs pread/pwrite functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
1598 | NSAPI_PUBLIC int system_pread(SYS_FILE fd, void *buf, int nbyte, off_t offset); |
a2438f6d1e73
adds vfs pread/pwrite functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
187
diff
changeset
|
1599 | NSAPI_PUBLIC int system_pwrite(SYS_FILE fd, const void *buf, int nbyte, off_t offset); |
66
74babc0082b7
added authentication cache
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
65
diff
changeset
|
1600 | NSAPI_PUBLIC off_t system_lseek(SYS_FILE fd, off_t offset, int whence); |
58
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
56
diff
changeset
|
1601 | NSAPI_PUBLIC int system_fclose(SYS_FILE fd); |
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
56
diff
changeset
|
1602 | |
172
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1603 | NSAPI_PUBLIC int system_aio_read(aiocb_s *aiocb); |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1604 | NSAPI_PUBLIC int system_aio_write(aiocb_s *aiocb); |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1605 | |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1606 | |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1607 | int log_ereport(int degree, const char *format, ...); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1608 | int log_ereport_v(int degree, const char *format, va_list args); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1609 | int log_error(int degree, const char *func, Session *sn, Request *rq, |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1610 | const char *format, ...); |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1611 | int log_error_v(int degree, const char *func, Session *sn, Request *rq, |
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1612 | const char *format, va_list args); |
434
ff576305ae6e
redirect stdout/stderr to log file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
432
diff
changeset
|
1613 | int log_message(const char *degree, const char *format, ...); |
ff576305ae6e
redirect stdout/stderr to log file
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
432
diff
changeset
|
1614 | int log_message_v(const char *degree, const char *format, va_list args); |
82
740cfd9dd443
added some nsapi stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
81
diff
changeset
|
1615 | |
67
50505dc3f8a6
dynamic thread pool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
1616 | /* new macro and function definitions begin */ |
50505dc3f8a6
dynamic thread pool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
1617 | |
63
66442f81f823
supports file system ACLs on Solaris
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
1618 | NSAPI_PUBLIC int util_errno2status(int errno_value); // new |
56
c6cf20b09043
added vfs_mkdir and vfs_unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
1619 | #define util_errno2status util_errno2status |
81
d25825f37967
preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
68
diff
changeset
|
1620 | NSAPI_PUBLIC pblock* util_parse_param(pool_handle_t *pool, char *query); |
d25825f37967
preparation for admin interface
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
68
diff
changeset
|
1621 | #define util_parse_param util_parse_param |
21
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1622 | |
172
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1623 | void nsapi_function_return(Session *sn, Request *rq, int ret); |
21
627b09ee74e4
New configuration loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
19
diff
changeset
|
1624 | |
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1625 | // threadpool |
67
50505dc3f8a6
dynamic thread pool
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
1626 | threadpool_t* threadpool_new(int min, int max); |
357
f45e962edf45
add separate threadpool_start function for creating initial threadpool threads
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
1627 | int threadpool_start(threadpool_t *pool); |
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1628 | void* threadpool_func(void *data); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1629 | threadpool_job* threadpool_get_job(threadpool_t *pool); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1630 | void threadpool_run(threadpool_t *pool, job_callback_f func, void *data); |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
1631 | |
172
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1632 | int event_pollin(EventHandler *ev, SYS_NETFD fd, Event *event); |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1633 | int event_pollout(EventHandler *ev, SYS_NETFD fd, Event *event); |
5580517faafc
adds public aio and poll api and asynchronous send_range function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
159
diff
changeset
|
1634 | int event_removepoll(EventHandler *ev, SYS_NETFD fd); |
187
4384bfbb7e26
adds platform independent aio functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
1635 | int event_send(EventHandler *ev, Event *event); |
87
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1636 | |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
1637 | // resource pool |
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
1638 | ResourceData* resourcepool_lookup(Session *sn, Request *rq, const char *name, int flags); |
371
ea836c4f7341
add global resource lookup function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
1639 | ResourceData* resourcepool_cfg_lookup(ServerConfiguration *cfg, const char *name, int flags); |
272
f210681d9dd0
add minimal working implementation for resourcepool_lookup()
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
1640 | void resourcepool_free(Session *sn, Request *rq, ResourceData *resource); |
260
4779a6fb4fbe
fix freebsd build
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
211
diff
changeset
|
1641 | |
274
607712fb3c66
escape html output in pg_query
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
272
diff
changeset
|
1642 | // utils |
607712fb3c66
escape html output in pg_query
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
272
diff
changeset
|
1643 | NSAPI_PUBLIC char *util_html_escape(const char *s); |
607712fb3c66
escape html output in pg_query
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
272
diff
changeset
|
1644 | |
87
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1645 | // assert |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1646 | void ws_log_assert(const char *file, const char *func, int line); |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1647 | #ifdef _DEBUG |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1648 | #ifndef __FUNCTION__ |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1649 | #define __FUNCTION__ __func__ |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1650 | #endif |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1651 | #define WS_ASSERT(c) if(!c) ws_log_assert(__FILE__, __FUNCTION__, __LINE__) |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1652 | #else |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1653 | #define WS_ASSERT(c) |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1654 | #endif |
bdec069d2239
fixed pathcheck behavior
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
1655 | |
8
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1656 | /* end new macro and function definitions */ |
f4d56bf9de40
Added request body reader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
6
diff
changeset
|
1657 | |
1 | 1658 | #define SYS_STDERR STDERR_FILENO |
1659 | ||
1660 | #ifdef XP_WIN32 | |
1661 | ||
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1662 | //typedef HANDLE pid_t; // TODO |
1 | 1663 | |
1664 | #define ERROR_PIPE \ | |
1665 | (ERROR_BROKEN_PIPE | ERROR_BAD_PIPE | \ | |
1666 | ERROR_PIPE_BUSY | ERROR_PIPE_LISTENING | ERROR_PIPE_NOT_CONNECTED) | |
1667 | #define CONVERT_TO_PRINTABLE_FORMAT(Filename) \ | |
1668 | { \ | |
1669 | register char *s; \ | |
1670 | if (Filename) \ | |
1671 | for (s = Filename; *s; s++) \ | |
1672 | if ( *s == '\\') \ | |
1673 | *s = '/'; \ | |
1674 | } | |
1675 | #define CONVERT_TO_NATIVE_FS(Filename) \ | |
1676 | { \ | |
1677 | register char *s; \ | |
1678 | if (Filename) \ | |
1679 | for (s = Filename; *s; s++) \ | |
1680 | if ( *s == '/') \ | |
1681 | *s = '\\'; \ | |
1682 | } | |
1683 | ||
1684 | #ifdef INTNSAPI | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1685 | //NSAPI_PUBLIC extern nsapi_dispatch_t *__nsapi30_table; |
1 | 1686 | #if NSAPI_VERSION >= 302 |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1687 | //NSAPI_PUBLIC extern nsapi302_dispatch_t *__nsapi302_table; |
1 | 1688 | #endif /* NSAPI_VERSION >= 302 */ |
1689 | #if NSAPI_VERSION >= 303 | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1690 | //NSAPI_PUBLIC extern nsapi303_dispatch_t *__nsapi303_table; |
1 | 1691 | #endif /* NSAPI_VERSION >= 303 */ |
1692 | #else | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1693 | //__declspec(dllimport) nsapi_dispatch_t *__nsapi30_table; |
1 | 1694 | #if NSAPI_VERSION >= 302 |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1695 | //__declspec(dllimport) nsapi302_dispatch_t *__nsapi302_table; |
1 | 1696 | #endif /* NSAPI_VERSION >= 302 */ |
1697 | #if NSAPI_VERSION >= 303 | |
147
d050449c3b9e
ported io.c and some headers to windows
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
1698 | //__declspec(dllimport) nsapi303_dispatch_t *__nsapi303_table; |
1 | 1699 | #endif /* NSAPI_VERSION >= 303 */ |
1700 | #endif /* INTNSAPI */ | |
1701 | ||
1702 | #else /* !XP_WIN32 */ | |
1703 | ||
1704 | ||
1705 | #endif /* XP_WIN32 */ | |
1706 | ||
1707 | #ifdef __cplusplus | |
1708 | } | |
1709 | #endif | |
1710 | ||
1711 | #endif /* !PUBLIC_NSAPI_H */ |