HTP  0.3
htp_urlencoded.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2009-2010, Open Information Security Foundation
3  * Copyright (c) 2009-2012, 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  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of the Qualys, Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  ***************************************************************************/
31 
37 #ifndef _HTP_URLENCODED_H
38 #define _HTP_URLENCODED_H
39 
40 typedef struct htp_urlenp_t htp_urlenp_t;
42 
43 #include "htp.h"
44 
45 #define HTP_URLENP_DEFAULT_PARAMS_SIZE 32
46 
47 #define HTP_URLENP_STATE_KEY 1
48 #define HTP_URLENP_STATE_VALUE 2
49 
50 #define HTP_URLENCODED_MIME_TYPE "application/x-www-form-urlencoded"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
60 struct htp_urlenp_t {
63 
67  unsigned char argument_separator;
68 
71 
74 
75  // Private fields; these are used during the parsing process only
76  int _state;
77  int _complete;
80 };
81 
88 
91 };
92 
94 void htp_urlenp_destroy(htp_urlenp_t **urlenp);
95 
96 void htp_urlenp_set_argument_separator(htp_urlenp_t *urlenp, unsigned char argument_separator);
97 void htp_urlenp_set_decode_url_encoding(htp_urlenp_t *urlenp, int decode_url_encoding);
98 
99 int htp_urlenp_parse_partial(htp_urlenp_t *urlenp, unsigned char *data, size_t len);
100 int htp_urlenp_parse_complete(htp_urlenp_t *urlenp, unsigned char *data, size_t len);
101 int htp_urlenp_finalize(htp_urlenp_t *urlenp);
102 
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* _HTP_URLENCODED_H */
111