src/server/pblock.h

changeset 1
3c066d52342d
child 5
dbc01588686e
equal deleted inserted replaced
0:4c89c7683fb6 1:3c066d52342d
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 BASE_PBLOCK_H
35 #define BASE_PBLOCK_H
36
37 #ifndef NOINTNSAPI
38 #define INTNSAPI
39 #endif /* !NOINTNSAPI */
40
41 /*
42 * pblock.h: Header for Parameter Block handling functions
43 *
44 *
45 * A parameter block is a set of name=value pairs which are generally used
46 * as parameters, but can be anything. They are kept in a hash table for
47 * reasonable speed, but if you are doing any intensive modification or
48 * access of them you should probably make a local copy of each parameter
49 * while working.
50 *
51 * Rob McCool
52 *
53 */
54
55 #ifndef NETSITE_H
56 #include "nsapi.h"
57 #include "netsite.h"
58 #endif /* !NETSITE_H */
59
60 #ifdef XP_WIN32
61 #ifdef BUILD_DLL
62 #define BASE_DLL _declspec(dllexport)
63 #else
64 #define BASE_DLL _declspec(dllimport)
65 #endif
66 #else
67 #define BASE_DLL
68 #endif
69
70 #ifdef INTNSAPI
71
72 /* --- Begin function prototypes --- */
73
74 NSPR_BEGIN_EXTERN_C
75
76 NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value);
77
78 NSAPI_PUBLIC int INTparam_free(pb_param *pp);
79
80 NSAPI_PUBLIC pblock *INTpblock_create(int n);
81
82 NSAPI_PUBLIC void INTpblock_free(pblock *pb);
83
84 NSAPI_PUBLIC char *INTpblock_findval(const char *name, const pblock *pb);
85
86 NSAPI_PUBLIC pb_param *INTpblock_nvinsert(const char *name, const char *value, pblock *pb);
87
88 NSAPI_PUBLIC pb_param *INTpblock_nninsert(const char *name, int value, pblock *pb);
89
90 NSAPI_PUBLIC void INTpblock_pinsert(pb_param *pp, pblock *pb);
91
92 NSAPI_PUBLIC int INTpblock_str2pblock(const char *str, pblock *pb);
93
94 NSAPI_PUBLIC char *INTpblock_pblock2str(const pblock *pb, char *str);
95
96 NSAPI_PUBLIC int INTpblock_copy(const pblock *src, pblock *dst);
97
98 NSAPI_PUBLIC pblock *INTpblock_dup(const pblock *src);
99
100 NSAPI_PUBLIC char **INTpblock_pb2env(const pblock *pb, char **env);
101
102 NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb);
103
104 /* --------------------------- Internal things ---------------------------- */
105
106 typedef struct pb_key pb_key;
107
108 BASE_DLL extern const pb_key *const pb_key_accept;
109 BASE_DLL extern const pb_key *const pb_key_accept_charset;
110 BASE_DLL extern const pb_key *const pb_key_accept_encoding;
111 BASE_DLL extern const pb_key *const pb_key_accept_language;
112 BASE_DLL extern const pb_key *const pb_key_accept_ranges;
113 BASE_DLL extern const pb_key *const pb_key_actual_route;
114 BASE_DLL extern const pb_key *const pb_key_age;
115 BASE_DLL extern const pb_key *const pb_key_always_allow_chunked;
116 BASE_DLL extern const pb_key *const pb_key_always_use_keep_alive;
117 BASE_DLL extern const pb_key *const pb_key_auth_cert;
118 BASE_DLL extern const pb_key *const pb_key_auth_expiring;
119 BASE_DLL extern const pb_key *const pb_key_auth_group;
120 BASE_DLL extern const pb_key *const pb_key_auth_type;
121 BASE_DLL extern const pb_key *const pb_key_auth_user;
122 BASE_DLL extern const pb_key *const pb_key_authorization;
123 BASE_DLL extern const pb_key *const pb_key_browser;
124 BASE_DLL extern const pb_key *const pb_key_c2p_cl;
125 BASE_DLL extern const pb_key *const pb_key_c2p_hl;
126 BASE_DLL extern const pb_key *const pb_key_cache_info;
127 BASE_DLL extern const pb_key *const pb_key_charset;
128 BASE_DLL extern const pb_key *const pb_key_check_http_server;
129 BASE_DLL extern const pb_key *const pb_key_ChunkedRequestBufferSize;
130 BASE_DLL extern const pb_key *const pb_key_ChunkedRequestTimeout;
131 BASE_DLL extern const pb_key *const pb_key_cipher;
132 BASE_DLL extern const pb_key *const pb_key_clf_request;
133 BASE_DLL extern const pb_key *const pb_key_cli_status;
134 BASE_DLL extern const pb_key *const pb_key_client_cert_nickname;
135 BASE_DLL extern const pb_key *const pb_key_client_ip;
136 BASE_DLL extern const pb_key *const pb_key_close;
137 BASE_DLL extern const pb_key *const pb_key_connect_timeout;
138 BASE_DLL extern const pb_key *const pb_key_connection;
139 BASE_DLL extern const pb_key *const pb_key_cont;
140 BASE_DLL extern const pb_key *const pb_key_content_encoding;
141 BASE_DLL extern const pb_key *const pb_key_content_language;
142 BASE_DLL extern const pb_key *const pb_key_content_length;
143 BASE_DLL extern const pb_key *const pb_key_content_location;
144 BASE_DLL extern const pb_key *const pb_key_content_md5;
145 BASE_DLL extern const pb_key *const pb_key_content_range;
146 BASE_DLL extern const pb_key *const pb_key_content_type;
147 BASE_DLL extern const pb_key *const pb_key_cookie;
148 BASE_DLL extern const pb_key *const pb_key_date;
149 BASE_DLL extern const pb_key *const pb_key_DATE_GMT;
150 BASE_DLL extern const pb_key *const pb_key_DATE_LOCAL;
151 BASE_DLL extern const pb_key *const pb_key_dir;
152 BASE_DLL extern const pb_key *const pb_key_Directive;
153 BASE_DLL extern const pb_key *const pb_key_dns;
154 BASE_DLL extern const pb_key *const pb_key_DOCUMENT_NAME;
155 BASE_DLL extern const pb_key *const pb_key_DOCUMENT_URI;
156 BASE_DLL extern const pb_key *const pb_key_domain;
157 BASE_DLL extern const pb_key *const pb_key_enc;
158 BASE_DLL extern const pb_key *const pb_key_engine;
159 BASE_DLL extern const pb_key *const pb_key_error_action;
160 BASE_DLL extern const pb_key *const pb_key_error_desc;
161 BASE_DLL extern const pb_key *const pb_key_error_fn;
162 BASE_DLL extern const pb_key *const pb_key_escape;
163 BASE_DLL extern const pb_key *const pb_key_escaped;
164 BASE_DLL extern const pb_key *const pb_key_etag;
165 BASE_DLL extern const pb_key *const pb_key_expect;
166 BASE_DLL extern const pb_key *const pb_key_expires;
167 BASE_DLL extern const pb_key *const pb_key_expr;
168 BASE_DLL extern const pb_key *const pb_key_filter;
169 BASE_DLL extern const pb_key *const pb_key_find_pathinfo_forward;
170 BASE_DLL extern const pb_key *const pb_key_flushTimer;
171 BASE_DLL extern const pb_key *const pb_key_fn;
172 BASE_DLL extern const pb_key *const pb_key_from;
173 BASE_DLL extern const pb_key *const pb_key_full_headers;
174 BASE_DLL extern const pb_key *const pb_key_hdr;
175 BASE_DLL extern const pb_key *const pb_key_host;
176 BASE_DLL extern const pb_key *const pb_key_hostname;
177 BASE_DLL extern const pb_key *const pb_key_if_match;
178 BASE_DLL extern const pb_key *const pb_key_if_modified_since;
179 BASE_DLL extern const pb_key *const pb_key_if_none_match;
180 BASE_DLL extern const pb_key *const pb_key_if_range;
181 BASE_DLL extern const pb_key *const pb_key_if_unmodified_since;
182 BASE_DLL extern const pb_key *const pb_key_ip;
183 BASE_DLL extern const pb_key *const pb_key_iponly;
184 BASE_DLL extern const pb_key *const pb_key_issuer_dn;
185 BASE_DLL extern const pb_key *const pb_key_jroute;
186 BASE_DLL extern const pb_key *const pb_key_keep_alive;
187 BASE_DLL extern const pb_key *const pb_key_keep_alive_timeout;
188 BASE_DLL extern const pb_key *const pb_key_keysize;
189 BASE_DLL extern const pb_key *const pb_key_lang;
190 BASE_DLL extern const pb_key *const pb_key_LAST_MODIFIED;
191 BASE_DLL extern const pb_key *const pb_key_last_modified;
192 BASE_DLL extern const pb_key *const pb_key_level;
193 BASE_DLL extern const pb_key *const pb_key_location;
194 BASE_DLL extern const pb_key *const pb_key_lock_owner;
195 BASE_DLL extern const pb_key *const pb_key_magnus_charset;
196 BASE_DLL extern const pb_key *const pb_key_magnus_internal;
197 BASE_DLL extern const pb_key *const pb_key_magnus_internal_dav_src;
198 BASE_DLL extern const pb_key *const pb_key_magnus_internal_default_acls_only;
199 BASE_DLL extern const pb_key *const pb_key_magnus_internal_error_j2ee;
200 BASE_DLL extern const pb_key *const pb_key_magnus_internal_j2ee_nsapi;
201 BASE_DLL extern const pb_key *const pb_key_magnus_internal_preserve_srvhdrs;
202 BASE_DLL extern const pb_key *const pb_key_magnus_internal_set_request_status;
203 BASE_DLL extern const pb_key *const pb_key_magnus_internal_set_response_status;
204 BASE_DLL extern const pb_key *const pb_key_magnus_internal_webapp_errordesc;
205 BASE_DLL extern const pb_key *const pb_key_matched_browser;
206 BASE_DLL extern const pb_key *const pb_key_max_age;
207 BASE_DLL extern const pb_key *const pb_key_max_forwards;
208 BASE_DLL extern const pb_key *const pb_key_message;
209 BASE_DLL extern const pb_key *const pb_key_method;
210 BASE_DLL extern const pb_key *const pb_key_name;
211 BASE_DLL extern const pb_key *const pb_key_nocache;
212 BASE_DLL extern const pb_key *const pb_key_nostat;
213 BASE_DLL extern const pb_key *const pb_key_ntrans_base;
214 BASE_DLL extern const pb_key *const pb_key_offline_origin_addr;
215 BASE_DLL extern const pb_key *const pb_key_offline_proxy_addr;
216 BASE_DLL extern const pb_key *const pb_key_origin_addr;
217 BASE_DLL extern const pb_key *const pb_key_p2c_cl;
218 BASE_DLL extern const pb_key *const pb_key_p2c_hl;
219 BASE_DLL extern const pb_key *const pb_key_p2r_cl;
220 BASE_DLL extern const pb_key *const pb_key_p2r_hl;
221 BASE_DLL extern const pb_key *const pb_key_parse_timeout;
222 BASE_DLL extern const pb_key *const pb_key_password;
223 BASE_DLL extern const pb_key *const pb_key_path;
224 BASE_DLL extern const pb_key *const pb_key_PATH_INFO;
225 BASE_DLL extern const pb_key *const pb_key_path_info;
226 BASE_DLL extern const pb_key *const pb_key_pblock;
227 BASE_DLL extern const pb_key *const pb_key_poll_interval;
228 BASE_DLL extern const pb_key *const pb_key_port;
229 BASE_DLL extern const pb_key *const pb_key_ppath;
230 BASE_DLL extern const pb_key *const pb_key_pragma;
231 BASE_DLL extern const pb_key *const pb_key_process_request_body;
232 BASE_DLL extern const pb_key *const pb_key_process_response_body;
233 BASE_DLL extern const pb_key *const pb_key_protocol;
234 BASE_DLL extern const pb_key *const pb_key_proxy_addr;
235 BASE_DLL extern const pb_key *const pb_key_proxy_agent;
236 BASE_DLL extern const pb_key *const pb_key_proxy_auth_cert;
237 BASE_DLL extern const pb_key *const pb_key_proxy_authorization;
238 BASE_DLL extern const pb_key *const pb_key_proxy_cipher;
239 BASE_DLL extern const pb_key *const pb_key_proxy_issuer_dn;
240 BASE_DLL extern const pb_key *const pb_key_proxy_jroute;
241 BASE_DLL extern const pb_key *const pb_key_proxy_keysize;
242 BASE_DLL extern const pb_key *const pb_key_proxy_ping;
243 BASE_DLL extern const pb_key *const pb_key_proxy_request;
244 BASE_DLL extern const pb_key *const pb_key_proxy_secret_keysize;
245 BASE_DLL extern const pb_key *const pb_key_proxy_ssl_id;
246 BASE_DLL extern const pb_key *const pb_key_proxy_user_dn;
247 BASE_DLL extern const pb_key *const pb_key_query;
248 BASE_DLL extern const pb_key *const pb_key_QUERY_STRING;
249 BASE_DLL extern const pb_key *const pb_key_QUERY_STRING_UNESCAPED;
250 BASE_DLL extern const pb_key *const pb_key_r2p_cl;
251 BASE_DLL extern const pb_key *const pb_key_r2p_hl;
252 BASE_DLL extern const pb_key *const pb_key_range;
253 BASE_DLL extern const pb_key *const pb_key_referer;
254 BASE_DLL extern const pb_key *const pb_key_reformat_request_headers;
255 BASE_DLL extern const pb_key *const pb_key_remote_status;
256 BASE_DLL extern const pb_key *const pb_key_request_jroute;
257 BASE_DLL extern const pb_key *const pb_key_required_rights;
258 BASE_DLL extern const pb_key *const pb_key_retries;
259 BASE_DLL extern const pb_key *const pb_key_rewrite_content_location;
260 BASE_DLL extern const pb_key *const pb_key_rewrite_host;
261 BASE_DLL extern const pb_key *const pb_key_rewrite_location;
262 BASE_DLL extern const pb_key *const pb_key_rewrite_set_cookie;
263 BASE_DLL extern const pb_key *const pb_key_root;
264 BASE_DLL extern const pb_key *const pb_key_route;
265 BASE_DLL extern const pb_key *const pb_key_route_cookie;
266 BASE_DLL extern const pb_key *const pb_key_route_hdr;
267 BASE_DLL extern const pb_key *const pb_key_route_offline;
268 BASE_DLL extern const pb_key *const pb_key_script_name;
269 BASE_DLL extern const pb_key *const pb_key_secret_keysize;
270 BASE_DLL extern const pb_key *const pb_key_secure;
271 BASE_DLL extern const pb_key *const pb_key_server;
272 BASE_DLL extern const pb_key *const pb_key_set_cookie;
273 BASE_DLL extern const pb_key *const pb_key_socks_addr;
274 BASE_DLL extern const pb_key *const pb_key_ssl_id;
275 BASE_DLL extern const pb_key *const pb_key_ssl_unclean_shutdown;
276 BASE_DLL extern const pb_key *const pb_key_status;
277 BASE_DLL extern const pb_key *const pb_key_sticky_cookie;
278 BASE_DLL extern const pb_key *const pb_key_sticky_param;
279 BASE_DLL extern const pb_key *const pb_key_suppress_request_headers;
280 BASE_DLL extern const pb_key *const pb_key_svr_status;
281 BASE_DLL extern const pb_key *const pb_key_timeout;
282 BASE_DLL extern const pb_key *const pb_key_to;
283 BASE_DLL extern const pb_key *const pb_key_transfer_encoding;
284 BASE_DLL extern const pb_key *const pb_key_transmit_timeout;
285 BASE_DLL extern const pb_key *const pb_key_tunnel_non_http_response;
286 BASE_DLL extern const pb_key *const pb_key_type;
287 BASE_DLL extern const pb_key *const pb_key_upstream_jroute;
288 BASE_DLL extern const pb_key *const pb_key_uri;
289 BASE_DLL extern const pb_key *const pb_key_url;
290 BASE_DLL extern const pb_key *const pb_key_url_prefix;
291 BASE_DLL extern const pb_key *const pb_key_UseOutputStreamSize;
292 BASE_DLL extern const pb_key *const pb_key_user;
293 BASE_DLL extern const pb_key *const pb_key_user_agent;
294 BASE_DLL extern const pb_key *const pb_key_user_dn;
295 BASE_DLL extern const pb_key *const pb_key_validate_server_cert;
296 BASE_DLL extern const pb_key *const pb_key_value;
297 BASE_DLL extern const pb_key *const pb_key_vary;
298 BASE_DLL extern const pb_key *const pb_key_via;
299 BASE_DLL extern const pb_key *const pb_key_warning;
300
301 NSAPI_PUBLIC pool_handle_t *pblock_pool(pblock *pb);
302
303 NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value);
304
305 NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n);
306
307 NSAPI_PUBLIC pb_param *INTpblock_fr(const char *name, pblock *pb, int remove);
308
309 NSAPI_PUBLIC char *INTpblock_replace(const char *name,char * new_value,pblock *pb);
310
311 NSAPI_PUBLIC int INTpblock_str2pblock_lowercasename(const char *str, pblock *pb);
312
313 NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb);
314
315 NSAPI_PUBLIC const pb_key *pblock_key(const char *name);
316
317 NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen);
318
319 NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb);
320
321 NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb);
322
323 NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb);
324
325 NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb);
326
327 NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb);
328
329 NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb);
330
331 NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb);
332
333 NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, PRInt64 value, pblock *pb);
334
335 #ifdef __cplusplus
336 inline const pb_key *param_key(pb_param *pp)
337 {
338 return *(const pb_key **)(pp + 1); /* XXX see plist_pvt.h */
339 }
340 #endif
341
342 NSPR_END_EXTERN_C
343
344 #define param_create INTparam_create
345 #define param_free INTparam_free
346 #define pblock_create INTpblock_create
347 #define pblock_free INTpblock_free
348 #define pblock_findval INTpblock_findval
349 #define pblock_nvinsert INTpblock_nvinsert
350 #define pblock_nninsert INTpblock_nninsert
351 #define pblock_pinsert INTpblock_pinsert
352 #define pblock_str2pblock INTpblock_str2pblock
353 #define pblock_pblock2str INTpblock_pblock2str
354 #define pblock_copy INTpblock_copy
355 #define pblock_dup INTpblock_dup
356 #define pblock_pb2env INTpblock_pb2env
357 #define pblock_fr INTpblock_fr
358 #define pblock_replace INTpblock_replace
359
360 #endif /* INTNSAPI */
361
362 #endif /* !BASE_PBLOCK_H */

mercurial