Apache HTTP Server Request Library
00001 /* 00002 ** Licensed to the Apache Software Foundation (ASF) under one or more 00003 ** contributor license agreements. See the NOTICE file distributed with 00004 ** this work for additional information regarding copyright ownership. 00005 ** The ASF licenses this file to You under the Apache License, Version 2.0 00006 ** (the "License"); you may not use this file except in compliance with 00007 ** the License. You may obtain a copy of the License at 00008 ** 00009 ** http://www.apache.org/licenses/LICENSE-2.0 00010 ** 00011 ** Unless required by applicable law or agreed to in writing, software 00012 ** distributed under the License is distributed on an "AS IS" BASIS, 00013 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 ** See the License for the specific language governing permissions and 00015 ** limitations under the License. 00016 */ 00017 00018 #ifndef APREQ_H 00019 #define APREQ_H 00020 00021 #ifdef APREQ_DEBUG 00022 #include <assert.h> 00023 #endif 00024 00025 #include "apr_tables.h" 00026 #include <stddef.h> 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00040 #ifndef WIN32 00041 00050 #define APREQ_DECLARE(d) APR_DECLARE(d) 00051 00060 #define APREQ_DECLARE_NONSTD(d) APR_DECLARE_NONSTD(d) 00061 00071 #define APREQ_DECLARE_DATA 00072 #else 00073 #define APREQ_DECLARE(type) __declspec(dllexport) type __stdcall 00074 #define APREQ_DECLARE_NONSTD(type) __declspec(dllexport) type 00075 #define APREQ_DECLARE_DATA __declspec(dllexport) 00076 #endif 00077 00082 #define APREQ_DEFAULT_READ_BLOCK_SIZE (64 * 1024) 00083 00090 #define APREQ_DEFAULT_READ_LIMIT (64 * 1024 * 1024) 00091 00097 #define APREQ_DEFAULT_BRIGADE_LIMIT (256 * 1024) 00098 00103 #define APREQ_DEFAULT_NELTS 8 00104 00105 00106 00110 #define APREQ_FLAGS_OFF(f, name) ((f) &= ~(name##_MASK << name##_BIT)) 00111 00114 #define APREQ_FLAGS_ON(f, name) ((f) |= (name##_MASK << name##_BIT)) 00115 00118 #define APREQ_FLAGS_GET(f, name) (((f) >> name##_BIT) & name##_MASK) 00119 00125 #define APREQ_FLAGS_SET(f, name, value) \ 00126 ((f) = (((f) & ~(name##_MASK << name##_BIT)) \ 00127 | ((name##_MASK & (value)) << name##_BIT))) 00128 00134 #define APREQ_CHARSET_BIT 0 00135 00141 #define APREQ_CHARSET_MASK 255 00142 00148 #define APREQ_TAINTED_BIT 8 00149 00154 #define APREQ_TAINTED_MASK 1 00155 00162 #define APREQ_COOKIE_VERSION_BIT 11 00163 00168 #define APREQ_COOKIE_VERSION_MASK 3 00169 00175 #define APREQ_COOKIE_SECURE_BIT 13 00176 00181 #define APREQ_COOKIE_SECURE_MASK 1 00182 00184 typedef enum { 00185 APREQ_CHARSET_ASCII =0, 00186 APREQ_CHARSET_LATIN1 =1, /* ISO-8859-1 */ 00187 APREQ_CHARSET_CP1252 =2, /* Windows-1252 */ 00188 APREQ_CHARSET_UTF8 =8 00189 } apreq_charset_t; 00190 00191 00193 typedef enum { 00194 APREQ_JOIN_AS_IS, 00195 APREQ_JOIN_ENCODE, 00196 APREQ_JOIN_DECODE, 00197 APREQ_JOIN_QUOTE 00198 } apreq_join_t; 00199 00201 typedef enum { 00202 APREQ_MATCH_FULL, 00203 APREQ_MATCH_PARTIAL 00204 } apreq_match_t; 00205 00207 typedef enum { 00208 APREQ_EXPIRES_HTTP, 00209 APREQ_EXPIRES_NSCOOKIE 00210 } apreq_expires_t; 00211 00212 00214 typedef struct apreq_value_t { 00215 char *name; 00216 apr_size_t nlen; 00217 apr_size_t dlen; 00218 char data[1]; 00219 } apreq_value_t; 00220 00232 static APR_INLINE 00233 void apreq_value_table_add(const apreq_value_t *v, apr_table_t *t) { 00234 apr_table_addn(t, v->name, v->data); 00235 } 00236 00244 #define apreq_attr_to_type(T,A,P) ( (T*) ((char*)(P)-offsetof(T,A)) ) 00245 00257 APREQ_DECLARE(apr_status_t) apreq_initialize(apr_pool_t *pool); 00258 00259 00271 APREQ_DECLARE(apr_status_t) apreq_pre_initialize(apr_pool_t *pool); 00272 00280 APREQ_DECLARE(apr_status_t) apreq_post_initialize(apr_pool_t *pool); 00281 00282 00283 #ifdef __cplusplus 00284 } 00285 #endif 00286 00287 #endif /* APREQ_H */