SCReturnInt(r);
}
-int AppLayerHandleTCPMsg(StreamMsg *smsg)
+/**
+ * \brief Attach a stream message to the TCP session for inspection
+ * in the detection engine.
+ *
+ * \param dp_ctx Thread app layer detect context
+ * \param smsg Stream message
+ *
+ * \retval 0 ok
+ * \retval -1 error
+ */
+int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn)
{
SCEnter();
- TcpSession *ssn;
StreamMsg *cur;
#ifdef PRINT
SCLogDebug("smsg %p", smsg);
BUG_ON(smsg->flow == NULL);
- ssn = smsg->flow->protoctx;
if (ssn != NULL) {
SCLogDebug("storing smsg %p in the tcp session", smsg);
stt->ra_ctx, ssn, &ssn->server,
reassemble_p, NULL);
FlowDeReference(&reassemble_p->flow);
- if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx, ssn) < 0) {
SCLogDebug("shutdown flow timeout "
"StreamTcpReassembleProcessAppLayer() erroring "
"over something");
stt->ra_ctx, ssn, &ssn->client,
reassemble_p, NULL);
FlowDeReference(&reassemble_p->flow);
- if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx, ssn) < 0) {
SCLogDebug("shutdown flow timeout "
"StreamTcpReassembleProcessAppLayer() erroring "
"over something");
* \retval 0 ok
* \retval -1 error
*/
-int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx)
+int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx, TcpSession *ssn)
{
SCEnter();
/* Handle the stream msg. No need to use locking, flow is
* already locked at this point. Don't break out of the
* loop if we encounter an error. */
- if (AppLayerHandleTCPMsg(smsg) != 0)
+ if (AppLayerHandleTCPMsg(smsg, ssn) != 0)
r = -1;
}
}
/* Process stream smsgs we may have in queue */
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (3): ");
goto end;
}
}
/* Process stream smsgs we may have in queue */
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}
}
/* Process stream smsgs we may have in queue */
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}
}
/* Process stream smsgs we may have in queue */
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}
}
/* Process stream smsgs we may have in queue */
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (4): ");
goto end;
}
"been sent (8): ");
goto end;
/* Process stream smsgs we may have in queue */
- } else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ } else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (9): ");
goto end;
}
"been sent (12): ");
goto end;
/* Process stream smsgs we may have in queue */
- } else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ } else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (13): ");
goto end;
}
/* Process stream smsgs we may have in queue */
}
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (17): ");
goto end;
}
printf("there should be a stream smsgs in the queue (6): ");
goto end;
/* Process stream smsgs we may have in queue */
- } else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ } else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (7): ");
goto end;
}
" been unpaused now (12): ");
goto end;
/* Process stream smsgs we may have in queue */
- } else if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ } else if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs (13): ");
goto end;
}
}
/* Process stream smsgs we may have in queue */
- if (StreamTcpReassembleProcessAppLayer(ra_ctx) < 0) {
+ if (StreamTcpReassembleProcessAppLayer(ra_ctx, &ssn) < 0) {
printf("failed in processing stream smsgs\n");
goto end;
}