suricata
stream-tcp-reassemble.c File Reference
Include dependency graph for stream-tcp-reassemble.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TestReassembleRawCallbackData
 

Macros

#define RAWREASSEMBLY_START(isn)
 
#define RAWREASSEMBLY_END
 
#define RAWREASSEMBLY_STEP(seq, seg, seglen, buf, buflen)
 
#define RAWREASSEMBLY_STEP_WITH_PROGRESS(seq, seg, seglen, buf, buflen, lastack, progress)
 

Macro Definition Documentation

◆ RAWREASSEMBLY_END

#define RAWREASSEMBLY_END
Value:
StreamTcpUTDeinit(ra_ctx); \
PASS

Definition at line 87 of file stream-tcp-reassemble.c.

◆ RAWREASSEMBLY_START

#define RAWREASSEMBLY_START (   isn)
Value:
TcpReassemblyThreadCtx *ra_ctx = NULL; \
TcpSession ssn; \
ThreadVars tv; \
memset(&tv, 0, sizeof(tv)); \
Packet *p = NULL; \
StreamTcpUTInit(&ra_ctx); \
StreamTcpUTInitInline(); \
stream_config.reassembly_toserver_chunk_size = 9; \
stream_config.reassembly_toclient_chunk_size = 9; \
StreamTcpUTSetupSession(&ssn); \
StreamTcpUTSetupStream(&ssn.server, (isn)); \
StreamTcpUTSetupStream(&ssn.client, (isn)); \
ssn.server.last_ack = (isn) + 1; \
ssn.client.last_ack = (isn) + 1; \
\
TcpStream *stream = &ssn.client;

Definition at line 67 of file stream-tcp-reassemble.c.

◆ RAWREASSEMBLY_STEP

#define RAWREASSEMBLY_STEP (   seq,
  seg,
  seglen,
  buf,
  buflen 
)
Value:
FAIL_IF_NULL(p); \
{ \
SCLogNotice("SEQ %u block of %u", (seq), (seglen)); \
p->flowflags = FLOW_PKT_TOSERVER; \
TCPHdr tcphdr; \
memset(&tcphdr, 0, sizeof(tcphdr)); \
p->tcph = &tcphdr; \
p->tcph->th_seq = htonl((seq)); \
p->tcph->th_ack = htonl(10); \
p->payload_len = (seglen); \
FAIL_IF(StreamTcpUTAddPayload(&tv, ra_ctx, &ssn, stream, (seq), (uint8_t *)(seg), (seglen)) != 0); \
p->flags |= PKT_STREAM_ADD; \
FAIL_IF(!(TestReassembleRawValidate(&ssn, p, (uint8_t *)(buf), (buflen)))); \
}\
PacketFree(p);

Definition at line 92 of file stream-tcp-reassemble.c.

◆ RAWREASSEMBLY_STEP_WITH_PROGRESS

#define RAWREASSEMBLY_STEP_WITH_PROGRESS (   seq,
  seg,
  seglen,
  buf,
  buflen,
  lastack,
  progress 
)
Value:
stream->last_ack = (lastack); \
RAWREASSEMBLY_STEP((seq),(seg),(seglen),(buf),(buflen)); \
FAIL_IF(STREAM_RAW_PROGRESS(stream) != (progress));

Definition at line 111 of file stream-tcp-reassemble.c.

StreamTcpUTAddPayload
int StreamTcpUTAddPayload(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, TcpSession *ssn, TcpStream *stream, uint32_t seq, uint8_t *payload, uint16_t len)
wrapper for StreamTcpReassembleHandleSegmentHandleData
Definition: stream-tcp-util.c:97
seq
uint32_t seq
Definition: stream-tcp-private.h:2
FLOW_PKT_TOSERVER
#define FLOW_PKT_TOSERVER
Definition: flow.h:222
StreamTcpUTInit
void StreamTcpUTInit(TcpReassemblyThreadCtx **ra_ctx)
Definition: stream-tcp-util.c:44
PKT_STREAM_ADD
#define PKT_STREAM_ADD
Definition: decode.h:1013
StreamTcpUTClearSession
void StreamTcpUTClearSession(TcpSession *ssn)
Definition: stream-tcp-util.c:71
FAIL_IF
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
Definition: util-unittest.h:71
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
PacketGetFromAlloc
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Definition: decode.c:173
TcpReassemblyThreadCtx_
Definition: stream-tcp-reassemble.h:60
STREAM_RAW_PROGRESS
#define STREAM_RAW_PROGRESS(stream)
Definition: stream-tcp-private.h:146