src/server/util/pblock.h

Sat, 25 Jan 2020 15:34:30 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Jan 2020 15:34:30 +0100
branch
webdav
changeset 240
cd74667f6c85
parent 211
2160585200ac
child 277
7608af69739f
permissions
-rw-r--r--

add proppatch interface

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
 *
 * THE BSD LICENSE
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer. 
 * Redistributions in binary form must reproduce the above copyright notice, 
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution. 
 *
 * Neither the name of the  nor the names of its contributors may be
 * used to endorse or promote products derived from this software without 
 * specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef BASE_PBLOCK_H
#define BASE_PBLOCK_H

#ifndef NOINTNSAPI
#define INTNSAPI
#endif /* !NOINTNSAPI */

/*
 * pblock.h: Header for Parameter Block handling functions
 * 
 *
 * A parameter block is a set of name=value pairs which are generally used 
 * as parameters, but can be anything. They are kept in a hash table for 
 * reasonable speed, but if you are doing any intensive modification or
 * access of them you should probably make a local copy of each parameter
 * while working.
 *
 * Rob McCool
 * 
 */

#ifndef NETSITE_H
#include "../public/nsapi.h"
#include "../daemon/netsite.h"
#endif /* !NETSITE_H */

#ifdef XP_WIN32
#ifdef BUILD_DLL
#define BASE_DLL _declspec(dllexport)
#else
#define BASE_DLL _declspec(dllimport)
#endif
#else
#define BASE_DLL
#endif

#ifdef INTNSAPI

/* --- Begin function prototypes --- */

#ifdef	__cplusplus
extern "C" {
#endif

NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value);

NSAPI_PUBLIC int INTparam_free(pb_param *pp);

NSAPI_PUBLIC pblock *INTpblock_create(int n);

NSAPI_PUBLIC void INTpblock_free(pblock *pb);

NSAPI_PUBLIC char *INTpblock_findval(const char *name, const pblock *pb);

NSAPI_PUBLIC pb_param *INTpblock_nvinsert(const char *name, const char *value, pblock *pb);

NSAPI_PUBLIC pb_param *pblock_nvlinsert(const char *name, int namelen, const char *value, int valuelen, pblock *pb);

NSAPI_PUBLIC pb_param *INTpblock_nninsert(const char *name, int value, pblock *pb);

NSAPI_PUBLIC void INTpblock_pinsert(pb_param *pp, pblock *pb);

NSAPI_PUBLIC int INTpblock_str2pblock(const char *str, pblock *pb);

NSAPI_PUBLIC char *INTpblock_pblock2str(const pblock *pb, char *str);

NSAPI_PUBLIC int INTpblock_copy(const pblock *src, pblock *dst);

NSAPI_PUBLIC pblock *INTpblock_dup(const pblock *src);

NSAPI_PUBLIC char **INTpblock_pb2env(const pblock *pb, char **env);

NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb);

/* --------------------------- Internal things ---------------------------- */

typedef struct pb_key pb_key;

extern const pb_key *const pb_key_accept;
extern const pb_key *const pb_key_accept_charset;
extern const pb_key *const pb_key_accept_encoding;
extern const pb_key *const pb_key_accept_language;
extern const pb_key *const pb_key_accept_ranges;
extern const pb_key *const pb_key_actual_route;
extern const pb_key *const pb_key_age;
extern const pb_key *const pb_key_always_allow_chunked;
extern const pb_key *const pb_key_always_use_keep_alive;
extern const pb_key *const pb_key_auth_cert;
extern const pb_key *const pb_key_auth_expiring;
extern const pb_key *const pb_key_auth_group;
extern const pb_key *const pb_key_auth_type;
extern const pb_key *const pb_key_auth_user;
extern const pb_key *const pb_key_authorization;
extern const pb_key *const pb_key_browser;
extern const pb_key *const pb_key_c2p_cl;
extern const pb_key *const pb_key_c2p_hl;
extern const pb_key *const pb_key_cache_info;
extern const pb_key *const pb_key_charset;
extern const pb_key *const pb_key_check_http_server;
extern const pb_key *const pb_key_ChunkedRequestBufferSize;
extern const pb_key *const pb_key_ChunkedRequestTimeout;
extern const pb_key *const pb_key_cipher;
extern const pb_key *const pb_key_clf_request;
extern const pb_key *const pb_key_cli_status;
extern const pb_key *const pb_key_client_cert_nickname;
extern const pb_key *const pb_key_client_ip;
extern const pb_key *const pb_key_close;
extern const pb_key *const pb_key_connect_timeout;
extern const pb_key *const pb_key_connection;
extern const pb_key *const pb_key_cont;
extern const pb_key *const pb_key_content_encoding;
extern const pb_key *const pb_key_content_language;
extern const pb_key *const pb_key_content_length;
extern const pb_key *const pb_key_content_location;
extern const pb_key *const pb_key_content_md5;
extern const pb_key *const pb_key_content_range;
extern const pb_key *const pb_key_content_type;
extern const pb_key *const pb_key_cookie;
extern const pb_key *const pb_key_date;
extern const pb_key *const pb_key_DATE_GMT;
extern const pb_key *const pb_key_DATE_LOCAL;
extern const pb_key *const pb_key_dir;
extern const pb_key *const pb_key_Directive;
extern const pb_key *const pb_key_dns;
extern const pb_key *const pb_key_DOCUMENT_NAME;
extern const pb_key *const pb_key_DOCUMENT_URI;
extern const pb_key *const pb_key_domain;
extern const pb_key *const pb_key_enc;
extern const pb_key *const pb_key_engine;
extern const pb_key *const pb_key_error_action;
extern const pb_key *const pb_key_error_desc;
extern const pb_key *const pb_key_error_fn;
extern const pb_key *const pb_key_escape;
extern const pb_key *const pb_key_escaped;
extern const pb_key *const pb_key_etag;
extern const pb_key *const pb_key_expect;
extern const pb_key *const pb_key_expires;
extern const pb_key *const pb_key_expr;
extern const pb_key *const pb_key_filter;
extern const pb_key *const pb_key_find_pathinfo_forward;
extern const pb_key *const pb_key_flushTimer;
extern const pb_key *const pb_key_fn;
extern const pb_key *const pb_key_from;
extern const pb_key *const pb_key_full_headers;
extern const pb_key *const pb_key_hdr;
extern const pb_key *const pb_key_host;
extern const pb_key *const pb_key_hostname;
extern const pb_key *const pb_key_if_match;
extern const pb_key *const pb_key_if_modified_since;
extern const pb_key *const pb_key_if_none_match;
extern const pb_key *const pb_key_if_range;
extern const pb_key *const pb_key_if_unmodified_since;
extern const pb_key *const pb_key_ip;
extern const pb_key *const pb_key_iponly;
extern const pb_key *const pb_key_issuer_dn;
extern const pb_key *const pb_key_jroute;
extern const pb_key *const pb_key_keep_alive;
extern const pb_key *const pb_key_keep_alive_timeout;
extern const pb_key *const pb_key_keysize;
extern const pb_key *const pb_key_lang;
extern const pb_key *const pb_key_last_modified;
extern const pb_key *const pb_key_level;
extern const pb_key *const pb_key_location;
extern const pb_key *const pb_key_lock_owner;
extern const pb_key *const pb_key_magnus_charset;
extern const pb_key *const pb_key_magnus_internal;
extern const pb_key *const pb_key_magnus_internal_dav_src;
extern const pb_key *const pb_key_magnus_internal_default_acls_only;
extern const pb_key *const pb_key_magnus_internal_error_j2ee;
extern const pb_key *const pb_key_magnus_internal_j2ee_nsapi;
extern const pb_key *const pb_key_magnus_internal_preserve_srvhdrs;
extern const pb_key *const pb_key_magnus_internal_set_request_status;
extern const pb_key *const pb_key_magnus_internal_set_response_status;
extern const pb_key *const pb_key_magnus_internal_webapp_errordesc;
extern const pb_key *const pb_key_matched_browser;
extern const pb_key *const pb_key_max_age;
extern const pb_key *const pb_key_max_forwards;
extern const pb_key *const pb_key_message;
extern const pb_key *const pb_key_method;
extern const pb_key *const pb_key_name;
extern const pb_key *const pb_key_nocache;
extern const pb_key *const pb_key_nostat;
extern const pb_key *const pb_key_ntrans_base;
extern const pb_key *const pb_key_offline_origin_addr;
extern const pb_key *const pb_key_offline_proxy_addr;
extern const pb_key *const pb_key_origin_addr;
extern const pb_key *const pb_key_p2c_cl;
extern const pb_key *const pb_key_p2c_hl;
extern const pb_key *const pb_key_p2r_cl;
extern const pb_key *const pb_key_p2r_hl;
extern const pb_key *const pb_key_parse_timeout;
extern const pb_key *const pb_key_password;
extern const pb_key *const pb_key_path;
extern const pb_key *const pb_key_PATH_INFO;
extern const pb_key *const pb_key_path_info;
extern const pb_key *const pb_key_pblock;
extern const pb_key *const pb_key_poll_interval;
extern const pb_key *const pb_key_pool; // new
extern const pb_key *const pb_key_port;
extern const pb_key *const pb_key_ppath;
extern const pb_key *const pb_key_pragma;
extern const pb_key *const pb_key_process_request_body;
extern const pb_key *const pb_key_process_response_body;
extern const pb_key *const pb_key_protocol;
extern const pb_key *const pb_key_proxy_addr;
extern const pb_key *const pb_key_proxy_agent;
extern const pb_key *const pb_key_proxy_auth_cert;
extern const pb_key *const pb_key_proxy_authorization;
extern const pb_key *const pb_key_proxy_cipher;
extern const pb_key *const pb_key_proxy_issuer_dn;
extern const pb_key *const pb_key_proxy_jroute;
extern const pb_key *const pb_key_proxy_keysize;
extern const pb_key *const pb_key_proxy_ping;
extern const pb_key *const pb_key_proxy_request;
extern const pb_key *const pb_key_proxy_secret_keysize;
extern const pb_key *const pb_key_proxy_ssl_id;
extern const pb_key *const pb_key_proxy_user_dn;
extern const pb_key *const pb_key_query;
extern const pb_key *const pb_key_QUERY_STRING;
extern const pb_key *const pb_key_QUERY_STRING_UNESCAPED;
extern const pb_key *const pb_key_r2p_cl;
extern const pb_key *const pb_key_r2p_hl;
extern const pb_key *const pb_key_range;
extern const pb_key *const pb_key_referer;
extern const pb_key *const pb_key_reformat_request_headers;
extern const pb_key *const pb_key_remote_status;
extern const pb_key *const pb_key_request_jroute;
extern const pb_key *const pb_key_required_rights;
extern const pb_key *const pb_key_retries;
extern const pb_key *const pb_key_rewrite_content_location;
extern const pb_key *const pb_key_rewrite_host;
extern const pb_key *const pb_key_rewrite_location;
extern const pb_key *const pb_key_rewrite_set_cookie;
extern const pb_key *const pb_key_root;
extern const pb_key *const pb_key_route;
extern const pb_key *const pb_key_route_cookie;
extern const pb_key *const pb_key_route_hdr;
extern const pb_key *const pb_key_route_offline;
extern const pb_key *const pb_key_script_name;
extern const pb_key *const pb_key_secret_keysize;
extern const pb_key *const pb_key_secure;
extern const pb_key *const pb_key_server;
extern const pb_key *const pb_key_set_cookie;
extern const pb_key *const pb_key_socks_addr;
extern const pb_key *const pb_key_ssl_id;
extern const pb_key *const pb_key_ssl_unclean_shutdown;
extern const pb_key *const pb_key_status;
extern const pb_key *const pb_key_sticky_cookie;
extern const pb_key *const pb_key_sticky_param;
extern const pb_key *const pb_key_suppress_request_headers;
extern const pb_key *const pb_key_svr_status;
extern const pb_key *const pb_key_timeout;
extern const pb_key *const pb_key_to;
extern const pb_key *const pb_key_transfer_encoding;
extern const pb_key *const pb_key_transmit_timeout;
extern const pb_key *const pb_key_tunnel_non_http_response;
extern const pb_key *const pb_key_type;
extern const pb_key *const pb_key_upstream_jroute;
extern const pb_key *const pb_key_uri;
extern const pb_key *const pb_key_url;
extern const pb_key *const pb_key_url_prefix;
extern const pb_key *const pb_key_UseOutputStreamSize;
extern const pb_key *const pb_key_user;
extern const pb_key *const pb_key_user_agent;
extern const pb_key *const pb_key_user_dn;
extern const pb_key *const pb_key_validate_server_cert;
extern const pb_key *const pb_key_value;
extern const pb_key *const pb_key_vary;
extern const pb_key *const pb_key_via;
extern const pb_key *const pb_key_warning;
extern const pb_key *const pb_key_depth;
extern const pb_key *const pb_key_if;

NSAPI_PUBLIC pool_handle_t *pblock_pool(pblock *pb);

NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value);

NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n);

NSAPI_PUBLIC pb_param *INTpblock_fr(const char *name, pblock *pb, int remove);

NSAPI_PUBLIC char *INTpblock_replace(const char *name,char * new_value,pblock *pb);

NSAPI_PUBLIC int INTpblock_str2pblock_lowercasename(const char *str, pblock *pb);

NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb);

NSAPI_PUBLIC const pb_key *pblock_key(const char *name);

NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen);

NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb);

NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb);

NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb);

NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb);

NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb);

NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb);

NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb);

NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, int64_t value, pblock *pb);

#ifdef __cplusplus
inline const pb_key *param_key(pb_param *pp)
{
    return *(const pb_key **)(pp + 1); /* XXX see plist_pvt.h */
}
#endif

#define PARAM_KEY(pp) *(const pb_key **)(pp + 1) /* new */

#ifdef	__cplusplus
}
#endif

#define param_create INTparam_create
#define param_free INTparam_free
#define pblock_create INTpblock_create
#define pblock_free INTpblock_free
#define pblock_findval INTpblock_findval
#define pblock_nvinsert INTpblock_nvinsert
#define pblock_nninsert INTpblock_nninsert
#define pblock_pinsert INTpblock_pinsert
#define pblock_str2pblock INTpblock_str2pblock
#define pblock_pblock2str INTpblock_pblock2str
#define pblock_copy INTpblock_copy
#define pblock_dup INTpblock_dup
#define pblock_pb2env INTpblock_pb2env
#define pblock_fr INTpblock_fr
#define pblock_replace INTpblock_replace

#endif /* INTNSAPI */

#endif /* !BASE_PBLOCK_H */

mercurial