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

apreq.h

Go to the documentation of this file.
00001 /*
00002 **  Copyright 2003-2004  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 #include "apr_tables.h" 
00021 #include "apr_file_io.h"
00022 #include "apr_buckets.h"
00023 #include <stddef.h>
00024 
00025 #ifdef  __cplusplus
00026  extern "C" {
00027 #endif 
00028 
00095 #ifndef WIN32
00096 #define APREQ_DECLARE(d)                APR_DECLARE(d)
00097 #define APREQ_DECLARE_NONSTD(d)         APR_DECLARE_NONSTD(d)
00098 #else
00099 #define APREQ_DECLARE(type)             __declspec(dllexport) type __stdcall
00100 #define APREQ_DECLARE_NONSTD(type)      __declspec(dllexport) type
00101 #define APREQ_DECLARE_DATA              __declspec(dllexport)
00102 #endif
00103 
00104 #define APREQ_URL_ENCTYPE               "application/x-www-form-urlencoded"
00105 #define APREQ_MFD_ENCTYPE               "multipart/form-data"
00106 #define APREQ_XML_ENCTYPE               "application/xml"
00107 
00108 #define APREQ_NELTS                     8
00109 #define APREQ_READ_AHEAD                (64 * 1024)
00110 #define APREQ_MAX_BRIGADE_LEN           (256 * 1024)
00111 
00115 typedef struct apreq_value_t {
00116     const char    *name;    
00117     apr_status_t   status;  
00118     apr_size_t     size;    
00119     char           data[1]; 
00120 } apreq_value_t;
00121 
00122 typedef apreq_value_t *(apreq_value_merge_t)(apr_pool_t *p,
00123                                              const apr_array_header_t *a);
00124 typedef apreq_value_t *(apreq_value_copy_t)(apr_pool_t *p,
00125                                             const apreq_value_t *v);
00126 
00127 
00128 #define apreq_attr_to_type(T,A,P) ( (T*) ((char*)(P)-offsetof(T,A)) )
00129 
00137 #define apreq_char_to_value(ptr)  apreq_attr_to_type(apreq_value_t, data, ptr)
00138 #define apreq_strtoval(ptr)  apreq_char_to_value(ptr)
00139 
00148 #define apreq_strlen(ptr) (apreq_strtoval(ptr)->size)
00149 
00163 APREQ_DECLARE(apreq_value_t *) apreq_make_value(apr_pool_t *p, 
00164                                                 const char *name,
00165                                                 const apr_size_t nlen,
00166                                                 const char *val, 
00167                                                 const apr_size_t vlen);
00168 
00174 apreq_value_t * apreq_copy_value(apr_pool_t *p, 
00175                                  const apreq_value_t *val);
00176 
00182 apreq_value_t * apreq_merge_values(apr_pool_t *p, 
00183                                    const apr_array_header_t *arr);
00184 
00189 APREQ_DECLARE(const char *)apreq_enctype(void *env);
00190 
00192 typedef enum { 
00193     AS_IS,      
00194     ENCODE,     
00195     DECODE,     
00196     QUOTE       
00197 } apreq_join_t;
00198 
00207 APREQ_DECLARE(const char *) apreq_join(apr_pool_t *p, 
00208                                        const char *sep, 
00209                                        const apr_array_header_t *arr, 
00210                                        apreq_join_t mode);
00211 
00212 
00214 typedef enum {
00215     FULL,       
00216     PARTIAL     
00217 } apreq_match_t;
00218 
00228 APREQ_DECLARE(char *) apreq_memmem(char* hay, apr_size_t hlen, 
00229                                    const char* ndl, apr_size_t nlen, 
00230                                    const apreq_match_t type);
00231 
00242 APREQ_DECLARE(apr_ssize_t) apreq_index(const char* hay, apr_size_t hlen, 
00243                         const char* ndl, apr_size_t nlen, 
00244                         const apreq_match_t type);
00255 APREQ_DECLARE(apr_size_t) apreq_quote(char *dest, const char *src, 
00256                                       const apr_size_t slen);
00257 
00268 APREQ_DECLARE(apr_size_t) apreq_quote_once(char *dest, const char *src, 
00269                                            const apr_size_t slen);
00270 
00279 APREQ_DECLARE(apr_size_t) apreq_encode(char *dest, const char *src, 
00280                                        const apr_size_t slen);
00281 
00291 APREQ_DECLARE(apr_ssize_t) apreq_decode(char *dest, const char *src, const apr_size_t slen);
00292 
00302 APREQ_DECLARE(char *) apreq_escape(apr_pool_t *p, 
00303                                    const char *src, const apr_size_t slen);
00304 
00312 APREQ_DECLARE(apr_ssize_t) apreq_unescape(char *str);
00313 
00314 
00316 typedef enum {
00317     HTTP,       
00318     NSCOOKIE    
00319 } apreq_expires_t;
00320 
00334 APREQ_DECLARE(char *) apreq_expires(apr_pool_t *p, const char *time_str, 
00335                                     const apreq_expires_t type);
00336 
00343 APREQ_DECLARE(apr_int64_t) apreq_atoi64f(const char *s);
00344 
00351 APREQ_DECLARE(apr_int64_t) apreq_atoi64t(const char *s);
00352 
00364 APREQ_DECLARE(apr_status_t) apreq_brigade_fwrite(apr_file_t *f,
00365                                                  apr_off_t *wlen,
00366                                                  apr_bucket_brigade *bb);
00379 APREQ_DECLARE(apr_status_t) apreq_file_mktemp(apr_file_t **fp, 
00380                                               apr_pool_t *pool,
00381                                               const char *path);
00382 
00391 APREQ_DECLARE(apr_file_t *) apreq_brigade_spoolfile(apr_bucket_brigade *bb);
00392 
00399 APREQ_DECLARE(apr_bucket_brigade *)
00400          apreq_brigade_copy(const apr_bucket_brigade *bb);
00401 
00411 APREQ_DECLARE(apr_status_t)
00412          apreq_header_attribute(const char *hdr,
00413                                 const char *name, const apr_size_t nlen,
00414                                 const char **val, apr_size_t *vlen);
00415 
00418 #ifdef __cplusplus
00419  }
00420 #endif
00421 
00422 #endif /* APREQ_H */

Generated on Sat Jun 12 10:16:29 2004 for libapreq2 by doxygen1.2.15