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

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

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