HTP 0.5
htp_transaction.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
34/*
35 * @file
36 * @author Ivan Ristic <ivanr@webkreator.com>
37 */
38
39#ifndef HTP_TRANSACTION_H
40#define HTP_TRANSACTION_H
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#include "htp.h"
47
60
67};
68
82};
83
91};
92
93#define HTP_CONFIG_PRIVATE 0
94#define HTP_CONFIG_SHARED 1
95
103
110
120
127void *htp_tx_get_user_data(const htp_tx_t *tx);
128
135void htp_tx_register_request_body_data(htp_tx_t *tx, int (*callback_fn)(htp_tx_data_t *));
136
143void htp_tx_register_response_body_data(htp_tx_t *tx, int (*callback_fn)(htp_tx_data_t *));
144
154
163htp_param_t *htp_tx_req_get_param(htp_tx_t *tx, const char *name, size_t name_len);
164
175htp_param_t *htp_tx_req_get_param_ex(htp_tx_t *tx, enum htp_data_source_t source, const char *name, size_t name_len);
176
183int htp_tx_req_has_body(const htp_tx_t *tx);
184
199htp_status_t htp_tx_req_process_body_data(htp_tx_t *tx, const void *data, size_t len);
200
214htp_status_t htp_tx_req_set_header(htp_tx_t *tx, const char *name, size_t name_len,
215 const char *value, size_t value_len, enum htp_alloc_strategy_t alloc);
216
230
241htp_status_t htp_tx_req_set_line(htp_tx_t *tx, const char *line, size_t line_len, enum htp_alloc_strategy_t alloc);
242
253htp_status_t htp_tx_req_set_method(htp_tx_t *tx, const char *method, size_t method_len, enum htp_alloc_strategy_t alloc);
254
264void htp_tx_req_set_method_number(htp_tx_t *tx, enum htp_method_t method_number);
265
276void htp_tx_req_set_parsed_uri(htp_tx_t *tx, htp_uri_t *parsed_uri);
277
286void htp_tx_req_set_protocol_0_9(htp_tx_t *tx, int is_protocol_0_9);
287
299htp_status_t htp_tx_req_set_protocol(htp_tx_t *tx, const char *protocol, size_t protocol_len, enum htp_alloc_strategy_t alloc);
300
316void htp_tx_req_set_protocol_number(htp_tx_t *tx, int protocol_number);
317
329htp_status_t htp_tx_req_set_uri(htp_tx_t *tx, const char *uri, size_t uri_len, enum htp_alloc_strategy_t alloc);
330
349htp_status_t htp_tx_res_process_body_data(htp_tx_t *tx, const void *data, size_t len);
350
364htp_status_t htp_tx_res_set_header(htp_tx_t *tx, const char *name, size_t name_len,
365 const char *value, size_t value_len, enum htp_alloc_strategy_t alloc);
366
380
389void htp_tx_res_set_protocol_number(htp_tx_t *tx, int protocol_number);
390
402htp_status_t htp_tx_res_set_status_line(htp_tx_t *tx, const char *line, size_t line_len, enum htp_alloc_strategy_t alloc);
403
411void htp_tx_res_set_status_code(htp_tx_t *tx, int status_code);
412
423htp_status_t htp_tx_res_set_status_message(htp_tx_t *tx, const char *msg, size_t msg_len, enum htp_alloc_strategy_t alloc);
424
440void htp_tx_set_config(htp_tx_t *tx, htp_cfg_t *cfg, int is_cfg_shared);
441
448void htp_tx_set_user_data(htp_tx_t *tx, void *user_data);
449
458
468
478
488
497
506
515
524
525#ifdef __cplusplus
526}
527#endif
528
529#endif /* HTP_HYBRID_H */
htp_data_source_t
Definition htp_core.h:317
htp_method_t
Definition htp_core.h:262
int htp_status_t
Definition htp_core.h:46
void htp_tx_req_set_method_number(htp_tx_t *tx, enum htp_method_t method_number)
Definition htp_transaction.c:323
htp_param_t * htp_tx_req_get_param_ex(htp_tx_t *tx, enum htp_data_source_t source, const char *name, size_t name_len)
Definition htp_transaction.c:259
htp_param_t * htp_tx_req_get_param(htp_tx_t *tx, const char *name, size_t name_len)
Definition htp_transaction.c:254
void htp_tx_register_request_body_data(htp_tx_t *tx, int(*callback_fn)(htp_tx_data_t *))
Definition htp_transaction.c:1534
htp_status_t htp_tx_res_set_header(htp_tx_t *tx, const char *name, size_t name_len, const char *value, size_t value_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:770
void htp_tx_res_set_protocol_number(htp_tx_t *tx, int protocol_number)
Definition htp_transaction.c:708
void htp_tx_set_user_data(htp_tx_t *tx, void *user_data)
Definition htp_transaction.c:239
void htp_tx_set_config(htp_tx_t *tx, htp_cfg_t *cfg, int is_cfg_shared)
Definition htp_transaction.c:225
htp_status_t htp_tx_req_set_header(htp_tx_t *tx, const char *name, size_t name_len, const char *value, size_t value_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:284
htp_status_t htp_tx_req_add_param(htp_tx_t *tx, htp_param_t *param)
Definition htp_transaction.c:244
htp_status_t htp_tx_req_set_protocol(htp_tx_t *tx, const char *protocol, size_t protocol_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:337
void htp_tx_req_set_parsed_uri(htp_tx_t *tx, htp_uri_t *parsed_uri)
Definition htp_transaction.c:687
int htp_tx_get_is_config_shared(const htp_tx_t *tx)
Definition htp_transaction.c:215
htp_status_t htp_tx_res_set_headers_clear(htp_tx_t *tx)
Definition htp_transaction.c:801
htp_status_t htp_tx_req_set_uri(htp_tx_t *tx, const char *uri, size_t uri_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:328
htp_status_t htp_tx_state_response_start(htp_tx_t *tx)
Definition htp_transaction.c:1496
htp_status_t htp_tx_res_set_status_message(htp_tx_t *tx, const char *msg, size_t msg_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:718
htp_status_t htp_tx_state_response_headers(htp_tx_t *tx)
Definition htp_transaction.c:1328
int htp_tx_req_has_body(const htp_tx_t *tx)
Definition htp_transaction.c:274
void htp_tx_req_set_protocol_number(htp_tx_t *tx, int protocol_number)
Definition htp_transaction.c:346
htp_status_t htp_tx_res_process_body_data(htp_tx_t *tx, const void *data, size_t len)
Definition htp_transaction.c:947
htp_status_t htp_tx_state_request_complete(htp_tx_t *tx)
Definition htp_transaction.c:1051
htp_tx_req_progress_t
Definition htp_transaction.h:75
@ HTP_REQUEST_BODY
Definition htp_transaction.h:79
@ HTP_REQUEST_HEADERS
Definition htp_transaction.h:78
@ HTP_REQUEST_TRAILER
Definition htp_transaction.h:80
@ HTP_REQUEST_NOT_STARTED
Definition htp_transaction.h:76
@ HTP_REQUEST_LINE
Definition htp_transaction.h:77
@ HTP_REQUEST_COMPLETE
Definition htp_transaction.h:81
void * htp_tx_get_user_data(const htp_tx_t *tx)
Definition htp_transaction.c:220
htp_status_t htp_tx_req_set_headers_clear(htp_tx_t *tx)
Definition htp_transaction.c:657
void htp_tx_register_response_body_data(htp_tx_t *tx, int(*callback_fn)(htp_tx_data_t *))
Definition htp_transaction.c:1545
htp_status_t htp_tx_destroy(htp_tx_t *tx)
Definition htp_transaction.c:111
htp_status_t htp_tx_res_set_status_line(htp_tx_t *tx, const char *line, size_t line_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:697
htp_status_t htp_tx_req_set_method(htp_tx_t *tx, const char *method, size_t method_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:314
htp_status_t htp_tx_state_request_line(htp_tx_t *tx)
Definition htp_transaction.c:1136
void htp_tx_res_set_status_code(htp_tx_t *tx, int status_code)
Definition htp_transaction.c:713
htp_status_t htp_tx_req_process_body_data(htp_tx_t *tx, const void *data, size_t len)
Definition htp_transaction.c:596
htp_tx_t * htp_tx_create(htp_connp_t *connp)
Definition htp_transaction.c:56
htp_status_t htp_tx_req_set_line(htp_tx_t *tx, const char *line, size_t line_len, enum htp_alloc_strategy_t alloc)
Definition htp_transaction.c:676
htp_status_t htp_tx_state_response_complete(htp_tx_t *tx)
Definition htp_transaction.c:1186
htp_tx_res_progress_t
Definition htp_transaction.h:84
@ HTP_RESPONSE_LINE
Definition htp_transaction.h:86
@ HTP_RESPONSE_TRAILER
Definition htp_transaction.h:89
@ HTP_RESPONSE_HEADERS
Definition htp_transaction.h:87
@ HTP_RESPONSE_BODY
Definition htp_transaction.h:88
@ HTP_RESPONSE_NOT_STARTED
Definition htp_transaction.h:85
@ HTP_RESPONSE_COMPLETE
Definition htp_transaction.h:90
htp_status_t htp_tx_state_request_headers(htp_tx_t *tx)
Definition htp_transaction.c:1096
void htp_tx_req_set_protocol_0_9(htp_tx_t *tx, int is_protocol_0_9)
Definition htp_transaction.c:351
htp_status_t htp_tx_state_response_line(htp_tx_t *tx)
Definition htp_transaction.c:731
htp_alloc_strategy_t
Definition htp_transaction.h:53
@ HTP_ALLOC_COPY
Definition htp_transaction.h:59
@ HTP_ALLOC_REUSE
Definition htp_transaction.h:66
htp_status_t htp_tx_state_request_start(htp_tx_t *tx)
Definition htp_transaction.c:1082
Definition htp_config_private.h:123
Definition htp_connection_parser_private.h:51
Definition htp.h:185
Definition htp.h:551
Definition htp.h:208
Definition htp.h:575