HTP  0.5
htp_urlencoded.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2009-2010 Open Information Security Foundation
3  * Copyright (c) 2010-2013 Qualys, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * - Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12 
13  * - Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16 
17  * - Neither the name of the Qualys, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  ***************************************************************************/
33 
39 #ifndef _HTP_URLENCODED_H
40 #define _HTP_URLENCODED_H
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct htp_urlenp_t htp_urlenp_t;
48 
49 #define HTP_URLENP_DEFAULT_PARAMS_SIZE 32
50 
51 #define HTP_URLENP_STATE_KEY 1
52 #define HTP_URLENP_STATE_VALUE 2
53 
54 // The MIME type that triggers the parser. Must be lowercase.
55 #define HTP_URLENCODED_MIME_TYPE "application/x-www-form-urlencoded"
56 
57 #include "htp.h"
58 
63 struct htp_urlenp_t {
66 
70  unsigned char argument_separator;
71 
74 
77 
78  // Private fields; these are used during the parsing process only
79  int _state;
80  int _complete;
83 };
84 
91 
94 };
95 
97 void htp_urlenp_destroy(htp_urlenp_t *urlenp);
98 
99 void htp_urlenp_set_argument_separator(htp_urlenp_t *urlenp, unsigned char argument_separator);
100 void htp_urlenp_set_decode_url_encoding(htp_urlenp_t *urlenp, int decode_url_encoding);
101 
102 htp_status_t htp_urlenp_parse_partial(htp_urlenp_t *urlenp, const void *data, size_t len);
103 htp_status_t htp_urlenp_parse_complete(htp_urlenp_t *urlenp, const void *data, size_t len);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* _HTP_URLENCODED_H */
111 
bstr_builder_t * _bb
Definition: htp_urlencoded.h:82
bstr * _name
Definition: htp_urlencoded.h:81
htp_status_t htp_urlenp_parse_partial(htp_urlenp_t *urlenp, const void *_data, size_t len)
Definition: htp_urlencoded.c:269
int _state
Definition: htp_urlencoded.h:79
htp_urlenp_t * htp_urlenp_create(htp_tx_t *tx)
Definition: htp_urlencoded.c:176
htp_table_t * params
Definition: htp_urlencoded.h:76
htp_tx_t * tx
Definition: htp_urlencoded.h:65
unsigned char argument_separator
Definition: htp_urlencoded.h:70
htp_status_t htp_urlenp_parse_complete(htp_urlenp_t *urlenp, const void *data, size_t len)
Definition: htp_urlencoded.c:254
Definition: bstr.h:57
void htp_urlenp_set_argument_separator(htp_urlenp_t *urlenp, unsigned char argument_separator)
bstr * name
Definition: htp_urlencoded.h:90
int htp_status_t
Definition: htp_core.h:46
void htp_urlenp_set_decode_url_encoding(htp_urlenp_t *urlenp, int decode_url_encoding)
Definition: bstr_builder.h:50
Definition: htp_urlencoded.h:88
Definition: htp_urlencoded.h:63
bstr * value
Definition: htp_urlencoded.h:93
Definition: htp_table_private.h:63
void htp_urlenp_destroy(htp_urlenp_t *urlenp)
Definition: htp_urlencoded.c:207
htp_status_t htp_urlenp_finalize(htp_urlenp_t *urlenp)
Definition: htp_urlencoded.c:238
int _complete
Definition: htp_urlencoded.h:80
Definition: htp.h:208
int decode_url_encoding
Definition: htp_urlencoded.h:73