SCReturnInt(0);
}
-AppLayerThreadCtx *AppLayerGetCtxThread(void)
+AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv)
{
SCEnter();
* \retval Pointer to the newly create thread context, on success;
* NULL, on failure.
*/
-AppLayerThreadCtx *AppLayerGetCtxThread(void);
+AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv);
/**
* \brief Destroys the context created by AppLayeGetCtxThread().
}
/** \brief Alloc and setup DecodeThreadVars */
-DecodeThreadVars *DecodeThreadVarsAlloc()
+DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *tv)
{
-
DecodeThreadVars *dtv = NULL;
if ( (dtv = SCMalloc(sizeof(DecodeThreadVars))) == NULL)
return NULL;
memset(dtv, 0, sizeof(DecodeThreadVars));
- dtv->app_tctx = AppLayerGetCtxThread();
+ dtv->app_tctx = AppLayerGetCtxThread(tv);
/** set config defaults */
int vlanbool = 0;
int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen);
const char *PktSrcToString(enum PktSrcEnum pkt_src);
-DecodeThreadVars *DecodeThreadVarsAlloc();
+DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *);
/* decoder functions */
int DecodeEthernet(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);
p->dst.family = AF_INET;
p->proto = IPPROTO_TCP;
- ra_ctx = StreamTcpReassembleInitThreadCtx();
+ ra_ctx = StreamTcpReassembleInitThreadCtx(&tv);
if (ra_ctx == NULL)
goto end;
StreamTcpInitConfig(TRUE);
p->dst.family = AF_INET;
p->proto = IPPROTO_TCP;
- ra_ctx = StreamTcpReassembleInitThreadCtx();
+ ra_ctx = StreamTcpReassembleInitThreadCtx(&tv);
if (ra_ctx == NULL)
goto end;
StreamTcpInitConfig(TRUE);
p->dst.family = AF_INET;
p->proto = IPPROTO_TCP;
- ra_ctx = StreamTcpReassembleInitThreadCtx();
+ ra_ctx = StreamTcpReassembleInitThreadCtx(&tv);
if (ra_ctx == NULL)
goto end;
StreamTcpInitConfig(TRUE);
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&ipv4h, 0, sizeof(IPV4Hdr));
- dtv.app_tctx = AppLayerGetCtxThread();
+ dtv.app_tctx = AppLayerGetCtxThread(&tv);
p->ip4h = &ipv4h;
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&ipv4h, 0, sizeof(IPV4Hdr));
- dtv.app_tctx = AppLayerGetCtxThread();
+ dtv.app_tctx = AppLayerGetCtxThread(&tv);
p->ip4h = &ipv4h;
PacketCopyData(p, raw_eth_pkt, pktsize);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(th_v));
- dtv.app_tctx = AppLayerGetCtxThread();
+ dtv.app_tctx = AppLayerGetCtxThread(&th_v);
FlowInitConfig(FLOW_QUIET);
DecodeEthernet(&th_v, &dtv, p, GET_PKT_DATA(p), pktsize, NULL);
SCEnter();
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
SCEnter();
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if(dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
{
SCEnter();
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
TmEcode DecodeIPFWThreadInit(ThreadVars *tv, void *initdata, void **data)
{
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
SCEnter();
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if(dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
TmEcode DecodeNFQThreadInit(ThreadVars *tv, void *initdata, void **data)
{
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
{
SCEnter();
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
SCEnter();
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
{
DecodeThreadVars *dtv = NULL;
- dtv = DecodeThreadVarsAlloc();
+ dtv = DecodeThreadVarsAlloc(tv);
if (dtv == NULL)
SCReturnInt(TM_ECODE_FAILED);
#endif
}
-TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(void)
+TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv)
{
SCEnter();
TcpReassemblyThreadCtx *ra_ctx = SCMalloc(sizeof(TcpReassemblyThreadCtx));
memset(ra_ctx, 0x00, sizeof(TcpReassemblyThreadCtx));
- ra_ctx->app_tctx = AppLayerGetCtxThread();
+ ra_ctx->app_tctx = AppLayerGetCtxThread(tv);
SCReturnPtr(ra_ctx, "TcpReassemblyThreadCtx");
}
Flow f;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
/* prevent L7 from kicking in */
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 4096);
Flow f;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
/* prevent L7 from kicking in */
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 4096);
Flow f;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
Flow f;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
uint8_t flowflags;
uint8_t check_contents[7] = {0x41, 0x41, 0x41, 0x42, 0x42, 0x43, 0x43};
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
memset(&ssn, 0, sizeof (TcpSession));
flowflags = FLOW_PKT_TOSERVER;
ack = 20;
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
StreamTcpCreateTestPacket(payload, 0x41, 3, 4); /*AAA*/
seq = 10;
ack = 20;
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
StreamTcpCreateTestPacket(payload, 0x41, 3, 4); /*AAA*/
seq = 10;
uint8_t check_contents[5] = {0x41, 0x41, 0x42, 0x42, 0x42};
TcpSession ssn;
memset(&ssn, 0, sizeof (TcpSession));
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
StreamTcpInitConfig(TRUE);
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 4096);
uint8_t th_flags;
uint8_t flowflags;
uint8_t check_contents[5] = {0x41, 0x41, 0x42, 0x42, 0x42};
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpSession ssn;
memset(&ssn, 0, sizeof (TcpSession));
TcpSession ssn;
memset(&ssn, 0, sizeof (TcpSession));
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
flowflags = FLOW_PKT_TOSERVER;
th_flag = TH_ACK|TH_PUSH;
uint8_t th_flag;
uint8_t flowflags;
uint8_t check_contents[5] = {0x41, 0x41, 0x42, 0x42, 0x42};
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpSession ssn;
memset(&ssn, 0, sizeof (TcpSession));
return 0;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpStream stream;
uint8_t ret = 0;
uint8_t check_contents[35] = {0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
return 0;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpStream stream;
memset(&stream, 0, sizeof (TcpStream));
stream.os_policy = OS_POLICY_BSD;
return 0;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpStream stream;
memset(&stream, 0, sizeof (TcpStream));
stream.os_policy = OS_POLICY_BSD;
return 0;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpStream stream;
memset(&stream, 0, sizeof (TcpStream));
stream.os_policy = OS_POLICY_BSD;
return 0;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpStream stream;
memset(&stream, 0, sizeof (TcpStream));
stream.os_policy = OS_POLICY_BSD;
TcpSession ssn;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
TcpStream stream;
uint8_t packet[1460] = "";
PacketQueue pq;
memset(&tv, 0, sizeof (ThreadVars));
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
uint8_t httpbuf2[] = "POST / HTTP/1.0\r\nUser-Agent: Victor/1.0\r\n\r\n";
uint32_t httplen2 = sizeof(httpbuf2) - 1; /* minus the \0 */
StreamTcpInitConfig(TRUE);
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 130);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
uint8_t httpbuf1[] = "P";
uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */
memset(&tv, 0, sizeof (ThreadVars));
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
uint8_t httpbuf1[] = "/ HTTP/1.0\r\nUser-Agent: Victor/1.0";
uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
STREAMTCP_SET_RA_BASE_SEQ(&ssn.server, 9);
ssn.server.isn = 9;
uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
STREAMTCP_SET_RA_BASE_SEQ(&ssn.server, 9);
ssn.server.isn = 9;
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOCLIENT, 0);
StreamTcpInitConfig(TRUE);
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
uint8_t httpbuf1[] = "GET /EVILSUFF HTTP/1.1\r\n\r\n";
uint32_t httplen1 = sizeof(httpbuf1) - 1; /* minus the \0 */
int StreamTcpReassembleInit(char);
void StreamTcpReassembleFree(char);
void StreamTcpReassembleRegisterTests(void);
-TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(void);
+TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv);
void StreamTcpReassembleFreeThreadCtx(TcpReassemblyThreadCtx *);
int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
TcpSession *ssn, TcpStream *stream,
void StreamTcpUTInit(TcpReassemblyThreadCtx **ra_ctx) {
StreamTcpInitConfig(TRUE);
- *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
}
void StreamTcpUTDeinit(TcpReassemblyThreadCtx *ra_ctx) {
"NULL");
/* init reassembly ctx */
- stt->ra_ctx = StreamTcpReassembleInitThreadCtx();
+ stt->ra_ctx = StreamTcpReassembleInitThreadCtx(tv);
if (stt->ra_ctx == NULL)
SCReturnInt(TM_ECODE_FAILED);
TcpSession ssn;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
uint8_t packet[1460] = "";
ThreadVars tv;
int result = 1;
return 0;
Flow f;
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
uint8_t packet[1460] = "";
ThreadVars tv;
int result = 1;
StreamTcpThread stt;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
int ret = 0;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
StreamTcpThread stt;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
int ret = 0;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
StreamTcpThread stt;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
int ret = 0;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
TCPHdr tcph;
TcpSession ssn;
IPV4Hdr ipv4h;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
struct in_addr addr;
struct in_addr addr1;
TCPCache tcpc;
TCPHdr tcph;
TcpSession ssn;
IPV4Hdr ipv4h;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
struct in_addr addr;
struct in_addr addr1;
TCPCache tcpc;
TCPHdr tcph;
TcpSession ssn;
IPV4Hdr ipv4h;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
struct in_addr addr;
struct in_addr addr1;
TCPCache tcpc;
StreamTcpThread stt;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
int ret = 0;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
StreamTcpThread stt;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
int ret = 0;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
StreamTcpThread stt;
uint8_t payload[4];
TCPHdr tcph;
- TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx();
+ TcpReassemblyThreadCtx *ra_ctx = StreamTcpReassembleInitThreadCtx(NULL);
int ret = 0;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));