Apache HTTP Server Request Library
00001 /* 00002 ** Copyright 2003-2006 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, apreq_charset_t c) { 00065 apreq_charset_t old = (apreq_charset_t) 00066 APREQ_FLAGS_GET(p->flags, APREQ_CHARSET); 00067 APREQ_FLAGS_SET(p->flags, APREQ_CHARSET, c); 00068 return old; 00069 } 00070 00072 static APR_INLINE 00073 apreq_charset_t apreq_param_charset_get(apreq_param_t *p) { 00074 return (apreq_charset_t)APREQ_FLAGS_GET(p->flags, APREQ_CHARSET); 00075 } 00076 00077 00079 static APR_INLINE 00080 apreq_param_t *apreq_value_to_param(const char *val) 00081 { 00082 union { const char *in; char *out; } deconst; 00083 00084 deconst.in = val; 00085 return apreq_attr_to_type(apreq_param_t, v, 00086 apreq_attr_to_type(apreq_value_t, data, deconst.out)); 00087 } 00088 00089 00090 00092 APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p, 00093 const char *name, 00094 const apr_size_t nlen, 00095 const char *val, 00096 const apr_size_t vlen); 00097 00114 APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param, 00115 apr_pool_t *pool, 00116 const char *word, 00117 apr_size_t nlen, 00118 apr_size_t vlen); 00119 00126 APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool, 00127 const apreq_param_t *param); 00128 00140 APREQ_DECLARE(apr_status_t) apreq_parse_query_string(apr_pool_t *pool, 00141 apr_table_t *t, 00142 const char *qs); 00143 00144 00156 APREQ_DECLARE(apr_array_header_t *) apreq_params_as_array(apr_pool_t *p, 00157 const apr_table_t *t, 00158 const char *key); 00159 00174 APREQ_DECLARE(const char *) apreq_params_as_string(apr_pool_t *p, 00175 const apr_table_t *t, 00176 const char *key, 00177 apreq_join_t mode); 00178 00186 APREQ_DECLARE(const apr_table_t *) apreq_uploads(const apr_table_t *body, 00187 apr_pool_t *pool); 00188 00197 APREQ_DECLARE(const apreq_param_t *) apreq_upload(const apr_table_t *body, 00198 const char *name); 00199 00200 00201 #ifdef __cplusplus 00202 } 00203 #endif 00204 00205 #endif /* APREQ_PARAM_H */ 00206 00207 00208