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

apreq.h

Go to the documentation of this file.
00001 /* ====================================================================
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 2003 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Apache" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation.  For more
00051  * information on the Apache Software Foundation, please see
00052  * <http://www.apache.org/>.
00053  */
00054 
00055 #ifndef APREQ_H
00056 #define APREQ_H
00057 
00058 #include "apr_tables.h" 
00059 #include "apr_file_io.h"
00060 #include "apr_buckets.h"
00061 #include <stddef.h>
00062 
00063 #ifdef  __cplusplus
00064  extern "C" {
00065 #endif 
00066 
00133 #ifndef WIN32
00134 #define APREQ_DECLARE(d)                APR_DECLARE(d)
00135 #define APREQ_DECLARE_NONSTD(d)         APR_DECLARE_NONSTD(d)
00136 #else
00137 #define APREQ_DECLARE(type)             __declspec(dllexport) type __stdcall
00138 #define APREQ_DECLARE_NONSTD(type)      __declspec(dllexport) type
00139 #define APREQ_DECLARE_DATA              __declspec(dllexport)
00140 #endif
00141 
00142 #define APREQ_URL_ENCTYPE               "application/x-www-form-urlencoded"
00143 #define APREQ_MFD_ENCTYPE               "multipart/form-data"
00144 #define APREQ_XML_ENCTYPE               "application/xml"
00145 
00146 #define APREQ_NELTS                     8
00147 
00151 typedef struct apreq_value_t {
00152     const char    *name;    
00153     apr_status_t   status;  
00154     apr_size_t     size;    
00155     char           data[1]; 
00156 } apreq_value_t;
00157 
00158 typedef apreq_value_t *(apreq_value_merge_t)(apr_pool_t *p,
00159                                              const apr_array_header_t *a);
00160 typedef apreq_value_t *(apreq_value_copy_t)(apr_pool_t *p,
00161                                             const apreq_value_t *v);
00162 
00163 
00164 #define apreq_attr_to_type(T,A,P) ( (T*) ((char*)(P)-offsetof(T,A)) )
00165 #define apreq_char_to_value(ptr)  apreq_attr_to_type(apreq_value_t, data, ptr)
00166 
00167 #define apreq_strtoval(ptr)  apreq_char_to_value(ptr)
00168 #define apreq_strlen(ptr) (apreq_strtoval(ptr)->size)
00169 
00183 APREQ_DECLARE(apreq_value_t *) apreq_make_value(apr_pool_t *p, 
00184                                                 const char *name,
00185                                                 const apr_size_t nlen,
00186                                                 const char *val, 
00187                                                 const apr_size_t vlen);
00188 
00194 apreq_value_t * apreq_copy_value(apr_pool_t *p, 
00195                                  const apreq_value_t *val);
00196 
00202 apreq_value_t * apreq_merge_values(apr_pool_t *p, 
00203                                    const apr_array_header_t *arr);
00204 
00209 APREQ_DECLARE(const char *)apreq_enctype(void *env);
00210 
00212 typedef enum { 
00213     AS_IS,      
00214     ENCODE,     
00215     DECODE,     
00216     QUOTE       
00217 } apreq_join_t;
00218 
00227 APREQ_DECLARE(const char *) apreq_join(apr_pool_t *p, 
00228                                        const char *sep, 
00229                                        const apr_array_header_t *arr, 
00230                                        apreq_join_t mode);
00231 
00232 
00234 typedef enum {
00235     FULL,       
00236     PARTIAL     
00237 } apreq_match_t;
00238 
00248 APREQ_DECLARE(char *) apreq_memmem(char* hay, apr_size_t hlen, 
00249                                    const char* ndl, apr_size_t nlen, 
00250                                    const apreq_match_t type);
00251 
00261 APREQ_DECLARE(apr_ssize_t) apreq_index(const char* hay, apr_size_t hlen, 
00262                         const char* ndl, apr_size_t nlen, 
00263                         const apreq_match_t type);
00272 APREQ_DECLARE(apr_size_t) apreq_quote(char *dest, const char *src, const apr_size_t slen);
00273 
00283 APREQ_DECLARE(apr_size_t) apreq_encode(char *dest, const char *src, const apr_size_t slen);
00284 
00295 APREQ_DECLARE(apr_ssize_t) apreq_decode(char *dest, const char *src, const apr_size_t slen);
00296 
00306 APREQ_DECLARE(char *) apreq_escape(apr_pool_t *p, 
00307                                    const char *src, const apr_size_t slen);
00308 
00315 APREQ_DECLARE(apr_ssize_t) apreq_unescape(char *str);
00316 #define apreq_unescape(str) apreq_decode(str,str,strlen(str))
00317 
00319 typedef enum {
00320     HTTP,       
00321     NSCOOKIE    
00322 } apreq_expires_t;
00323 
00337 APREQ_DECLARE(char *) apreq_expires(apr_pool_t *p, const char *time_str, 
00338                                     const apreq_expires_t type);
00339 
00346 APREQ_DECLARE(apr_int64_t) apreq_atoi64f(const char *s);
00347 
00354 APREQ_DECLARE(apr_int64_t) apreq_atoi64t(const char *s);
00355 
00367 APREQ_DECLARE(apr_status_t) apreq_brigade_fwrite(apr_file_t *f,
00368                                                  apr_off_t *wlen,
00369                                                  apr_bucket_brigade *bb);
00381 APREQ_DECLARE(apr_status_t) apreq_file_mktemp(apr_file_t **fp, 
00382                                               apr_pool_t *pool,
00383                                               const char *path);
00384 
00393 APREQ_DECLARE(apr_file_t *) apreq_brigade_spoolfile(apr_bucket_brigade *bb);
00394 
00395 APREQ_DECLARE(apr_bucket_brigade *)
00396          apreq_copy_brigade(const apr_bucket_brigade *bb);
00397 
00398 APREQ_DECLARE(apr_status_t)
00399          apreq_header_attribute(const char *hdr,
00400                                 const char *name, const apr_size_t nlen,
00401                                 const char **val, apr_size_t *vlen);
00402 
00405 #ifdef __cplusplus
00406  }
00407 #endif
00408 
00409 #endif /* APREQ_H */

Generated on Sat Nov 15 23:04:48 2003 for libapreq2 by doxygen1.3