suricata
app-layer-htp-libhtp.h
Go to the documentation of this file.
1 /*
2  * We are using this file to hold APIs copied from libhtp 0.5.x.
3  */
4 
5 /***************************************************************************
6  * Copyright (c) 2009-2010 Open Information Security Foundation
7  * Copyright (c) 2010-2013 Qualys, Inc.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are
12  * met:
13  *
14  * - Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  *
17  * - Redistributions in binary form must reproduce the above copyright
18  * notice, this list of conditions and the following disclaimer in the
19  * documentation and/or other materials provided with the distribution.
20  *
21  * - Neither the name of the Qualys, Inc. nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  ***************************************************************************/
37 
38 /**
39  * \file
40  *
41  * \author Anoop Saldanha <anoopsaldanha@gmail.com>
42  *
43  * APIs from libhtp 0.5.x.
44  */
45 
46 #ifndef SURICATA_APP_LAYER_HTP_LIBHTP__H
47 #define SURICATA_APP_LAYER_HTP_LIBHTP__H
48 
49 #include "suricata-common.h"
50 
51 // Temporary alias definitions before switching to libhtp rust
52 #define HTP_STATUS_OK HTP_OK
53 #define HTP_STATUS_ERROR HTP_ERROR
54 
55 #define HTP_SERVER_PERSONALITY_APACHE_2 HTP_SERVER_APACHE_2
56 #define HTP_SERVER_PERSONALITY_MINIMAL HTP_SERVER_MINIMAL
57 #define HTP_SERVER_PERSONALITY_GENERIC HTP_SERVER_GENERIC
58 #define HTP_SERVER_PERSONALITY_IDS HTP_SERVER_IDS
59 #define HTP_SERVER_PERSONALITY_IIS_4_0 HTP_SERVER_IIS_4_0
60 #define HTP_SERVER_PERSONALITY_IIS_5_0 HTP_SERVER_IIS_5_0
61 #define HTP_SERVER_PERSONALITY_IIS_5_1 HTP_SERVER_IIS_5_1
62 #define HTP_SERVER_PERSONALITY_IIS_6_0 HTP_SERVER_IIS_6_0
63 #define HTP_SERVER_PERSONALITY_IIS_7_0 HTP_SERVER_IIS_7_0
64 #define HTP_SERVER_PERSONALITY_IIS_7_5 HTP_SERVER_IIS_7_5
65 
66 #define HTP_FLAGS_REQUEST_INVALID_T_E HTP_REQUEST_INVALID_T_E
67 #define HTP_FLAGS_REQUEST_INVALID_C_L HTP_REQUEST_INVALID_C_L
68 #define HTP_FLAGS_HOST_MISSING HTP_HOST_MISSING
69 #define HTP_FLAGS_HOST_AMBIGUOUS HTP_HOST_AMBIGUOUS
70 #define HTP_FLAGS_HOSTU_INVALID HTP_HOSTU_INVALID
71 #define HTP_FLAGS_HOSTH_INVALID HTP_HOSTH_INVALID
72 
73 #define HTP_AUTH_TYPE_UNRECOGNIZED HTP_AUTH_UNRECOGNIZED
74 
75 #define HTP_METHOD_UNKNOWN HTP_M_UNKNOWN
76 #define HTP_METHOD_GET HTP_M_GET
77 #define HTP_METHOD_POST HTP_M_POST
78 #define HTP_METHOD_PUT HTP_M_PUT
79 #define HTP_METHOD_CONNECT HTP_M_CONNECT
80 
81 #define HTP_STREAM_STATE_ERROR HTP_STREAM_ERROR
82 #define HTP_STREAM_STATE_TUNNEL HTP_STREAM_TUNNEL
83 
84 #define HTP_PROTOCOL_V1_1 HTP_PROTOCOL_1_1
85 #define HTP_PROTOCOL_V1_0 HTP_PROTOCOL_1_0
86 #define HTP_PROTOCOL_V0_9 HTP_PROTOCOL_0_9
87 
88 #define HTP_REQUEST_PROGRESS_LINE HTP_REQUEST_LINE
89 #define HTP_REQUEST_PROGRESS_HEADERS HTP_REQUEST_HEADERS
90 #define HTP_REQUEST_PROGRESS_BODY HTP_REQUEST_BODY
91 #define HTP_REQUEST_PROGRESS_TRAILER HTP_REQUEST_TRAILER
92 #define HTP_REQUEST_PROGRESS_COMPLETE HTP_REQUEST_COMPLETE
93 #define HTP_RESPONSE_PROGRESS_LINE HTP_RESPONSE_LINE
94 #define HTP_RESPONSE_PROGRESS_HEADERS HTP_RESPONSE_HEADERS
95 #define HTP_RESPONSE_PROGRESS_BODY HTP_RESPONSE_BODY
96 #define HTP_RESPONSE_PROGRESS_TRAILER HTP_RESPONSE_TRAILER
97 #define HTP_RESPONSE_PROGRESS_COMPLETE HTP_RESPONSE_COMPLETE
98 
99 // Functions introduced to handle opaque htp_tx_t
100 #define htp_tx_flags(tx) tx->flags
101 #define htp_tx_is_protocol_0_9(tx) tx->is_protocol_0_9
102 #define htp_tx_request_auth_type(tx) tx->request_auth_type
103 #define htp_tx_request_hostname(tx) tx->request_hostname
104 #define htp_tx_request_line(tx) tx->request_line
105 #define htp_tx_request_message_len(tx) tx->request_message_len
106 #define htp_tx_request_method(tx) tx->request_method
107 #define htp_tx_request_method_number(tx) tx->request_method_number
108 #define htp_tx_request_port_number(tx) tx->request_port_number
109 #define htp_tx_request_progress(tx) tx->request_progress
110 #define htp_tx_request_protocol(tx) tx->request_protocol
111 #define htp_tx_request_protocol_number(tx) tx->request_protocol_number
112 #define htp_tx_request_uri(tx) tx->request_uri
113 #define htp_tx_request_headers(tx) tx->request_headers
114 #define htp_tx_response_headers(tx) tx->response_headers
115 #define htp_tx_response_protocol(tx) tx->response_protocol
116 #define htp_tx_response_line(tx) tx->response_line
117 #define htp_tx_response_message(tx) tx->response_message
118 #define htp_tx_response_message_len(tx) tx->response_message_len
119 #define htp_tx_response_status(tx) tx->response_status
120 #define htp_tx_response_status_number(tx) tx->response_status_number
121 #define htp_tx_response_progress(tx) tx->response_progress
122 #define htp_tx_response_protocol_number(tx) tx->response_protocol_number
123 
124 bstr *SCHTPGenerateNormalizedUri(htp_tx_t *tx, htp_uri_t *uri, bool uri_include_all);
125 
126 #endif /* SURICATA_APP_LAYER_HTP_LIBHTP__H */
SCHTPGenerateNormalizedUri
bstr * SCHTPGenerateNormalizedUri(htp_tx_t *tx, htp_uri_t *uri, bool uri_include_all)
Generates the normalized uri.
Definition: app-layer-htp-libhtp.c:64
suricata-common.h