Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 {
40  unsigned flags;
41  const apreq_value_t v;
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) {
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;
87  apreq_attr_to_type(apreq_value_t, data, deconst.out));
88 }
89 
90 
91 
94  const char *name,
95  const apr_size_t nlen,
96  const char *val,
97  const apr_size_t vlen);
98 
116  apr_pool_t *pool,
117  const char *word,
118  apr_size_t nlen,
119  apr_size_t vlen);
120 
128  const apreq_param_t *param);
129 
142  apr_table_t *t,
143  const char *qs);
144 
145 
158  const apr_table_t *t,
159  const char *key);
160 
176  const apr_table_t *t,
177  const char *key,
178  apreq_join_t mode);
179 
188  apr_pool_t *pool);
189 
199  const char *name);
200 
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* APREQ_PARAM_H */
207 
208 
209 
size_t apr_size_t
Definition: apr.h:375
Definition: apr_tables.h:62
const char const char apr_text_header * body
Definition: mod_dav.h:1615
apr_bucket_brigade * upload
Definition: apreq_param.h:39
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:556
unsigned flags
Definition: apreq_param.h:40
apr_array_header_t * apreq_params_as_array(apr_pool_t *p, const apr_table_t *t, const char *key)
#define APREQ_DECLARE(x)
Definition: macros.h:12
apreq_charset_t
Definition: apreq.h:160
const apreq_param_t * apreq_upload(const apr_table_t *body, const char *name)
Definition: apr_buckets.h:258
const apreq_value_t v
Definition: apreq_param.h:41
#define APREQ_FLAGS_OFF(f, name)
Definition: apreq.h:73
struct apreq_param_t apreq_param_t
const char * apreq_params_as_string(apr_pool_t *p, const apr_table_t *t, const char *key, apreq_join_t mode)
#define APREQ_FLAGS_ON(f, name)
Definition: apreq.h:77
#define APREQ_FLAGS_SET(f, name, value)
Definition: apreq.h:88
const apr_table_t * apreq_uploads(const apr_table_t *body, apr_pool_t *pool)
#define APREQ_FLAGS_GET(f, name)
Definition: apreq.h:81
APR-UTIL Buckets/Bucket Brigades.
Definition: apreq_param.h:37
libapreq's pre-extensible string type
Definition: apreq.h:190
apr_table_t * info
Definition: apreq_param.h:38
apr_status_t apreq_parse_query_string(apr_pool_t *pool, apr_table_t *t, const char *qs)
#define APR_INLINE
Definition: apr.h:65
apr_pool_t * p
Main header file...Define the common data structures.
apreq_join_t
Definition: apreq.h:169
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
const char * name
Definition: mod_dav.h:730
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
char * apreq_param_encode(apr_pool_t *pool, const apreq_param_t *param)
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)
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)
#define apreq_attr_to_type(T, A, P)
Definition: apreq.h:220