profiling: fix compilation

Stream engine can't access app layer proto detection datatypes
anymore, so moved some of the logic into app-layer.c
pull/753/head
Victor Julien 11 years ago
parent 1cbd1cdf36
commit 106e1c7d19

@ -470,11 +470,11 @@ int AppLayerHandleUdp(void *app_tctx, Packet *p, Flow *f)
/* if we don't have a data object here we are not getting it
* a start msg should have gotten us one */
if (f->alproto != ALPROTO_UNKNOWN) {
PACKET_PROFILING_APP_START(dp_ctx, f->alproto);
PACKET_PROFILING_APP_START(tctx, f->alproto);
r = AppLayerParserParse(tctx->alp_tctx,
f, f->alproto, flags,
p->payload, p->payload_len);
PACKET_PROFILING_APP_END(dp_ctx, f->alproto);
PACKET_PROFILING_APP_END(tctx, f->alproto);
} else {
SCLogDebug("udp session has started, but failed to detect alproto "
"for l7");
@ -580,6 +580,22 @@ void AppLayerDestroyCtxThread(void *tctx)
SCReturn;
}
/* profiling */
void AppLayerProfilingReset(void *tctx) {
#ifdef PROFILING
AppLayerCtxThread *app_tctx = tctx;
PACKET_PROFILING_APP_RESET(app_tctx);
#endif
}
void AppLayerProfilingStore(void *tctx, Packet *p) {
#ifdef PROFILING
AppLayerCtxThread *app_tctx = tctx;
PACKET_PROFILING_APP_STORE(app_tctx, p);
#endif
}
/***** Unittests *****/
#ifdef UNITTESTS

@ -118,6 +118,10 @@ void *AppLayerGetCtxThread(void);
*/
void AppLayerDestroyCtxThread(void *tctx);
void AppLayerProfilingReset(void *tctx);
void AppLayerProfilingStore(void *tctx, Packet *p);
/***** Unittests *****/
#ifdef UNITTESTS

@ -1891,7 +1891,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
STREAM_SET_INLINE_FLAGS(ssn, stream, p, flags);
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
NULL, 0, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
} else {
SCLogDebug("no segments in the list to reassemble");
@ -1970,7 +1970,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
/* process what we have so far */
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_sent += data_len;
data_len = 0;
@ -1999,7 +1999,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
STREAM_SET_INLINE_FLAGS(ssn, stream, p, flags);
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
NULL, 0, flags|STREAM_GAP);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_len = 0;
/* set a GAP flag and make sure not bothering this stream anymore */
@ -2071,7 +2071,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
BUG_ON(data_len > sizeof(data));
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_sent += data_len;
data_len = 0;
}
@ -2125,7 +2125,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
BUG_ON(data_len > sizeof(data));
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_sent += data_len;
data_len = 0;
}
@ -2161,7 +2161,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
BUG_ON(data_len > sizeof(data));
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_sent += data_len;
}
@ -2171,7 +2171,7 @@ int StreamTcpReassembleInlineAppLayer(ThreadVars *tv,
STREAM_SET_INLINE_FLAGS(ssn, stream, p, flags);
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
NULL, 0, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
}
/* store ra_base_seq in the stream */
@ -2678,7 +2678,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
STREAM_SET_FLAGS(ssn, stream, p, flags);
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
NULL, 0, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
SCReturnInt(0);
}
@ -2782,7 +2782,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
/* process what we have so far */
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_len = 0;
}
@ -2809,7 +2809,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
STREAM_SET_FLAGS(ssn, stream, p, flags);
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
NULL, 0, flags|STREAM_GAP);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_len = 0;
/* set a GAP flag and make sure not bothering this stream anymore */
@ -2906,7 +2906,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
BUG_ON(data_len > sizeof(data));
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_len = 0;
/* if after the first data chunk we have no alproto yet,
@ -2966,7 +2966,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
BUG_ON(data_len > sizeof(data));
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
data_len = 0;
/* if after the first data chunk we have no alproto yet,
@ -3013,7 +3013,7 @@ int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
BUG_ON(data_len > sizeof(data));
AppLayerHandleTCPData(tv, ra_ctx, p, p->flow, ssn, stream,
data, data_len, flags);
PACKET_PROFILING_APP_STORE(&ra_ctx->dp_ctx, p);
AppLayerProfilingStore(ra_ctx->app_tctx, p);
}
/* store ra_base_seq in the stream */

@ -62,6 +62,7 @@
#include "pkt-var.h"
#include "host.h"
#include "app-layer.h"
#include "app-layer-parser.h"
#include "app-layer-protos.h"
@ -4486,7 +4487,7 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
p->flags |= PKT_IGNORE_CHECKSUM;
}
PACKET_PROFILING_APP_RESET(&stt->ra_ctx->dp_ctx);
AppLayerProfilingReset(stt->ra_ctx->app_tctx);
FLOWLOCK_WRLOCK(p->flow);
ret = StreamTcpPacket(tv, p, stt, pq);

Loading…
Cancel
Save