]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2141 in SNORT/snort3 from ~RUCOMBS/snort3:flowbits_fixups to...
authorRuss Combs (rucombs) <rucombs@cisco.com>
Wed, 8 Apr 2020 18:08:06 +0000 (18:08 +0000)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Wed, 8 Apr 2020 18:08:06 +0000 (18:08 +0000)
Squashed commit of the following:

commit 6a0647dc39ea3806b2cbb51cd19833a25b6b1d51
Author: russ <rucombs@cisco.com>
Date:   Wed Apr 8 10:00:16 2020 -0400

    flowbits: fix build warnings from latest cleanup

src/ips_options/ips_flowbits.cc
src/utils/sflsq.cc
src/utils/sflsq.h

index 80e8f63257679df87b030a0fb847c220562419f4..25d1ad576812836edc7b20eed50f7f69e31e19af 100644 (file)
@@ -452,7 +452,7 @@ class FlowbitsModule : public Module
 {
 public:
     FlowbitsModule() : Module(s_name, s_help, s_params) { }
-    ~FlowbitsModule() { delete fbc; }
+    ~FlowbitsModule() override { delete fbc; }
 
     bool begin(const char*, int, SnortConfig*) override;
     bool set(const char*, Value&, SnortConfig*) override;
index 0627955ae34fbe404ff9c41b856b2ed633f5af45..4f54d6c1b06ddf9e5be062c973872d062a60a31d 100644 (file)
@@ -145,7 +145,7 @@ NODE_DATA sflist_next(SF_LNODE** v)
 NODE_DATA sflist_remove_head(SF_LIST* s)
 {
     NODE_DATA ndata = nullptr;
-    SF_QNODE* q;
+    SF_LNODE* q;
     if ( s && s->head  )
     {
         q = s->head;
@@ -166,7 +166,7 @@ NODE_DATA sflist_remove_head(SF_LIST* s)
 NODE_DATA sflist_remove_tail(SF_LIST* s)
 {
     NODE_DATA ndata = nullptr;
-    SF_QNODE* q;
+    SF_LNODE* q;
     if (s && s->tail)
     {
         q = s->tail;
@@ -185,53 +185,6 @@ NODE_DATA sflist_remove_tail(SF_LIST* s)
     return (NODE_DATA)ndata;
 }
 
-void sflist_remove_node(SF_LIST* s, SF_LNODE* n)
-{
-    SF_LNODE* cur;
-
-    if ( n == s->head )
-    {
-        s->head = s->head->next;
-        s->count--;
-
-        if (!s->head)
-            s->tail = nullptr;
-        else
-            s->head->prev = nullptr;
-
-        snort_free(n);
-        return;
-    }
-    else if ( n == s->tail )
-    {
-        s->tail = s->tail->prev;
-        s->count--;
-
-        if (!s->tail )
-            s->head = nullptr;
-        else
-            s->tail->next = nullptr;
-
-        snort_free(n);
-        return;
-    }
-
-    for (cur = s->head;
-        cur!= nullptr;
-        cur = cur->next )
-    {
-        if ( n == cur )
-        {
-            /* unlink a middle node */
-            n->next->prev = n->prev;
-            n->prev->next = n->next;
-            s->count--;
-            snort_free(n);
-            return;
-        }
-    }
-}
-
 int sflist_count(SF_LIST* s)
 {
     if (!s)
@@ -279,34 +232,3 @@ void sflist_static_free_all(SF_LIST* s, void (* nfree)(void*) )
 
 }
 
-// ----- queue methods -----
-
-using namespace snort;
-
-SF_QUEUE* sfqueue_new()
-{
-    return (SF_QUEUE*)sflist_new();
-}
-
-void sfqueue_add(SF_QUEUE* s, NODE_DATA ndata)
-{
-    sflist_add_tail(s, ndata);
-}
-
-
-NODE_DATA sfqueue_remove(SF_QUEUE* s)
-{
-    return (NODE_DATA)sflist_remove_head(s);
-}
-
-int sfqueue_count(SF_QUEUE* s)
-{
-    if (!s)
-        return 0;
-    return s->count;
-}
-
-void sfqueue_free_all(SF_QUEUE* s,void (* nfree)(void*) )
-{
-    sflist_free_all(s, nfree);
-}
index 78a7c0792d112e76289ea48c0d9ea32004edfdd6..3e736dbb46ff3cced733df850bc49ca67d75f2ea 100644 (file)
 
 #include "main/snort_types.h"
 
-// Simple LIST, STACK, QUEUE DICTIONARY (LIST BASED) interface
-// All of these functions are based on lists.
-// Use STL containers instead of these if possible.
+// Simple LIST interface
+// Switch to STL containers ASAP
+// FIXIT-M deprecated, we are going to delete this
 
-// FIXIT-L if we're going to keep sflsq around (instead of using STL data
-// structures) it would make sense to template the interfaces instead of
-// using a void* for data
-
-// FIXIT-M but we are going to delete sflsq and use STL instead
-
-// Note that NODE_DATA can be redefined with the typedef below
 typedef void* NODE_DATA;
 
-// Simple list, stack, or queue NODE
 typedef struct sf_lnode
 {
     struct sf_lnode* next;
     struct sf_lnode* prev;
     NODE_DATA ndata;
 }
-SF_QNODE,SF_SNODE,SF_LNODE;
-
-// Integer Stack - uses an array from the subroutines stack
-struct SF_ISTACK
-{
-    unsigned* stack;
-    unsigned nstack;
-    unsigned n;
-};
-
-// Pointer Stack - uses an array from the subroutines stack
-struct SF_PSTACK
-{
-    void** stack;
-    unsigned nstack;
-    unsigned n;
-};
+SF_LNODE;
 
-// Simple Structure for Queue's, stacks, lists
 struct sf_list
 {
     SF_LNODE* head, * tail;
     unsigned count;
 };
 
-typedef sf_list SF_QUEUE;
 typedef sf_list SF_LIST;
 
 // -----------------------------------------------------------------------------
 // Linked List Interface
 // -----------------------------------------------------------------------------
+
 namespace snort
 {
 SO_PUBLIC SF_LIST* sflist_new();
@@ -83,7 +58,6 @@ SO_PUBLIC void sflist_add_head(SF_LIST*, NODE_DATA);
 SO_PUBLIC void sflist_add_before(SF_LIST*, SF_LNODE*, NODE_DATA);
 SO_PUBLIC NODE_DATA sflist_remove_head(SF_LIST*);
 SO_PUBLIC NODE_DATA sflist_remove_tail(SF_LIST*);
-SO_PUBLIC void sflist_remove_node(SF_LIST*, SF_LNODE*);
 SO_PUBLIC int sflist_count(SF_LIST*);
 SO_PUBLIC NODE_DATA sflist_first(SF_LIST*, SF_LNODE**);
 SO_PUBLIC NODE_DATA sflist_next(SF_LNODE**);
@@ -92,14 +66,5 @@ SO_PUBLIC void sflist_free_all(SF_LIST*, void (* free)(void*) );
 SO_PUBLIC void sflist_static_free_all(SF_LIST*, void (* nfree)(void*));
 }
 
-// -----------------------------------------------------------------------------
-//  Queue Interface ( FIFO - First in, First out )
-// -----------------------------------------------------------------------------
-SF_QUEUE* sfqueue_new();
-void sfqueue_add(SF_QUEUE*, NODE_DATA);
-NODE_DATA sfqueue_remove(SF_QUEUE*);
-int sfqueue_count(SF_QUEUE*);
-void sfqueue_free_all(SF_QUEUE*, void (* free)(void*) );
-
 #endif