Go to the documentation of this file.
25 #ifndef __STREAM_TCP_H__
26 #define __STREAM_TCP_H__
34 #define STREAM_VERBOSE false
37 #define STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION BIT_U8(0)
38 #define STREAMTCP_INIT_FLAG_DROP_INVALID BIT_U8(1)
39 #define STREAMTCP_INIT_FLAG_BYPASS BIT_U8(2)
40 #define STREAMTCP_INIT_FLAG_INLINE BIT_U8(3)
130 void *data,
const uint8_t *input,
const uint32_t input_len,
const uint64_t
offset);
133 void *cb_data,
const uint64_t
offset,
const bool eof);
136 uint64_t progress_in,
137 uint64_t *progress_out,
bool eof);
140 uint64_t *progress_out,
bool respect_inspect_depth);
159 static inline int StreamTcpCheckFlowDrops(
Packet *p)
199 const uint32_t progress);
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION
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)
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 StreamTcpGetAcked(const TcpStream *stream)
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
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)
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
uint64_t StreamTcpReassembleMemuseGlobalCounter(void)
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
void StreamTcpThreadCacheCleanup(void)
int StreamReassembleForFrame(TcpSession *ssn, TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, const uint64_t offset, const bool eof)
int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn)
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
void StreamTcpThreadCacheEnable(void)
enable segment cache. Should only be done for worker threads
const char * StreamTcpSsnStateAsString(const TcpSession *ssn)
const char * StreamTcpStateAsString(const enum TcpState)
int StreamReassembleLog(TcpSession *ssn, TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, uint64_t progress_in, uint64_t *progress_out, bool eof)
uint16_t counter_tcp_active_sessions
uint32_t prealloc_sessions
TcpStreamCnf stream_config
SC_ATOMIC_DECLARE(uint64_t, reassembly_memcap)
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NONE
int StreamTcpInlineMode(void)
See if stream engine is operating in inline mode.
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
int EngineModeIsIPS(void)
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
uint16_t reassembly_toserver_chunk_size
void StreamTcpFreeConfig(bool)
void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, const uint64_t progress)
update stream engine after detection