libapreq2-2.05-dev: libapreq2: include/apreq.h Source File

Apache HTTP Server Request Library

Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# apreq.h

Go to the documentation of this file.

    00001 /*
    00002 **  Copyright 2003-2005  The Apache Software Foundation
    00003 **
    00004 **  Licensed under the Apache License, Version 2.0 (the "License");
    00005 **  you may not use this file except in compliance with the License.
    00006 **  You may obtain a copy of the License at
    00007 **
    00008 **      http://www.apache.org/licenses/LICENSE-2.0
    00009 **
    00010 **  Unless required by applicable law or agreed to in writing, software
    00011 **  distributed under the License is distributed on an "AS IS" BASIS,
    00012 **  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013 **  See the License for the specific language governing permissions and
    00014 **  limitations under the License.
    00015 */
    00016
    00017 #ifndef APREQ_H
    00018 #define APREQ_H
    00019
    00020 #ifdef APREQ_DEBUG
    00021 #include <assert.h>
    00022 #endif
    00023
    00024 #include "apr_tables.h"
    00025 #include <stddef.h>
    00026
    00027 #ifdef  __cplusplus
    00028  extern "C" {
    00029 #endif
    00030
    00039 #ifndef WIN32
    00040 #define APREQ_DECLARE(d)                APR_DECLARE(d)
    00041 #define APREQ_DECLARE_NONSTD(d)         APR_DECLARE_NONSTD(d)
    00042 #define APREQ_DECLARE_DATA
    00043 #else
    00044 #define APREQ_DECLARE(type)             __declspec(dllexport) type __stdcall
    00045 #define APREQ_DECLARE_NONSTD(type)      __declspec(dllexport) type
    00046 #define APREQ_DECLARE_DATA              __declspec(dllexport)
    00047 #endif
    00048
    00049 #define APREQ_DEFAULT_READ_BLOCK_SIZE   (64  * 1024)
    00050 #define APREQ_DEFAULT_READ_LIMIT        (64 * 1024 * 1024)
    00051 #define APREQ_DEFAULT_BRIGADE_LIMIT     (256 * 1024)
    00052 #define APREQ_DEFAULT_NELTS              8
    00053
    00054
    00055
    00056 #define APREQ_FLAGS_OFF(f, name) ((f) &= ~(name##_MASK << name##_BIT))
    00057 #define APREQ_FLAGS_ON(f, name)  ((f) |=  (name##_MASK << name##_BIT))
    00058 #define APREQ_FLAGS_GET(f, name) (((f) >> name##_BIT) & name##_MASK)
    00059 #define APREQ_FLAGS_SET(f, name, value)                 \
    00060     ((f) = (((f) & ~(name##_MASK << name##_BIT))        \
    00061             | ((name##_MASK & (value)) << name##_BIT)))
    00062
    00063
    00064 #define APREQ_CHARSET_BIT           0
    00065 #define APREQ_CHARSET_MASK        255
    00066
    00067 #define APREQ_TAINTED_BIT           8
    00068 #define APREQ_TAINTED_MASK          1
    00069
    00070 #define APREQ_COOKIE_VERSION_BIT   11
    00071 #define APREQ_COOKIE_VERSION_MASK   3
    00072
    00073 #define APREQ_COOKIE_SECURE_BIT    13
    00074 #define APREQ_COOKIE_SECURE_MASK    1
    00075
    00077 typedef enum {
    00078     APREQ_CHARSET_ASCII  =0,
    00079     APREQ_CHARSET_LATIN1 =1, /* ISO-8859-1   */
    00080     APREQ_CHARSET_CP1252 =2, /* Windows-1252 */
    00081     APREQ_CHARSET_UTF8   =8
    00082 } apreq_charset_t;
    00083
    00084
    00086 typedef enum {
    00087     APREQ_JOIN_AS_IS,
    00088     APREQ_JOIN_ENCODE,
    00089     APREQ_JOIN_DECODE,
    00090     APREQ_JOIN_QUOTE
    00091 } apreq_join_t;
    00092
    00094 typedef enum {
    00095     APREQ_MATCH_FULL,
    00096     APREQ_MATCH_PARTIAL
    00097 } apreq_match_t;
    00098
    00100 typedef enum {
    00101     APREQ_EXPIRES_HTTP,
    00102     APREQ_EXPIRES_NSCOOKIE
    00103 } apreq_expires_t;
    00104
    00105
    00107 typedef struct apreq_value_t {
    00108     char             *name;
    00109     apr_size_t        nlen;
    00110     apr_size_t        dlen;
    00111     char              data[1];
    00112 } apreq_value_t;
    00113
    00114 static APR_INLINE
    00115 void apreq_value_table_add(const apreq_value_t *v, apr_table_t *t) {
    00116     apr_table_addn(t, v->name, v->data);
    00117 }
    00118
    00119 #define apreq_attr_to_type(T,A,P) ( (T*) ((char*)(P)-offsetof(T,A)) )
    00120
    00132 APREQ_DECLARE(apr_status_t) apreq_initialize(apr_pool_t *pool);
    00133
    00134
    00146 APREQ_DECLARE(apr_status_t) apreq_pre_initialize(apr_pool_t *pool);
    00147
    00155 APREQ_DECLARE(apr_status_t) apreq_post_initialize(apr_pool_t *pool);
    00156
    00157
    00158 #ifdef __cplusplus
    00159  }
    00160 #endif
    00161
    00162 #endif /* APREQ_H */