]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
detect: pass flags to inspect_id update logic
authorVictor Julien <victor@inliniac.net>
Fri, 17 Jul 2015 11:32:31 +0000 (13:32 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 22 Jul 2015 10:13:43 +0000 (12:13 +0200)
src/app-layer-parser.c
src/app-layer-parser.h
src/detect-engine-state.c
src/detect-engine-state.h

index 0e2fdfb474ef582e93169d69a6c3ec1650b69d5c..134f99095c1ce1a65a1783570b2359c047a62ddf 100644 (file)
@@ -546,15 +546,15 @@ uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint
 }
 
 void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
-                                           uint8_t ipproto, AppProto alproto, void *alstate,
-                                           uint8_t direction)
+                                           const uint8_t ipproto, const AppProto alproto,
+                                           void *alstate, const uint8_t flags)
 {
     SCEnter();
 
-    uint8_t dir = (direction & STREAM_TOSERVER) ? 0 : 1;
+    int direction = (flags & STREAM_TOSERVER) ? 0 : 1;
     uint64_t total_txs = AppLayerParserGetTxCnt(ipproto, alproto, alstate);
-    uint64_t idx = AppLayerParserGetTransactionInspectId(pstate, direction);
-    int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(ipproto, alproto, direction);
+    uint64_t idx = AppLayerParserGetTransactionInspectId(pstate, flags);
+    int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(ipproto, alproto, flags);
     void *tx;
     int state_progress;
 
@@ -562,13 +562,13 @@ void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
         tx = AppLayerParserGetTx(ipproto, alproto, alstate, idx);
         if (tx == NULL)
             continue;
-        state_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx, direction);
+        state_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx, flags);
         if (state_progress >= state_done_progress)
             continue;
         else
             break;
     }
-    pstate->inspect_id[dir] = idx;
+    pstate->inspect_id[direction] = idx;
 
     SCReturn;
 }
index b81459b7666a6dca3b4194a83c9fde299a72c128..62cb8f68691fb5c93ec86ef59ee6e87cac6f33a4 100644 (file)
@@ -158,8 +158,8 @@ uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate);
 void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate);
 uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
 void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
-                                uint8_t ipproto, AppProto alproto, void *alstate,
-                                uint8_t direction);
+                                const uint8_t ipproto, const AppProto alproto, void *alstate,
+                                const uint8_t flags);
 AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate);
 void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents);
 AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *alstate,
index 8d5baca8bd31c99b5e1e3c253a58b8460b56b4a8..05ca25d57fc7753e8c5305ac4c6bc221acb46c77 100644 (file)
@@ -1095,13 +1095,17 @@ end:
     return;
 }
 /** \brief update flow's inspection id's
+ *
+ *  \param f unlocked flow
+ *  \param flags direction and disruption flags
  *
  *  \note it is possible that f->alstate, f->alparser are NULL */
-void DeStateUpdateInspectTransactionId(Flow *f, uint8_t direction)
+void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags)
 {
     FLOWLOCK_WRLOCK(f);
     if (f->alparser && f->alstate) {
-        AppLayerParserSetTransactionInspectId(f->alparser, f->proto, f->alproto, f->alstate, direction);
+        AppLayerParserSetTransactionInspectId(f->alparser, f->proto,
+                                              f->alproto, f->alstate, flags);
     }
     FLOWLOCK_UNLOCK(f);
 
index 8efb9445a0df3fbbcf66a34abb5abb153527da5b..51f67448e778709a63a4f9dc7f8e1ac7659e0d20 100644 (file)
@@ -219,10 +219,10 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
 /**
  *  \brief Update the inspect id.
  *
- *  \param f Flow(unlocked).
- *  \param direction 0 for to server, 1 for toclient.
+ *  \param f unlocked flow
+ *  \param flags direction and disruption flags
  */
-void DeStateUpdateInspectTransactionId(Flow *f, uint8_t direction);
+void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags);
 
 /**
  * \brief Reset a DetectEngineState state.