Go to the documentation of this file.
25 #ifndef SURICATA_STREAM_TCP_H
26 #define SURICATA_STREAM_TCP_H
35 #define STREAM_VERBOSE false
38 #define STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION BIT_U8(0)
39 #define STREAMTCP_INIT_FLAG_DROP_INVALID BIT_U8(1)
40 #define STREAMTCP_INIT_FLAG_BYPASS BIT_U8(2)
41 #define STREAMTCP_INIT_FLAG_INLINE BIT_U8(3)
134 void *data,
const uint8_t *input,
const uint32_t input_len,
const uint64_t
offset);
137 void *cb_data,
const uint64_t
offset,
const bool eof);
140 uint64_t *progress_out,
const bool eof);
143 uint64_t *progress_out,
bool respect_inspect_depth);
162 static inline int StreamTcpCheckFlowDrops(
Packet *p)
202 const uint32_t progress);
int(* StreamReassembleRawFunc)(void *data, const uint8_t *input, const uint32_t input_len, const uint64_t offset)
uint16_t counter_tcp_midstream_pickups
int(* StreamSegmentCallback)(const Packet *, TcpSegment *, void *, const uint8_t *, uint32_t)
SC_ATOMIC_DECLARE(uint64_t, memcap)
int StreamTcpPacket(ThreadVars *tv, Packet *p, StreamTcpThread *stt, PacketQueueNoLock *pq)
struct TcpStreamCnf_ TcpStreamCnf
int StreamTcpSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback CallbackFunc, void *data)
void StreamTcpDecrMemuse(uint64_t)
int StreamTcpCheckMemcap(uint64_t)
Check if alloc'ing "size" would mean we're over memcap.
void StreamTcpReassembleConfigEnableOverlapCheck(void)
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION
uint32_t reassembly_depth
uint16_t counter_tcp_ssn_from_cache
uint16_t counter_tcp_sessions
int StreamReassembleRaw(TcpSession *ssn, const Packet *p, StreamReassembleRawFunc Callback, void *cb_data, uint64_t *progress_out, bool respect_inspect_depth)
StreamingBufferConfig sbcnf
uint64_t StreamTcpMemuseCounter(void)
uint64_t StreamTcpGetMemcap(void)
Return memcap value.
void StreamTcpSessionPktFree(Packet *)
Function to return the stream segments back to the pool.
enum ExceptionPolicy midstream_policy
void StreamTcpSessionClear(void *ssnptr)
Function to return the stream back to the pool. It returns the segments in the stream to the segment ...
simple fifo queue for packets
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NONE
uint16_t counter_tcp_ssn_memcap
enum ExceptionPolicy ssn_memcap_policy
int StreamTcpBypassEnabled(void)
void StreamTcpIncrMemuse(uint64_t)
TmEcode StreamTcpThreadInit(ThreadVars *, void *, void **)
uint16_t counter_tcp_wrong_thread
uint16_t counter_tcp_invalid_checksum
Per thread variable structure.
void StreamTcpUpdateAppLayerProgress(TcpSession *ssn, char direction, const uint32_t progress)
update reassembly progress
void StreamTcpStreamCleanup(TcpStream *stream)
bool StreamTcpInlineMode(void)
See if stream engine is operating in inline mode.
void StreamTcpDetectLogFlush(ThreadVars *tv, StreamTcpThread *stt, Flow *f, Packet *p, PacketQueueNoLock *pq)
create packets in both directions to flush out logging and detection before switching protocols....
uint8_t max_synack_queued
void StreamTcpRegisterTests(void)
void TcpSessionSetReassemblyDepth(TcpSession *ssn, uint32_t size)
void StreamTcpSessionCleanup(TcpSession *ssn)
Session cleanup function. Does not free the ssn.
uint16_t counter_tcp_ssn_from_pool
int StreamReassembleForFrame(TcpSession *ssn, TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, const uint64_t offset, const bool eof)
enum ExceptionPolicy reassembly_memcap_policy
TmEcode StreamTcp(ThreadVars *, Packet *, void *, PacketQueueNoLock *)
void StreamTcpInitConfig(bool)
To initialize the stream global configuration data.
uint16_t counter_tcp_pseudo_failed
const char * StreamTcpSsnStateAsString(const TcpSession *ssn)
const char * StreamTcpStateAsString(const enum TcpState)
uint16_t counter_tcp_active_sessions
uint32_t prealloc_sessions
TcpStreamCnf stream_config
SC_ATOMIC_DECLARE(uint64_t, reassembly_memcap)
TmEcode StreamTcpThreadDeinit(ThreadVars *tv, void *data)
uint16_t reassembly_toclient_chunk_size
void StreamTcpInitMemuse(void)
struct StreamTcpThread_ StreamTcpThread
uint64_t StreamTcpGetUsable(const TcpStream *stream, const bool eof)
int StreamTcpSetMemcap(uint64_t)
Update memcap value.
uint64_t StreamDataRightEdge(const TcpStream *stream, const bool eof)
uint16_t counter_tcp_pseudo
TcpReassemblyThreadCtx * ra_ctx
uint16_t stream_init_flags
int StreamTcpSegmentForSession(const Packet *p, uint8_t flag, StreamSegmentCallback CallbackFunc, void *data)
Run callback function on each TCP segment in both directions of a session.
uint32_t prealloc_segments
ExceptionPolicyCounters counter_tcp_ssn_memcap_eps
int EngineModeIsIPS(void)
bool TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn)
uint8_t StreamNeedsReassembly(const TcpSession *ssn, uint8_t direction)
see what if any work the TCP session still needs
uint16_t counter_tcp_ack_unseen_data
ExceptionPolicyCounters counter_tcp_midstream_eps
uint16_t reassembly_toserver_chunk_size
void StreamTcpFreeConfig(bool)
void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, const uint64_t progress)
update stream engine after detection
int StreamReassembleLog(const TcpSession *ssn, const TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, const uint64_t progress_in, uint64_t *progress_out, const bool eof)