Apache2
apreq_parser.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_PARSERS_H
19 #define APREQ_PARSERS_H
20 /* These structs are defined below */
21 
22 #include "apreq_param.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27 
39 typedef struct apreq_hook_t apreq_hook_t;
40 
44 typedef struct apreq_parser_t apreq_parser_t;
45 
47 #define APREQ_PARSER_ARGS apreq_parser_t *parser, \
48  apr_table_t *t, \
49  apr_bucket_brigade *bb
50 
52 #define APREQ_HOOK_ARGS apreq_hook_t *hook, \
53  apreq_param_t *param, \
54  apr_bucket_brigade *bb
55 
60 
65 
69 #define APREQ_DECLARE_PARSER(f) APREQ_DECLARE_NONSTD(apr_status_t) \
70  f (APREQ_PARSER_ARGS)
71 
75 #define APREQ_DECLARE_HOOK(f) APREQ_DECLARE_NONSTD(apr_status_t) \
76  f (APREQ_HOOK_ARGS)
77 
83 struct apreq_hook_t {
87  void *ctx;
88 };
89 
97  const char *content_type;
105  const char *temp_dir;
109  void *ctx;
110 };
111 
112 
123 static APR_INLINE
124 apr_status_t apreq_parser_run(struct apreq_parser_t *psr, apr_table_t *t,
126 {
127  return psr->parser(psr, t, bb);
128 }
129 
137 static APR_INLINE
138 apr_status_t apreq_hook_run(struct apreq_hook_t *h, apreq_param_t *param,
140 {
141  return h->hook(h, param, bb);
142 }
143 
144 
151 
156 
164 
174 
183 
198  apr_bucket_alloc_t *ba,
199  const char *content_type,
201  apr_size_t brigade_limit,
202  const char *temp_dir,
203  apreq_hook_t *hook,
204  void *ctx);
205 
217  apreq_hook_t *next,
218  void *ctx);
219 
220 
228  apreq_hook_t *h);
229 
230 
238 
239 
254 
255 
262 
268 
273  const char *name;
277 
278 
294 
295 
296 #ifdef __cplusplus
297 }
298 
299 #endif
300 #endif /* APREQ_PARSERS_H */
Request parsing and parameter API.
apr_status_t apreq_parse_generic(apreq_parser_t *parser, apr_table_t *t, apr_bucket_brigade *bb)
apr_status_t apreq_parse_urlencoded(apreq_parser_t *parser, apr_table_t *t, apr_bucket_brigade *bb)
apr_status_t(* apreq_hook_function_t)(apreq_hook_t *hook, apreq_param_t *param, apr_bucket_brigade *bb)
Definition: apreq_parser.h:64
apr_status_t(* apreq_parser_function_t)(apreq_parser_t *parser, apr_table_t *t, apr_bucket_brigade *bb)
Definition: apreq_parser.h:59
apreq_hook_t * apreq_hook_make(apr_pool_t *pool, apreq_hook_function_t hook, apreq_hook_t *next, void *ctx)
apreq_parser_t * apreq_parser_make(apr_pool_t *pool, apr_bucket_alloc_t *ba, const char *content_type, apreq_parser_function_t pfn, apr_size_t brigade_limit, const char *temp_dir, apreq_hook_t *hook, void *ctx)
apr_status_t apreq_register_parser(const char *enctype, apreq_parser_function_t pfn)
#define APREQ_HOOK_ARGS
Definition: apreq_parser.h:52
apreq_parser_function_t apreq_parser(const char *enctype)
#define APREQ_DECLARE_PARSER(f)
Definition: apreq_parser.h:69
apr_status_t apreq_hook_find_param(apreq_hook_t *hook, apreq_param_t *param, apr_bucket_brigade *bb)
apr_status_t apreq_parse_multipart(apreq_parser_t *parser, apr_table_t *t, apr_bucket_brigade *bb)
apr_status_t apreq_parser_add_hook(apreq_parser_t *p, apreq_hook_t *h)
apr_status_t apreq_hook_disable_uploads(apreq_hook_t *hook, apreq_param_t *param, apr_bucket_brigade *bb)
struct apreq_hook_find_param_ctx_t apreq_hook_find_param_ctx_t
#define APREQ_DECLARE_HOOK(f)
Definition: apreq_parser.h:75
apr_status_t apreq_parse_headers(apreq_parser_t *parser, apr_table_t *t, apr_bucket_brigade *bb)
apr_status_t apreq_hook_discard_brigade(apreq_hook_t *hook, apreq_param_t *param, apr_bucket_brigade *bb)
apr_status_t apreq_hook_apr_xml_parser(apreq_hook_t *hook, apreq_param_t *param, apr_bucket_brigade *bb)
#define APREQ_PARSER_ARGS
Definition: apreq_parser.h:47
struct apr_bucket_alloc_t apr_bucket_alloc_t
Definition: apr_buckets.h:128
apr_bucket_brigade * bb
Definition: mod_dav.h:555
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
enctype
Definition: mod_proxy.h:75
int apr_status_t
Definition: apr_errno.h:44
size_t apr_size_t
Definition: apr.h:394
#define APR_INLINE
Definition: apr.h:65
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
#define APREQ_DECLARE(x)
Definition: macros.h:12
Definition: apr_buckets.h:263
Definition: apreq_parser.h:272
apreq_param_t * param
Definition: apreq_parser.h:274
const char * name
Definition: apreq_parser.h:273
apreq_hook_t * prev
Definition: apreq_parser.h:275
Definition: apreq_parser.h:83
apreq_hook_t * next
Definition: apreq_parser.h:85
apr_pool_t * pool
Definition: apreq_parser.h:86
void * ctx
Definition: apreq_parser.h:87
apreq_hook_function_t hook
Definition: apreq_parser.h:84
Definition: apreq_param.h:37
Definition: apreq_parser.h:93
apr_size_t brigade_limit
Definition: apreq_parser.h:103
const char * content_type
Definition: apreq_parser.h:97
apr_pool_t * pool
Definition: apreq_parser.h:99
const char * temp_dir
Definition: apreq_parser.h:105
void * ctx
Definition: apreq_parser.h:109
apreq_parser_function_t parser
Definition: apreq_parser.h:95
apreq_hook_t * hook
Definition: apreq_parser.h:107
apr_bucket_alloc_t * bucket_alloc
Definition: apreq_parser.h:101
apr_pool_t * p