00001 /*************************************************************************** 00002 * Copyright (c) 2009-2010 Open Information Security Foundation 00003 * Copyright (c) 2010-2013 Qualys, Inc. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are 00008 * met: 00009 * 00010 * - Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 00013 * - Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 00017 * - Neither the name of the Qualys, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived from 00019 * this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 ***************************************************************************/ 00033 00039 #ifndef HTP_CONNECTION_PARSER_PRIVATE_H 00040 #define HTP_CONNECTION_PARSER_PRIVATE_H 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 #include "htp_core.h" 00047 00051 struct htp_connp_t { 00052 00053 // General fields 00054 00056 htp_cfg_t *cfg; 00057 00059 htp_conn_t *conn; 00060 00062 const void *user_data; 00063 00069 htp_log_t *last_error; 00070 00071 00072 // Request parser fields 00073 00075 enum htp_stream_state_t in_status; 00076 00078 enum htp_stream_state_t out_status; 00079 00085 unsigned int out_data_other_at_tx_end; 00086 00091 htp_time_t in_timestamp; 00092 00094 unsigned char *in_current_data; 00095 00097 int64_t in_current_len; 00098 00100 int64_t in_current_read_offset; 00101 00106 int64_t in_current_consume_offset; 00107 00113 int64_t in_current_receiver_offset; 00114 00116 size_t in_chunk_count; 00117 00119 size_t in_chunk_request_index; 00120 00122 int64_t in_stream_offset; 00123 00128 int in_next_byte; 00129 00131 unsigned char *in_buf; 00132 00134 size_t in_buf_size; 00135 00140 bstr *in_header; 00141 00143 htp_tx_t *in_tx; 00144 00150 int64_t in_content_length; 00151 00157 int64_t in_body_data_left; 00158 00163 int64_t in_chunked_length; 00164 00166 int (*in_state)(htp_connp_t *); 00167 00169 int (*in_state_previous)(htp_connp_t *); 00170 00172 htp_hook_t *in_data_receiver_hook; 00173 00174 // Response parser fields 00175 00181 size_t out_next_tx_index; 00182 00184 htp_time_t out_timestamp; 00185 00187 unsigned char *out_current_data; 00188 00190 int64_t out_current_len; 00191 00193 int64_t out_current_read_offset; 00194 00199 int64_t out_current_consume_offset; 00200 00206 int64_t out_current_receiver_offset; 00207 00209 int64_t out_stream_offset; 00210 00212 int out_next_byte; 00213 00215 unsigned char *out_buf; 00216 00218 size_t out_buf_size; 00219 00224 bstr *out_header; 00225 00227 htp_tx_t *out_tx; 00228 00233 int64_t out_content_length; 00234 00236 int64_t out_body_data_left; 00237 00242 int64_t out_chunked_length; 00243 00245 int (*out_state)(htp_connp_t *); 00246 00248 int (*out_state_previous)(htp_connp_t *); 00249 00251 htp_hook_t *out_data_receiver_hook; 00252 00254 htp_decompressor_t *out_decompressor; 00255 00257 htp_file_t *put_file; 00258 }; 00259 00265 void htp_connp_in_reset(htp_connp_t *connp); 00266 00267 #ifdef __cplusplus 00268 } 00269 #endif 00270 00271 #endif /* HTP_CONNECTION_PARSER_PRIVATE_H */ 00272