39 #ifndef _HTP_MULTIPART_H
40 #define _HTP_MULTIPART_H
58 #define HTP_MULTIPART_LF_LINE 0x0001
61 #define HTP_MULTIPART_CRLF_LINE 0x0002
64 #define HTP_MULTIPART_BBOUNDARY_LWS_AFTER 0x0004
67 #define HTP_MULTIPART_BBOUNDARY_NLWS_AFTER 0x0008
72 #define HTP_MULTIPART_HAS_PREAMBLE 0x0010
77 #define HTP_MULTIPART_HAS_EPILOGUE 0x0020
85 #define HTP_MULTIPART_SEEN_LAST_BOUNDARY 0x0040
91 #define HTP_MULTIPART_PART_AFTER_LAST_BOUNDARY 0x0080
99 #define HTP_MULTIPART_INCOMPLETE 0x0100
102 #define HTP_MULTIPART_HBOUNDARY_INVALID 0x0200
109 #define HTP_MULTIPART_HBOUNDARY_UNUSUAL 0x0400
115 #define HTP_MULTIPART_HBOUNDARY_QUOTED 0x0800
118 #define HTP_MULTIPART_PART_HEADER_FOLDING 0x1000
124 #define HTP_MULTIPART_PART_UNKNOWN 0x2000
127 #define HTP_MULTIPART_PART_HEADER_REPEATED 0x4000
130 #define HTP_MULTIPART_PART_HEADER_UNKNOWN 0x8000
133 #define HTP_MULTIPART_PART_HEADER_INVALID 0x10000
136 #define HTP_MULTIPART_CD_TYPE_INVALID 0x20000
139 #define HTP_MULTIPART_CD_PARAM_REPEATED 0x40000
142 #define HTP_MULTIPART_CD_PARAM_UNKNOWN 0x80000
145 #define HTP_MULTIPART_CD_SYNTAX_INVALID 0x100000
152 #define HTP_MULTIPART_PART_INCOMPLETE 0x200000
155 #define HTP_MULTIPART_NUL_BYTE 0x400000
158 #define HTP_MULTIPART_CD_INVALID ( \
159 HTP_MULTIPART_CD_TYPE_INVALID | \
160 HTP_MULTIPART_CD_PARAM_REPEATED | \
161 HTP_MULTIPART_CD_PARAM_UNKNOWN | \
162 HTP_MULTIPART_CD_SYNTAX_INVALID )
165 #define HTP_MULTIPART_PART_INVALID ( \
166 HTP_MULTIPART_CD_INVALID | \
167 HTP_MULTIPART_NUL_BYTE | \
168 HTP_MULTIPART_PART_UNKNOWN | \
169 HTP_MULTIPART_PART_HEADER_REPEATED | \
170 HTP_MULTIPART_PART_INCOMPLETE | \
171 HTP_MULTIPART_PART_HEADER_UNKNOWN | \
172 HTP_MULTIPART_PART_HEADER_INVALID )
175 #define HTP_MULTIPART_INVALID ( \
176 HTP_MULTIPART_PART_INVALID | \
177 HTP_MULTIPART_PART_AFTER_LAST_BOUNDARY | \
178 HTP_MULTIPART_INCOMPLETE | \
179 HTP_MULTIPART_HBOUNDARY_INVALID )
182 #define HTP_MULTIPART_UNUSUAL ( \
183 HTP_MULTIPART_INVALID | \
184 HTP_MULTIPART_PART_HEADER_FOLDING | \
185 HTP_MULTIPART_BBOUNDARY_NLWS_AFTER | \
186 HTP_MULTIPART_HAS_EPILOGUE | \
187 HTP_MULTIPART_HBOUNDARY_UNUSUAL \
188 HTP_MULTIPART_HBOUNDARY_QUOTED )
191 #define HTP_MULTIPART_UNUSUAL_PARANOID ( \
192 HTP_MULTIPART_UNUSUAL | \
193 HTP_MULTIPART_LF_LINE | \
194 HTP_MULTIPART_BBOUNDARY_LWS_AFTER | \
195 HTP_MULTIPART_HAS_PREAMBLE )
197 #define HTP_MULTIPART_MIME_TYPE "multipart/form-data"
Definition: htp_config_private.h:123
#define htp_list_t
Definition: htp_list.h:48
int boundary_count
Definition: htp_multipart.h:236
htp_status_t htp_mpartp_finalize(htp_mpartp_t *parser)
Definition: htp_multipart.c:1080
htp_status_t htp_mpartp_find_boundary(bstr *content_type, bstr **boundary, uint64_t *flags)
Definition: htp_multipart.c:1472
uint64_t flags
Definition: htp_multipart.h:242
char * boundary
Definition: htp_multipart.h:230
htp_mpartp_t * htp_mpartp_create(htp_cfg_t *cfg, bstr *boundary, uint64_t flags)
Definition: htp_multipart.c:885
struct htp_multipart_t htp_multipart_t
Definition: htp_multipart.h:248
htp_list_t * parts
Definition: htp_multipart.h:239
htp_mpartp_t * parser
Definition: htp_multipart.h:250
struct htp_multipart_part_t htp_multipart_part_t
enum htp_multipart_type_t type
Definition: htp_multipart.h:253
Definition: htp_multipart.h:228
htp_file_t * file
Definition: htp_multipart.h:276
bstr * name
Definition: htp_multipart.h:259
Definition: htp_multipart.h:214
int htp_status_t
Definition: htp_core.h:46
void htp_mpartp_destroy(htp_mpartp_t *parser)
Definition: htp_multipart.c:944
Definition: htp_multipart.h:205
Definition: htp_multipart.h:208
Definition: htp_multipart.h:211
Definition: htp_multipart.h:202
bstr * content_type
Definition: htp_multipart.h:270
bstr * value
Definition: htp_multipart.h:267
htp_multipart_t * htp_mpartp_get_multipart(htp_mpartp_t *parser)
Definition: htp_multipart.c:61
Definition: htp_multipart_private.h:85
size_t len
Definition: htp_multipart.h:256
Definition: htp_table_private.h:63
htp_multipart_type_t
Definition: htp_multipart.h:199
htp_table_t * headers
Definition: htp_multipart.h:273
htp_status_t htp_mpartp_parse(htp_mpartp_t *parser, const void *_data, size_t len)
Definition: htp_multipart.c:1099
size_t boundary_len
Definition: htp_multipart.h:233