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

apreq_param.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_PARAM_H
00018 #define APREQ_PARAM_H
00019 
00020 #include "apreq.h"
00021 #include "apr_buckets.h"
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 
00036 typedef struct apreq_param_t {
00037     apr_table_t         *info;   
00038     apr_bucket_brigade  *upload; 
00039     unsigned             flags;  
00040     const apreq_value_t  v;      
00041 } apreq_param_t;
00042 
00043 
00045 static APR_INLINE
00046 unsigned apreq_param_is_tainted(const apreq_param_t *p) {
00047     return APREQ_FLAGS_GET(p->flags, APREQ_TAINTED);
00048 }
00049 
00051 static APR_INLINE
00052 void apreq_param_tainted_on(apreq_param_t *p) {
00053     APREQ_FLAGS_ON(p->flags, APREQ_TAINTED);
00054 }
00055 
00057 static APR_INLINE
00058 void apreq_param_tainted_off(apreq_param_t *p) {
00059     APREQ_FLAGS_OFF(p->flags, APREQ_TAINTED);
00060 }
00061 
00063 static APR_INLINE
00064 apreq_charset_t apreq_param_charset_set(apreq_param_t *p, unsigned char c) {
00065     unsigned char old = APREQ_FLAGS_GET(p->flags, APREQ_CHARSET);
00066     APREQ_FLAGS_SET(p->flags, APREQ_CHARSET, c);
00067     return old;
00068 }
00069 
00071 static APR_INLINE
00072 apreq_charset_t apreq_param_charset_get(apreq_param_t *p) {
00073     return APREQ_FLAGS_GET(p->flags, APREQ_CHARSET);
00074 }
00075 
00076 
00078 static APR_INLINE
00079 apreq_param_t *apreq_value_to_param(const char *val)
00080 {
00081     union { const char *in; char *out; } deconst;
00082 
00083     deconst.in = val;
00084     return apreq_attr_to_type(apreq_param_t, v,
00085            apreq_attr_to_type(apreq_value_t, data, deconst.out));
00086 }
00087 
00088 
00089 
00091 APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p,
00092                                                 const char *name,
00093                                                 const apr_size_t nlen,
00094                                                 const char *val,
00095                                                 const apr_size_t vlen);
00096 
00113 APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param,
00114                                                apr_pool_t *pool,
00115                                                const char *word,
00116                                                apr_size_t nlen,
00117                                                apr_size_t vlen);
00118 
00125 APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool,
00126                                          const apreq_param_t *param);
00127 
00139 APREQ_DECLARE(apr_status_t) apreq_parse_query_string(apr_pool_t *pool,
00140                                                      apr_table_t *t,
00141                                                      const char *qs);
00142 
00143 
00155 APREQ_DECLARE(apr_array_header_t *) apreq_params_as_array(apr_pool_t *p,
00156                                                           const apr_table_t *t,
00157                                                           const char *key);
00158 
00173 APREQ_DECLARE(const char *) apreq_params_as_string(apr_pool_t *p,
00174                                                    const apr_table_t *t,
00175                                                    const char *key,
00176                                                    apreq_join_t mode);
00177 
00185 APREQ_DECLARE(const apr_table_t *) apreq_uploads(const apr_table_t *body,
00186                                                  apr_pool_t *pool);
00187 
00196 APREQ_DECLARE(const apreq_param_t *) apreq_upload(const apr_table_t *body,
00197                                                   const char *name);
00198 
00199 
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203 
00204 #endif /* APREQ_PARAM_H */
00205 
00206 
00207