libapreq2-2.15: include/apreq_param.h Source File

Apache HTTP Server Request Library

apreq_param.h
Go to the documentation of this file.
1 /*
2 ** Licensed to the Apache Software Foundation (ASF) under one or more
3 ** contributor license agreements. See the NOTICE file distributed with
4 ** this work for additional information regarding copyright ownership.
5 ** The ASF licenses this file to You under the Apache License, Version 2.0
6 ** (the "License"); you may not use this file except in compliance with
7 ** the License. You may obtain a copy of the License at
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17
18 #ifndef APREQ_PARAM_H
19 #define APREQ_PARAM_H
20
21 #include "apreq.h"
22 #include "apr_buckets.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28
37 typedef struct apreq_param_t {
38 apr_table_t *info;
39 apr_bucket_brigade *upload;
40 unsigned flags;
41 const apreq_value_t v;
42 } apreq_param_t;
43
44
46 static APR_INLINE
47 unsigned apreq_param_is_tainted(const apreq_param_t *p) {
48 return APREQ_FLAGS_GET(p->flags, APREQ_TAINTED);
49 }
50
52 static APR_INLINE
53 void apreq_param_tainted_on(apreq_param_t *p) {
54 APREQ_FLAGS_ON(p->flags, APREQ_TAINTED);
55 }
56
58 static APR_INLINE
59 void apreq_param_tainted_off(apreq_param_t *p) {
60 APREQ_FLAGS_OFF(p->flags, APREQ_TAINTED);
61 }
62
64 static APR_INLINE
65 apreq_charset_t apreq_param_charset_set(apreq_param_t *p, apreq_charset_t c) {
66 apreq_charset_t old = (apreq_charset_t)
67 APREQ_FLAGS_GET(p->flags, APREQ_CHARSET);
68 APREQ_FLAGS_SET(p->flags, APREQ_CHARSET, c);
69 return old;
70 }
71
73 static APR_INLINE
74 apreq_charset_t apreq_param_charset_get(apreq_param_t *p) {
75 return (apreq_charset_t)APREQ_FLAGS_GET(p->flags, APREQ_CHARSET);
76 }
77
78
80 static APR_INLINE
81 apreq_param_t *apreq_value_to_param(const char *val)
82 {
83 union { const char *in; char *out; } deconst;
84
85 deconst.in = val;
86 return apreq_attr_to_type(apreq_param_t, v,
87 apreq_attr_to_type(apreq_value_t, data, deconst.out));
88 }
89
90
91
93 APREQ_DECLARE(apreq_param_t *) apreq_param_make(apr_pool_t *p,
94 const char *name,
95 const apr_size_t nlen,
96 const char *val,
97 const apr_size_t vlen);
98
115 APREQ_DECLARE(apr_status_t) apreq_param_decode(apreq_param_t **param,
116 apr_pool_t *pool,
117 const char *word,
118 apr_size_t nlen,
119 apr_size_t vlen);
120
127 APREQ_DECLARE(char *) apreq_param_encode(apr_pool_t *pool,
128 const apreq_param_t *param);
129
141 APREQ_DECLARE(apr_status_t) apreq_parse_query_string(apr_pool_t *pool,
142 apr_table_t *t,
143 const char *qs);
144
145
157 APREQ_DECLARE(apr_array_header_t *) apreq_params_as_array(apr_pool_t *p,
158 const apr_table_t *t,
159 const char *key);
160
175 APREQ_DECLARE(const char *) apreq_params_as_string(apr_pool_t *p,
176 const apr_table_t *t,
177 const char *key,
178 apreq_join_t mode);
179
187 APREQ_DECLARE(const apr_table_t *) apreq_uploads(const apr_table_t *body,
188 apr_pool_t *pool);
189
198 APREQ_DECLARE(const apreq_param_t *) apreq_upload(const apr_table_t *body,
199 const char *name);
200
201
202 #ifdef __cplusplus
203 }
204 #endif
205
206 #endif /* APREQ_PARAM_H */
207
208
209
apreq_param_t
Definition: apreq_param.h:37
apreq_param_charset_set
static APR_INLINE apreq_charset_t apreq_param_charset_set(apreq_param_t *p, apreq_charset_t c)
Definition: apreq_param.h:65
apreq_param_tainted_on
static APR_INLINE void apreq_param_tainted_on(apreq_param_t *p)
Definition: apreq_param.h:53
APREQ_DECLARE
#define APREQ_DECLARE(d)
Definition: apreq.h:50
apreq_param_t::flags
unsigned flags
Definition: apreq_param.h:40
apreq_uploads
const apr_table_t * apreq_uploads(const apr_table_t *body, apr_pool_t *pool)
apreq_param_is_tainted
static APR_INLINE unsigned apreq_param_is_tainted(const apreq_param_t *p)
Definition: apreq_param.h:47
apreq_value_to_param
static APR_INLINE apreq_param_t * apreq_value_to_param(const char *val)
Definition: apreq_param.h:81
APREQ_FLAGS_ON
#define APREQ_FLAGS_ON(f, name)
Definition: apreq.h:122
APREQ_FLAGS_SET
#define APREQ_FLAGS_SET(f, name, value)
Definition: apreq.h:133
apreq_param_decode
apr_status_t apreq_param_decode(apreq_param_t **param, apr_pool_t *pool, const char *word, apr_size_t nlen, apr_size_t vlen)
APREQ_FLAGS_OFF
#define APREQ_FLAGS_OFF(f, name)
Definition: apreq.h:118
apreq_param_tainted_off
static APR_INLINE void apreq_param_tainted_off(apreq_param_t *p)
Definition: apreq_param.h:59
apreq_param_t::v
const apreq_value_t v
Definition: apreq_param.h:41
APREQ_FLAGS_GET
#define APREQ_FLAGS_GET(f, name)
Definition: apreq.h:126
apreq_attr_to_type
#define apreq_attr_to_type(T, A, P)
Definition: apreq.h:265
apreq_upload
const apreq_param_t * apreq_upload(const apr_table_t *body, const char *name)
apreq_param_encode
char * apreq_param_encode(apr_pool_t *pool, const apreq_param_t *param)
apreq.h
Main header file...
apreq_param_charset_get
static APR_INLINE apreq_charset_t apreq_param_charset_get(apreq_param_t *p)
Definition: apreq_param.h:74
apreq_join_t
apreq_join_t
Definition: apreq.h:214
apreq_charset_t
apreq_charset_t
Definition: apreq.h:205
apreq_param_t::info
apr_table_t * info
Definition: apreq_param.h:38
apreq_param_make
apreq_param_t * apreq_param_make(apr_pool_t *p, const char *name, const apr_size_t nlen, const char *val, const apr_size_t vlen)
apreq_params_as_string
const char * apreq_params_as_string(apr_pool_t *p, const apr_table_t *t, const char *key, apreq_join_t mode)
apreq_param_t
struct apreq_param_t apreq_param_t
apreq_params_as_array
apr_array_header_t * apreq_params_as_array(apr_pool_t *p, const apr_table_t *t, const char *key)
apreq_value_t
libapreq's pre-extensible string type
Definition: apreq.h:235
apreq_parse_query_string
apr_status_t apreq_parse_query_string(apr_pool_t *pool, apr_table_t *t, const char *qs)
apreq_param_t::upload
apr_bucket_brigade * upload
Definition: apreq_param.h:39