HTP
0.5
Main Page
Data Structures
Files
File List
Globals
htp
htp.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_H
40
#define _HTP_H
41
42
#ifdef __cplusplus
43
extern
"C"
{
44
#endif
45
46
#include <sys/time.h>
47
48
#include "
htp_core.h
"
49
50
#include "
bstr.h
"
51
#include "
htp_base64.h
"
52
#include "
htp_config.h
"
53
#include "
htp_connection_parser.h
"
54
#include "
htp_decompressors.h
"
55
#include "
htp_hooks.h
"
56
#include "
htp_list.h
"
57
#include "
htp_multipart.h
"
58
#include "
htp_table.h
"
59
#include "
htp_transaction.h
"
60
#include "
htp_urlencoded.h
"
61
#include "
htp_utf8_decoder.h
"
62
66
struct
htp_conn_t
{
68
char
*
client_addr
;
69
71
int
client_port
;
72
74
char
*
server_addr
;
75
77
int
server_port
;
78
84
htp_list_t
*
transactions
;
85
87
htp_list_t
*
messages
;
88
90
uint8_t
flags
;
91
93
htp_time_t
open_timestamp
;
94
96
htp_time_t
close_timestamp
;
97
99
int64_t
in_data_counter
;
100
102
int64_t
out_data_counter
;
103
};
104
110
struct
htp_file_t
{
112
enum
htp_file_source_t
source
;
113
115
bstr
*
filename
;
116
118
int64_t
len
;
119
121
char
*
tmpname
;
122
124
int
fd
;
125
};
126
130
struct
htp_file_data_t
{
132
htp_file_t
*
file
;
133
135
const
unsigned
char
*
data
;
136
138
size_t
len
;
139
};
140
144
struct
htp_log_t
{
146
htp_connp_t
*
connp
;
147
149
htp_tx_t
*
tx
;
150
152
const
char
*
msg
;
153
155
enum
htp_log_level_t
level
;
156
158
int
code
;
159
161
const
char
*
file
;
162
164
unsigned
int
line
;
165
};
166
170
struct
htp_header_t
{
172
bstr
*
name
;
173
175
bstr
*
value
;
176
178
uint64_t
flags
;
179
};
180
184
struct
htp_param_t
{
186
bstr
*
name
;
187
189
bstr
*
value
;
190
192
enum
htp_data_source_t
source
;
193
195
enum
htp_parser_id_t
parser_id
;
196
201
void
*
parser_data
;
202
};
203
207
struct
htp_tx_t
{
209
htp_connp_t
*
connp
;
210
212
htp_conn_t
*
conn
;
213
215
htp_cfg_t
*
cfg
;
216
221
int
is_config_shared
;
222
224
void
*
user_data
;
225
226
227
// Request fields
228
230
unsigned
int
request_ignored_lines
;
231
233
bstr
*
request_line
;
234
236
bstr
*
request_method
;
237
239
enum
htp_method_t
request_method_number
;
240
247
bstr
*
request_uri
;
248
250
bstr
*
request_protocol
;
251
256
int
request_protocol_number
;
257
264
int
is_protocol_0_9
;
265
271
htp_uri_t
*
parsed_uri
;
272
279
htp_uri_t
*
parsed_uri_raw
;
280
281
/* HTTP 1.1 RFC
282
*
283
* 4.3 Message Body
284
*
285
* The message-body (if any) of an HTTP message is used to carry the
286
* entity-body associated with the request or response. The message-body
287
* differs from the entity-body only when a transfer-coding has been
288
* applied, as indicated by the Transfer-Encoding header field (section
289
* 14.41).
290
*
291
* message-body = entity-body
292
* | <entity-body encoded as per Transfer-Encoding>
293
*/
294
303
int64_t
request_message_len
;
304
313
int64_t
request_entity_len
;
314
316
htp_table_t
*
request_headers
;
317
323
enum
htp_transfer_coding_t
request_transfer_coding
;
324
326
enum
htp_content_encoding_t
request_content_encoding
;
327
333
bstr
*
request_content_type
;
334
341
int64_t
request_content_length
;
342
347
htp_hook_t
*
hook_request_body_data
;
348
353
htp_hook_t
*
hook_response_body_data
;
354
359
htp_urlenp_t
*
request_urlenp_query
;
360
365
htp_urlenp_t
*
request_urlenp_body
;
366
371
htp_mpartp_t
*
request_mpartp
;
372
374
htp_table_t
*
request_params
;
375
377
htp_table_t
*
request_cookies
;
378
380
enum
htp_auth_type_t
request_auth_type
;
381
383
bstr
*
request_auth_username
;
384
386
bstr
*
request_auth_password
;
387
394
bstr
*
request_hostname
;
395
400
int
request_port_number
;
401
402
403
// Response fields
404
406
unsigned
int
response_ignored_lines
;
407
409
bstr
*
response_line
;
410
412
bstr
*
response_protocol
;
413
418
int
response_protocol_number
;
419
424
bstr
*
response_status
;
425
430
int
response_status_number
;
431
436
int
response_status_expected_number
;
437
439
bstr
*
response_message
;
440
442
int
seen_100continue
;
443
445
htp_table_t
*
response_headers
;
446
447
/* HTTP 1.1 RFC
448
*
449
* 4.3 Message Body
450
*
451
* The message-body (if any) of an HTTP message is used to carry the
452
* entity-body associated with the request or response. The message-body
453
* differs from the entity-body only when a transfer-coding has been
454
* applied, as indicated by the Transfer-Encoding header field (section
455
* 14.41).
456
*
457
* message-body = entity-body
458
* | <entity-body encoded as per Transfer-Encoding>
459
*/
460
469
int64_t
response_message_len
;
470
479
int64_t
response_entity_len
;
480
487
int64_t
response_content_length
;
488
493
enum
htp_transfer_coding_t
response_transfer_coding
;
494
500
enum
htp_content_encoding_t
response_content_encoding
;
501
509
enum
htp_content_encoding_t
response_content_encoding_processing
;
510
516
bstr
*
response_content_type
;
517
518
519
// Common fields
520
525
uint64_t
flags
;
526
528
enum
htp_tx_req_progress_t
request_progress
;
529
531
enum
htp_tx_res_progress_t
response_progress
;
532
};
533
538
struct
htp_tx_data_t
{
540
htp_tx_t
*
tx
;
541
543
const
unsigned
char
*
data
;
544
546
size_t
len
;
547
553
int
is_last
;
554
};
555
562
struct
htp_uri_t
{
564
bstr
*
scheme
;
565
567
bstr
*
username
;
568
570
bstr
*
password
;
571
573
bstr
*
hostname
;
574
576
bstr
*
port
;
577
583
int
port_number
;
584
586
bstr
*
path
;
587
589
bstr
*
query
;
590
594
bstr
*
fragment
;
595
};
596
602
void
htp_uri_free
(
htp_uri_t
*uri);
603
609
htp_uri_t
*
htp_uri_alloc
(
void
);
610
623
void
htp_log
(
htp_connp_t
*connp,
const
char
*file,
int
line,
enum
htp_log_level_t
level,
int
code,
const
char
*fmt, ...);
624
625
#ifdef __cplusplus
626
}
627
#endif
628
629
#endif
/* _HTP_H */
Generated by
1.8.3.1