HTP 0.5
htp_multipart_private.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_MULTIPART_PRIVATE_H
40#define _HTP_MULTIPART_PRIVATE_H
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#include "htp_multipart.h"
47
48#define CD_PARAM_OTHER 0
49#define CD_PARAM_NAME 1
50#define CD_PARAM_FILENAME 2
51
52#define DEFAULT_FILE_EXTRACT_LIMIT 16
53
57
59 MODE_DATA = 1
60};
61
65
68
71
74
77
80
83};
84
87
89
91
93
95
97
98 // Parsing callbacks
99
100 int (*handle_data)(htp_mpartp_t *mpartp, const unsigned char *data,
101 size_t len, int line_end);
103
104 // Internal parsing fields; move into a private structure
105
110
116
121
136
144
146
148
155
161
172
179};
180
181htp_status_t htp_mpartp_run_request_file_data_hook(htp_multipart_part_t *part, const unsigned char *data, size_t len);
182
184
185htp_status_t htp_mpartp_parse_header(htp_multipart_part_t *part, const unsigned char *data, size_t len);
186
187htp_status_t htp_mpart_part_handle_data(htp_multipart_part_t *part, const unsigned char *data, size_t len, int is_line);
188
190
192
194
195void htp_mpart_part_destroy(htp_multipart_part_t *part, int gave_up_data);
196
198
199#ifdef __cplusplus
200}
201#endif
202
203#endif /* _HTP_MULTIPART_PRIVATE_H */
int htp_status_t
Definition: htp_core.h:46
htp_status_t htp_mpart_part_handle_data(htp_multipart_part_t *part, const unsigned char *data, size_t len, int is_line)
Definition: htp_multipart.c:602
htp_status_t htp_mpart_part_process_headers(htp_multipart_part_t *part)
Definition: htp_multipart.c:297
htp_multipart_state_t
Definition: htp_multipart_private.h:62
@ STATE_BOUNDARY_IS_LAST2
Definition: htp_multipart_private.h:76
@ STATE_DATA
Definition: htp_multipart_private.h:67
@ STATE_BOUNDARY_EAT_LWS_CR
Definition: htp_multipart_private.h:82
@ STATE_BOUNDARY_EAT_LWS
Definition: htp_multipart_private.h:79
@ STATE_INIT
Definition: htp_multipart_private.h:64
@ STATE_BOUNDARY
Definition: htp_multipart_private.h:70
@ STATE_BOUNDARY_IS_LAST1
Definition: htp_multipart_private.h:73
htp_status_t htp_mpartp_run_request_file_data_hook(htp_multipart_part_t *part, const unsigned char *data, size_t len)
Definition: htp_multipart.c:574
int htp_mpartp_is_boundary_character(int c)
htp_part_mode_t
Definition: htp_multipart_private.h:54
@ MODE_DATA
Definition: htp_multipart_private.h:59
@ MODE_LINE
Definition: htp_multipart_private.h:56
htp_multipart_part_t * htp_mpart_part_create(htp_mpartp_t *parser)
Definition: htp_multipart.c:454
htp_status_t htp_mpart_part_parse_c_d(htp_multipart_part_t *part)
Definition: htp_multipart.c:101
htp_status_t htp_mpartp_parse_header(htp_multipart_part_t *part, const unsigned char *data, size_t len)
Definition: htp_multipart.c:312
htp_status_t htp_mpart_part_finalize_data(htp_multipart_part_t *part)
Definition: htp_multipart.c:520
void htp_mpart_part_destroy(htp_multipart_part_t *part, int gave_up_data)
Definition: htp_multipart.c:477
Definition: bstr_builder.h:50
Definition: bstr.h:57
Definition: htp_config_private.h:123
Definition: htp_multipart_private.h:85
int gave_up_data
Definition: htp_multipart_private.h:178
size_t boundary_match_pos
Definition: htp_multipart_private.h:115
htp_multipart_t multipart
Definition: htp_multipart_private.h:86
size_t boundary_candidate_pos
Definition: htp_multipart_private.h:160
bstr_builder_t * part_data_pieces
Definition: htp_multipart_private.h:154
char * extract_dir
Definition: htp_multipart_private.h:94
bstr_builder_t * part_header_pieces
Definition: htp_multipart_private.h:145
int cr_aside
Definition: htp_multipart_private.h:171
int file_count
Definition: htp_multipart_private.h:96
htp_multipart_part_t * current_part
Definition: htp_multipart_private.h:120
enum htp_multipart_state_t parser_state
Definition: htp_multipart_private.h:109
bstr * pending_header_line
Definition: htp_multipart_private.h:147
bstr_builder_t * boundary_pieces
Definition: htp_multipart_private.h:143
int(* handle_boundary)(htp_mpartp_t *mpartp)
Definition: htp_multipart_private.h:102
int extract_limit
Definition: htp_multipart_private.h:92
htp_cfg_t * cfg
Definition: htp_multipart_private.h:88
enum htp_part_mode_t current_part_mode
Definition: htp_multipart_private.h:135
int(* handle_data)(htp_mpartp_t *mpartp, const unsigned char *data, size_t len, int line_end)
Definition: htp_multipart_private.h:100
int extract_files
Definition: htp_multipart_private.h:90
Definition: htp_multipart.h:248
Definition: htp_multipart.h:228