Go to the documentation of this file.
24 #ifndef __STREAM_TCP_PRIVATE_H__
25 #define __STREAM_TCP_PRIVATE_H__
30 #define STREAMTCP_QUEUE_FLAG_TS 0x01
31 #define STREAMTCP_QUEUE_FLAG_WS 0x02
32 #define STREAMTCP_QUEUE_FLAG_SACK 0x04
58 #define TCPSEG_PKT_HDR_DEFAULT_SIZE 64
94 #define TCP_SEG_LEN(seg) (seg)->payload_len
95 #define TCP_SEG_OFFSET(seg) (seg)->sbseg.stream_offset
97 #define SEG_SEQ_RIGHT_EDGE(seg) ((seg)->seq + TCP_SEG_LEN((seg)))
101 #define STREAM_SEQ_RIGHT_EDGE(stream) (stream)->segs_right_edge
102 #define STREAM_RIGHT_EDGE(stream) (STREAM_BASE_OFFSET((stream)) + (STREAM_SEQ_RIGHT_EDGE((stream)) - (stream)->base_seq))
104 #define STREAM_HAS_SEEN_DATA(stream) StreamingBufferHasData(&(stream)->sb)
143 #define STREAM_BASE_OFFSET(stream) ((stream)->sb.region.stream_offset)
144 #define STREAM_APP_PROGRESS(stream) (STREAM_BASE_OFFSET((stream)) + (stream)->app_progress_rel)
145 #define STREAM_RAW_PROGRESS(stream) (STREAM_BASE_OFFSET((stream)) + (stream)->raw_progress_rel)
146 #define STREAM_LOG_PROGRESS(stream) (STREAM_BASE_OFFSET((stream)) + (stream)->log_progress_rel)
169 #define STREAMTCP_FLAG_MIDSTREAM 0x0001
171 #define STREAMTCP_FLAG_MIDSTREAM_ESTABLISHED 0x0002
173 #define STREAMTCP_FLAG_MIDSTREAM_SYNACK 0x0004
175 #define STREAMTCP_FLAG_TIMESTAMP 0x0008
177 #define STREAMTCP_FLAG_SERVER_WSCALE 0x0010
179 #define STREAMTCP_FLAG_CLOSED_BY_RST 0x0020
181 #define STREAMTCP_FLAG_ASYNC 0x0040
184 #define STREAMTCP_FLAG_4WHS 0x0080
187 #define STREAMTCP_FLAG_DETECTION_EVASION_ATTEMPT 0x0100
189 #define STREAMTCP_FLAG_CLIENT_SACKOK 0x0200
191 #define STREAMTCP_FLAG_SACKOK 0x0400
197 #define STREAMTCP_FLAG_3WHS_CONFIRMED 0x1000
199 #define STREAMTCP_FLAG_APP_LAYER_DISABLED 0x2000
201 #define STREAMTCP_FLAG_BYPASS 0x4000
203 #define STREAMTCP_FLAG_TCP_FAST_OPEN 0x8000
210 #define STREAMTCP_STREAM_FLAG_HAS_GAP BIT_U16(0)
212 #define STREAMTCP_STREAM_FLAG_NOREASSEMBLY BIT_U16(1)
214 #define STREAMTCP_STREAM_FLAG_KEEPALIVE BIT_U16(2)
216 #define STREAMTCP_STREAM_FLAG_DEPTH_REACHED BIT_U16(3)
218 #define STREAMTCP_STREAM_FLAG_TRIGGER_RAW BIT_U16(4)
221 #define STREAMTCP_STREAM_FLAG_TIMESTAMP BIT_U16(5)
223 #define STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP BIT_U16(6)
225 #define STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED BIT_U16(7)
227 #define STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_SKIPPED BIT_U16(8)
229 #define STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED BIT_U16(9)
231 #define STREAMTCP_STREAM_FLAG_DISABLE_RAW BIT_U16(10)
233 #define STREAMTCP_STREAM_FLAG_RST_RECV BIT_U16(11)
240 #define PAWS_24DAYS 2073600
242 #define PKT_IS_IN_RIGHT_DIR(ssn, p) ((ssn)->flags & STREAMTCP_FLAG_MIDSTREAM_SYNACK ? \
243 PKT_IS_TOSERVER(p) ? (p)->flowflags &= ~FLOW_PKT_TOSERVER \
244 (p)->flowflags |= FLOW_PKT_TOCLIENT : (p)->flowflags &= ~FLOW_PKT_TOCLIENT \
245 (p)->flowflags |= FLOW_PKT_TOSERVER : 0)
249 #define SEQ_EQ(a,b) ((int32_t)((a) - (b)) == 0)
250 #define SEQ_LT(a,b) ((int32_t)((a) - (b)) < 0)
251 #define SEQ_LEQ(a,b) ((int32_t)((a) - (b)) <= 0)
252 #define SEQ_GT(a,b) ((int32_t)((a) - (b)) > 0)
253 #define SEQ_GEQ(a,b) ((int32_t)((a) - (b)) >= 0)
255 #define STREAMTCP_SET_RA_BASE_SEQ(stream, seq) { \
257 (stream)->base_seq = (seq) + 1; \
261 #define StreamTcpSetEvent(p, e) { \
262 if ((p)->flags & PKT_STREAM_NO_EVENTS) { \
263 SCLogDebug("not setting event %d on pkt %p (%"PRIu64"), " \
264 "stream in known bad condition", (e), p, (p)->pcap_cnt); \
266 SCLogDebug("setting event %d on pkt %p (%"PRIu64")", \
267 (e), p, (p)->pcap_cnt); \
268 ENGINE_SET_EVENT((p), (e)); \
289 #define StreamTcpSetStreamFlagAppProtoDetectionCompleted(stream) \
290 ((stream)->flags |= STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED)
291 #define StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(stream) \
292 ((stream)->flags & STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED)
293 #define StreamTcpResetStreamFlagAppProtoDetectionCompleted(stream) \
294 ((stream)->flags &= ~STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED);
295 #define StreamTcpDisableAppLayerReassembly(ssn) do { \
296 SCLogDebug("setting STREAMTCP_FLAG_APP_LAYER_DISABLED on ssn %p", ssn); \
297 ((ssn)->flags |= STREAMTCP_FLAG_APP_LAYER_DISABLED); \
struct TcpStateQueue_ * next
struct TcpStateQueue_ TcpStateQueue
RB_PROTOTYPE(TCPSACK, StreamTcpSackRecord, rb, TcpSackCompare)
int TcpSegmentCompare(struct TcpSegment *a, struct TcpSegment *b)
compare function for the Segment tree
uint32_t log_progress_rel
StreamingBufferSegment sbseg
struct TcpSegmentPcapHdrStorage_ TcpSegmentPcapHdrStorage
RB_ENTRY(StreamTcpSackRecord) rb
RB_HEAD(TCPSACK, StreamTcpSackRecord)
struct TcpSegment __attribute__((__packed__)) TcpSegment
DNP3 link header.
uint32_t reassembly_depth
struct TcpStream_ TcpStream
struct TcpSession_ TcpSession
uint32_t min_inspect_depth
uint32_t raw_progress_rel
struct StreamTcpSackRecord StreamTcpSackRecord
int TcpSackCompare(struct StreamTcpSackRecord *a, struct StreamTcpSackRecord *b)
TcpSegmentPcapHdrStorage * pcap_hdr_storage
uint32_t app_progress_rel
RB_ENTRY(TcpSegment) __attribute__((__packed__)) rb
int8_t data_first_seen_dir