]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
code cleanup - replace SigMatchAppendPacket with SigMatchAppendSMToList
authorAnoop Saldanha <poonaatsoc@gmail.com>
Sat, 18 Feb 2012 12:02:08 +0000 (17:32 +0530)
committerVictor Julien <victor@inliniac.net>
Sat, 18 Feb 2012 16:57:06 +0000 (17:57 +0100)
29 files changed:
src/detect-ack.c
src/detect-asn1.c
src/detect-csum.c
src/detect-dsize.c
src/detect-engine-event.c
src/detect-flags.c
src/detect-flow.c
src/detect-flowbits.c
src/detect-flowint.c
src/detect-flowvar.c
src/detect-fragbits.c
src/detect-fragoffset.c
src/detect-icmp-id.c
src/detect-icmp-seq.c
src/detect-icode.c
src/detect-id.c
src/detect-ipopts.c
src/detect-ipproto.c
src/detect-itype.c
src/detect-parse.c
src/detect-parse.h
src/detect-pktvar.c
src/detect-rpc.c
src/detect-sameip.c
src/detect-seq.c
src/detect-stream_size.c
src/detect-tos.c
src/detect-ttl.c
src/detect-window.c

index c8ed77f8e83d7895c326ecf733e7e37e9db11453..e3ac7d3f6207e792aa563800fa44a7d8ca061d60 100644 (file)
@@ -112,7 +112,7 @@ static int DetectAckSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr)
     }
     sm->ctx = data;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 12eb10971880d53e731f07f1b609a7feec998318..22034be461a8077ce1630410f1fbea0e1c513254 100644 (file)
@@ -301,7 +301,7 @@ int DetectAsn1Setup(DetectEngineCtx *de_ctx, Signature *s, char *asn1str) {
     sm->type = DETECT_ASN1;
     sm->ctx = (void *)ad;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
index f0f4655f972f510759287e057ec1cea13fff1452..c462c76ff2173891a8cefb5c7ad3c8a701160cf3 100644 (file)
@@ -283,7 +283,7 @@ static int DetectIPV4CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *csum
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
@@ -378,7 +378,7 @@ static int DetectTCPV4CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *csu
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
@@ -473,7 +473,7 @@ static int DetectTCPV6CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *csu
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
@@ -569,7 +569,7 @@ static int DetectUDPV4CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *csu
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
@@ -665,7 +665,7 @@ static int DetectUDPV6CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *csu
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
@@ -760,7 +760,7 @@ static int DetectICMPV4CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *cs
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
@@ -853,7 +853,7 @@ static int DetectICMPV6CsumSetup(DetectEngineCtx *de_ctx, Signature *s, char *cs
 
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
index 2dae4c58efac0a6c6be6573d47cccfaf7221450e..828c054393fcab291bc7254c964d764bc479268a 100644 (file)
@@ -303,7 +303,7 @@ static int DetectDsizeSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr
     sm->type = DETECT_DSIZE;
     sm->ctx = (void *)dd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     SCLogDebug("dd->dsize %"PRIu16", dd->dsize2 %"PRIu16", dd->mode %"PRIu8"",
             dd->dsize, dd->dsize2, dd->mode);
index 93f7a31a03e04e82965675238eaf15a5cdf44839..bde932042a979a23a6b715174a85a904ad1885d1 100644 (file)
@@ -207,7 +207,7 @@ static int _DetectEngineEventSetup (DetectEngineCtx *de_ctx, Signature *s, char
     sm->type = smtype;
     sm->ctx = (void *)de;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     return 0;
 
 error:
index d23d9c852d50a7d5cb3f8f2cbd5bf3ab6d2b7a30..f5ae3141f0dbe541756557bcc66a9e9a7a1fb332 100644 (file)
@@ -498,7 +498,7 @@ static int DetectFlagsSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr
     sm->type = DETECT_FLAGS;
     sm->ctx = (void *)de;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 446bdab1d2c67eecd03b8c0325f48d322621bebd..8147d9fecb7075637a9995e839b4e530dbd7f7ba 100644 (file)
@@ -310,7 +310,7 @@ int DetectFlowSetup (DetectEngineCtx *de_ctx, Signature *s, char *flowstr)
     sm->type = DETECT_FLOW;
     sm->ctx = (void *)fd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     /* set the signature direction flags */
     if (fd->flags & FLOW_PKT_TOSERVER) {
index 83863ff7f406e9235b3d42769e4e2e0afb7450d8..762fc5fb0b9fae455ec903265746273e2c3611fd 100644 (file)
@@ -257,7 +257,7 @@ int DetectFlowbitSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr)
         case DETECT_FLOWBITS_CMD_ISNOTSET:
         case DETECT_FLOWBITS_CMD_ISSET:
             /* checks, so packet list */
-            SigMatchAppendPacket(s, sm);
+            SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
             break;
 
         case DETECT_FLOWBITS_CMD_SET:
index 95ec405920ecccd166dabea5d2a2bd47a4d4cb24..508bce52b89b33c599574de23758c3d66f24f07e 100644 (file)
@@ -390,7 +390,7 @@ static int DetectFlowintSetup(DetectEngineCtx *de_ctx, Signature *s, char *rawst
         case FLOWINT_MODIFIER_GT:
         case FLOWINT_MODIFIER_ISSET:
         case FLOWINT_MODIFIER_NOTSET:
-            SigMatchAppendPacket(s, sm);
+            SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
             break;
     }
 
index 865dca677256fde89f40261fbe522debd331b3dc..dddf0f84bfbce0c9c82b3dd41f9f073da779a041 100644 (file)
@@ -236,7 +236,7 @@ static int DetectFlowvarSetup (DetectEngineCtx *de_ctx, Signature *s, char *raws
     sm->type = DETECT_FLOWVAR;
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     if (dubbed) SCFree(str);
     return 0;
index 74e9b88914eadfb0174c1b8b35a2fd5147b9bf01..127d61d58b02b06bdf0e72b7ab0b2e16634d8601 100644 (file)
@@ -296,7 +296,7 @@ static int DetectFragBitsSetup (DetectEngineCtx *de_ctx, Signature *s, char *raw
     sm->type = DETECT_FRAGBITS;
     sm->ctx = (void *)de;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index b94d5ed0643cfe6599f5f92880b333b6a84da0ed..5e12be9e05eec18d0ccd3035f24fcf7394ccc3f5 100644 (file)
@@ -226,7 +226,7 @@ static int DetectFragOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, char *f
     sm->type = DETECT_FRAGOFFSET;
     sm->ctx = (void *)fragoff;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 5edec50613cbea915256d9f2180cdc20e5357868..0d07927f1ef611ef1144c05cb72a6bd04c5d3d4f 100644 (file)
@@ -232,7 +232,7 @@ static int DetectIcmpIdSetup (DetectEngineCtx *de_ctx, Signature *s, char *icmpi
     sm->type = DETECT_ICMP_ID;
     sm->ctx = (void *)iid;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index fa38c734377451a3fe3c8db1a807e1a8d60d2c35..548184bffacecac24ebb07b217cbd0684b04db29 100644 (file)
@@ -233,7 +233,7 @@ static int DetectIcmpSeqSetup (DetectEngineCtx *de_ctx, Signature *s, char *icmp
     sm->type = DETECT_ICMP_SEQ;
     sm->ctx = (void *)iseq;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
index f8f66fb70b88e129de0db12e3f08820b9ac39674..1a3362405d9d64f45490dbb36ea9d206e051954c 100644 (file)
@@ -255,7 +255,7 @@ static int DetectICodeSetup(DetectEngineCtx *de_ctx, Signature *s, char *icodest
     sm->type = DETECT_ICODE;
     sm->ctx = (void *)icd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 51fe1de1d0629a9a3f2766123bbb895a2d57d9df..1627810f02ebe0318c89cad9f145608d175c008e 100644 (file)
@@ -232,7 +232,7 @@ int DetectIdSetup (DetectEngineCtx *de_ctx, Signature *s, char *idstr)
     sm->type = DETECT_ID;
     sm->ctx = (void *)id_d;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 44f8a9f6413b53a945267e28851764a2293854a1..b6c7384418005ba006e1cb9ae4b9c39a916abd39 100644 (file)
@@ -200,7 +200,7 @@ static int DetectIpOptsSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawst
     sm->type = DETECT_IPOPTS;
     sm->ctx = (void *)de;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index bc5a71ac9b2fac6924e83a457319e4f70cbc6182..c9b9034957f421556da200cc041d25c893f55d94 100644 (file)
@@ -519,7 +519,7 @@ static int DetectIPProtoSetup(DetectEngineCtx *de_ctx, Signature *s, char *optst
         goto error;
     sm->type = DETECT_IPPROTO;
     sm->ctx = (void *)data;
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 97db15acd9c442c5402db3da9d9b5c1231fe4af2..7941ebbd969a4b058d8fc7b5436ae135e568c513 100644 (file)
@@ -255,7 +255,7 @@ static int DetectITypeSetup(DetectEngineCtx *de_ctx, Signature *s, char *itypest
     sm->type = DETECT_ITYPE;
     sm->ctx = (void *)itd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 5011fb642f5c6c85e4c25cb77addb216a6847446..77559f0cbcdbbee4946d72e155e3669cf14934c6 100644 (file)
@@ -189,32 +189,6 @@ void SigMatchRemoveSMFromList(Signature *s, SigMatch *sm, int sm_list)
     return;
 }
 
-/** \brief Append a sig match to the signatures non-payload match list
- *
- *  \param s signature
- *  \param new sigmatch to append
- */
-void SigMatchAppendPacket(Signature *s, SigMatch *new) {
-    if (s->sm_lists[DETECT_SM_LIST_MATCH] == NULL) {
-        s->sm_lists[DETECT_SM_LIST_MATCH] = new;
-        s->sm_lists_tail[DETECT_SM_LIST_MATCH] = new;
-        new->next = NULL;
-        new->prev = NULL;
-    } else {
-        SigMatch *cur = s->sm_lists[DETECT_SM_LIST_MATCH];
-
-        for ( ; cur->next != NULL; cur = cur->next);
-
-        cur->next = new;
-        new->next = NULL;
-        new->prev = cur;
-        s->sm_lists_tail[DETECT_SM_LIST_MATCH] = new;
-    }
-
-    new->idx = s->sm_cnt;
-    s->sm_cnt++;
-}
-
 /** \brief Append a sig match to the signatures threshold list
  *
  *  \param s signature
index dabe638387859679fe586dad049bc20610420bd7..43b9e1b16306e5945018ddc33e3478660cdb24f8 100644 (file)
@@ -57,7 +57,6 @@ void SigMatchReplace(Signature *, SigMatch *, SigMatch *);
 void SigMatchReplaceContent(Signature *, SigMatch *, SigMatch *);
 void SigMatchReplaceContentToUricontent(Signature *, SigMatch *, SigMatch *);
 
-void SigMatchAppendPacket(Signature *, SigMatch *);
 void SigMatchAppendThreshold(Signature *, SigMatch *);
 void SigMatchAppendPostMatch(Signature *, SigMatch *);
 void SigMatchAppendSMToList(Signature *, SigMatch *, int);
index bb2b6470f0e8a69cbe5c2fd54c2e9add64cf539b..9f00bc002c76748ca39a9fd26adbff33f61e6ce5 100644 (file)
@@ -231,7 +231,7 @@ static int DetectPktvarSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawst
     sm->type = DETECT_PKTVAR;
     sm->ctx = (void *)cd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     if (dubbed) SCFree(str);
     return 0;
index b41b5c0fad64b1491ef67a56f7c95952585dbdfa..6341c80efbff133fdba0118605050a7050f1162d 100644 (file)
@@ -285,7 +285,7 @@ int DetectRpcSetup (DetectEngineCtx *de_ctx, Signature *s, char *rpcstr)
     sm->type = DETECT_RPC;
     sm->ctx = (void *)rd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index dfad9a9aed57ce62710a7c312b1575cae96ead3c..b67f9c5f8c80fb0af4e9c2a9e543ddbb42d1f41d 100644 (file)
@@ -96,7 +96,7 @@ static int DetectSameipSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr
     sm->type = DETECT_SAMEIP;
     sm->ctx = NULL;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 48e752a6fd6c24b22c0c8ea0a2d15aa484905357..064782c1b2234e2e9ffa1edc8eb04397f91f8edc 100644 (file)
@@ -111,7 +111,7 @@ static int DetectSeqSetup (DetectEngineCtx *de_ctx, Signature *s, char *optstr)
     }
     sm->ctx = data;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index fe23c1c107e5aa60101b71db83b66fcb6be05902..159c591285673bf5814ab9595f8d0ed99333b5c6 100644 (file)
@@ -319,7 +319,7 @@ static int DetectStreamSizeSetup (DetectEngineCtx *de_ctx, Signature *s, char *s
     sm->type = DETECT_STREAM_SIZE;
     sm->ctx = (void *)sd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
 
     return 0;
 
index 1d2fc820b270ce5e0bb8d5b9fa2e35210825f7ce..aa4f9342e778214a1e14d41cc2b1ad41993f6092 100644 (file)
@@ -217,7 +217,7 @@ int DetectTosSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
     sm->type = DETECT_TOS;
     sm->ctx = (void *)tosd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 2a8cbba122096764808be77b83c336224dc280af..89f890bda91a7aad78f57659a905ddd941d982d9 100644 (file)
@@ -281,7 +281,7 @@ static int DetectTtlSetup (DetectEngineCtx *de_ctx, Signature *s, char *ttlstr)
     sm->type = DETECT_TTL;
     sm->ctx = (void *)ttld;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;
index 69c5bb6c09cb6a6744e3e6abe6b8bd0c98429307..d9ce412d1236d54591470bfe9ae49387c86e844e 100644 (file)
@@ -216,7 +216,7 @@ int DetectWindowSetup (DetectEngineCtx *de_ctx, Signature *s, char *windowstr)
     sm->type = DETECT_WINDOW;
     sm->ctx = (void *)wd;
 
-    SigMatchAppendPacket(s, sm);
+    SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_MATCH);
     s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
     return 0;