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
43 extern "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 
127 void *htp_tx_get_user_data(const htp_tx_t *tx);
128 
135 void htp_tx_register_request_body_data(htp_tx_t *tx, int (*callback_fn)(htp_tx_data_t *));
136 
143 void htp_tx_register_response_body_data(htp_tx_t *tx, int (*callback_fn)(htp_tx_data_t *));
144 
154 
163 htp_param_t *htp_tx_req_get_param(htp_tx_t *tx, const char *name, size_t name_len);
164 
175 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);
176 
183 int htp_tx_req_has_body(const htp_tx_t *tx);
184 
199 htp_status_t htp_tx_req_process_body_data(htp_tx_t *tx, const void *data, size_t len);
200 
214 htp_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 
241 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);
242 
253 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);
254 
264 void htp_tx_req_set_method_number(htp_tx_t *tx, enum htp_method_t method_number);
265 
276 void htp_tx_req_set_parsed_uri(htp_tx_t *tx, htp_uri_t *parsed_uri);
277 
286 void htp_tx_req_set_protocol_0_9(htp_tx_t *tx, int is_protocol_0_9);
287 
299 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);
300 
316 void htp_tx_req_set_protocol_number(htp_tx_t *tx, int protocol_number);
317 
329 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);
330 
349 htp_status_t htp_tx_res_process_body_data(htp_tx_t *tx, const void *data, size_t len);
350 
364 htp_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 
389 void htp_tx_res_set_protocol_number(htp_tx_t *tx, int protocol_number);
390 
402 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);
403 
411 void htp_tx_res_set_status_code(htp_tx_t *tx, int status_code);
412 
423 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);
424 
440 void htp_tx_set_config(htp_tx_t *tx, htp_cfg_t *cfg, int is_cfg_shared);
441 
448 void 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 */
Definition: htp_config_private.h:123
htp_status_t htp_tx_destroy(htp_tx_t *tx)
Definition: htp_transaction.c:108
void htp_tx_req_set_protocol_number(htp_tx_t *tx, int protocol_number)
Definition: htp_transaction.c:343
void * htp_tx_get_user_data(const htp_tx_t *tx)
Definition: htp_transaction.c:217
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:709
htp_tx_req_progress_t
Definition: htp_transaction.h:75
Definition: htp.h:569
htp_status_t htp_tx_state_response_line(htp_tx_t *tx)
Definition: htp_transaction.c:670
htp_status_t htp_tx_state_request_start(htp_tx_t *tx)
Definition: htp_transaction.c:915
htp_status_t htp_tx_state_response_start(htp_tx_t *tx)
Definition: htp_transaction.c:1313
int htp_tx_req_has_body(const htp_tx_t *tx)
Definition: htp_transaction.c:271
void htp_tx_req_set_parsed_uri(htp_tx_t *tx, htp_uri_t *parsed_uri)
Definition: htp_transaction.c:626
void htp_tx_register_response_body_data(htp_tx_t *tx, int(*callback_fn)(htp_tx_data_t *))
Definition: htp_transaction.c:1366
htp_status_t htp_tx_state_response_complete(htp_tx_t *tx)
Definition: htp_transaction.c:1019
Definition: htp_transaction.h:88
void htp_tx_res_set_protocol_number(htp_tx_t *tx, int protocol_number)
Definition: htp_transaction.c:647
htp_status_t htp_tx_state_response_headers(htp_tx_t *tx)
Definition: htp_transaction.c:1157
htp_status_t htp_tx_res_set_headers_clear(htp_tx_t *tx)
Definition: htp_transaction.c:740
Definition: htp_transaction.h:87
htp_status_t htp_tx_res_process_body_data(htp_tx_t *tx, const void *data, size_t len)
Definition: htp_transaction.c:796
htp_tx_t * htp_tx_create(htp_connp_t *connp)
Definition: htp_transaction.c:53
htp_param_t * htp_tx_req_get_param(htp_tx_t *tx, const char *name, size_t name_len)
Definition: htp_transaction.c:251
void htp_tx_res_set_status_code(htp_tx_t *tx, int status_code)
Definition: htp_transaction.c:652
void htp_tx_req_set_method_number(htp_tx_t *tx, enum htp_method_t method_number)
Definition: htp_transaction.c:320
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:281
int htp_status_t
Definition: htp_core.h:46
htp_status_t htp_tx_req_set_headers_clear(htp_tx_t *tx)
Definition: htp_transaction.c:596
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:636
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:334
Definition: htp_transaction.h:80
Definition: htp_transaction.h:81
htp_method_t
Definition: htp_core.h:254
Definition: htp.h:185
Definition: htp_transaction.h:86
htp_status_t htp_tx_req_add_param(htp_tx_t *tx, htp_param_t *param)
Definition: htp_transaction.c:241
void htp_tx_set_user_data(htp_tx_t *tx, void *user_data)
Definition: htp_transaction.c:236
void htp_tx_req_set_protocol_0_9(htp_tx_t *tx, int is_protocol_0_9)
Definition: htp_transaction.c:348
Definition: htp_transaction.h:78
Definition: htp_transaction.h:59
htp_status_t htp_tx_req_process_body_data(htp_tx_t *tx, const void *data, size_t len)
Definition: htp_transaction.c:564
Definition: htp_connection_parser_private.h:51
htp_status_t htp_tx_state_request_line(htp_tx_t *tx)
Definition: htp_transaction.c:969
Definition: htp_transaction.h:90
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:657
htp_status_t htp_tx_state_request_complete(htp_tx_t *tx)
Definition: htp_transaction.c:884
Definition: htp_transaction.h:66
htp_tx_res_progress_t
Definition: htp_transaction.h:84
Definition: htp_transaction.h:89
Definition: htp_transaction.h:76
htp_alloc_strategy_t
Definition: htp_transaction.h:53
Definition: htp_transaction.h:85
int htp_tx_get_is_config_shared(const htp_tx_t *tx)
Definition: htp_transaction.c:212
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:615
void htp_tx_set_config(htp_tx_t *tx, htp_cfg_t *cfg, int is_cfg_shared)
Definition: htp_transaction.c:222
void htp_tx_register_request_body_data(htp_tx_t *tx, int(*callback_fn)(htp_tx_data_t *))
Definition: htp_transaction.c:1355
htp_status_t htp_tx_state_request_headers(htp_tx_t *tx)
Definition: htp_transaction.c:929
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:311
Definition: htp_transaction.h:77
Definition: htp.h:545
htp_data_source_t
Definition: htp_core.h:309
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:325
Definition: htp.h:208
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:256
Definition: htp_transaction.h:79