]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mpm engine cleanup. Remove unnecessary flags
authorAnoop Saldanha <poonaatsoc@gmail.com>
Wed, 20 Jun 2012 17:56:44 +0000 (23:26 +0530)
committerVictor Julien <victor@inliniac.net>
Thu, 21 Jun 2012 14:19:48 +0000 (16:19 +0200)
src/detect-engine-mpm.c
src/detect.h

index 599901a4b0d2c6f7f7f7cbc08cb29f4ef4942944..ca5ed3c1ce041c5069fbc5143165ca8e925eaac3 100644 (file)
@@ -783,9 +783,7 @@ void PatternMatchThreadPrepare(MpmThreadCtx *mpm_thread_ctx, uint16_t mpm_matche
 /* free the pattern matcher part of a SigGroupHead */
 void PatternMatchDestroyGroup(SigGroupHead *sh) {
     /* content */
-    if (sh->flags & SIG_GROUP_HAVECONTENT &&
-        !(sh->flags & SIG_GROUP_HEAD_MPM_COPY)) {
-
+    if (!(sh->flags & SIG_GROUP_HEAD_MPM_COPY)) {
         SCLogDebug("destroying mpm_ctx %p (sh %p)",
                    sh->mpm_proto_tcp_ctx_ts, sh);
         if (sh->mpm_proto_tcp_ctx_ts != NULL &&
@@ -840,13 +838,10 @@ void PatternMatchDestroyGroup(SigGroupHead *sh) {
         }
         /* ready for reuse */
         sh->mpm_proto_other_ctx = NULL;
-
-        sh->flags &= ~SIG_GROUP_HAVECONTENT;
     }
 
     /* uricontent */
-    if (sh->flags & SIG_GROUP_HAVEURICONTENT &&
-        (sh->mpm_uri_ctx_ts != NULL || sh->mpm_uri_ctx_tc != NULL) &&
+    if ((sh->mpm_uri_ctx_ts != NULL || sh->mpm_uri_ctx_tc != NULL) &&
         !(sh->flags & SIG_GROUP_HEAD_MPM_URI_COPY)) {
         if (sh->mpm_uri_ctx_ts != NULL) {
             SCLogDebug("destroying mpm_uri_ctx %p (sh %p)", sh->mpm_uri_ctx_ts, sh);
@@ -866,32 +861,28 @@ void PatternMatchDestroyGroup(SigGroupHead *sh) {
             /* ready for reuse */
             sh->mpm_uri_ctx_tc = NULL;
         }
-
-        sh->flags &= ~SIG_GROUP_HAVEURICONTENT;
     }
 
     /* stream content */
-    if (sh->flags & SIG_GROUP_HAVESTREAMCONTENT) {
-        if (!(sh->flags & SIG_GROUP_HEAD_MPM_STREAM_COPY)) {
-            if (sh->mpm_stream_ctx_ts != NULL) {
-                SCLogDebug("destroying mpm_stream_ctx %p (sh %p)", sh->mpm_stream_ctx_ts, sh);
-                if (!MpmFactoryIsMpmCtxAvailable(sh->mpm_stream_ctx_ts)) {
-                    mpm_table[sh->mpm_stream_ctx_ts->mpm_type].DestroyCtx(sh->mpm_stream_ctx_ts);
-                    SCFree(sh->mpm_stream_ctx_ts);
-                }
-                /* ready for reuse */
-                sh->mpm_stream_ctx_ts = NULL;
+    if ((sh->mpm_stream_ctx_ts != NULL || sh->mpm_stream_ctx_tc != NULL) &&
+        !(sh->flags & SIG_GROUP_HEAD_MPM_STREAM_COPY)) {
+        if (sh->mpm_stream_ctx_ts != NULL) {
+            SCLogDebug("destroying mpm_stream_ctx %p (sh %p)", sh->mpm_stream_ctx_ts, sh);
+            if (!MpmFactoryIsMpmCtxAvailable(sh->mpm_stream_ctx_ts)) {
+                mpm_table[sh->mpm_stream_ctx_ts->mpm_type].DestroyCtx(sh->mpm_stream_ctx_ts);
+                SCFree(sh->mpm_stream_ctx_ts);
             }
-            if (sh->mpm_stream_ctx_tc != NULL) {
-                SCLogDebug("destroying mpm_stream_ctx %p (sh %p)", sh->mpm_stream_ctx_tc, sh);
-                if (!MpmFactoryIsMpmCtxAvailable(sh->mpm_stream_ctx_tc)) {
-                    mpm_table[sh->mpm_stream_ctx_tc->mpm_type].DestroyCtx(sh->mpm_stream_ctx_tc);
-                    SCFree(sh->mpm_stream_ctx_tc);
-                }
-                /* ready for reuse */
-                sh->mpm_stream_ctx_tc = NULL;
+            /* ready for reuse */
+            sh->mpm_stream_ctx_ts = NULL;
+        }
+        if (sh->mpm_stream_ctx_tc != NULL) {
+            SCLogDebug("destroying mpm_stream_ctx %p (sh %p)", sh->mpm_stream_ctx_tc, sh);
+            if (!MpmFactoryIsMpmCtxAvailable(sh->mpm_stream_ctx_tc)) {
+                mpm_table[sh->mpm_stream_ctx_tc->mpm_type].DestroyCtx(sh->mpm_stream_ctx_tc);
+                SCFree(sh->mpm_stream_ctx_tc);
             }
-            sh->flags &= ~SIG_GROUP_HAVESTREAMCONTENT;
+            /* ready for reuse */
+            sh->mpm_stream_ctx_tc = NULL;
         }
     }
 
@@ -1740,48 +1731,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
         }
     }
 
-    if (has_co_packet > 0) {
-        sh->flags |= SIG_GROUP_HAVECONTENT;
-    }
-    if (has_co_stream > 0) {
-        sh->flags |= SIG_GROUP_HAVESTREAMCONTENT;
-    }
-    if (has_co_uri > 0) {
-        sh->flags |= SIG_GROUP_HAVEURICONTENT;
-    }
-    if (has_co_hcbd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHCBDCONTENT;
-    }
-    if (has_co_hsbd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHSBDCONTENT;
-    }
-    if (has_co_hhd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHHDCONTENT;
-    }
-    if (has_co_hrhd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHRHDCONTENT;
-    }
-    if (has_co_hmd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHMDCONTENT;
-    }
-    if (has_co_hcd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHCDCONTENT;
-    }
-    if (has_co_hrud > 0) {
-        sh->flags |= SIG_GROUP_HAVEHRUDCONTENT;
-    }
-    if (has_co_hsmd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHSMDCONTENT;
-    }
-    if (has_co_hscd > 0) {
-        sh->flags |= SIG_GROUP_HAVEHSCDCONTENT;
-    }
-    if (has_co_huad > 0) {
-        sh->flags |= SIG_GROUP_HAVEHUADCONTENT;
-    }
-
     /* intialize contexes */
-    if (sh->flags & SIG_GROUP_HAVECONTENT) {
+    if (has_co_packet) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_proto_tcp_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_proto_tcp_packet, 0);
             sh->mpm_proto_tcp_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_proto_tcp_packet, 1);
@@ -1836,9 +1787,9 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #else
         MpmInitCtx(sh->mpm_proto_other_ctx, de_ctx->mpm_matcher, de_ctx->cuda_rc_mod_handle);
 #endif
-    } /* if (sh->flags & SIG_GROUP_HAVECONTENT) */
+    } /* if (has_co_packet) */
 
-    if (sh->flags & SIG_GROUP_HAVESTREAMCONTENT) {
+    if (has_co_stream) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_stream_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_stream, 0);
             sh->mpm_stream_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_stream, 1);
@@ -1860,7 +1811,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEURICONTENT) {
+    if (has_co_uri) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_uri_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_uri, 0);
             sh->mpm_uri_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_uri, 1);
@@ -1882,7 +1833,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHCBDCONTENT) {
+    if (has_co_hcbd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hcbd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hcbd, 0);
             sh->mpm_hcbd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hcbd, 1);
@@ -1904,7 +1855,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHSBDCONTENT) {
+    if (has_co_hsbd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hsbd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hsbd, 0);
             sh->mpm_hsbd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hsbd, 1);
@@ -1926,7 +1877,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHHDCONTENT) {
+    if (has_co_hhd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hhd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hhd, 0);
             sh->mpm_hhd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hhd, 1);
@@ -1948,7 +1899,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHRHDCONTENT) {
+    if (has_co_hrhd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hrhd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hrhd, 0);
             sh->mpm_hrhd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hrhd, 1);
@@ -1970,7 +1921,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHMDCONTENT) {
+    if (has_co_hmd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hmd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hmd, 0);
             sh->mpm_hmd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hmd, 1);
@@ -1992,7 +1943,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHCDCONTENT) {
+    if (has_co_hcd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hcd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hcd, 0);
             sh->mpm_hcd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hcd, 1);
@@ -2014,7 +1965,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHRUDCONTENT) {
+    if (has_co_hrud) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hrud_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hrud, 0);
             sh->mpm_hrud_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hrud, 1);
@@ -2036,7 +1987,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHSMDCONTENT) {
+    if (has_co_hsmd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hsmd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hsmd, 0);
             sh->mpm_hsmd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hsmd, 1);
@@ -2058,7 +2009,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHSCDCONTENT) {
+    if (has_co_hscd) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_hscd_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hscd, 0);
             sh->mpm_hscd_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_hscd, 1);
@@ -2080,7 +2031,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVEHUADCONTENT) {
+    if (has_co_huad) {
         if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
             sh->mpm_huad_ctx_ts = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_huad, 0);
             sh->mpm_huad_ctx_tc = MpmFactoryGetMpmCtxForProfile(de_ctx->sgh_mpm_context_huad, 1);
@@ -2102,19 +2053,19 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
 #endif
     }
 
-    if (sh->flags & SIG_GROUP_HAVECONTENT ||
-        sh->flags & SIG_GROUP_HAVESTREAMCONTENT ||
-        sh->flags & SIG_GROUP_HAVEURICONTENT ||
-        sh->flags & SIG_GROUP_HAVEHCBDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHSBDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHHDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHRHDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHMDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHCDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHSMDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHSCDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHRUDCONTENT ||
-        sh->flags & SIG_GROUP_HAVEHUADCONTENT) {
+    if (has_co_packet ||
+        has_co_stream ||
+        has_co_uri ||
+        has_co_hcbd ||
+        has_co_hsbd ||
+        has_co_hhd ||
+        has_co_hrhd ||
+        has_co_hmd ||
+        has_co_hcd ||
+        has_co_hsmd ||
+        has_co_hscd ||
+        has_co_hrud ||
+        has_co_huad) {
 
         PatternMatchPreparePopulateMpm(de_ctx, sh);
 
@@ -2124,8 +2075,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_proto_tcp_ctx_ts);
                  sh->mpm_proto_tcp_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVECONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_proto_tcp_ctx_ts->mpm_type].Prepare != NULL) {
                          mpm_table[sh->mpm_proto_tcp_ctx_ts->mpm_type].
                              Prepare(sh->mpm_proto_tcp_ctx_ts);
@@ -2138,8 +2088,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_proto_tcp_ctx_tc);
                  sh->mpm_proto_tcp_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVECONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_proto_tcp_ctx_tc->mpm_type].Prepare != NULL) {
                          mpm_table[sh->mpm_proto_tcp_ctx_tc->mpm_type].
                              Prepare(sh->mpm_proto_tcp_ctx_tc);
@@ -2153,8 +2102,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_proto_udp_ctx_ts);
                  sh->mpm_proto_udp_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVECONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_proto_udp_ctx_ts->mpm_type].Prepare != NULL) {
                          mpm_table[sh->mpm_proto_udp_ctx_ts->mpm_type].
                              Prepare(sh->mpm_proto_udp_ctx_ts);
@@ -2167,8 +2115,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_proto_udp_ctx_tc);
                  sh->mpm_proto_udp_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVECONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_proto_udp_ctx_tc->mpm_type].Prepare != NULL) {
                          mpm_table[sh->mpm_proto_udp_ctx_tc->mpm_type].
                              Prepare(sh->mpm_proto_udp_ctx_tc);
@@ -2182,8 +2129,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_proto_other_ctx);
                  sh->mpm_proto_other_ctx = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVECONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_proto_other_ctx->mpm_type].Prepare != NULL) {
                          mpm_table[sh->mpm_proto_other_ctx->mpm_type].
                              Prepare(sh->mpm_proto_other_ctx);
@@ -2197,8 +2143,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_stream_ctx_ts);
                  sh->mpm_stream_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVESTREAMCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_stream_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_stream_ctx_ts->mpm_type].Prepare(sh->mpm_stream_ctx_ts);
                  }
@@ -2209,8 +2154,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_stream_ctx_tc);
                  sh->mpm_stream_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVESTREAMCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_stream_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_stream_ctx_tc->mpm_type].Prepare(sh->mpm_stream_ctx_tc);
                  }
@@ -2222,8 +2166,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_uri_ctx_ts);
                  sh->mpm_uri_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEURICONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_uri_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_uri_ctx_ts->mpm_type].Prepare(sh->mpm_uri_ctx_ts);
                  }
@@ -2234,8 +2177,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_uri_ctx_tc);
                  sh->mpm_uri_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEURICONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_uri_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_uri_ctx_tc->mpm_type].Prepare(sh->mpm_uri_ctx_tc);
                  }
@@ -2247,8 +2189,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hcbd_ctx_ts);
                  sh->mpm_hcbd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHCBDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hcbd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hcbd_ctx_ts->mpm_type].Prepare(sh->mpm_hcbd_ctx_ts);
                  }
@@ -2259,8 +2200,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hcbd_ctx_tc);
                  sh->mpm_hcbd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHCBDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hcbd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hcbd_ctx_tc->mpm_type].Prepare(sh->mpm_hcbd_ctx_tc);
                  }
@@ -2272,8 +2212,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hsbd_ctx_ts);
                  sh->mpm_hsbd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHSBDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hsbd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hsbd_ctx_ts->mpm_type].Prepare(sh->mpm_hsbd_ctx_ts);
                  }
@@ -2284,8 +2223,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hsbd_ctx_tc);
                  sh->mpm_hsbd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHSBDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hsbd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hsbd_ctx_tc->mpm_type].Prepare(sh->mpm_hsbd_ctx_tc);
                  }
@@ -2297,8 +2235,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hhd_ctx_ts);
                  sh->mpm_hhd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHHDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hhd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hhd_ctx_ts->mpm_type].Prepare(sh->mpm_hhd_ctx_ts);
                  }
@@ -2309,8 +2246,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hhd_ctx_tc);
                  sh->mpm_hhd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHHDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hhd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hhd_ctx_tc->mpm_type].Prepare(sh->mpm_hhd_ctx_tc);
                  }
@@ -2322,8 +2258,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hrhd_ctx_ts);
                  sh->mpm_hrhd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHRHDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hrhd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hrhd_ctx_ts->mpm_type].Prepare(sh->mpm_hrhd_ctx_ts);
                  }
@@ -2334,8 +2269,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hrhd_ctx_tc);
                  sh->mpm_hrhd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHRHDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hrhd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hrhd_ctx_tc->mpm_type].Prepare(sh->mpm_hrhd_ctx_tc);
                  }
@@ -2347,8 +2281,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hmd_ctx_ts);
                  sh->mpm_hmd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHMDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hmd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hmd_ctx_ts->mpm_type].Prepare(sh->mpm_hmd_ctx_ts);
                  }
@@ -2359,8 +2292,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hmd_ctx_tc);
                  sh->mpm_hmd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHMDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hmd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hmd_ctx_tc->mpm_type].Prepare(sh->mpm_hmd_ctx_tc);
                  }
@@ -2372,8 +2304,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hcd_ctx_ts);
                  sh->mpm_hcd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHCDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hcd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hcd_ctx_ts->mpm_type].Prepare(sh->mpm_hcd_ctx_ts);
                  }
@@ -2384,8 +2315,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hcd_ctx_tc);
                  sh->mpm_hcd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHCDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hcd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hcd_ctx_tc->mpm_type].Prepare(sh->mpm_hcd_ctx_tc);
                  }
@@ -2397,8 +2327,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hrud_ctx_ts);
                  sh->mpm_hrud_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHRUDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hrud_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hrud_ctx_ts->mpm_type].Prepare(sh->mpm_hrud_ctx_ts);
                  }
@@ -2409,8 +2338,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hrud_ctx_tc);
                  sh->mpm_hrud_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHRUDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hrud_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hrud_ctx_tc->mpm_type].Prepare(sh->mpm_hrud_ctx_tc);
                  }
@@ -2421,8 +2349,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hsmd_ctx_ts);
                  sh->mpm_hsmd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHSMDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hsmd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hsmd_ctx_ts->mpm_type].Prepare(sh->mpm_hsmd_ctx_ts);
                  }
@@ -2433,8 +2360,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hsmd_ctx_tc);
                  sh->mpm_hsmd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHSMDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hsmd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hsmd_ctx_tc->mpm_type].Prepare(sh->mpm_hsmd_ctx_tc);
                  }
@@ -2445,8 +2371,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hscd_ctx_ts);
                  sh->mpm_hscd_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHSCDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hscd_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hscd_ctx_ts->mpm_type].Prepare(sh->mpm_hscd_ctx_ts);
                  }
@@ -2457,8 +2382,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_hscd_ctx_tc);
                  sh->mpm_hscd_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHSCDCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_hscd_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_hscd_ctx_tc->mpm_type].Prepare(sh->mpm_hscd_ctx_tc);
                  }
@@ -2469,8 +2393,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_huad_ctx_ts);
                  sh->mpm_huad_ctx_ts = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHUADCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_huad_ctx_ts->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_huad_ctx_ts->mpm_type].Prepare(sh->mpm_huad_ctx_ts);
                  }
@@ -2481,8 +2404,7 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                  MpmFactoryReClaimMpmCtx(sh->mpm_huad_ctx_tc);
                  sh->mpm_huad_ctx_tc = NULL;
              } else {
-                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
-                     sh->flags & SIG_GROUP_HAVEHUADCONTENT) {
+                 if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
                      if (mpm_table[sh->mpm_huad_ctx_tc->mpm_type].Prepare != NULL)
                          mpm_table[sh->mpm_huad_ctx_tc->mpm_type].Prepare(sh->mpm_huad_ctx_tc);
                  }
index 61e233caf2aeb1091db0de770af90dfee0045bce..88fa1d0174b8bbd9a7905d06d792780c5516531e 100644 (file)
@@ -796,38 +796,25 @@ typedef struct SigTableElmt_ {
     char *name;
 } SigTableElmt;
 
-#define SIG_GROUP_HAVECONTENT           0x00000001
-#define SIG_GROUP_HAVEURICONTENT        0x00000002
-#define SIG_GROUP_HAVESTREAMCONTENT     0x00000004
-#define SIG_GROUP_HAVEHCBDCONTENT       0x00000008
-#define SIG_GROUP_HAVEHHDCONTENT        0x00000010
-#define SIG_GROUP_HAVEHRHDCONTENT       0x00000020
-#define SIG_GROUP_HAVEHMDCONTENT        0x00000040
-#define SIG_GROUP_HAVEHCDCONTENT        0x00000080
-#define SIG_GROUP_HAVEHRUDCONTENT       0x00000100
-#define SIG_GROUP_HEAD_MPM_COPY         0x00000200
-#define SIG_GROUP_HEAD_MPM_URI_COPY     0x00000400
-#define SIG_GROUP_HEAD_MPM_STREAM_COPY  0x00000800
-#define SIG_GROUP_HEAD_FREE             0x00001000
-#define SIG_GROUP_HEAD_MPM_PACKET       0x00002000
-#define SIG_GROUP_HEAD_MPM_STREAM       0x00004000
-#define SIG_GROUP_HEAD_MPM_URI          0x00008000
-#define SIG_GROUP_HEAD_MPM_HCBD         0x00010000
-#define SIG_GROUP_HEAD_MPM_HHD          0x00020000
-#define SIG_GROUP_HEAD_MPM_HRHD         0x00040000
-#define SIG_GROUP_HEAD_MPM_HMD          0x00080000
-#define SIG_GROUP_HEAD_MPM_HCD          0x00100000
-#define SIG_GROUP_HEAD_MPM_HRUD         0x00200000
-#define SIG_GROUP_HEAD_REFERENCED       0x00400000 /**< sgh is being referenced by others, don't clear */
-#define SIG_GROUP_HEAD_HAVEFILEMAGIC    0x00800000
-#define SIG_GROUP_HAVEHSBDCONTENT       0x01000000
-#define SIG_GROUP_HEAD_MPM_HSBD         0x02000000
-#define SIG_GROUP_HAVEHSMDCONTENT       0x04000000
-#define SIG_GROUP_HEAD_MPM_HSMD         0x08000000
-#define SIG_GROUP_HAVEHSCDCONTENT       0x10000000
-#define SIG_GROUP_HEAD_MPM_HSCD         0x20000000
-#define SIG_GROUP_HAVEHUADCONTENT       0x40000000
-#define SIG_GROUP_HEAD_MPM_HUAD         0x80000000
+#define SIG_GROUP_HEAD_MPM_COPY         (1)
+#define SIG_GROUP_HEAD_MPM_URI_COPY     (1 << 1)
+#define SIG_GROUP_HEAD_MPM_STREAM_COPY  (1 << 2)
+#define SIG_GROUP_HEAD_FREE             (1 << 3)
+#define SIG_GROUP_HEAD_MPM_PACKET       (1 << 4)
+#define SIG_GROUP_HEAD_MPM_STREAM       (1 << 5)
+#define SIG_GROUP_HEAD_MPM_URI          (1 << 6)
+#define SIG_GROUP_HEAD_MPM_HCBD         (1 << 7)
+#define SIG_GROUP_HEAD_MPM_HHD          (1 << 8)
+#define SIG_GROUP_HEAD_MPM_HRHD         (1 << 9)
+#define SIG_GROUP_HEAD_MPM_HMD          (1 << 10)
+#define SIG_GROUP_HEAD_MPM_HCD          (1 << 11)
+#define SIG_GROUP_HEAD_MPM_HRUD         (1 << 12)
+#define SIG_GROUP_HEAD_REFERENCED       (1 << 13) /**< sgh is being referenced by others, don't clear */
+#define SIG_GROUP_HEAD_HAVEFILEMAGIC    (1 << 14)
+#define SIG_GROUP_HEAD_MPM_HSBD         (1 << 15)
+#define SIG_GROUP_HEAD_MPM_HSMD         (1 << 16)
+#define SIG_GROUP_HEAD_MPM_HSCD         (1 << 17)
+#define SIG_GROUP_HEAD_MPM_HUAD         (1 << 18)
 
 typedef struct SigGroupHeadInitData_ {
     /* list of content containers