Annotation of embedaddon/lighttpd/src/keyvalue.h, revision 1.1.1.1

1.1       misho       1: #ifndef _KEY_VALUE_H_
                      2: #define _KEY_VALUE_H_
                      3: 
                      4: #ifdef HAVE_CONFIG_H
                      5: # include "config.h"
                      6: #endif
                      7: 
                      8: #ifdef HAVE_PCRE_H
                      9: # include <pcre.h>
                     10: #endif
                     11: 
                     12: struct server;
                     13: 
                     14: /* sources:
                     15:  * - [RFC2616], Section 9
                     16:  *   (or http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22)
                     17:  * - http://tools.ietf.org/html/draft-ietf-httpbis-method-registrations-11, Appendix A
                     18:  *
                     19:  * http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22, Section 8.1 defines
                     20:  * a new registry (not available yet):
                     21:  *   http://www.iana.org/assignments/http-methods
                     22:  */
                     23: 
                     24: typedef enum {
                     25:        HTTP_METHOD_UNSET = -1,
                     26:        HTTP_METHOD_GET,               /* [RFC2616], Section 9.3 */
                     27:        HTTP_METHOD_HEAD,              /* [RFC2616], Section 9.4 */
                     28:        HTTP_METHOD_POST,              /* [RFC2616], Section 9.5 */
                     29:        HTTP_METHOD_PUT,               /* [RFC2616], Section 9.6 */
                     30:        HTTP_METHOD_DELETE,            /* [RFC2616], Section 9.7 */
                     31:        HTTP_METHOD_CONNECT,           /* [RFC2616], Section 9.9 */
                     32:        HTTP_METHOD_OPTIONS,           /* [RFC2616], Section 9.2 */
                     33:        HTTP_METHOD_TRACE,             /* [RFC2616], Section 9.8 */
                     34:        HTTP_METHOD_ACL,               /* [RFC3744], Section 8.1 */
                     35:        HTTP_METHOD_BASELINE_CONTROL,  /* [RFC3253], Section 12.6 */
                     36:        HTTP_METHOD_BIND,              /* [RFC5842], Section 4 */
                     37:        HTTP_METHOD_CHECKIN,           /* [RFC3253], Section 4.4 and [RFC3253], Section 9.4 */
                     38:        HTTP_METHOD_CHECKOUT,          /* [RFC3253], Section 4.3 and [RFC3253], Section 8.8 */
                     39:        HTTP_METHOD_COPY,              /* [RFC4918], Section 9.8 */
                     40:        HTTP_METHOD_LABEL,             /* [RFC3253], Section 8.2 */
                     41:        HTTP_METHOD_LINK,              /* [RFC2068], Section 19.6.1.2 */
                     42:        HTTP_METHOD_LOCK,              /* [RFC4918], Section 9.10 */
                     43:        HTTP_METHOD_MERGE,             /* [RFC3253], Section 11.2 */
                     44:        HTTP_METHOD_MKACTIVITY,        /* [RFC3253], Section 13.5 */
                     45:        HTTP_METHOD_MKCALENDAR,        /* [RFC4791], Section 5.3.1 */
                     46:        HTTP_METHOD_MKCOL,             /* [RFC4918], Section 9.3 */
                     47:        HTTP_METHOD_MKREDIRECTREF,     /* [RFC4437], Section 6 */
                     48:        HTTP_METHOD_MKWORKSPACE,       /* [RFC3253], Section 6.3 */
                     49:        HTTP_METHOD_MOVE,              /* [RFC4918], Section 9.9 */
                     50:        HTTP_METHOD_ORDERPATCH,        /* [RFC3648], Section 7 */
                     51:        HTTP_METHOD_PATCH,             /* [RFC5789], Section 2 */
                     52:        HTTP_METHOD_PROPFIND,          /* [RFC4918], Section 9.1 */
                     53:        HTTP_METHOD_PROPPATCH,         /* [RFC4918], Section 9.2 */
                     54:        HTTP_METHOD_REBIND,            /* [RFC5842], Section 6 */
                     55:        HTTP_METHOD_REPORT,            /* [RFC3253], Section 3.6 */
                     56:        HTTP_METHOD_SEARCH,            /* [RFC5323], Section 2 */
                     57:        HTTP_METHOD_UNBIND,            /* [RFC5842], Section 5 */
                     58:        HTTP_METHOD_UNCHECKOUT,        /* [RFC3253], Section 4.5 */
                     59:        HTTP_METHOD_UNLINK,            /* [RFC2068], Section 19.6.1.3 */
                     60:        HTTP_METHOD_UNLOCK,            /* [RFC4918], Section 9.11 */
                     61:        HTTP_METHOD_UPDATE,            /* [RFC3253], Section 7.1 */
                     62:        HTTP_METHOD_UPDATEREDIRECTREF, /* [RFC4437], Section 7 */
                     63:        HTTP_METHOD_VERSION_CONTROL    /* [RFC3253], Section 3.5 */
                     64: } http_method_t;
                     65: 
                     66: typedef enum { HTTP_VERSION_UNSET = -1, HTTP_VERSION_1_0, HTTP_VERSION_1_1 } http_version_t;
                     67: 
                     68: typedef struct {
                     69:        int key;
                     70: 
                     71:        char *value;
                     72: } keyvalue;
                     73: 
                     74: typedef struct {
                     75:        char *key;
                     76: 
                     77:        char *value;
                     78: } s_keyvalue;
                     79: 
                     80: typedef struct {
                     81: #ifdef HAVE_PCRE_H
                     82:        pcre *key;
                     83:        pcre_extra *key_extra;
                     84: #endif
                     85: 
                     86:        buffer *value;
                     87: } pcre_keyvalue;
                     88: 
                     89: typedef enum { HTTP_AUTH_BASIC, HTTP_AUTH_DIGEST } httpauth_type;
                     90: 
                     91: typedef struct {
                     92:        char *key;
                     93: 
                     94:        char *realm;
                     95:        httpauth_type type;
                     96: } httpauth_keyvalue;
                     97: 
                     98: #define KVB(x) \
                     99: typedef struct {\
                    100:        x **kv; \
                    101:        size_t used;\
                    102:        size_t size;\
                    103: } x ## _buffer
                    104: 
                    105: KVB(keyvalue);
                    106: KVB(s_keyvalue);
                    107: KVB(httpauth_keyvalue);
                    108: KVB(pcre_keyvalue);
                    109: 
                    110: const char *get_http_status_name(int i);
                    111: const char *get_http_version_name(int i);
                    112: const char *get_http_method_name(http_method_t i);
                    113: const char *get_http_status_body_name(int i);
                    114: int get_http_version_key(const char *s);
                    115: http_method_t get_http_method_key(const char *s);
                    116: 
                    117: const char *keyvalue_get_value(keyvalue *kv, int k);
                    118: int keyvalue_get_key(keyvalue *kv, const char *s);
                    119: 
                    120: keyvalue_buffer *keyvalue_buffer_init(void);
                    121: int keyvalue_buffer_append(keyvalue_buffer *kvb, int k, const char *value);
                    122: void keyvalue_buffer_free(keyvalue_buffer *kvb);
                    123: 
                    124: s_keyvalue_buffer *s_keyvalue_buffer_init(void);
                    125: int s_keyvalue_buffer_append(s_keyvalue_buffer *kvb, const char *key, const char *value);
                    126: void s_keyvalue_buffer_free(s_keyvalue_buffer *kvb);
                    127: 
                    128: httpauth_keyvalue_buffer *httpauth_keyvalue_buffer_init(void);
                    129: int httpauth_keyvalue_buffer_append(httpauth_keyvalue_buffer *kvb, const char *key, const char *realm, httpauth_type type);
                    130: void httpauth_keyvalue_buffer_free(httpauth_keyvalue_buffer *kvb);
                    131: 
                    132: pcre_keyvalue_buffer *pcre_keyvalue_buffer_init(void);
                    133: int pcre_keyvalue_buffer_append(struct server *srv, pcre_keyvalue_buffer *kvb, const char *key, const char *value);
                    134: void pcre_keyvalue_buffer_free(pcre_keyvalue_buffer *kvb);
                    135: 
                    136: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>