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