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 */