]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
profiling: fix compilation
authorVictor Julien <victor@inliniac.net>
Wed, 8 Jan 2014 15:11:43 +0000 (16:11 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jan 2014 10:53:40 +0000 (11:53 +0100)
Stream engine can't access app layer proto detection datatypes
anymore, so moved some of the logic into app-layer.c

src/app-layer.c
src/app-layer.h
src/stream-tcp-reassemble.c
src/stream-tcp.c

index 86fe6239fa227a71dd3422e2c56420b51a8e54ca..81ab7e49cb59f90521fbd111d6d9933046e63704 100644 (file)
@@ -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
index f44106d51ad688f8394476a8c2ff58da182398c7..10dd1acd2695ba7fc35bb7d8761c1bd8d82d70a7 100644 (file)
@@ -118,6 +118,10 @@ void *AppLayerGetCtxThread(void);
  */
 void AppLayerDestroyCtxThread(void *tctx);
 
+
+void AppLayerProfilingReset(void *tctx);
+void AppLayerProfilingStore(void *tctx, Packet *p);
+
 /***** Unittests *****/
 
 #ifdef UNITTESTS
index a05391ba34f493f5aa86ec9faebb337940c54113..9bd0b79f480f2b98b39b2a7437647c64ec0390d5 100644 (file)
@@ -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 */
index d9ba11838093077d826d818136e4100fed29ace0..f004b602c1b0bc2f07944901d47a6c29f017f21d 100644 (file)
@@ -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);