stream-tcp-list.c File Reference
Include dependency graph for stream-tcp-list.c:

Go to the source code of this file.


void StreamTcpReassembleConfigEnableOverlapCheck (void)
 RB_GENERATE (TCPSEG, TcpSegment, rb, TcpSegmentCompare)
int TcpSegmentCompare (struct TcpSegment *a, struct TcpSegment *b)
 compare function for the Segment tree More...
int StreamTcpReassembleInsertSegment (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, TcpStream *stream, TcpSegment *seg, Packet *p, uint32_t pkt_seq, uint8_t *pkt_data, uint16_t pkt_datalen)
void StreamTcpPruneSession (Flow *f, uint8_t flags)
 Remove idle TcpSegments from TcpSession. More...

Detailed Description

Segment list functions for insertions, overlap handling, removal and more.

Definition in file stream-tcp-list.c.

Function Documentation


TcpSegment  ,
rb  ,

◆ StreamTcpPruneSession()

void StreamTcpPruneSession ( Flow f,
uint8_t  flags 

Remove idle TcpSegments from TcpSession.

Checks app progress and raw progress and progresses them if needed, slides the streaming buffer, then gets rid of excess segments.

flagsdirection flags

Definition at line 801 of file stream-tcp-list.c.

References TcpSession_::client, flags, TcpStream_::flags, TcpSession_::flags, Flow_::protoctx, TcpStream_::sb, SCEnter, SCLogDebug, SCReturn, TcpSession_::server, STREAM_TOCLIENT, STREAM_TOSERVER, StreamingBufferClear(), STREAMTCP_FLAG_APP_LAYER_DISABLED, STREAMTCP_STREAM_FLAG_DEPTH_REACHED, STREAMTCP_STREAM_FLAG_DISABLE_RAW, STREAMTCP_STREAM_FLAG_GAP, STREAMTCP_STREAM_FLAG_NOREASSEMBLY, and StreamTcpReturnStreamSegments().

Here is the call graph for this function:

◆ StreamTcpReassembleConfigEnableOverlapCheck()

void StreamTcpReassembleConfigEnableOverlapCheck ( void  )

Definition at line 38 of file stream-tcp-list.c.

◆ StreamTcpReassembleInsertSegment()

int StreamTcpReassembleInsertSegment ( ThreadVars tv,
TcpReassemblyThreadCtx ra_ctx,
TcpStream stream,
TcpSegment seg,
Packet p,
uint32_t  pkt_seq,
uint8_t *  pkt_data,
uint16_t  pkt_datalen 
Return values
-1segment not inserted
segsegment, this function takes total ownership

In case of error, this function returns the segment to the pool

Definition at line 557 of file stream-tcp-list.c.

References SCEnter.

Referenced by StreamTcpUTAddSegmentWithByte(), and StreamTcpUTAddSegmentWithPayload().

Here is the caller graph for this function:

◆ TcpSegmentCompare()

int TcpSegmentCompare ( struct TcpSegment a,
struct TcpSegment b 

compare function for the Segment tree

Main sort point is the sequence number. When sequence numbers are equal compare payload_len as well. This way the tree is sorted by seq, and in case of duplicate seqs we are sorted small to large.

Definition at line 49 of file stream-tcp-list.c.

References TcpSegment::payload_len, TcpSegment::seq, SEQ_GT, and SEQ_LT.