UNIXworkcode

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 "../public/nsapi.h" 57 #include "../daemon/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 #ifdef __cplusplus 75 extern "C" { 76 #endif 77 78 NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value); 79 80 NSAPI_PUBLIC int INTparam_free(pb_param *pp); 81 82 NSAPI_PUBLIC pblock *INTpblock_create(int n); 83 84 NSAPI_PUBLIC void INTpblock_free(pblock *pb); 85 86 NSAPI_PUBLIC char *INTpblock_findval(const char *name, const pblock *pb); 87 88 NSAPI_PUBLIC pb_param *INTpblock_nvinsert(const char *name, const char *value, pblock *pb); 89 90 NSAPI_PUBLIC pb_param *pblock_nvlinsert(const char *name, int namelen, const char *value, int valuelen, pblock *pb); 91 92 NSAPI_PUBLIC pb_param *INTpblock_nninsert(const char *name, int value, pblock *pb); 93 94 NSAPI_PUBLIC void INTpblock_pinsert(pb_param *pp, pblock *pb); 95 96 NSAPI_PUBLIC int INTpblock_str2pblock(const char *str, pblock *pb); 97 98 NSAPI_PUBLIC char *INTpblock_pblock2str(const pblock *pb, char *str); 99 100 NSAPI_PUBLIC int INTpblock_copy(const pblock *src, pblock *dst); 101 102 NSAPI_PUBLIC pblock *INTpblock_dup(const pblock *src); 103 104 NSAPI_PUBLIC char **INTpblock_pb2env(const pblock *pb, char **env); 105 106 NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb); 107 108 /* --------------------------- Internal things ---------------------------- */ 109 110 typedef struct pb_key pb_key; 111 112 extern const pb_key *pb_key_accept; 113 extern const pb_key *pb_key_accept_charset; 114 extern const pb_key *pb_key_accept_encoding; 115 extern const pb_key *pb_key_accept_language; 116 extern const pb_key *pb_key_accept_ranges; 117 extern const pb_key *pb_key_actual_route; 118 extern const pb_key *pb_key_age; 119 extern const pb_key *pb_key_always_allow_chunked; 120 extern const pb_key *pb_key_always_use_keep_alive; 121 extern const pb_key *pb_key_auth_cert; 122 extern const pb_key *pb_key_auth_expiring; 123 extern const pb_key *pb_key_auth_group; 124 extern const pb_key *pb_key_auth_type; 125 extern const pb_key *pb_key_auth_user; 126 extern const pb_key *pb_key_authorization; 127 extern const pb_key *pb_key_browser; 128 extern const pb_key *pb_key_c2p_cl; 129 extern const pb_key *pb_key_c2p_hl; 130 extern const pb_key *pb_key_cache_info; 131 extern const pb_key *pb_key_charset; 132 extern const pb_key *pb_key_check_http_server; 133 extern const pb_key *pb_key_ChunkedRequestBufferSize; 134 extern const pb_key *pb_key_ChunkedRequestTimeout; 135 extern const pb_key *pb_key_cipher; 136 extern const pb_key *pb_key_clf_request; 137 extern const pb_key *pb_key_cli_status; 138 extern const pb_key *pb_key_client_cert_nickname; 139 extern const pb_key *pb_key_client_ip; 140 extern const pb_key *pb_key_close; 141 extern const pb_key *pb_key_connect_timeout; 142 extern const pb_key *pb_key_connection; 143 extern const pb_key *pb_key_cont; 144 extern const pb_key *pb_key_content_encoding; 145 extern const pb_key *pb_key_content_language; 146 extern const pb_key *pb_key_content_length; 147 extern const pb_key *pb_key_content_location; 148 extern const pb_key *pb_key_content_md5; 149 extern const pb_key *pb_key_content_range; 150 extern const pb_key *pb_key_content_type; 151 extern const pb_key *pb_key_cookie; 152 extern const pb_key *pb_key_date; 153 extern const pb_key *pb_key_DATE_GMT; 154 extern const pb_key *pb_key_DATE_LOCAL; 155 extern const pb_key *pb_key_dir; 156 extern const pb_key *pb_key_Directive; 157 extern const pb_key *pb_key_dns; 158 extern const pb_key *pb_key_DOCUMENT_NAME; 159 extern const pb_key *pb_key_DOCUMENT_URI; 160 extern const pb_key *pb_key_domain; 161 extern const pb_key *pb_key_enc; 162 extern const pb_key *pb_key_engine; 163 extern const pb_key *pb_key_error_action; 164 extern const pb_key *pb_key_error_desc; 165 extern const pb_key *pb_key_error_fn; 166 extern const pb_key *pb_key_escape; 167 extern const pb_key *pb_key_escaped; 168 extern const pb_key *pb_key_etag; 169 extern const pb_key *pb_key_expect; 170 extern const pb_key *pb_key_expires; 171 extern const pb_key *pb_key_expr; 172 extern const pb_key *pb_key_filter; 173 extern const pb_key *pb_key_find_pathinfo_forward; 174 extern const pb_key *pb_key_flushTimer; 175 extern const pb_key *pb_key_fn; 176 extern const pb_key *pb_key_from; 177 extern const pb_key *pb_key_full_headers; 178 extern const pb_key *pb_key_hdr; 179 extern const pb_key *pb_key_host; 180 extern const pb_key *pb_key_hostname; 181 extern const pb_key *pb_key_if_match; 182 extern const pb_key *pb_key_if_modified_since; 183 extern const pb_key *pb_key_if_none_match; 184 extern const pb_key *pb_key_if_range; 185 extern const pb_key *pb_key_if_unmodified_since; 186 extern const pb_key *pb_key_ip; 187 extern const pb_key *pb_key_iponly; 188 extern const pb_key *pb_key_issuer_dn; 189 extern const pb_key *pb_key_jroute; 190 extern const pb_key *pb_key_keep_alive; 191 extern const pb_key *pb_key_keep_alive_timeout; 192 extern const pb_key *pb_key_keysize; 193 extern const pb_key *pb_key_lang; 194 extern const pb_key *pb_key_last_modified; 195 extern const pb_key *pb_key_level; 196 extern const pb_key *pb_key_location; 197 extern const pb_key *pb_key_lock_owner; 198 extern const pb_key *pb_key_magnus_charset; 199 extern const pb_key *pb_key_magnus_internal; 200 extern const pb_key *pb_key_magnus_internal_dav_src; 201 extern const pb_key *pb_key_magnus_internal_default_acls_only; 202 extern const pb_key *pb_key_magnus_internal_error_j2ee; 203 extern const pb_key *pb_key_magnus_internal_j2ee_nsapi; 204 extern const pb_key *pb_key_magnus_internal_preserve_srvhdrs; 205 extern const pb_key *pb_key_magnus_internal_set_request_status; 206 extern const pb_key *pb_key_magnus_internal_set_response_status; 207 extern const pb_key *pb_key_magnus_internal_webapp_errordesc; 208 extern const pb_key *pb_key_matched_browser; 209 extern const pb_key *pb_key_max_age; 210 extern const pb_key *pb_key_max_forwards; 211 extern const pb_key *pb_key_message; 212 extern const pb_key *pb_key_method; 213 extern const pb_key *pb_key_name; 214 extern const pb_key *pb_key_nocache; 215 extern const pb_key *pb_key_nostat; 216 extern const pb_key *pb_key_ntrans_base; 217 extern const pb_key *pb_key_offline_origin_addr; 218 extern const pb_key *pb_key_offline_proxy_addr; 219 extern const pb_key *pb_key_origin_addr; 220 extern const pb_key *pb_key_p2c_cl; 221 extern const pb_key *pb_key_p2c_hl; 222 extern const pb_key *pb_key_p2r_cl; 223 extern const pb_key *pb_key_p2r_hl; 224 extern const pb_key *pb_key_parse_timeout; 225 extern const pb_key *pb_key_password; 226 extern const pb_key *pb_key_path; 227 extern const pb_key *pb_key_PATH_INFO; 228 extern const pb_key *pb_key_path_info; 229 extern const pb_key *pb_key_pblock; 230 extern const pb_key *pb_key_poll_interval; 231 extern const pb_key *pb_key_pool; // new 232 extern const pb_key *pb_key_port; 233 extern const pb_key *pb_key_ppath; 234 extern const pb_key *pb_key_pragma; 235 extern const pb_key *pb_key_process_request_body; 236 extern const pb_key *pb_key_process_response_body; 237 extern const pb_key *pb_key_protocol; 238 extern const pb_key *pb_key_proxy_addr; 239 extern const pb_key *pb_key_proxy_agent; 240 extern const pb_key *pb_key_proxy_auth_cert; 241 extern const pb_key *pb_key_proxy_authorization; 242 extern const pb_key *pb_key_proxy_cipher; 243 extern const pb_key *pb_key_proxy_issuer_dn; 244 extern const pb_key *pb_key_proxy_jroute; 245 extern const pb_key *pb_key_proxy_keysize; 246 extern const pb_key *pb_key_proxy_ping; 247 extern const pb_key *pb_key_proxy_request; 248 extern const pb_key *pb_key_proxy_secret_keysize; 249 extern const pb_key *pb_key_proxy_ssl_id; 250 extern const pb_key *pb_key_proxy_user_dn; 251 extern const pb_key *pb_key_query; 252 extern const pb_key *pb_key_QUERY_STRING; 253 extern const pb_key *pb_key_QUERY_STRING_UNESCAPED; 254 extern const pb_key *pb_key_r2p_cl; 255 extern const pb_key *pb_key_r2p_hl; 256 extern const pb_key *pb_key_range; 257 extern const pb_key *pb_key_referer; 258 extern const pb_key *pb_key_reformat_request_headers; 259 extern const pb_key *pb_key_remote_status; 260 extern const pb_key *pb_key_request_jroute; 261 extern const pb_key *pb_key_required_rights; 262 extern const pb_key *pb_key_retries; 263 extern const pb_key *pb_key_rewrite_content_location; 264 extern const pb_key *pb_key_rewrite_host; 265 extern const pb_key *pb_key_rewrite_location; 266 extern const pb_key *pb_key_rewrite_set_cookie; 267 extern const pb_key *pb_key_root; 268 extern const pb_key *pb_key_route; 269 extern const pb_key *pb_key_route_cookie; 270 extern const pb_key *pb_key_route_hdr; 271 extern const pb_key *pb_key_route_offline; 272 extern const pb_key *pb_key_script_name; 273 extern const pb_key *pb_key_secret_keysize; 274 extern const pb_key *pb_key_secure; 275 extern const pb_key *pb_key_server; 276 extern const pb_key *pb_key_set_cookie; 277 extern const pb_key *pb_key_socks_addr; 278 extern const pb_key *pb_key_ssl_id; 279 extern const pb_key *pb_key_ssl_unclean_shutdown; 280 extern const pb_key *pb_key_status; 281 extern const pb_key *pb_key_sticky_cookie; 282 extern const pb_key *pb_key_sticky_param; 283 extern const pb_key *pb_key_suppress_request_headers; 284 extern const pb_key *pb_key_svr_status; 285 extern const pb_key *pb_key_timeout; 286 extern const pb_key *pb_key_to; 287 extern const pb_key *pb_key_transfer_encoding; 288 extern const pb_key *pb_key_transmit_timeout; 289 extern const pb_key *pb_key_tunnel_non_http_response; 290 extern const pb_key *pb_key_type; 291 extern const pb_key *pb_key_upstream_jroute; 292 extern const pb_key *pb_key_uri; 293 extern const pb_key *pb_key_url; 294 extern const pb_key *pb_key_url_prefix; 295 extern const pb_key *pb_key_UseOutputStreamSize; 296 extern const pb_key *pb_key_user; 297 extern const pb_key *pb_key_user_agent; 298 extern const pb_key *pb_key_user_dn; 299 extern const pb_key *pb_key_validate_server_cert; 300 extern const pb_key *pb_key_value; 301 extern const pb_key *pb_key_vary; 302 extern const pb_key *pb_key_via; 303 extern const pb_key *pb_key_warning; 304 extern const pb_key *pb_key_depth; 305 extern const pb_key *pb_key_if; 306 extern const pb_key *pb_key_vfs; 307 extern const pb_key *pb_key_dav; 308 extern const pb_key *pb_key_vfsclass; 309 extern const pb_key *pb_key_davclass; 310 311 NSAPI_PUBLIC void pblock_init_default_keys(void); 312 313 NSAPI_PUBLIC void pblock_free_default_keys(void); 314 315 NSAPI_PUBLIC pool_handle_t *pblock_pool(pblock *pb); 316 317 NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value); 318 319 NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n); 320 321 NSAPI_PUBLIC pb_param *INTpblock_fr(const char *name, pblock *pb, int remove); 322 323 NSAPI_PUBLIC char *INTpblock_replace(const char *name,char * new_value,pblock *pb); 324 325 NSAPI_PUBLIC int INTpblock_str2pblock_lowercasename(const char *str, pblock *pb); 326 327 NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb); 328 329 NSAPI_PUBLIC const pb_key *pblock_key(const char *name); 330 331 NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen); 332 333 NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb); 334 335 NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb); 336 337 NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb); 338 339 NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb); 340 341 NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb); 342 343 NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb); 344 345 NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb); 346 347 NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, int64_t value, pblock *pb); 348 349 #define PARAM_KEY(pp) *(const pb_key **)((pp) + 1) /* new */ 350 351 #ifdef __cplusplus 352 } 353 #endif 354 355 #define param_create INTparam_create 356 #define param_free INTparam_free 357 #define pblock_create INTpblock_create 358 #define pblock_free INTpblock_free 359 #define pblock_findval INTpblock_findval 360 #define pblock_nvinsert INTpblock_nvinsert 361 #define pblock_nninsert INTpblock_nninsert 362 #define pblock_pinsert INTpblock_pinsert 363 #define pblock_str2pblock INTpblock_str2pblock 364 #define pblock_pblock2str INTpblock_pblock2str 365 #define pblock_copy INTpblock_copy 366 #define pblock_dup INTpblock_dup 367 #define pblock_pb2env INTpblock_pb2env 368 #define pblock_fr INTpblock_fr 369 #define pblock_replace INTpblock_replace 370 371 #endif /* INTNSAPI */ 372 373 #endif /* !BASE_PBLOCK_H */ 374