]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1057 in SNORT/snort3 from rename_hashs to master
authorHui Cao (huica) <huica@cisco.com>
Fri, 3 Nov 2017 15:06:28 +0000 (11:06 -0400)
committerHui Cao (huica) <huica@cisco.com>
Fri, 3 Nov 2017 15:06:28 +0000 (11:06 -0400)
Squashed commit of the following:

commit 7554b9b3f0a0894cb525548436916385b7a95f56
Author: Victor Roemer <viroemer@cisco.com>
Date:   Fri Nov 3 08:14:06 2017 -0400

    fix build

commit 22610f0d5112c6d2d7996712c0f24dff4a8ca87d
Author: Victor Roemer <viroemer@cisco.com>
Date:   Thu Nov 2 12:41:23 2017 -0400

    detection: rename ServiceInfo to SignatureServiceInfo

commit 1b0538ac5321fb801e6710041b8073a830433106
Author: Victor Roemer <viroemer@cisco.com>
Date:   Tue Oct 31 17:10:37 2017 -0400

    hash: Rename SFGHASH, SFXHASH, SFHASHFCN to something resonable

128 files changed:
extra/src/ips_options/ips_mss/ips_mss.cc
extra/src/ips_options/ips_pkt_num/ips_pkt_num.cc
extra/src/ips_options/ips_urg/ips_urg.cc
extra/src/ips_options/ips_wscale/ips_wscale.cc
src/detection/detection_options.cc
src/detection/detection_options.h
src/detection/fp_create.cc
src/detection/service_map.cc
src/detection/service_map.h
src/detection/signature.cc
src/detection/signature.h
src/detection/tag.cc
src/file_api/file_cache.cc
src/file_api/file_cache.h
src/file_api/file_enforcer.cc
src/file_api/file_enforcer.h
src/file_api/file_identifier.cc
src/file_api/file_identifier.h
src/filters/detection_filter.cc
src/filters/rate_filter.cc
src/filters/sfrf.cc
src/filters/sfrf.h
src/filters/sfthd.cc
src/filters/sfthd.h
src/filters/sfthd_test.cc
src/filters/sfthreshold.cc
src/flow/flow_key.cc
src/flow/flow_key.h
src/framework/ips_option.cc
src/hash/CMakeLists.txt
src/hash/Makefile.am
src/hash/ghash.cc [moved from src/hash/sfghash.cc with 80% similarity]
src/hash/ghash.h [moved from src/hash/sfghash.h with 61% similarity]
src/hash/hashfcn.cc [moved from src/hash/sfhashfcn.cc with 82% similarity]
src/hash/hashfcn.h [moved from src/hash/sfhashfcn.h with 85% similarity]
src/hash/primetable.cc [moved from src/hash/sfprimetable.cc with 99% similarity]
src/hash/primetable.h [moved from src/hash/sfprimetable.h with 93% similarity]
src/hash/test/CMakeLists.txt
src/hash/test/Makefile.am
src/hash/test/ghash_test.cc [moved from src/hash/test/sfghash_test.cc with 73% similarity]
src/hash/xhash.cc [moved from src/hash/sfxhash.cc with 77% similarity]
src/hash/xhash.h [moved from src/hash/sfxhash.h with 56% similarity]
src/hash/zhash.cc
src/hash/zhash.h
src/ips_options/ips_ack.cc
src/ips_options/ips_asn1.cc
src/ips_options/ips_base64.cc
src/ips_options/ips_bufferlen.cc
src/ips_options/ips_byte_extract.cc
src/ips_options/ips_byte_jump.cc
src/ips_options/ips_byte_math.cc
src/ips_options/ips_byte_test.cc
src/ips_options/ips_content.cc
src/ips_options/ips_cvs.cc
src/ips_options/ips_dsize.cc
src/ips_options/ips_flags.cc
src/ips_options/ips_flow.cc
src/ips_options/ips_flowbits.cc
src/ips_options/ips_fragbits.cc
src/ips_options/ips_fragoffset.cc
src/ips_options/ips_hash.cc
src/ips_options/ips_icmp_id.cc
src/ips_options/ips_icmp_seq.cc
src/ips_options/ips_icode.cc
src/ips_options/ips_id.cc
src/ips_options/ips_ip_proto.cc
src/ips_options/ips_ipopts.cc
src/ips_options/ips_isdataat.cc
src/ips_options/ips_itype.cc
src/ips_options/ips_luajit.cc
src/ips_options/ips_pcre.cc
src/ips_options/ips_regex.cc
src/ips_options/ips_replace.cc
src/ips_options/ips_rpc.cc
src/ips_options/ips_sd_pattern.cc
src/ips_options/ips_seq.cc
src/ips_options/ips_session.cc
src/ips_options/ips_so.cc
src/ips_options/ips_tos.cc
src/ips_options/ips_ttl.cc
src/ips_options/ips_window.cc
src/loggers/alert_sf_socket.cc
src/main/policy.h
src/main/snort_config.cc
src/main/snort_config.h
src/network_inspectors/appid/app_forecast.cc
src/network_inspectors/appid/appid_utils/network_set.cc
src/network_inspectors/appid/appid_utils/network_set.h
src/network_inspectors/appid/ips_appid_option.cc
src/network_inspectors/appid/length_app_cache.cc
src/network_inspectors/appid/lua_detector_api.cc
src/network_inspectors/appid/service_state.cc
src/network_inspectors/perf_monitor/flow_ip_tracker.cc
src/network_inspectors/perf_monitor/flow_ip_tracker.h
src/network_inspectors/port_scan/ps_detect.cc
src/parser/parse_conf.cc
src/parser/parse_rule.cc
src/parser/parser.cc
src/ports/port_object2.cc
src/ports/port_object2.h
src/ports/port_table.cc
src/ports/port_table.h
src/ports/port_var_table.cc
src/ports/port_var_table.h
src/profiler/rule_profiler.cc
src/service_inspectors/dce_rpc/ips_dce_iface.cc
src/service_inspectors/dce_rpc/ips_dce_opnum.cc
src/service_inspectors/dce_rpc/ips_dce_stub_data.cc
src/service_inspectors/dnp3/ips_dnp3_data.cc
src/service_inspectors/dnp3/ips_dnp3_func.cc
src/service_inspectors/dnp3/ips_dnp3_ind.cc
src/service_inspectors/dnp3/ips_dnp3_obj.cc
src/service_inspectors/gtp/ips_gtp_info.cc
src/service_inspectors/gtp/ips_gtp_type.cc
src/service_inspectors/gtp/ips_gtp_version.cc
src/service_inspectors/http_inspect/http_uri.cc
src/service_inspectors/http_inspect/ips_http.cc
src/service_inspectors/modbus/ips_modbus_data.cc
src/service_inspectors/modbus/ips_modbus_func.cc
src/service_inspectors/modbus/ips_modbus_unit.cc
src/service_inspectors/sip/ips_sip_method.cc
src/service_inspectors/sip/ips_sip_stat_code.cc
src/service_inspectors/sip/sip_utils.cc
src/service_inspectors/ssl/ips_ssl_state.cc
src/service_inspectors/ssl/ips_ssl_version.cc
src/stream/tcp/ips_stream_reassemble.cc
src/stream/tcp/ips_stream_size.cc
src/stream/udp/udp_session.cc

index 876850e75cfd4fca9dafb609daa3e36b2886e7fc..8a4934028860302a0bd5f184820d2e9058fc95ba 100644 (file)
@@ -21,7 +21,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
index 86106770bf24c11bdba4875903ddc8266ffe1282..e5f58a66ab33d828171a784a42d3b8d70ab002b4 100644 (file)
@@ -22,7 +22,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 
 static const char* s_name = "pkt_num";
index 2681099d9b513582f37fd4a3293636f9c4dd223c..c59e35348cb4d97e3723fef7aa1912743d401d77 100644 (file)
@@ -21,7 +21,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
index e55546a7d13457a5740ef86dc6b75c5826c3aa2d..39414b17f225d4d824353b44f283c62fb8adb8e9 100644 (file)
@@ -21,7 +21,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
index cbc53cfe63e11f0528baa5319f7d2765d1680f65..5b124548d6e82eaf7d0e65eadb039dff1ec2401d 100644 (file)
@@ -36,8 +36,8 @@
 
 #include "filters/detection_filter.h"
 #include "framework/cursor.h"
-#include "hash/sfhashfcn.h"
-#include "hash/sfxhash.h"
+#include "hash/hashfcn.h"
+#include "hash/xhash.h"
 #include "ips_options/extract.h"
 #include "ips_options/ips_flowbits.h"
 #include "latency/packet_latency.h"
@@ -79,7 +79,7 @@ struct detection_option_key_t
 static inline bool operator==(const struct timeval& a, const struct timeval& b)
 { return a.tv_sec == b.tv_sec && a.tv_usec == b.tv_usec; }
 
-static uint32_t detection_option_hash_func(SFHASHFCN*, const unsigned char* k, int)
+static uint32_t detection_option_hash_func(HashFnc*, const unsigned char* k, int)
 {
     const detection_option_key_t* key = (const detection_option_key_t*)k;
 
@@ -125,9 +125,9 @@ static int detection_hash_free_func(void* option_key, void*)
     return 0;
 }
 
-static SFXHASH* DetectionHashTableNew()
+static XHash* DetectionHashTableNew()
 {
-    SFXHASH* doht = sfxhash_new(HASH_RULE_OPTIONS,
+    XHash* doht = xhash_new(HASH_RULE_OPTIONS,
         sizeof(detection_option_key_t),
         0,                              /* Data size == 0, just store the ptr */
         0,                              /* Memcap */
@@ -139,15 +139,15 @@ static SFXHASH* DetectionHashTableNew()
     if (doht == nullptr)
         FatalError("Failed to create rule detection option hash table");
 
-    sfxhash_set_keyops(doht, detection_option_hash_func, detection_option_key_compare_func);
+    xhash_set_keyops(doht, detection_option_hash_func, detection_option_key_compare_func);
 
     return doht;
 }
 
-void DetectionHashTableFree(SFXHASH* doht)
+void DetectionHashTableFree(XHash* doht)
 {
     if (doht != nullptr)
-        sfxhash_delete(doht);
+        xhash_delete(doht);
 }
 
 void* add_detection_option(SnortConfig* sc, option_type_t type, void* option_data)
@@ -159,10 +159,10 @@ void* add_detection_option(SnortConfig* sc, option_type_t type, void* option_dat
     key.option_type = type;
     key.option_data = option_data;
 
-    if ( void* p = sfxhash_find(sc->detection_option_hash_table, &key) )
+    if ( void* p = xhash_find(sc->detection_option_hash_table, &key) )
         return p;
 
-    sfxhash_add(sc->detection_option_hash_table, &key, option_data);
+    xhash_add(sc->detection_option_hash_table, &key, option_data);
     return nullptr;
 }
 
@@ -209,7 +209,7 @@ static uint32_t detection_option_tree_hash(detection_option_tree_node_t* node)
     return c;
 }
 
-static uint32_t detection_option_tree_hash_func(SFHASHFCN*, const unsigned char* k, int)
+static uint32_t detection_option_tree_hash_func(HashFnc*, const unsigned char* k, int)
 {
     const detection_option_key_t* key = (const detection_option_key_t*)k;
     detection_option_tree_node_t* node;
@@ -270,15 +270,15 @@ static int detection_option_tree_free_func(void*, void* data)
     return 0;
 }
 
-void DetectionTreeHashTableFree(SFXHASH* dtht)
+void DetectionTreeHashTableFree(XHash* dtht)
 {
     if (dtht != nullptr)
-        sfxhash_delete(dtht);
+        xhash_delete(dtht);
 }
 
-static SFXHASH* DetectionTreeHashTableNew()
+static XHash* DetectionTreeHashTableNew()
 {
-    SFXHASH* dtht = sfxhash_new(
+    XHash* dtht = xhash_new(
         HASH_RULE_TREE,
         sizeof(detection_option_key_t),
         0,      /* Data size == 0, just store the ptr */
@@ -291,7 +291,7 @@ static SFXHASH* DetectionTreeHashTableNew()
     if (dtht == nullptr)
         FatalError("Failed to create rule detection option hash table");
 
-    sfxhash_set_keyops(dtht, detection_option_tree_hash_func, detection_option_tree_compare_func);
+    xhash_set_keyops(dtht, detection_option_tree_hash_func, detection_option_tree_compare_func);
 
     return dtht;
 }
@@ -332,10 +332,10 @@ void* add_detection_option_tree(SnortConfig* sc, detection_option_tree_node_t* o
     key.option_data = (void*)option_tree;
     key.option_type = RULE_OPTION_TYPE_LEAF_NODE;
 
-    if ( void* p = sfxhash_find(sc->detection_option_tree_hash_table, &key) )
+    if ( void* p = xhash_find(sc->detection_option_tree_hash_table, &key) )
         return p;
 
-    sfxhash_add(sc->detection_option_tree_hash_table, &key, option_tree);
+    xhash_add(sc->detection_option_tree_hash_table, &key, option_tree);
     return nullptr;
 }
 
@@ -808,12 +808,12 @@ static void detection_option_node_update_otn_stats(detection_option_tree_node_t*
     }
 }
 
-void detection_option_tree_update_otn_stats(SFXHASH* doth)
+void detection_option_tree_update_otn_stats(XHash* doth)
 {
     if ( !doth )
         return;
 
-    for ( auto hnode = sfxhash_findfirst(doth); hnode; hnode = sfxhash_findnext(doth) )
+    for ( auto hnode = xhash_findfirst(doth); hnode; hnode = xhash_findnext(doth) )
     {
         auto* node = (detection_option_tree_node_t*)hnode->data;
         assert(node);
index 0eb5a44d8159962bfaa9dfdd92f8602ba56b402f..0d6d6ae8c520443fdee26f84bfdd8ca48eedb679 100644 (file)
@@ -38,7 +38,7 @@
 
 struct Packet;
 struct RuleLatencyState;
-struct SFXHASH;
+struct XHash;
 
 typedef int (* eval_func_t)(void* option_data, class Cursor&, Packet*);
 
@@ -117,11 +117,11 @@ void* add_detection_option_tree(struct SnortConfig*, detection_option_tree_node_
 int detection_option_node_evaluate(
     detection_option_tree_node_t*, detection_option_eval_data_t*, class Cursor&);
 
-void DetectionHashTableFree(SFXHASH*);
-void DetectionTreeHashTableFree(SFXHASH*);
+void DetectionHashTableFree(XHash*);
+void DetectionTreeHashTableFree(XHash*);
 
 void print_option_tree(detection_option_tree_node_t*, int level);
-void detection_option_tree_update_otn_stats(SFXHASH*);
+void detection_option_tree_update_otn_stats(XHash*);
 
 detection_option_tree_root_t* new_root(OptTreeNode*);
 void free_detection_option_root(void** existing_tree);
index 8ed3610719e683caafafed68beffd38d0b9bee63..d568caa9154721d4f8f8403704fa0a8ce325a2a5 100644 (file)
@@ -35,7 +35,7 @@
 #include "fp_create.h"
 
 #include "framework/mpse.h"
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "managers/mpse_manager.h"
@@ -644,9 +644,9 @@ static int fpCreateInitRuleMap(
     /* Process src PORT groups */
     if ( src )
     {
-        for ( SFGHASH_NODE* node=sfghash_findfirst(src->pt_mpxo_hash);
+        for ( GHashNode* node=ghash_findfirst(src->pt_mpxo_hash);
             node;
-            node=sfghash_findnext(src->pt_mpxo_hash) )
+            node=ghash_findnext(src->pt_mpxo_hash) )
         {
             PortObject2* po = (PortObject2*)node->data;
 
@@ -668,9 +668,9 @@ static int fpCreateInitRuleMap(
     /* process destination port groups */
     if ( dst )
     {
-        for ( SFGHASH_NODE* node=sfghash_findfirst(dst->pt_mpxo_hash);
+        for ( GHashNode* node=ghash_findfirst(dst->pt_mpxo_hash);
             node;
-            node=sfghash_findnext(dst->pt_mpxo_hash) )
+            node=ghash_findnext(dst->pt_mpxo_hash) )
         {
             PortObject2* po = (PortObject2*)node->data;
 
@@ -864,7 +864,7 @@ static void fpDeletePMX(void* pv)
 static int fpCreatePortObject2PortGroup(
     SnortConfig* sc, PortObject2* po, PortObject2* poaa)
 {
-    SFGHASH_NODE* node;
+    GHashNode* node;
     unsigned sid, gid;
     OptTreeNode* otn;
     PortGroup* pg;
@@ -907,9 +907,9 @@ static int fpCreatePortObject2PortGroup(
 
     while (pox != nullptr)
     {
-        for (node = sfghash_findfirst(pox->rule_hash);
+        for (node = ghash_findfirst(pox->rule_hash);
             node;
-            node = sfghash_findnext(pox->rule_hash))
+            node = ghash_findnext(pox->rule_hash))
         {
             int* prindex = (int*)node->data;
 
@@ -952,16 +952,16 @@ static int fpCreatePortObject2PortGroup(
 static int fpCreatePortTablePortGroups(
     SnortConfig* sc, PortTable* p, PortObject2* poaa)
 {
-    SFGHASH_NODE* node;
+    GHashNode* node;
     int cnt=1;
     FastPatternConfig* fp = sc->fast_pattern_config;
 
     if (fp->get_debug_print_rule_group_build_details())
         LogMessage("%d Port Groups in Port Table\n",p->pt_mpo_hash->count);
 
-    for (node=sfghash_findfirst(p->pt_mpo_hash);
+    for (node=ghash_findfirst(p->pt_mpo_hash);
         node;
-        node=sfghash_findnext(p->pt_mpo_hash) )
+        node=ghash_findnext(p->pt_mpo_hash) )
     {
         PortObject2* po = (PortObject2*)node->data;
 
@@ -1177,7 +1177,7 @@ static int fpCreatePortGroups(SnortConfig* sc, RulePortTables* p)
 * list- list of otns for this service
 */
 static void fpBuildServicePortGroupByServiceOtnList(
-    SnortConfig* sc, SFGHASH* p, const char* srvc, SF_LIST* list, FastPatternConfig* fp)
+    SnortConfig* sc, GHash* p, const char* srvc, SF_LIST* list, FastPatternConfig* fp)
 {
     PortGroup* pg = PortGroup::alloc();
     s_group = srvc;
@@ -1200,7 +1200,7 @@ static void fpBuildServicePortGroupByServiceOtnList(
         return;
 
     /* Add the port_group using it's service name */
-    sfghash_add(p, srvc, pg);
+    ghash_add(p, srvc, pg);
 }
 
 /*
@@ -1217,11 +1217,11 @@ static void fpBuildServicePortGroupByServiceOtnList(
  *
  */
 static void fpBuildServicePortGroups(
-    SnortConfig* sc, SFGHASH* spg, PortGroupVector& sopg, SFGHASH* srm, FastPatternConfig* fp)
+    SnortConfig* sc, GHash* spg, PortGroupVector& sopg, GHash* srm, FastPatternConfig* fp)
 {
-    for ( SFGHASH_NODE* n = sfghash_findfirst(srm);
+    for ( GHashNode* n = ghash_findfirst(srm);
         n;
-        n=sfghash_findnext(srm) )
+        n=ghash_findnext(srm) )
     {
         SF_LIST* list = (SF_LIST*)n->data;
         const char* srvc = (const char*)n->key;
@@ -1231,7 +1231,7 @@ static void fpBuildServicePortGroups(
         fpBuildServicePortGroupByServiceOtnList(sc, spg, srvc, list, fp);
 
         /* Add this PortGroup to the protocol-ordinal -> port_group table */
-        PortGroup* pg = (PortGroup*)sfghash_find(spg, srvc);
+        PortGroup* pg = (PortGroup*)ghash_find(spg, srvc);
         if ( !pg )
         {
             ParseError("*** failed to create and find a port group for '%s'",srvc);
@@ -1286,9 +1286,9 @@ static void fpPrintRuleList(SF_LIST* list)
     }
 }
 
-static void fpPrintServiceRuleMapTable(SFGHASH* p, const char* proto, const char* dir)
+static void fpPrintServiceRuleMapTable(GHash* p, const char* proto, const char* dir)
 {
-    SFGHASH_NODE* n;
+    GHashNode* n;
 
     if ( !p || !p->count )
         return;
@@ -1299,9 +1299,9 @@ static void fpPrintServiceRuleMapTable(SFGHASH* p, const char* proto, const char
     label += dir;
     LogLabel(label.c_str());
 
-    for ( n = sfghash_findfirst(p);
+    for ( n = ghash_findfirst(p);
         n;
-        n = sfghash_findnext(p) )
+        n = ghash_findnext(p) )
     {
         SF_LIST* list;
 
@@ -1328,7 +1328,7 @@ static void fpPrintServiceRuleMaps(SnortConfig* sc, srmm_table_t* service_map)
     }
 }
 
-static void fp_print_service_rules(SnortConfig* sc, SFGHASH* cli, SFGHASH* srv, const char* msg)
+static void fp_print_service_rules(SnortConfig* sc, GHash* cli, GHash* srv, const char* msg)
 {
     if ( !cli->count and !srv->count )
         return;
@@ -1343,8 +1343,8 @@ static void fp_print_service_rules(SnortConfig* sc, SFGHASH* cli, SFGHASH* srv,
 
     while ( const char* svc = sc->proto_ref->get_name_sorted(idx++) )
     {
-        SF_LIST* clist = (SF_LIST*)sfghash_find(cli, svc);
-        SF_LIST* slist = (SF_LIST*)sfghash_find(srv, svc);
+        SF_LIST* clist = (SF_LIST*)ghash_find(cli, svc);
+        SF_LIST* slist = (SF_LIST*)ghash_find(srv, svc);
 
         if ( !clist and !slist )
             continue;
@@ -1377,10 +1377,10 @@ static void fp_sum_port_groups(PortGroup* pg, unsigned c[PM_TYPE_MAX])
             c[i]++;
 }
 
-static void fp_sum_service_groups(SFGHASH* h, unsigned c[PM_TYPE_MAX])
+static void fp_sum_service_groups(GHash* h, unsigned c[PM_TYPE_MAX])
 {
-    for ( SFGHASH_NODE* node=sfghash_findfirst(h);
-        node; node=sfghash_findnext(h) )
+    for ( GHashNode* node=ghash_findfirst(h);
+        node; node=ghash_findnext(h) )
     {
         PortGroup* pg = (PortGroup*)node->data;
         fp_sum_port_groups(pg, c);
@@ -1416,8 +1416,8 @@ static void fp_print_service_groups(srmm_table_t* srmm)
 
 static void fp_sum_port_groups(PortTable* tab, unsigned c[PM_TYPE_MAX])
 {
-    for ( SFGHASH_NODE* node=sfghash_findfirst(tab->pt_mpxo_hash);
-        node; node=sfghash_findnext(tab->pt_mpxo_hash) )
+    for ( GHashNode* node=ghash_findfirst(tab->pt_mpxo_hash);
+        node; node=ghash_findnext(tab->pt_mpxo_hash) )
     {
         PortObject2* po = (PortObject2*)node->data;
         fp_sum_port_groups(po->group, c);
index fcbd4fb0a6a78e106ab54ec325b2ef39babff99d..00b1f68f3aa8eb1d0ea4517ae3386ff7c3cf3636 100644 (file)
@@ -37,7 +37,7 @@
 
 #include <cassert>
 
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 #include "ips_options/ips_flow.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 // service map stuff
 //-------------------------------------------------------------------------
 
-static SFGHASH* alloc_srvmap()
+static GHash* alloc_srvmap()
 {
-    // nodes are lists,free them in sfghash_delete
-    SFGHASH* p = sfghash_new(1000, 0, 0, (void (*)(void*))sflist_free);
+    // nodes are lists,free them in ghash_delete
+    GHash* p = ghash_new(1000, 0, 0, (void (*)(void*))sflist_free);
     return p;
 }
 
-static void free_srvmap(SFGHASH* table)
+static void free_srvmap(GHash* table)
 {
     if ( table )
-        sfghash_delete(table);
+        ghash_delete(table);
 }
 
 srmm_table_t* ServiceMapNew()
@@ -102,19 +102,19 @@ void ServiceMapFree(srmm_table_t* table)
 static void delete_pg(void* pv)
 { PortGroup::free((PortGroup*)pv); }
 
-static SFGHASH* alloc_spgmm()
+static GHash* alloc_spgmm()
 {
     // 1000 rows, ascii key
-    SFGHASH* p = sfghash_new(1000, 0, 0, delete_pg);
+    GHash* p = ghash_new(1000, 0, 0, delete_pg);
     return p;
 }
 
-static void free_spgmm(SFGHASH* table)
+static void free_spgmm(GHash* table)
 {
     if ( !table )
         return;
 
-    sfghash_delete(table);
+    ghash_delete(table);
 }
 
 srmm_table_t* ServicePortGroupMapNew()
@@ -159,11 +159,11 @@ void ServicePortGroupMapFree(srmm_table_t* table)
  * otn - rule - may be content,-no-content, or uri-content
  *
  */
-static void ServiceMapAddOtnRaw(SFGHASH* table, const char* servicename, OptTreeNode* otn)
+static void ServiceMapAddOtnRaw(GHash* table, const char* servicename, OptTreeNode* otn)
 {
     SF_LIST* list;
 
-    list = (SF_LIST*)sfghash_find(table, servicename);
+    list = (SF_LIST*)ghash_find(table, servicename);
 
     if ( !list )
     {
@@ -173,7 +173,7 @@ static void ServiceMapAddOtnRaw(SFGHASH* table, const char* servicename, OptTree
             FatalError("service_rule_map: could not create a  service rule-list\n");
 
         /* add the service list to the table */
-        if ( sfghash_add(table, servicename, list) != SFGHASH_OK )
+        if ( ghash_add(table, servicename, list) != GHASH_OK )
         {
             FatalError("service_rule_map: could not add a rule to the rule-service-map\n");
         }
@@ -196,8 +196,8 @@ static int ServiceMapAddOtn(
     if ( proto > SNORT_PROTO_USER )
         proto = SNORT_PROTO_USER;
 
-    SFGHASH* to_srv = srmm->to_srv[proto];
-    SFGHASH* to_cli = srmm->to_cli[proto];
+    GHash* to_srv = srmm->to_srv[proto];
+    GHash* to_cli = srmm->to_cli[proto];
 
     if ( !OtnFlowFromClient(otn) )
         ServiceMapAddOtnRaw(to_cli, servicename, otn);
@@ -233,14 +233,14 @@ void fpPrintServicePortGroupSummary(SnortConfig* sc, srmm_table_t* srvc_pg_map)
 int fpCreateServiceMaps(SnortConfig* sc)
 {
     RuleTreeNode* rtn;
-    SFGHASH_NODE* hashNode;
+    GHashNode* hashNode;
     OptTreeNode* otn  = nullptr;
     PolicyId policyId = 0;
     unsigned int svc_idx;
 
-    for (hashNode = sfghash_findfirst(sc->otn_map);
+    for (hashNode = ghash_findfirst(sc->otn_map);
         hashNode;
-        hashNode = sfghash_findnext(sc->otn_map))
+        hashNode = ghash_findnext(sc->otn_map))
     {
         otn = (OptTreeNode*)hashNode->data;
         for ( policyId = 0;
index 0eebd44b6d6c5fc7dd6a8932dac6afa49ca7380c..26511bc7f4ba6119db0053dcd126e29a58ef4900 100644 (file)
 #include "target_based/snort_protocols.h"
 
 struct PortGroup;
-struct SFGHASH;
+struct GHash;
 struct SnortConfig;
 
 //  Service Rule Map Master Table
 struct srmm_table_t
 {
-    SFGHASH* to_srv[SNORT_PROTO_MAX];
-    SFGHASH* to_cli[SNORT_PROTO_MAX];
+    GHash* to_srv[SNORT_PROTO_MAX];
+    GHash* to_cli[SNORT_PROTO_MAX];
 };
 
 srmm_table_t* ServiceMapNew();
index 1c3b8c9335f460392bacad8a1889f578b0e4428c..828f098ff400bcaad3f51bd06fa069e8b07a1901 100644 (file)
@@ -151,7 +151,7 @@ ClassType* ClassTypeLookupByType(SnortConfig* sc, const char* type)
 
 /***************** Otn Utilities ***********************/
 
-void OtnRemove(SFGHASH* otn_map, OptTreeNode* otn)
+void OtnRemove(GHash* otn_map, OptTreeNode* otn)
 {
     assert(otn_map and otn);
 
@@ -159,7 +159,7 @@ void OtnRemove(SFGHASH* otn_map, OptTreeNode* otn)
     key.gid = otn->sigInfo.gid;
     key.sid = otn->sigInfo.sid;
 
-    sfghash_remove(otn_map, &key);
+    ghash_remove(otn_map, &key);
 }
 
 void OtnFree(void* data)
@@ -229,12 +229,12 @@ void OtnFree(void* data)
     snort_free(otn);
 }
 
-SFGHASH* OtnLookupNew()
+GHash* OtnLookupNew()
 {
-    return sfghash_new(10000, sizeof(OtnKey), 0, OtnFree);
+    return ghash_new(10000, sizeof(OtnKey), 0, OtnFree);
 }
 
-void OtnLookupAdd(SFGHASH* otn_map, OptTreeNode* otn)
+void OtnLookupAdd(GHash* otn_map, OptTreeNode* otn)
 {
     assert(otn_map);
 
@@ -242,16 +242,16 @@ void OtnLookupAdd(SFGHASH* otn_map, OptTreeNode* otn)
     key.gid = otn->sigInfo.gid;
     key.sid = otn->sigInfo.sid;
 
-    int status = sfghash_add(otn_map, &key, otn);
+    int status = ghash_add(otn_map, &key, otn);
 
-    if ( status == SFGHASH_OK )
+    if ( status == GHASH_OK )
         return;
 
-    assert(status == SFGHASH_INTABLE);
+    assert(status == GHASH_INTABLE);
     ParseError("duplicate rule with same gid (%u) and sid (%u)", key.gid, key.sid);
 }
 
-OptTreeNode* OtnLookup(SFGHASH* otn_map, uint32_t gid, uint32_t sid)
+OptTreeNode* OtnLookup(GHash* otn_map, uint32_t gid, uint32_t sid)
 {
     assert(otn_map);
 
@@ -259,7 +259,7 @@ OptTreeNode* OtnLookup(SFGHASH* otn_map, uint32_t gid, uint32_t sid)
     key.gid = gid;
     key.sid = sid;
 
-    OptTreeNode* otn = (OptTreeNode*)sfghash_find(otn_map, &key);
+    OptTreeNode* otn = (OptTreeNode*)ghash_find(otn_map, &key);
 
     return otn;
 }
@@ -281,9 +281,9 @@ OptTreeNode* GetOTN(uint32_t gid, uint32_t sid)
     return otn;
 }
 
-void OtnLookupFree(SFGHASH* otn_map)
+void OtnLookupFree(GHash* otn_map)
 {
     if ( otn_map )
-        sfghash_delete(otn_map);
+        ghash_delete(otn_map);
 }
 
index 0b73357e6eb611d4125a8d8fa6cdfd3271ab3c10..ec472c83e62cb4041f7e0388c5c7458c50ed1f10 100644 (file)
@@ -29,7 +29,7 @@
 
 struct SnortConfig;
 struct OptTreeNode;
-struct SFGHASH;
+struct GHash;
 
 /* this contains a list of the URLs for various reference systems */
 struct ReferenceSystemNode
@@ -67,7 +67,7 @@ void AddClassification(SnortConfig*, const char* type, const char* name, int pri
 
 ClassType* ClassTypeLookupByType(SnortConfig*, const char*);
 
-struct ServiceInfo
+struct SignatureServiceInfo
 {
     char* service;
     int16_t service_ordinal;
@@ -87,7 +87,7 @@ struct SigInfo
     char* message;
     ClassType* class_type;
     ReferenceNode* refs;
-    ServiceInfo* services;
+    SignatureServiceInfo* services;
 
     uint32_t gid;
     uint32_t sid;
@@ -101,11 +101,11 @@ struct SigInfo
     Target target;
 };
 
-SFGHASH* OtnLookupNew();
-void OtnLookupAdd(SFGHASH*, OptTreeNode*);
-OptTreeNode* OtnLookup(SFGHASH*, uint32_t gid, uint32_t sid);
-void OtnLookupFree(SFGHASH*);
-void OtnRemove(SFGHASH*, OptTreeNode*);
+GHash* OtnLookupNew();
+void OtnLookupAdd(GHash*, OptTreeNode*);
+OptTreeNode* OtnLookup(GHash*, uint32_t gid, uint32_t sid);
+void OtnLookupFree(GHash*);
+void OtnRemove(GHash*, OptTreeNode*);
 
 void OtnDeleteData(void* data);
 void OtnFree(void* data);
index 9005a40da78f75547cc3d09c337c9b85bfbde3a8..16caf9af1bce4751d21067010e1e71a4d2bb8f57 100644 (file)
@@ -26,7 +26,7 @@
 #include "tag.h"
 
 #include "events/event.h"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "main/snort_debug.h"
@@ -99,10 +99,10 @@ struct TagNode
 };
 
 /*  G L O B A L S  **************************************************/
-static THREAD_LOCAL SFXHASH* host_tag_cache_ptr = nullptr;
+static THREAD_LOCAL XHash* host_tag_cache_ptr = nullptr;
 
 // FIXIT-M utilize Flow instead of separate cache
-static THREAD_LOCAL SFXHASH* ssn_tag_cache_ptr = nullptr;
+static THREAD_LOCAL XHash* ssn_tag_cache_ptr = nullptr;
 
 static THREAD_LOCAL uint32_t last_prune_time = 0;
 static THREAD_LOCAL uint32_t tag_alloc_faults = 0;
@@ -117,36 +117,36 @@ static THREAD_LOCAL unsigned s_sessions = 0;
 static const unsigned s_max_sessions = 1;
 
 /*  P R O T O T Y P E S  ********************************************/
-static TagNode* TagAlloc(SFXHASH*);
-static void TagFree(SFXHASH*, TagNode*);
+static TagNode* TagAlloc(XHash*);
+static void TagFree(XHash*, TagNode*);
 static int TagFreeSessionNodeFunc(void* key, void* data);
 static int TagFreeHostNodeFunc(void* key, void* data);
 static int PruneTagCache(uint32_t, int);
-static int PruneTime(SFXHASH* tree, uint32_t thetime);
+static int PruneTime(XHash* tree, uint32_t thetime);
 static void TagSession(Packet*, TagData*, uint32_t, uint16_t, void*);
 static void TagHost(Packet*, TagData*, uint32_t, uint16_t, void*);
 static void AddTagNode(Packet*, TagData*, int, uint32_t, uint16_t, void*);
 static inline void SwapTag(TagNode*);
 
 /**Calculated memory needed per node insertion into respective cache. Its includes
- * memory needed for allocating TagNode, SFXHASH_NODE, and key size.
+ * memory needed for allocating TagNode, XHashNode, and key size.
  *
- * @param hash - pointer to SFXHASH that should point to either ssn_tag_cache_ptr
+ * @param hash - pointer to XHash that should point to either ssn_tag_cache_ptr
  * or host_tag_cache_ptr.
  *
  * @returns number of bytes needed
  */
 static inline unsigned int memory_per_node(
-    SFXHASH* hash
+    XHash* hash
     )
 {
     if (hash == ssn_tag_cache_ptr)
     {
-        return sizeof(tTagFlowKey)+sizeof(SFXHASH_NODE)+sizeof(TagNode);
+        return sizeof(tTagFlowKey)+sizeof(XHashNode)+sizeof(TagNode);
     }
     else if (hash == host_tag_cache_ptr)
     {
-        return sizeof(SfIp)+sizeof(SFXHASH_NODE)+sizeof(TagNode);
+        return sizeof(SfIp)+sizeof(XHashNode)+sizeof(TagNode);
     }
 
     return 0;
@@ -158,13 +158,13 @@ static inline unsigned int memory_per_node(
  * Least used nodes may be deleted from ssn_tag_cache and host_tag_cache to make space if
  * the limit is being exceeded.
  *
- * @param hash - pointer to SFXHASH that should point to either ssn_tag_cache_ptr
+ * @param hash - pointer to XHash that should point to either ssn_tag_cache_ptr
  * or host_tag_cache_ptr.
  *
  * @returns a pointer to new TagNode or NULL if memory couldn't * be allocated
  */
 static TagNode* TagAlloc(
-    SFXHASH* hash
+    XHash* hash
     )
 {
     TagNode* tag_node = nullptr;
@@ -202,12 +202,12 @@ static TagNode* TagAlloc(
 
 /**Frees allocated TagNode.
  *
- * @param hash - pointer to SFXHASH that should point to either ssn_tag_cache_ptr
+ * @param hash - pointer to XHash that should point to either ssn_tag_cache_ptr
  * or host_tag_cache_ptr.
  * @param node - pointer to node to be freed
  */
 static void TagFree(
-    SFXHASH* hash,
+    XHash* hash,
     TagNode* node
     )
 {
@@ -266,7 +266,7 @@ void InitTag()
 {
     unsigned int hashTableSize = TAG_MEMCAP/sizeof(TagNode);
 
-    ssn_tag_cache_ptr = sfxhash_new(
+    ssn_tag_cache_ptr = xhash_new(
         hashTableSize,                      /* number of hash buckets */
         sizeof(tTagFlowKey),             /* size of the key we're going to use */
         0,                                  /* size of the storage node */
@@ -276,7 +276,7 @@ void InitTag()
         TagFreeSessionNodeFunc,             /* user free function */
         0);                                 /* recycle node flag */
 
-    host_tag_cache_ptr = sfxhash_new(
+    host_tag_cache_ptr = xhash_new(
         hashTableSize,               /* number of hash buckets */
         sizeof(SfIp),            /* size of the key we're going to use */
         0,                           /* size of the storage node */
@@ -291,12 +291,12 @@ void CleanupTag()
 {
     if (ssn_tag_cache_ptr)
     {
-        sfxhash_delete(ssn_tag_cache_ptr);
+        xhash_delete(ssn_tag_cache_ptr);
     }
 
     if (host_tag_cache_ptr)
     {
-        sfxhash_delete(host_tag_cache_ptr);
+        xhash_delete(host_tag_cache_ptr);
     }
 }
 
@@ -334,7 +334,7 @@ static void AddTagNode(Packet* p, TagData* tag, int mode, uint32_t now,
 {
     TagNode* idx;  /* index pointer */
     TagNode* returned;
-    SFXHASH* tag_cache_ptr = nullptr;
+    XHash* tag_cache_ptr = nullptr;
 
     DebugMessage(DEBUG_FLOW, "Adding new Tag Head\n");
 
@@ -402,13 +402,13 @@ static void AddTagNode(Packet* p, TagData* tag, int mode, uint32_t now,
     }
 
     /* check for duplicates */
-    returned = (TagNode*)sfxhash_find(tag_cache_ptr, idx);
+    returned = (TagNode*)xhash_find(tag_cache_ptr, idx);
 
     if (returned == nullptr)
     {
         DebugMessage(DEBUG_FLOW,"Looking the other way!!\n");
         SwapTag(idx);
-        returned = (TagNode*)sfxhash_find(tag_cache_ptr, idx);
+        returned = (TagNode*)xhash_find(tag_cache_ptr, idx);
         SwapTag(idx);
     }
 
@@ -423,10 +423,10 @@ static void AddTagNode(Packet* p, TagData* tag, int mode, uint32_t now,
             SwapTag(idx);
         }
 
-        if (sfxhash_add(tag_cache_ptr, idx, idx) != SFXHASH_OK)
+        if (xhash_add(tag_cache_ptr, idx, idx) != XHASH_OK)
         {
             DebugMessage(DEBUG_FLOW,
-                "sfxhash_add failed, that's going to "
+                "xhash_add failed, that's going to "
                 "make life difficult\n");
             TagFree(tag_cache_ptr, idx);
             return;
@@ -450,11 +450,11 @@ int CheckTagList(Packet* p, Event& event, void** log_list)
 {
     TagNode idx;
     TagNode* returned = nullptr;
-    SFXHASH* taglist = nullptr;
+    XHash* taglist = nullptr;
     char create_event = 1;
 
     /* check for active tags */
-    if (!sfxhash_count(host_tag_cache_ptr) && !sfxhash_count(ssn_tag_cache_ptr))
+    if (!xhash_count(host_tag_cache_ptr) && !xhash_count(ssn_tag_cache_ptr))
     {
         return 0;
     }
@@ -466,7 +466,7 @@ int CheckTagList(Packet* p, Event& event, void** log_list)
     }
 
     DebugFormat(DEBUG_FLOW,"Host Tags Active: %u   Session Tags Active: %u\n",
-        sfxhash_count(host_tag_cache_ptr), sfxhash_count(ssn_tag_cache_ptr));
+        xhash_count(host_tag_cache_ptr), xhash_count(ssn_tag_cache_ptr));
 
     DebugMessage(DEBUG_FLOW, "[*] Checking session tag list (forward)...\n");
 
@@ -476,7 +476,7 @@ int CheckTagList(Packet* p, Event& event, void** log_list)
     idx.key.dp = p->ptrs.dp;
 
     /* check for session tags... */
-    returned = (TagNode*)sfxhash_find(ssn_tag_cache_ptr, &idx);
+    returned = (TagNode*)xhash_find(ssn_tag_cache_ptr, &idx);
 
     if (returned == nullptr)
     {
@@ -486,14 +486,14 @@ int CheckTagList(Packet* p, Event& event, void** log_list)
         idx.key.sp = p->ptrs.dp;
 
         DebugMessage(DEBUG_FLOW, "   Checking session tag list (reverse)...\n");
-        returned = (TagNode*)sfxhash_find(ssn_tag_cache_ptr, &idx);
+        returned = (TagNode*)xhash_find(ssn_tag_cache_ptr, &idx);
 
         if (returned == nullptr)
         {
             DebugMessage(DEBUG_FLOW, "   Checking host tag list "
                 "(forward)...\n");
 
-            returned = (TagNode*)sfxhash_find(host_tag_cache_ptr, &idx);
+            returned = (TagNode*)xhash_find(host_tag_cache_ptr, &idx);
 
             if (returned == nullptr)
             {
@@ -503,7 +503,7 @@ int CheckTagList(Packet* p, Event& event, void** log_list)
                 */
                 idx.key.sip.set(*p->ptrs.ip_api.get_src());
 
-                returned = (TagNode*)sfxhash_find(host_tag_cache_ptr, &idx);
+                returned = (TagNode*)xhash_find(host_tag_cache_ptr, &idx);
             }
 
             if (returned != nullptr)
@@ -589,7 +589,7 @@ int CheckTagList(Packet* p, Event& event, void** log_list)
             DebugMessage(DEBUG_FLOW,
                 "    Prune condition met for tag, removing from list\n");
 
-            if (sfxhash_remove(taglist, returned) != SFXHASH_OK)
+            if (xhash_remove(taglist, returned) != XHASH_OK)
             {
                 LogMessage("WARNING: failed to remove tagNode from hash.\n");
             }
@@ -616,12 +616,12 @@ static int PruneTagCache(uint32_t thetime, int mustdie)
 
     if (mustdie == 0)
     {
-        if (sfxhash_count(ssn_tag_cache_ptr) != 0)
+        if (xhash_count(ssn_tag_cache_ptr) != 0)
         {
             pruned = PruneTime(ssn_tag_cache_ptr, thetime);
         }
 
-        if (sfxhash_count(host_tag_cache_ptr) != 0)
+        if (xhash_count(host_tag_cache_ptr) != 0)
         {
             pruned += PruneTime(host_tag_cache_ptr, thetime);
         }
@@ -629,21 +629,21 @@ static int PruneTagCache(uint32_t thetime, int mustdie)
     else
     {
         while (pruned < mustdie &&
-            (sfxhash_count(ssn_tag_cache_ptr) > 0 || sfxhash_count(host_tag_cache_ptr) > 0))
+            (xhash_count(ssn_tag_cache_ptr) > 0 || xhash_count(host_tag_cache_ptr) > 0))
         {
             TagNode* lru_node;
 
-            if ((lru_node = (TagNode*)sfxhash_lru(ssn_tag_cache_ptr)) != nullptr)
+            if ((lru_node = (TagNode*)xhash_lru(ssn_tag_cache_ptr)) != nullptr)
             {
-                if (sfxhash_remove(ssn_tag_cache_ptr, lru_node) != SFXHASH_OK)
+                if (xhash_remove(ssn_tag_cache_ptr, lru_node) != XHASH_OK)
                 {
                     LogMessage("WARNING: failed to remove tagNode from hash.\n");
                 }
                 pruned++;
             }
-            if ((lru_node = (TagNode*)sfxhash_lru(host_tag_cache_ptr)) != nullptr)
+            if ((lru_node = (TagNode*)xhash_lru(host_tag_cache_ptr)) != nullptr)
             {
-                if (sfxhash_remove(host_tag_cache_ptr, lru_node) != SFXHASH_OK)
+                if (xhash_remove(host_tag_cache_ptr, lru_node) != XHASH_OK)
                 {
                     LogMessage("WARNING: failed to remove tagNode from hash.\n");
                 }
@@ -655,16 +655,16 @@ static int PruneTagCache(uint32_t thetime, int mustdie)
     return pruned;
 }
 
-static int PruneTime(SFXHASH* tree, uint32_t thetime)
+static int PruneTime(XHash* tree, uint32_t thetime)
 {
     int pruned = 0;
     TagNode* lru_node = nullptr;
 
-    while ((lru_node = (TagNode*)sfxhash_lru(tree)) != nullptr)
+    while ((lru_node = (TagNode*)xhash_lru(tree)) != nullptr)
     {
         if ((lru_node->last_access + TAG_PRUNE_QUANTUM) < thetime)
         {
-            if (sfxhash_remove(tree, lru_node) != SFXHASH_OK)
+            if (xhash_remove(tree, lru_node) != XHASH_OK)
             {
                 LogMessage("WARNING: failed to remove tagNode from hash.\n");
             }
index 7db068f50741a9d352489cfe2939ac6a068e2456..e4136a200a3a35ea7e88d5eb1d22a1f8cfa110cf 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "file_cache.h"
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "main/snort_debug.h"
@@ -45,18 +45,18 @@ static int file_cache_free_func(void*, void* data)
 FileCache::FileCache()
 {
     int max_files = SnortConfig::get_conf()->file_config.max_files_cached;
-    fileHash = sfxhash_new(max_files, sizeof(FileHashKey), sizeof(FileNode),
+    fileHash = xhash_new(max_files, sizeof(FileHashKey), sizeof(FileNode),
         0, 1, nullptr, file_cache_free_func, 1);
     if (!fileHash)
         FatalError("Failed to create the expected channel hash table.\n");
-    sfxhash_set_max_nodes(fileHash, max_files);
+    xhash_set_max_nodes(fileHash, max_files);
 }
 
 FileCache::~FileCache()
 {
     if (fileHash)
     {
-        sfxhash_delete(fileHash);
+        xhash_delete(fileHash);
     }
 }
 
@@ -75,7 +75,7 @@ FileContext* FileCache::add(const FileHashKey& hashKey)
 
     std::lock_guard<std::mutex> lock(cache_mutex);
 
-    if (sfxhash_add(fileHash, (void*)&hashKey, &new_node) != SFXHASH_OK)
+    if (xhash_add(fileHash, (void*)&hashKey, &new_node) != XHASH_OK)
     {
         /* Uh, shouldn't get here...
          * There is already a node or couldn't alloc space
@@ -95,13 +95,13 @@ FileContext* FileCache::find(const FileHashKey& hashKey)
     std::lock_guard<std::mutex> lock(cache_mutex);
 
     // No hash table, or its empty?  Get out of dodge.
-    if ((!fileHash) || (!sfxhash_count(fileHash)))
+    if ((!fileHash) || (!xhash_count(fileHash)))
     {
         DebugMessage(DEBUG_FILE, "No expected sessions\n");
         return nullptr;
     }
 
-    SFXHASH_NODE* hash_node = sfxhash_find_node(fileHash, &hashKey);
+    XHashNode* hash_node = xhash_find_node(fileHash, &hashKey);
 
     if (!hash_node)
         return nullptr;
@@ -109,7 +109,7 @@ FileContext* FileCache::find(const FileHashKey& hashKey)
     FileNode* node = (FileNode*)hash_node->data;
     if (!node)
     {
-        sfxhash_free_node(fileHash, hash_node);
+        xhash_free_node(fileHash, hash_node);
         return nullptr;
     }
 
@@ -118,7 +118,7 @@ FileContext* FileCache::find(const FileHashKey& hashKey)
     if (node->expires && now > node->expires)
     {
         DebugMessage(DEBUG_FILE, "File expired\n");
-        sfxhash_free_node(fileHash, hash_node);
+        xhash_free_node(fileHash, hash_node);
         return nullptr;
     }
 
index 708f52e986d39283ea5fe52912273afa9f042317..b57ced606bdce71004fb0e1b0d97039e4fa0d8e2 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "file_config.h"
 
-struct SFXHASH;
+struct XHash;
 
 class FileCache
 {
@@ -57,7 +57,7 @@ PADDING_GUARD_END
 
 private:
     /* The hash table of expected files */
-    SFXHASH* fileHash = nullptr;
+    XHash* fileHash = nullptr;
     uint32_t timeout = DEFAULT_FILE_BLOCK_TIMEOUT;
     std::mutex cache_mutex;
 };
index 5816ab9a36093d4b5a21daba9d612c5c4eecde0e..5453e2dfff4dea7d6203898c6abde50f26325779 100644 (file)
@@ -47,7 +47,7 @@ static int file_node_free_func(void*, void* data)
 
 FileEnforcer::FileEnforcer()
 {
-    fileHash = sfxhash_new(MAX_FILES_TRACKED, sizeof(FileHashKey), sizeof(FileNode),
+    fileHash = xhash_new(MAX_FILES_TRACKED, sizeof(FileHashKey), sizeof(FileNode),
         MAX_MEMORY_USED, 1, nullptr, file_node_free_func, 1);
     if (!fileHash)
         FatalError("Failed to create the expected channel hash table.\n");
@@ -57,7 +57,7 @@ FileEnforcer::~FileEnforcer()
 {
     if (fileHash)
     {
-        sfxhash_delete(fileHash);
+        xhash_delete(fileHash);
     }
 }
 
@@ -67,7 +67,7 @@ void FileEnforcer::update_file_node(FileNode* node, FileInfo* file)
 }
 
 FileVerdict FileEnforcer::check_verdict(Flow* flow, FileNode* node,
-    SFXHASH_NODE* hash_node, FilePolicy& inspect)
+    XHashNode* hash_node, FilePolicy& inspect)
 {
     assert(node->file);
 
@@ -87,7 +87,7 @@ FileVerdict FileEnforcer::check_verdict(Flow* flow, FileNode* node,
 
     if (verdict == FILE_VERDICT_LOG)
     {
-        sfxhash_free_node(fileHash, hash_node);
+        xhash_free_node(fileHash, hash_node);
     }
 
     return verdict;
@@ -109,11 +109,11 @@ int FileEnforcer::store_verdict(Flow* flow, FileInfo* file)
     hashKey.file_sig = file_sig;
 
     FileNode* node;
-    SFXHASH_NODE* hash_node = sfxhash_find_node(fileHash, &hashKey);
+    XHashNode* hash_node = xhash_find_node(fileHash, &hashKey);
     if (hash_node)
     {
         if (!(node = (FileNode*)hash_node->data))
-            sfxhash_free_node(fileHash, hash_node);
+            xhash_free_node(fileHash, hash_node);
     }
     else
         node = nullptr;
@@ -141,7 +141,7 @@ int FileEnforcer::store_verdict(Flow* flow, FileInfo* file)
         new_node.expires = now + timeout;
 
         /* Add it to the table */
-        if (sfxhash_add(fileHash, &hashKey, &new_node) != SFXHASH_OK)
+        if (xhash_add(fileHash, &hashKey, &new_node) != XHASH_OK)
         {
             /* Uh, shouldn't get here...
              * There is already a node or couldn't alloc space
@@ -192,11 +192,11 @@ FileVerdict FileEnforcer::cached_verdict_lookup(Flow* flow, FileInfo* file,
     FilePolicy& inspect)
 {
     FileVerdict verdict = FILE_VERDICT_UNKNOWN;
-    SFXHASH_NODE* hash_node;
+    XHashNode* hash_node;
     FileNode* node;
 
     /* No hash table, or its empty?  Get out of dodge.  */
-    if ((!fileHash) || (!sfxhash_count(fileHash)))
+    if ((!fileHash) || (!xhash_count(fileHash)))
     {
         DebugMessage(DEBUG_FILE, "No expected sessions\n");
         return verdict;
@@ -213,12 +213,12 @@ FileVerdict FileEnforcer::cached_verdict_lookup(Flow* flow, FileInfo* file,
     hashKey.padding = 0;
     hashKey.file_sig = file_sig;
 
-    hash_node = sfxhash_find_node(fileHash, &hashKey);
+    hash_node = xhash_find_node(fileHash, &hashKey);
 
     if (hash_node)
     {
         if (!(node = (FileNode*)hash_node->data))
-            sfxhash_free_node(fileHash, hash_node);
+            xhash_free_node(fileHash, hash_node);
     }
     else
         return verdict;
@@ -229,7 +229,7 @@ FileVerdict FileEnforcer::cached_verdict_lookup(Flow* flow, FileInfo* file,
         if (node->expires && packet_time() > node->expires)
         {
             DebugMessage(DEBUG_FILE, "File expired\n");
-            sfxhash_free_node(fileHash, hash_node);
+            xhash_free_node(fileHash, hash_node);
             return verdict;
         }
         /*Query the file policy in case verdict has been changed*/
index 1e30bc2b37485552b092f2959a09c56efaf58a85..d05785df6adb9750223172a7488a5d8fc6dc786a 100644 (file)
@@ -26,7 +26,7 @@
 // to request the file data left. To block the new session, we use URL and IPs
 // to continue blocking the same file.
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "sfip/sf_ip.h"
 #include "utils/cpp_macros.h"
 
@@ -65,11 +65,11 @@ PADDING_GUARD_BEGIN
 PADDING_GUARD_END
 
     void update_file_node(FileNode*, FileInfo*);
-    FileVerdict check_verdict(Flow*, FileNode*, SFXHASH_NODE*, FilePolicy&);
+    FileVerdict check_verdict(Flow*, FileNode*, XHashNode*, FilePolicy&);
     int store_verdict(Flow*, FileInfo*);
 
     /* The hash table of expected files */
-    SFXHASH* fileHash = nullptr;
+    XHash* fileHash = nullptr;
     uint32_t timeout = DEFAULT_FILE_BLOCK_TIMEOUT;
 };
 
index 692bd208caaa923110ccbc5ec2c90e735fa6762f..ce854f49865ad8480e076a02e61b6dcdcdcb1823 100644 (file)
@@ -65,7 +65,7 @@ void FileMagicRule::clear()
 
 void FileIdentifier::init_merge_hash()
 {
-    identifier_merge_hash = sfghash_new(1000, sizeof(MergeNode), 0, nullptr);
+    identifier_merge_hash = ghash_new(1000, sizeof(MergeNode), 0, nullptr);
     assert(identifier_merge_hash);
 }
 
@@ -79,7 +79,7 @@ FileIdentifier::~FileIdentifier()
 
     if (identifier_merge_hash != nullptr)
     {
-        sfghash_delete(identifier_merge_hash);
+        ghash_delete(identifier_merge_hash);
     }
 }
 
@@ -192,7 +192,7 @@ bool FileIdentifier::update_next(IdentifierNode* start,IdentifierNode** next_ptr
         set_node_state_shared(append);
         return false;
     }
-    else if ((result = (IdentifierNode*)sfghash_find(identifier_merge_hash, &merge_node)))
+    else if ((result = (IdentifierNode*)ghash_find(identifier_merge_hash, &merge_node)))
     {
         /*the same pointer has been processed, reuse it*/
         *next_ptr = result;
@@ -217,7 +217,7 @@ bool FileIdentifier::update_next(IdentifierNode* start,IdentifierNode** next_ptr
 
             set_node_state_shared(next);
             next = node;
-            sfghash_add(identifier_merge_hash, &merge_node, next);
+            ghash_add(identifier_merge_hash, &merge_node, next);
         }
         else if (next->state == ID_NODE_SHARED)
         {
@@ -227,7 +227,7 @@ bool FileIdentifier::update_next(IdentifierNode* start,IdentifierNode** next_ptr
             merge_node.append_node = append;
             next = clone_node(current_next);
             set_node_state_shared(next);
-            sfghash_add(identifier_merge_hash, &merge_node, next);
+            ghash_add(identifier_merge_hash, &merge_node, next);
         }
 
         *next_ptr = next;
index e31b348fac52109a02d2dd47b5ae9b97c937ba67..159c626e1b498f3b288293c790473e59055e7ab7 100644 (file)
@@ -29,7 +29,7 @@
 #include <list>
 #include <vector>
 
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 
 #include "file_lib.h"
 
@@ -103,7 +103,7 @@ private:
     /*properties*/
     IdentifierNode* identifier_root = nullptr; /*Root of magic tries*/
     uint32_t memory_used = 0; /*Track memory usage*/
-    SFGHASH* identifier_merge_hash = nullptr;
+    GHash* identifier_merge_hash = nullptr;
     FileMagicRule file_magic_rules[FILE_ID_MAX + 1];
     IDMemoryBlocks id_memory_blocks;
 };
index d04f4558e3d0017b2b40f7a353643ac951571af5..f8e2af776b035056902800d54b5e2eb2c21e8e9b 100644 (file)
 
 #include "detection_filter.h"
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/thread.h"
 #include "utils/util.h"
 
 #include "sfthd.h"
 
-static THREAD_LOCAL SFXHASH* detection_filter_hash = nullptr;
+static THREAD_LOCAL XHash* detection_filter_hash = nullptr;
 
 DetectionFilterConfig* DetectionFilterConfigNew()
 {
@@ -99,7 +99,7 @@ void detection_filter_term()
     if ( !detection_filter_hash )
         return;
 
-    sfxhash_delete(detection_filter_hash);
+    xhash_delete(detection_filter_hash);
     detection_filter_hash = nullptr;
 }
 
index 1350b07b2e35bf4c3857e16ceb9f1cba157ad2e9..449c827d68a4964eb95dd3a4c247040200ee861c 100644 (file)
@@ -54,7 +54,7 @@ void RateFilter_ConfigFree(RateFilterConfig* config)
     for (i = 0; i < SFRF_MAX_GENID; i++)
     {
         if (config->genHash[i] != nullptr)
-            sfghash_delete(config->genHash[i]);
+            ghash_delete(config->genHash[i]);
     }
 
     snort_free(config);
@@ -210,17 +210,17 @@ static int _printThresholdContext(RateFilterConfig* config)
 
     for ( gid=0; gid < SFRF_MAX_GENID; gid++ )
     {
-        SFGHASH_NODE* item_hash_node;
-        SFGHASH* sfrf_hash = config->genHash [ gid ];
+        GHashNode* item_hash_node;
+        GHash* sfrf_hash = config->genHash [ gid ];
 
         if ( !sfrf_hash )
         {
             continue;
         }
 
-        for ( item_hash_node  = sfghash_findfirst(sfrf_hash);
+        for ( item_hash_node  = ghash_findfirst(sfrf_hash);
             item_hash_node != 0;
-            item_hash_node  = sfghash_findnext(sfrf_hash) )
+            item_hash_node  = ghash_findnext(sfrf_hash) )
         {
             tSFRFSidNode* sfrf_item;
             tSFRFConfigNode* sfrf_node;
index d77c6c4e152a55044ffbef604a5c26099e816301..2da3a6c06e14570522d3a8ca54e6827c9d20c075 100644 (file)
@@ -27,8 +27,8 @@
 #include "sfrf.h"
 
 #include "detection/rules.h"
-#include "hash/sfghash.h"
-#include "hash/sfxhash.h"
+#include "hash/ghash.h"
+#include "hash/xhash.h"
 #include "sfip/sf_ip.h"
 #include "sfip/sf_ipvar.h"
 #include "utils/cpp_macros.h"
@@ -93,7 +93,7 @@ typedef struct
     time_t revertTime;
 } tSFRFTrackingNode;
 
-SFXHASH* rf_hash = nullptr;
+XHash* rf_hash = nullptr;
 
 // private methods ...
 static int _checkThreshold(
@@ -146,7 +146,7 @@ static void SFRF_New(unsigned nbytes)
     nrows = nbytes / (SFRF_BYTES);
 
     /* Create global hash table for all of the IP Nodes */
-    rf_hash = sfxhash_new(
+    rf_hash = xhash_new(
         nrows,  /* try one node per row - for speed */
         sizeof(tSFRFTrackingNodeKey), /* keys size */
         sizeof(tSFRFTrackingNode),     /* data size */
@@ -162,14 +162,14 @@ void SFRF_Delete()
     if ( !rf_hash )
         return;
 
-    sfxhash_delete(rf_hash);
+    xhash_delete(rf_hash);
     rf_hash = nullptr;
 }
 
 void SFRF_Flush()
 {
     if ( rf_hash )
-        sfxhash_make_empty(rf_hash);
+        xhash_make_empty(rf_hash);
 }
 
 static void SFRF_ConfigNodeFree(void* item)
@@ -216,7 +216,7 @@ static void SFRF_SidNodeFree(void* item)
 int SFRF_ConfigAdd(
     SnortConfig*, RateFilterConfig* rf_config, tSFRFConfigNode* cfgNode)
 {
-    SFGHASH* genHash;
+    GHash* genHash;
     tSFRFSidNode* pSidNode;
     tSFRFConfigNode* pNewConfigNode;
     tSFRFGenHashKey key = { 0,0 };
@@ -270,7 +270,7 @@ int SFRF_ConfigAdd(
         }
 
         /* Create the hash table for this gid */
-        genHash = sfghash_new(nrows, sizeof(tSFRFGenHashKey), 0, SFRF_SidNodeFree);
+        genHash = ghash_new(nrows, sizeof(tSFRFGenHashKey), 0, SFRF_SidNodeFree);
         if ( !genHash )
             return -2;
 
@@ -281,7 +281,7 @@ int SFRF_ConfigAdd(
     key.policyId = policy_id;
 
     /* Check if sid is already in the table - if not allocate and add it */
-    pSidNode = (tSFRFSidNode*)sfghash_find(genHash, (void*)&key);
+    pSidNode = (tSFRFSidNode*)ghash_find(genHash, (void*)&key);
     if ( !pSidNode )
     {
         /* Create the pSidNode hash node data */
@@ -298,7 +298,7 @@ int SFRF_ConfigAdd(
         }
 
         /* Add the pSidNode to the hash table */
-        if ( sfghash_add(genHash, (void*)&key, pSidNode) )
+        if ( ghash_add(genHash, (void*)&key, pSidNode) )
         {
             sflist_free(pSidNode->configNodeList);
             snort_free(pSidNode);
@@ -448,7 +448,7 @@ int SFRF_TestThreshold(
     SFRF_COUNT_OPERATION op
     )
 {
-    SFGHASH* genHash;
+    GHash* genHash;
     tSFRFSidNode* pSidNode;
     tSFRFConfigNode* cfgNode;
     int newStatus = -1;
@@ -489,7 +489,7 @@ int SFRF_TestThreshold(
     key.sid = sid;
     key.policyId = policy_id;
 
-    pSidNode = (tSFRFSidNode*)sfghash_find(genHash, (void*)&key);
+    pSidNode = (tSFRFSidNode*)ghash_find(genHash, (void*)&key);
     if ( !pSidNode )
     {
 #ifdef SFRF_DEBUG
@@ -575,20 +575,20 @@ void SFRF_ShowObjects(RateFilterConfig* config)
     tSFRFSidNode* pSidnode;
     tSFRFConfigNode* cfgNode;
     unsigned int gid;
-    SFGHASH_NODE* sidHashNode;
+    GHashNode* sidHashNode;
 
     for ( gid=0; gid < SFRF_MAX_GENID; gid++ )
     {
-        SFGHASH* genHash = config->genHash [ gid ];
+        GHash* genHash = config->genHash [ gid ];
 
         if ( !genHash )
             continue;
 
         printf("...GEN_ID = %u\n",gid);
 
-        for ( sidHashNode  = sfghash_findfirst(genHash);
+        for ( sidHashNode  = ghash_findfirst(genHash);
             sidHashNode != nullptr;
-            sidHashNode  = sfghash_findnext(genHash) )
+            sidHashNode  = ghash_findnext(genHash) )
         {
             /* Check for any Permanent sid objects for this gid */
             pSidnode = (tSFRFSidNode*)sidHashNode->data;
@@ -790,7 +790,7 @@ static tSFRFTrackingNode* _getSFRFTrackingNode(
     /*
      * Check for any Permanent sid objects for this gid or add this one ...
      */
-    SFXHASH_NODE* hnode = sfxhash_get_node(rf_hash, (void*)&key);
+    XHashNode* hnode = xhash_get_node(rf_hash, (void*)&key);
     if ( hnode && hnode->data )
     {
         dynNode = (tSFRFTrackingNode*)hnode->data;
index 6d7a40741bf7cc92a501964e810414b4fa0ebf98..48364144fa8578cb5d5d151be1ce2ed5e8d1002b 100644 (file)
@@ -133,7 +133,7 @@ struct RateFilterConfig
     /* Array of hash, indexed by gid. Each array element is a hash, which
      * is keyed on sid/policyId and data is a tSFRFSidNode node.
      */
-    struct SFGHASH* genHash [SFRF_MAX_GENID];
+    struct GHash* genHash [SFRF_MAX_GENID];
 
     // Number of DOS thresholds added.
     int count;
index bfab673242b66c82985922f3e83bcdd929c31d67..6baab23ff6de4c607c7d074a7614e5692cdeb1ba 100644 (file)
@@ -35,8 +35,8 @@
 
 #include <cassert>
 
-#include "hash/sfghash.h"
-#include "hash/sfxhash.h"
+#include "hash/ghash.h"
+#include "hash/xhash.h"
 #include "sfip/sf_ipvar.h"
 #include "utils/dyn_array.h"
 #include "utils/sflsq.h"
@@ -48,7 +48,7 @@
 // This disables adding and testing of Threshold objects
 //#define CRIPPLE
 
-SFXHASH* sfthd_new_hash(unsigned nbytes, size_t key, size_t data)
+XHash* sfthd_new_hash(unsigned nbytes, size_t key, size_t data)
 {
     size_t size = key + data;
     int nrows;
@@ -60,7 +60,7 @@ SFXHASH* sfthd_new_hash(unsigned nbytes, size_t key, size_t data)
     }
     nrows = nbytes / (size);
 
-    return sfxhash_new(
+    return xhash_new(
         nrows,  /* try one node per row - for speed */
         key,    /* keys size */
         data,   /* data size */
@@ -82,9 +82,9 @@ SFXHASH* sfthd_new_hash(unsigned nbytes, size_t key, size_t data)
   @retval !0 valid THD_STRUCT
 */
 
-SFXHASH* sfthd_local_new(unsigned bytes)
+XHash* sfthd_local_new(unsigned bytes)
 {
-    SFXHASH* local_hash =
+    XHash* local_hash =
         sfthd_new_hash(bytes,
         sizeof(THD_IP_NODE_KEY),
         sizeof(THD_IP_NODE));
@@ -97,9 +97,9 @@ SFXHASH* sfthd_local_new(unsigned bytes)
     return local_hash;
 }
 
-SFXHASH* sfthd_global_new(unsigned bytes)
+XHash* sfthd_global_new(unsigned bytes)
 {
-    SFXHASH* global_hash =
+    XHash* global_hash =
         sfthd_new_hash(bytes,
         sizeof(THD_IP_GNODE_KEY),
         sizeof(THD_IP_NODE));
@@ -141,7 +141,7 @@ THD_STRUCT* sfthd_new(unsigned lbytes, unsigned gbytes)
 #ifdef THD_DEBUG
         printf("Could not allocate the sfxhash table\n");
 #endif
-        sfxhash_delete(thd->ip_nodes);
+        xhash_delete(thd->ip_nodes);
         snort_free(thd);
         return nullptr;
     }
@@ -180,7 +180,7 @@ void sfthd_objs_free(ThresholdObjects* thd_objs)
     for (i = 0; i < THD_MAX_GENID; i++)
     {
         if (thd_objs->sfthd_array[i])
-            sfghash_delete(thd_objs->sfthd_array[i]);
+            ghash_delete(thd_objs->sfthd_array[i]);
     }
 
     for (policyId = 0; policyId < thd_objs->numPoliciesAllocated; policyId++)
@@ -237,10 +237,10 @@ void sfthd_free(THD_STRUCT* thd)
 
 #ifndef CRIPPLE
     if (thd->ip_nodes != nullptr)
-        sfxhash_delete(thd->ip_nodes);
+        xhash_delete(thd->ip_nodes);
 
     if (thd->ip_gnodes != nullptr)
-        sfxhash_delete(thd->ip_gnodes);
+        xhash_delete(thd->ip_gnodes);
 #endif
 
     snort_free(thd);
@@ -293,7 +293,7 @@ the current event should be logged or dropped.
 static int sfthd_create_threshold_local(
     SnortConfig*, ThresholdObjects* thd_objs, THD_NODE* config)
 {
-    SFGHASH* sfthd_hash;
+    GHash* sfthd_hash;
     THD_ITEM* sfthd_item;
     THD_NODE* sfthd_node;
     tThdItemKey key;
@@ -325,7 +325,7 @@ static int sfthd_create_threshold_local(
         }
 
         /* Create the hash table for this gen_id */
-        sfthd_hash = sfghash_new(nrows, sizeof(tThdItemKey), 0, sfthd_item_free);
+        sfthd_hash = ghash_new(nrows, sizeof(tThdItemKey), 0, sfthd_item_free);
         if ( !sfthd_hash )
         {
             return -2;
@@ -346,7 +346,7 @@ static int sfthd_create_threshold_local(
     key.policyId = policy_id;
 
     /* Check if sig_id is already in the table - if not allocate and add it */
-    sfthd_item = (THD_ITEM*)sfghash_find(sfthd_hash, (void*)&key);
+    sfthd_item = (THD_ITEM*)ghash_find(sfthd_hash, (void*)&key);
     if ( !sfthd_item )
     {
         /* Create the sfthd_item hash node data */
@@ -364,7 +364,7 @@ static int sfthd_create_threshold_local(
         }
 
         /* Add the sfthd_item to the hash table */
-        if ( sfghash_add(sfthd_hash, (void*)&key, sfthd_item) )
+        if ( ghash_add(sfthd_hash, (void*)&key, sfthd_item) )
         {
             sflist_free(sfthd_item->sfthd_node_list);
             snort_free(sfthd_item);
@@ -652,7 +652,7 @@ static char* printIP(unsigned u, char* buf, unsigned len)
 
 #endif
 
-int sfthd_test_rule(SFXHASH* rule_hash, THD_NODE* sfthd_node,
+int sfthd_test_rule(XHash* rule_hash, THD_NODE* sfthd_node,
     const SfIp* sip, const SfIp* dip, long curtime)
 {
     int status;
@@ -850,7 +850,7 @@ static inline int sfthd_test_non_suppress(
  *
  */
 int sfthd_test_local(
-    SFXHASH* local_hash,
+    XHash* local_hash,
     THD_NODE* sfthd_node,
     const SfIp* sip,
     const SfIp* dip,
@@ -920,8 +920,8 @@ int sfthd_test_local(
     /*
      * Check for any Permanent sig_id objects for this gen_id  or add this one ...
      */
-    status = sfxhash_add(local_hash, (void*)&key, &data);
-    if (status == SFXHASH_INTABLE)
+    status = xhash_add(local_hash, (void*)&key, &data);
+    if (status == XHASH_INTABLE)
     {
         /* Already in the table */
         sfthd_ip_node = (THD_IP_NODE*)local_hash->cnode->data;
@@ -929,7 +929,7 @@ int sfthd_test_local(
         /* Increment the event count */
         sfthd_ip_node->count++;
     }
-    else if (status != SFXHASH_OK)
+    else if (status != XHASH_OK)
     {
         /* hash error */
         return 1; /*  check the next threshold object */
@@ -947,7 +947,7 @@ int sfthd_test_local(
  *   Test a global thresholding object
  */
 static inline int sfthd_test_global(
-    SFXHASH* global_hash,
+    XHash* global_hash,
     THD_NODE* sfthd_node,
     unsigned sig_id,     /* from current event */
     const SfIp* sip,        /* " */
@@ -1014,8 +1014,8 @@ static inline int sfthd_test_global(
     data.tstart = data.tlast = curtime; /* Event time */
 
     /* Check for any Permanent sig_id objects for this gen_id  or add this one ...  */
-    status = sfxhash_add(global_hash, (void*)&key, &data);
-    if (status == SFXHASH_INTABLE)
+    status = xhash_add(global_hash, (void*)&key, &data);
+    if (status == XHASH_INTABLE)
     {
         /* Already in the table */
         sfthd_ip_node = (THD_IP_NODE*)global_hash->cnode->data;
@@ -1023,7 +1023,7 @@ static inline int sfthd_test_global(
         /* Increment the event count */
         sfthd_ip_node->count++;
     }
-    else if (status != SFXHASH_OK)
+    else if (status != XHASH_OK)
     {
         /* hash error */
         return 1; /*  check the next threshold object */
@@ -1065,7 +1065,7 @@ int sfthd_test_threshold(
     long curtime)
 {
     tThdItemKey key;
-    SFGHASH* sfthd_hash;
+    GHash* sfthd_hash;
     THD_ITEM* sfthd_item;
     THD_NODE* sfthd_node;
     THD_NODE* g_thd_node = nullptr;
@@ -1115,7 +1115,7 @@ int sfthd_test_threshold(
     /*
      * Check for any Permanent sig_id objects for this gen_id
      */
-    sfthd_item = (THD_ITEM*)sfghash_find(sfthd_hash, (void*)&key);
+    sfthd_item = (THD_ITEM*)ghash_find(sfthd_hash, (void*)&key);
     if (sfthd_item == nullptr)
     {
 #ifdef THD_DEBUG
@@ -1237,20 +1237,20 @@ int sfthd_show_objects(ThresholdObjects* thd_objs)
     THD_ITEM* sfthd_item;
     THD_NODE* sfthd_node;
     unsigned gen_id;
-    SFGHASH_NODE* item_hash_node;
+    GHashNode* item_hash_node;
 
     for (gen_id=0; gen_id < THD_MAX_GENID; gen_id++ )
     {
-        SFGHASH* sfthd_hash = thd_objs->sfthd_array[gen_id];
+        GHash* sfthd_hash = thd_objs->sfthd_array[gen_id];
 
         if ( !sfthd_hash )
             continue;
 
         printf("...GEN_ID = %u\n",gen_id);
 
-        for (item_hash_node  = sfghash_findfirst(sfthd_hash);
+        for (item_hash_node  = ghash_findfirst(sfthd_hash);
             item_hash_node != 0;
-            item_hash_node  = sfghash_findnext(sfthd_hash) )
+            item_hash_node  = ghash_findnext(sfthd_hash) )
         {
             /* Check for any Permanent sig_id objects for this gen_id */
             sfthd_item = (THD_ITEM*)item_hash_node->data;
index 0224d62a8ddd457b2e978761041aae334adda651..2bda91dc15ea7e29a2fc4470f4e0a1cc206e6de2 100644 (file)
@@ -27,8 +27,8 @@
 #include "sfip/sf_ip.h"
 #include "utils/cpp_macros.h"
 
-struct SFGHASH;
-struct SFXHASH;
+struct GHash;
+struct XHash;
 typedef struct sf_list SF_LIST;
 
 /*!
@@ -181,14 +181,14 @@ struct tThdItemKey
  */
 struct THD_STRUCT
 {
-    SFXHASH* ip_nodes;   /* Global hash of active IP's key=THD_IP_NODE_KEY, data=THD_IP_NODE */
-    SFXHASH* ip_gnodes;  /* Global hash of active IP's key=THD_IP_GNODE_KEY, data=THD_IP_GNODE */
+    XHash* ip_nodes;   /* Global hash of active IP's key=THD_IP_NODE_KEY, data=THD_IP_NODE */
+    XHash* ip_gnodes;  /* Global hash of active IP's key=THD_IP_GNODE_KEY, data=THD_IP_GNODE */
 };
 
 struct ThresholdObjects
 {
     int count;  /* Total number of thresholding/suppression objects */
-    SFGHASH* sfthd_array[THD_MAX_GENID];    /* Local Hash of THD_ITEM nodes,  lookup by key=sig_id
+    GHash* sfthd_array[THD_MAX_GENID];    /* Local Hash of THD_ITEM nodes,  lookup by key=sig_id
                                               */
 
     /* Double array of THD_NODE pointers. First index is policyId and therefore variable length.
@@ -208,13 +208,13 @@ struct ThresholdObjects
 // lbytes = local threshold memcap
 // gbytes = global threshold memcap (0 to disable global)
 THD_STRUCT* sfthd_new(unsigned lbytes, unsigned gbytes);
-SFXHASH* sfthd_local_new(unsigned bytes);
-SFXHASH* sfthd_global_new(unsigned bytes);
+XHash* sfthd_local_new(unsigned bytes);
+XHash* sfthd_global_new(unsigned bytes);
 void sfthd_free(THD_STRUCT*);
 ThresholdObjects* sfthd_objs_new();
 void sfthd_objs_free(ThresholdObjects*);
 
-int sfthd_test_rule(SFXHASH* rule_hash, THD_NODE* sfthd_node,
+int sfthd_test_rule(XHash* rule_hash, THD_NODE* sfthd_node,
     const SfIp* sip, const SfIp* dip, long curtime);
 
 THD_NODE* sfthd_create_rule_threshold(
@@ -252,10 +252,10 @@ int sfthd_test_threshold(
     const SfIp* dip,
     long curtime);
 
-SFXHASH* sfthd_new_hash(unsigned, size_t, size_t);
+XHash* sfthd_new_hash(unsigned, size_t, size_t);
 
 int sfthd_test_local(
-    SFXHASH* local_hash,
+    XHash* local_hash,
     THD_NODE* sfthd_node,
     const SfIp* sip,
     const SfIp* dip,
index 53b373db2e8c24a6134de4e91e0b2d8a4b9edbce..8a995c6c9d0ff03b9e52049ea2626890e27d75b1 100644 (file)
@@ -23,7 +23,7 @@
 #endif
 
 #include "catch/catch.hpp"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "main/snort_types.h"
 #include "parser/parse_ip.h"
 #include "sfip/sf_ip.h"
@@ -92,7 +92,7 @@ typedef struct
 
 static THD_STRUCT* pThd = nullptr;
 static ThresholdObjects* pThdObjs = nullptr;
-static SFXHASH* dThd = nullptr;
+static XHash* dThd = nullptr;
 
 //---------------------------------------------------------------
 
@@ -809,7 +809,7 @@ static void Term()
             p->rule = nullptr;
         }
     }
-    sfxhash_delete(dThd);
+    xhash_delete(dThd);
 }
 
 static int SetupCheck(int i)
index 66c4c2bd6a4d3be215c455924d409d718787aede..e6026a439d9359d1fbb88bb068049beab546edbd 100644 (file)
@@ -22,7 +22,7 @@
    This file contains functions that glue the generic thresholding2 code to
    snort.
 
-   dependent files:  sfthd sfxghash sfghash sflsq
+   dependent files:  sfthd sfxghash ghash sflsq
                      util mstring
 
    Marc Norton
@@ -43,7 +43,7 @@
 
 #include "sfthreshold.h"
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "main/snort_config.h"
 #include "utils/util.h"
 
@@ -203,11 +203,11 @@ static int print_thd_node(THD_NODE* p, PrintFormat type, unsigned* prnMode)
 
 static int print_thd_local(ThresholdObjects* thd_objs, PrintFormat type, unsigned* prnMode)
 {
-    SFGHASH* sfthd_hash;
+    GHash* sfthd_hash;
     THD_ITEM* sfthd_item;
     THD_NODE* sfthd_node;
     int gen_id;
-    SFGHASH_NODE* item_hash_node;
+    GHashNode* item_hash_node;
     int lcnt=0;
     PolicyId policyId;
 
@@ -221,9 +221,9 @@ static int print_thd_local(ThresholdObjects* thd_objs, PrintFormat type, unsigne
                 continue;
             }
 
-            for (item_hash_node  = sfghash_findfirst(sfthd_hash);
+            for (item_hash_node  = ghash_findfirst(sfthd_hash);
                 item_hash_node != 0;
-                item_hash_node  = sfghash_findnext(sfthd_hash) )
+                item_hash_node  = ghash_findnext(sfthd_hash) )
             {
                 /* Check for any Permanent sig_id objects for this gen_id */
                 sfthd_item = (THD_ITEM*)item_hash_node->data;
index a04ac1e24235b97a362c2871d58824b9c17cc6c8..43345e48d40ce84451d75d3b67d147e1c25ab1c0 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "flow/flow_key.h"
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "main/snort_config.h"
 #include "protocols/icmp4.h"
 #include "protocols/icmp6.h"
@@ -295,7 +295,7 @@ bool FlowKey::init(
 // hash foo
 //-------------------------------------------------------------------------
 
-uint32_t FlowKey::hash(SFHASHFCN* hf, const unsigned char* p, int)
+uint32_t FlowKey::hash(HashFnc* hf, const unsigned char* p, int)
 {
     uint32_t a, b, c;
     a = b = c = hf->hardener;
index d4fca3b1ecf381415d364ae47ac4dace4d144b12..55729d01e238c9b183b697967840762e341a6382 100644 (file)
@@ -28,7 +28,7 @@
 #include "framework/decode_data.h"
 #include "utils/cpp_macros.h"
 
-struct SFHASHFCN;
+struct HashFnc;
 struct SfIp;
 
 PADDING_GUARD_BEGIN
@@ -67,7 +67,7 @@ struct FlowKey
     void init_address_space(uint16_t);
 
     // XXX If this data structure changes size, compare must be updated!
-    static uint32_t hash(SFHASHFCN*, const unsigned char* d, int);
+    static uint32_t hash(HashFnc*, const unsigned char* d, int);
     static int compare(const void* s1, const void* s2, size_t);
 
 private:
index de1e4d84041db88dfcded286c3d635e479f700f0..43afc92f639c3fd1418aa0c8c88198d49df7a0cc 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <cstring>
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 
 static const char* s_buffer = nullptr;
 
index 07a2b5de6a4d3e6b589ac82fde66b1c6afa62856..3e67542fa74edde055522cfd34cd9e14fc5403a7 100644 (file)
@@ -1,9 +1,9 @@
 
 set (HASH_INCLUDES
     hashes.h
-    sfghash.h 
-    sfxhash.h 
-    sfhashfcn.h 
+    ghash.h 
+    xhash.h 
+    hashfcn.h 
 )
 
 set (HASH_SOURCES )
@@ -14,11 +14,11 @@ add_library( hash STATIC
     hashes.cc
     lru_cache_shared.h
     lru_cache_shared.cc
-    sfghash.cc 
-    sfhashfcn.cc 
-    sfprimetable.cc 
-    sfprimetable.h 
-    sfxhash.cc 
+    ghash.cc 
+    hashfcn.cc 
+    primetable.cc 
+    primetable.h 
+    xhash.cc 
     zhash.cc 
     zhash.h
 )
index cfb5f616b274a39dc685236ecd23d1b52691bad3..267c64e4f67d89ec67de3eb4c5e5411efb887fc7 100644 (file)
@@ -5,18 +5,18 @@ x_includedir = $(pkgincludedir)/hash
 
 x_include_HEADERS = \
 hashes.h \
-sfghash.h \
-sfxhash.h \
-sfhashfcn.h
+ghash.h \
+xhash.h \
+hashfcn.h
 
 libhash_a_SOURCES = \
 hashes.cc \
 lru_cache_shared.cc \
 lru_cache_shared.h \
-sfghash.cc \
-sfhashfcn.cc \
-sfprimetable.cc sfprimetable.h \
-sfxhash.cc \
+ghash.cc \
+hashfcn.cc \
+primetable.cc primetable.h \
+xhash.cc \
 zhash.cc zhash.h
 
 if BUILD_CPPUTESTS
similarity index 80%
rename from src/hash/sfghash.cc
rename to src/hash/ghash.cc
index 37771d28c13be2dc235979968e331371ae1055af..f48bc15bf54be7cae75240d9ad02dbd79f8d5d8e 100644 (file)
@@ -19,7 +19,7 @@
 
 /*
 *
-*  sfghash.c
+*  ghash.c
 *
 *  Generic hash table library.
 *
 #include "config.h"
 #endif
 
-#include "sfghash.h"
+#include "ghash.h"
 
 #include <cassert>
 
 #include "utils/util.h"
 
-#include "sfhashfcn.h"
-#include "sfprimetable.h"
+#include "hashfcn.h"
+#include "primetable.h"
 
 /*
 *
 *               save the pointer to the key.
 *               ==0 => we should copy the keys and manage them internally
 *    userfree : routine to free users data, null if we should not
-*               free user data in sfghash_delete(). The routine
+*               free user data in ghash_delete(). The routine
 *               should be of the form 'void userfree(void * userdata)',
 *               'free' works for simple allocations.
 */
-SFGHASH* sfghash_new(int nrows, int keysize, int userkeys, SfgHashFree userfree)
+GHash* ghash_new(int nrows, int keysize, int userkeys, gHashFree userfree)
 {
     if ( nrows > 0 ) /* make sure we have a prime number */
     {
-        nrows = sf_nearest_prime(nrows);
+        nrows = nearest_prime(nrows);
     }
     else  /* use the magnitude or nrows as is */
     {
         nrows = -nrows;
     }
 
-    SFGHASH* h = (SFGHASH*)snort_calloc(sizeof(SFGHASH));
+    GHash* h = (GHash*)snort_calloc(sizeof(GHash));
 
-    h->sfhashfcn = sfhashfcn_new(nrows);
-    h->table = (SFGHASH_NODE**)snort_calloc(nrows, sizeof(SFGHASH_NODE*));
+    h->hashfcn = hashfcn_new(nrows);
+    h->table = (GHashNode**)snort_calloc(nrows, sizeof(GHashNode*));
 
     for ( int i = 0; i < nrows; i++ )
     {
@@ -125,20 +125,20 @@ SFGHASH* sfghash_new(int nrows, int keysize, int userkeys, SfgHashFree userfree)
 *  free key's, free node's, and free the users data, if they
 *  supply a free function
 */
-void sfghash_delete(SFGHASH* h)
+void ghash_delete(GHash* h)
 {
     if ( !h )
         return;
 
-    sfhashfcn_free(h->sfhashfcn);
+    hashfcn_free(h->hashfcn);
 
     if ( h->table )
     {
         for (int i=0; i<h->nrows; i++)
         {
-            for ( SFGHASH_NODE* node=h->table[i]; node; )
+            for ( GHashNode* node=h->table[i]; node; )
             {
-                SFGHASH_NODE* onode = node;
+                GHashNode* onode = node;
                 node  = node->next;
 
                 if ( !h->userkey && onode->key )
@@ -178,15 +178,15 @@ void sfghash_delete(SFGHASH* h)
 *  linked list of data items held by the node, or track a counter, or whatever.
 *
 */
-int sfghash_add(SFGHASH* t, const void* const key, void* const data)
+int ghash_add(GHash* t, const void* const key, void* const data)
 {
     unsigned hashkey;
     int klen;
     int index;
-    SFGHASH_NODE* hnode;
+    GHashNode* hnode;
 
     if (t == nullptr || key == nullptr)
-        return SFGHASH_ERR;
+        return GHASH_ERR;
 
     /*
     *   Get proper Key Size
@@ -197,11 +197,11 @@ int sfghash_add(SFGHASH* t, const void* const key, void* const data)
     }
     else
     {
-        /* need the null byte for strcmp() in sfghash_find() */
+        /* need the null byte for strcmp() in ghash_find() */
         klen = strlen( (const char*)key) + 1;
     }
 
-    hashkey = t->sfhashfcn->hash_fcn(t->sfhashfcn, (const unsigned char*)key, klen);
+    hashkey = t->hashfcn->hash_fcn(t->hashfcn, (const unsigned char*)key, klen);
 
     index = hashkey % t->nrows;
 
@@ -214,10 +214,10 @@ int sfghash_add(SFGHASH* t, const void* const key, void* const data)
     {
         if ( t->keysize > 0 )
         {
-            if ( !t->sfhashfcn->keycmp_fcn(hnode->key,key,klen) )
+            if ( !t->hashfcn->keycmp_fcn(hnode->key,key,klen) )
             {
                 t->cnode = hnode; /* save pointer to the node */
-                return SFGHASH_INTABLE; /* found it */
+                return GHASH_INTABLE; /* found it */
             }
         }
         else
@@ -225,7 +225,7 @@ int sfghash_add(SFGHASH* t, const void* const key, void* const data)
             if ( !strcmp((const char*)hnode->key,(const char*)key) )
             {
                 t->cnode = hnode; /* save pointer to the node */
-                return SFGHASH_INTABLE; /* found it */
+                return GHASH_INTABLE; /* found it */
             }
         }
     }
@@ -233,7 +233,7 @@ int sfghash_add(SFGHASH* t, const void* const key, void* const data)
     /*
     *  Create new node
     */
-    hnode = (SFGHASH_NODE*)snort_calloc(sizeof(SFGHASH_NODE));
+    hnode = (GHashNode*)snort_calloc(sizeof(GHashNode));
 
     /* Add the Key */
     if ( t->userkey )
@@ -269,17 +269,17 @@ int sfghash_add(SFGHASH* t, const void* const key, void* const data)
 
     t->count++;
 
-    return SFGHASH_OK;
+    return GHASH_OK;
 }
 
 /*
 *  Find a Node based on the key, return users data.
 */
-static SFGHASH_NODE* sfghash_find_node(SFGHASH* t, const void* const key)
+static GHashNode* ghash_find_node(GHash* t, const void* const key)
 {
     unsigned hashkey;
     int index, klen;
-    SFGHASH_NODE* hnode;
+    GHashNode* hnode;
 
     assert(t);
 
@@ -292,7 +292,7 @@ static SFGHASH_NODE* sfghash_find_node(SFGHASH* t, const void* const key)
         klen = strlen( (const char*)key) + 1;
     }
 
-    hashkey = t->sfhashfcn->hash_fcn(t->sfhashfcn, (const unsigned char*)key, klen);
+    hashkey = t->hashfcn->hash_fcn(t->hashfcn, (const unsigned char*)key, klen);
 
     index = hashkey % t->nrows;
 
@@ -307,7 +307,7 @@ static SFGHASH_NODE* sfghash_find_node(SFGHASH* t, const void* const key)
         }
         else
         {
-            if ( !t->sfhashfcn->keycmp_fcn(hnode->key,key,t->keysize) )
+            if ( !t->hashfcn->keycmp_fcn(hnode->key,key,t->keysize) )
             {
                 return hnode;
             }
@@ -320,13 +320,13 @@ static SFGHASH_NODE* sfghash_find_node(SFGHASH* t, const void* const key)
 /*
 *  Find a Node based on the key, return users data.
 */
-void* sfghash_find(SFGHASH* t, const void* const key)
+void* ghash_find(GHash* t, const void* const key)
 {
-    SFGHASH_NODE* hnode;
+    GHashNode* hnode;
 
     assert(t);
 
-    hnode = sfghash_find_node(t, key);
+    hnode = ghash_find_node(t, key);
 
     if ( hnode )
         return hnode->data;
@@ -337,7 +337,7 @@ void* sfghash_find(SFGHASH* t, const void* const key)
 /*
 *  Unlink and free the node
 */
-static int sfghash_free_node(SFGHASH* t, unsigned index, SFGHASH_NODE* hnode)
+static int ghash_free_node(GHash* t, unsigned index, GHashNode* hnode)
 {
     assert(t);
 
@@ -366,7 +366,7 @@ static int sfghash_free_node(SFGHASH* t, unsigned index, SFGHASH_NODE* hnode)
 
     t->count--;
 
-    return SFGHASH_OK;
+    return GHASH_OK;
 }
 
 /*
@@ -375,9 +375,9 @@ static int sfghash_free_node(SFGHASH* t, unsigned index, SFGHASH_NODE* hnode)
 *  returns : 0 - OK
 *           -1 - node not found
 */
-int sfghash_remove(SFGHASH* t, const void* const key)
+int ghash_remove(GHash* t, const void* const key)
 {
-    SFGHASH_NODE* hnode;
+    GHashNode* hnode;
     int klen;
     unsigned hashkey, index;
 
@@ -392,7 +392,7 @@ int sfghash_remove(SFGHASH* t, const void* const key)
         klen = strlen((const char*)key) + 1;
     }
 
-    hashkey = t->sfhashfcn->hash_fcn(t->sfhashfcn, (const unsigned char*)key, klen);
+    hashkey = t->hashfcn->hash_fcn(t->hashfcn, (const unsigned char*)key, klen);
 
     index = hashkey % t->nrows;
 
@@ -400,25 +400,25 @@ int sfghash_remove(SFGHASH* t, const void* const key)
     {
         if ( t->keysize > 0 )
         {
-            if ( !t->sfhashfcn->keycmp_fcn(hnode->key,key,klen) )
+            if ( !t->hashfcn->keycmp_fcn(hnode->key,key,klen) )
             {
-                return sfghash_free_node(t, index, hnode);
+                return ghash_free_node(t, index, hnode);
             }
         }
         else
         {
             if ( !strcmp((const char*)hnode->key,(const char*)key) )
             {
-                return sfghash_free_node(t, index, hnode);
+                return ghash_free_node(t, index, hnode);
             }
         }
     }
 
-    return SFGHASH_ERR;
+    return GHASH_ERR;
 }
 
 /* Internal use only */
-static void sfghash_next(SFGHASH* t)
+static void ghash_next(GHash* t)
 {
     assert(t and t->cnode);
 
@@ -444,9 +444,9 @@ static void sfghash_next(SFGHASH* t)
 /*
 *   Get First Hash Table Node
 */
-SFGHASH_NODE* sfghash_findfirst(SFGHASH* t)
+GHashNode* ghash_findfirst(GHash* t)
 {
-    SFGHASH_NODE* n;
+    GHashNode* n;
 
     assert(t);
     /* Start with 1st row */
@@ -459,7 +459,7 @@ SFGHASH_NODE* sfghash_findfirst(SFGHASH* t)
         {
             n = t->cnode;
 
-            sfghash_next(t); // load t->cnode with the next entry
+            ghash_next(t); // load t->cnode with the next entry
 
             return n;
         }
@@ -470,9 +470,9 @@ SFGHASH_NODE* sfghash_findfirst(SFGHASH* t)
 /*
 *   Get Next Hash Table Node
 */
-SFGHASH_NODE* sfghash_findnext(SFGHASH* t)
+GHashNode* ghash_findnext(GHash* t)
 {
-    SFGHASH_NODE* n;
+    GHashNode* n;
 
     assert(t);
 
@@ -486,23 +486,23 @@ SFGHASH_NODE* sfghash_findnext(SFGHASH* t)
     /*
        Preload next node into current node
     */
-    sfghash_next(t);
+    ghash_next(t);
 
     return n;
 }
 
 /**
- * Make sfhashfcn use a separate set of opcodes for the backend.
+ * Make hashfcn use a separate set of opcodes for the backend.
  *
- * @param h sfhashfcn ptr
+ * @param h hashfcn ptr
  * @param hash_fcn user specified hash function
  * @param keycmp_fcn user specified key comparison function
  */
-int sfghash_set_keyops(SFGHASH* h,
-    unsigned (* hash_fcn)(SFHASHFCN* p, const unsigned char* d, int n),
+int ghash_set_keyops(GHash* h,
+    unsigned (* hash_fcn)(HashFnc* p, const unsigned char* d, int n),
     int (* keycmp_fcn)(const void* s1, const void* s2, size_t n))
 {
     assert(h && hash_fcn && keycmp_fcn);
 
-    return sfhashfcn_set_keyops(h->sfhashfcn, hash_fcn, keycmp_fcn);
+    return hashfcn_set_keyops(h->hashfcn, hash_fcn, keycmp_fcn);
 }
similarity index 61%
rename from src/hash/sfghash.h
rename to src/hash/ghash.h
index 171cc053c99da7ab3a0791a980c0abb6b69bf56c..709b6717e3a39321757d8dc8750010716c9a3c09 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-// sfghash.h author Marc Norton
+// ghash.h author Marc Norton
 
-#ifndef SFGHASH_H
-#define SFGHASH_H
+#ifndef GHASH_H
+#define GHASH_H
 
 // generic hash table - stores and maps key + data pairs
 
 #include "main/snort_types.h"
 
-struct SFHASHFCN;
+struct HashFnc;
 
-#define SFGHASH_NOMEM    (-2)
-#define SFGHASH_ERR      (-1)
-#define SFGHASH_OK        0
-#define SFGHASH_INTABLE   1
+#define GHASH_NOMEM    (-2)
+#define GHASH_ERR      (-1)
+#define GHASH_OK        0
+#define GHASH_INTABLE   1
 
 // Flags for ghash_new: userkeys
 #define GH_COPYKEYS 0
 #define GH_USERKEYS 1
 
-struct SFGHASH_NODE
+struct GHashNode
 {
-    struct SFGHASH_NODE* next, * prev;
+    struct GHashNode* next, * prev;
 
     const void* key;  /* Copy of, or Pointer to, the Users key */
     void* data;       /* The users data, this is never copied! */
 };
 
-typedef void (* SfgHashFree)(void*);
+typedef void (* gHashFree)(void*);
 
-struct SFGHASH
+struct GHash
 {
-    SFHASHFCN* sfhashfcn;
+    HashFnc* hashfcn;
     int keysize;          /* bytes in key, if < 0 -> keys are strings */
     int userkey;          /* user owns the key */
 
-    SFGHASH_NODE** table; /* array of node ptr's */
+    GHashNode** table; /* array of node ptr's */
     int nrows;            /* # rows int the hash table use a prime number 211, 9871 */
 
     unsigned count;       /* total # nodes in table */
 
-    SfgHashFree userfree;
+    gHashFree userfree;
 
     int crow;             /* findfirst/next row in table */
-    SFGHASH_NODE* cnode;  /* findfirst/next node ptr */
+    GHashNode* cnode;  /* findfirst/next node ptr */
 };
 
-SO_PUBLIC SFGHASH* sfghash_new(int nrows, int keysize, int userkeys, SfgHashFree);
-SO_PUBLIC void sfghash_delete(SFGHASH*);
-SO_PUBLIC int sfghash_add(SFGHASH*, const void* const key, void* const data);
-SO_PUBLIC int sfghash_remove(SFGHASH*, const void* const key);
-SO_PUBLIC void* sfghash_find(SFGHASH*, const void* const key);
-SO_PUBLIC SFGHASH_NODE* sfghash_findfirst(SFGHASH*);
-SO_PUBLIC SFGHASH_NODE* sfghash_findnext(SFGHASH*);
-SO_PUBLIC int sfghash_set_keyops(SFGHASH*,
-    unsigned (* hash_fcn)(SFHASHFCN* p, const unsigned char* d, int n),
-    int (* keycmp_fcn)(const void* s1, const void* s2, size_t n));
+SO_PUBLIC GHash* ghash_new(int nrows, int keysize, int userkeys, gHashFree);
+SO_PUBLIC void ghash_delete(GHash*);
+SO_PUBLIC int ghash_add(GHash*, const void* const key, void* const data);
+SO_PUBLIC int ghash_remove(GHash*, const void* const key);
+SO_PUBLIC void* ghash_find(GHash*, const void* const key);
+SO_PUBLIC GHashNode* ghash_findfirst(GHash*);
+SO_PUBLIC GHashNode* ghash_findnext(GHash*);
+SO_PUBLIC int ghash_set_keyops(GHash*,
+unsigned (* hash_fcn)(HashFnc* p, const unsigned char* d, int n),
+int (* keycmp_fcn)(const void* s1, const void* s2, size_t n));
 
 #endif
 
similarity index 82%
rename from src/hash/sfhashfcn.cc
rename to src/hash/hashfcn.cc
index 57fa56275569e11fda66724b6b68a629c45c285b..70f83180e87ebee297615556af31e8d7b3eb30bc 100644 (file)
 //--------------------------------------------------------------------------
 
 /*
-     sfhashfcn.c
+     hashfcn.c
 
-     Each hash table must allocate it's own SFGHASH struct, this is because
-     sfghash_new uses the number of rows in the hash table to modulo the random
+     Each hash table must allocate it's own GHash struct, this is because
+     ghash_new uses the number of rows in the hash table to modulo the random
      values.
 
      Updates:
 #include "config.h"
 #endif
 
-#include "sfhashfcn.h"
+#include "hashfcn.h"
 
 #include "main/snort_config.h"
 #include "utils/util.h"
 
-#include "sfprimetable.h"
+#include "primetable.h"
 
-SFHASHFCN* sfhashfcn_new(int m)
+HashFnc* hashfcn_new(int m)
 {
-    SFHASHFCN* p;
+    HashFnc* p;
     static int one=1;
 
     if ( one ) /* one time init */
@@ -51,7 +51,7 @@ SFHASHFCN* sfhashfcn_new(int m)
         one = 0;
     }
 
-    p = (SFHASHFCN*)snort_calloc(sizeof(*p));
+    p = (HashFnc*)snort_calloc(sizeof(*p));
 
     if ( SnortConfig::static_hash() )
     {
@@ -61,18 +61,18 @@ SFHASHFCN* sfhashfcn_new(int m)
     }
     else
     {
-        p->seed     = sf_nearest_prime( (rand()%m)+3191);
-        p->scale    = sf_nearest_prime( (rand()%m)+709);
+        p->seed     = nearest_prime( (rand()%m)+3191);
+        p->scale    = nearest_prime( (rand()%m)+709);
         p->hardener = (rand()*rand()) + 133824503;
     }
 
-    p->hash_fcn   = &sfhashfcn_hash;
+    p->hash_fcn   = &hashfcn_hash;
     p->keycmp_fcn = &memcmp;
 
     return p;
 }
 
-void sfhashfcn_free(SFHASHFCN* p)
+void hashfcn_free(HashFnc* p)
 {
     if ( p )
     {
@@ -80,7 +80,7 @@ void sfhashfcn_free(SFHASHFCN* p)
     }
 }
 
-unsigned sfhashfcn_hash(SFHASHFCN* p, const unsigned char* d, int n)
+unsigned hashfcn_hash(HashFnc* p, const unsigned char* d, int n)
 {
     unsigned hash = p->seed;
     while ( n )
@@ -93,14 +93,14 @@ unsigned sfhashfcn_hash(SFHASHFCN* p, const unsigned char* d, int n)
 }
 
 /**
- * Make sfhashfcn use a separate set of opcodes for the backend.
+ * Make hashfcn use a separate set of opcodes for the backend.
  *
- * @param h sfhashfcn ptr
+ * @param h hashfcn ptr
  * @param hash_fcn user specified hash function
  * @param keycmp_fcn user specified key comparison function
  */
-int sfhashfcn_set_keyops(SFHASHFCN* h,
-    unsigned (* hash_fcn)(SFHASHFCN* p, const unsigned char* d, int n),
+int hashfcn_set_keyops(HashFnc* h,
+    unsigned (* hash_fcn)(HashFnc* p, const unsigned char* d, int n),
     int (* keycmp_fcn)(const void* s1, const void* s2, size_t n))
 {
     if (h && hash_fcn && keycmp_fcn)
similarity index 85%
rename from src/hash/sfhashfcn.h
rename to src/hash/hashfcn.h
index ee9e168cf4fd0baeb7b442c4912d55e1809c4950..4a7c70a63d6fd10af9b934c6f50966538fca2b45 100644 (file)
@@ -17,8 +17,8 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#ifndef SFHASHFCN_H
-#define SFHASHFCN_H
+#ifndef HashFnc_H
+#define HashFnc_H
 
 #include "main/snort_types.h"
 
@@ -52,25 +52,25 @@ SO_PUBLIC void mix_str(
 
 SO_PUBLIC size_t str_to_hash(const uint8_t *str, int length);
 
-struct SFHASHFCN
+struct HashFnc
 {
     unsigned seed;
     unsigned scale;
     unsigned hardener;
     // FIXIT-H use types for these callbacks
-    unsigned (* hash_fcn)(SFHASHFCN*, const unsigned char* d, int n);
+    unsigned (* hash_fcn)(HashFnc*, const unsigned char* d, int n);
     int (* keycmp_fcn)(const void* s1, const void* s2, size_t n);
 };
 
-SFHASHFCN* sfhashfcn_new(int nrows);
-void sfhashfcn_free(SFHASHFCN*);
+HashFnc* hashfcn_new(int nrows);
+void hashfcn_free(HashFnc*);
 
-unsigned sfhashfcn_hash(SFHASHFCN*, const unsigned char* d, int n);
+unsigned hashfcn_hash(HashFnc*, const unsigned char* d, int n);
 
-int sfhashfcn_set_keyops(
-    SFHASHFCN*,
+int hashfcn_set_keyops(
+    HashFnc*,
     // FIXIT-H use types for these callbacks
-    unsigned (* hash_fcn)(SFHASHFCN* p, const unsigned char* d, int n),
+    unsigned (* hash_fcn)(HashFnc* p, const unsigned char* d, int n),
     int (* keycmp_fcn)(const void* s1, const void* s2, size_t n) );
 
 #endif
similarity index 99%
rename from src/hash/sfprimetable.cc
rename to src/hash/primetable.cc
index ea73063503e53e3a804f3b249d62ed9e5e856826..5462f4faf090366d36a5e48747467289f5ea5f07 100644 (file)
@@ -23,7 +23,7 @@
 * Prime number calculation via Table lookups.
 *
 * This was implemented for use with the hashing functions
-* in sfghash, and sfxhash.
+* in ghash, and sfxhash.
 *
 */
 
@@ -31,7 +31,7 @@
 #include "config.h"
 #endif
 
-#include "sfprimetable.h"
+#include "primetable.h"
 
 /* 0-8K, increments=8 */
 static unsigned prime_table0[1024]=
@@ -2101,7 +2101,7 @@ static unsigned prime_table3[1024]=
     134086639, /* 134086656 */       134217689, /* 134217728 */
 };
 
-int sf_nearest_prime(int n)
+int nearest_prime(int n)
 {
     if ( n < 0 )
         n = -n;
similarity index 93%
rename from src/hash/sfprimetable.h
rename to src/hash/primetable.h
index 28131d440b8e4caa8ecff67a909f6d67455b2809..1455ec0ee90898ab549918fe6803b60885634664 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-#ifndef SFPRIMETABLE_H
-#define SFPRIMETABLE_H
+#ifndef PRIMETABLE_H
+#define PRIMETABLE_H
 
-int sf_nearest_prime(int n);
+int nearest_prime(int n);
 
 #endif
 
index 9db87cf6305b876538f1096c57ceffa863b3c90d..04677171671f0f7c86733940917531c57710465e 100644 (file)
@@ -1,2 +1,2 @@
 add_cpputest(lru_cache_shared_test hash)
-add_cpputest(sfghash_test hash)
+add_cpputest(ghash_test hash)
index e9fd96e29cc6dc4907a669f8044a6c53a6b2b23d..2c33494d99d9fadcd908f4247c3c8bb1c4d7e213 100644 (file)
@@ -3,12 +3,12 @@ AM_DEFAULT_SOURCE_EXT = .cc
 
 check_PROGRAMS = \
 lru_cache_shared_test \
-sfghash_test
+ghash_test
 
 TESTS = $(check_PROGRAMS)
 
 lru_cache_shared_test_CPPFLAGS = $(AM_CPPFLAGS) @CPPUTEST_CPPFLAGS@
 lru_cache_shared_test_LDADD = ../lru_cache_shared.o @CPPUTEST_LDFLAGS@
 
-sfghash_test_CPPFLAGS = $(AM_CPPFLAGS) @CPPUTEST_CPPFLAGS@
-sfghash_test_LDADD = ../libhash.a @CPPUTEST_LDFLAGS@
+ghash_test_CPPFLAGS = $(AM_CPPFLAGS) @CPPUTEST_CPPFLAGS@
+ghash_test_LDADD = ../libhash.a @CPPUTEST_LDFLAGS@
similarity index 73%
rename from src/hash/test/sfghash_test.cc
rename to src/hash/test/ghash_test.cc
index a3e34c06c0165fdfb5876e8612419623d238597f..165b59dd6c4c0ad86c7e0fb4727924be522ba6ff 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-// sfg_hash_test.cc author Steven Baigal <sbaigal@cisco.com>
-// unit tests for sfghash utility functions
+// ghash_test.cc author Steven Baigal <sbaigal@cisco.com>
+// unit tests for ghash utility functions
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 
 #include "main/snort_config.h"
 
@@ -35,7 +35,7 @@ static SnortConfig my_config;
 THREAD_LOCAL SnortConfig *snort_conf = &my_config;
 
 SnortConfig::SnortConfig(SnortConfig*) 
-{ snort_conf->run_flags = 0;} // run_flags is used indirectly from SFHASHFCN class by calling SnortConfig::static_hash()
+{ snort_conf->run_flags = 0;} // run_flags is used indirectly from HashFnc class by calling SnortConfig::static_hash()
 
 SnortConfig::~SnortConfig() = default;
 
@@ -56,26 +56,26 @@ static void myfree(void* p)
     snort_free(p);
 }
 
-TEST_GROUP(sfghash)
+TEST_GROUP(ghash)
 {
 };
 
 //  Test create a hash table, add nodes, find and delete.
-TEST(sfghash, create_find_delete_test)
+TEST(ghash, create_find_delete_test)
 {
     int i;
     char str[256];
     int num=100;
 
     // Create a Hash Table
-    SFGHASH* t = sfghash_new(1000, 0, GH_COPYKEYS, nullptr);
+    GHash* t = ghash_new(1000, 0, GH_COPYKEYS, nullptr);
 
     // Add Nodes to the Hash Table
     for (i=0; i<num; i++)
     {
         snprintf(str, sizeof(str), "KeyWord%d",i+1);
         str[sizeof(str) - 1] = '\0';
-        sfghash_add(t, str, (void *)(str + (i+1)));
+        ghash_add(t, str, (void *)(str + (i+1)));
     }
 
     // find those nodes
@@ -84,31 +84,31 @@ TEST(sfghash, create_find_delete_test)
         snprintf(str, sizeof(str), "KeyWord%d",i+1);
         str[sizeof(str) - 1] = '\0';
 
-        char* p = (char*)sfghash_find(t, str);
+        char* p = (char*)ghash_find(t, str);
 
         CHECK(p != nullptr);
         CHECK(p == (void *)(str + (i+1)));
     }
 
-    for (SFGHASH_NODE* n = sfghash_findfirst(t); n; n = sfghash_findnext(t) )
+    for (GHashNode* n = ghash_findfirst(t); n; n = ghash_findnext(t) )
     {
-        i = sfghash_remove(t,n->key);
+        i = ghash_remove(t,n->key);
 
         CHECK(i==0);
     }
 
-    sfghash_delete(t);
+    ghash_delete(t);
 }
 
 // test to generate collisions and increase test code coverage
-TEST(sfghash, collision_test)
+TEST(ghash, collision_test)
 {
     int i;
     char str[256];
     int num=100;
 
     // Create a Hash Table with smaller entries
-    SFGHASH* t = sfghash_new(-10, 0, GH_COPYKEYS, nullptr);
+    GHash* t = ghash_new(-10, 0, GH_COPYKEYS, nullptr);
 
     CHECK(t != nullptr);
 
@@ -117,14 +117,14 @@ TEST(sfghash, collision_test)
     {
         snprintf(str, sizeof(str), "KeyWord%d",i+1);
         str[sizeof(str) - 1] = '\0';
-        sfghash_add(t, str, (void *)(str + (i+1)));
+        ghash_add(t, str, (void *)(str + (i+1)));
     }
 
     // try to add an existed entry
     snprintf(str, sizeof(str), "KeyWord%d",1);
     str[sizeof(str) - 1] = '\0';
-    i = sfghash_add(t, str, (void *)(str + (1)));
-    CHECK(i == SFGHASH_INTABLE);
+    i = ghash_add(t, str, (void *)(str + (1)));
+    CHECK(i == GHASH_INTABLE);
 
     // find those nodes
     for (i=num-1; i>=0; i--)
@@ -132,40 +132,40 @@ TEST(sfghash, collision_test)
         snprintf(str, sizeof(str), "KeyWord%d",i+1);
         str[sizeof(str) - 1] = '\0';
 
-        char* p = (char*)sfghash_find(t, str);
+        char* p = (char*)ghash_find(t, str);
 
         CHECK(p != nullptr);
         CHECK(p == (void *)(str + (i+1)));
     }
 
     // remove one node
-    SFGHASH_NODE* n = sfghash_findfirst(t);
+    GHashNode* n = ghash_findfirst(t);
     if (n)
     {
-        n = sfghash_findnext(t);
-        i = sfghash_remove(t,n->key);
+        n = ghash_findnext(t);
+        i = ghash_remove(t,n->key);
 
         CHECK(i==0);
     }
 
     // remove rest of nodes
-    for ( n = sfghash_findfirst(t); n; n = sfghash_findnext(t) )
+    for ( n = ghash_findfirst(t); n; n = ghash_findnext(t) )
     {
-        i = sfghash_remove(t,n->key);
+        i = ghash_remove(t,n->key);
 
         CHECK(i==0);
     }
 
-    sfghash_delete(t);
+    ghash_delete(t);
 }
 
-TEST(sfghash, userfree_test)
+TEST(ghash, userfree_test)
 {
     char str[256];
     int i;
 
     // Create a small Hash Table with user free
-    SFGHASH* t = sfghash_new(-5, 0, GH_COPYKEYS, myfree);
+    GHash* t = ghash_new(-5, 0, GH_COPYKEYS, myfree);
     // add 5 nodes
     for (i=0; i<5; i++)
     {
@@ -174,7 +174,7 @@ TEST(sfghash, userfree_test)
         char* p = (char*)snort_alloc(32);
         p[0] = (char)(i+1);
         p[1] = '\0';
-        sfghash_add(t, str, (void *)p);
+        ghash_add(t, str, (void *)p);
     }
 
     // find those nodes
@@ -183,7 +183,7 @@ TEST(sfghash, userfree_test)
         snprintf(str, sizeof(str), "KeyWord%d",i+1);
         str[sizeof(str) - 1] = '\0';
 
-        char *p = (char*)sfghash_find(t, str);
+        char *p = (char*)ghash_find(t, str);
 
         CHECK(p != nullptr);
         CHECK(p[0] == (i+1));
@@ -194,26 +194,26 @@ TEST(sfghash, userfree_test)
     str[sizeof(str) - 1] = '\0';
 
     // it should not be found
-    CHECK(sfghash_find(t, str) == nullptr);
+    CHECK(ghash_find(t, str) == nullptr);
     
     // try to remove a node that is not in the table
-    CHECK(sfghash_remove(t, str) == SFGHASH_ERR);
+    CHECK(ghash_remove(t, str) == GHASH_ERR);
 
-    for ( SFGHASH_NODE* n = sfghash_findfirst(t); n; n = sfghash_findnext(t) )
+    for ( GHashNode* n = ghash_findfirst(t); n; n = ghash_findnext(t) )
     {
         // user free should be called here, no memory leak should be detected
-        i = sfghash_remove(t,n->key);
+        i = ghash_remove(t,n->key);
 
         CHECK(i==0);
     }
 
-    sfghash_delete(t);
+    ghash_delete(t);
 }
 
-TEST(sfghash, nullptr_test)
+TEST(ghash, nullptr_test)
 {
-    CHECK(SFGHASH_ERR == sfghash_add(nullptr, nullptr, nullptr));
-    sfghash_delete(nullptr);
+    CHECK(GHASH_ERR == ghash_add(nullptr, nullptr, nullptr));
+    ghash_delete(nullptr);
 }
 
 int main(int argc, char** argv)
similarity index 77%
rename from src/hash/sfxhash.cc
rename to src/hash/xhash.cc
index 62300d8b01dad0ca57c42e0ea8faf6f2dcb2e55f..3c12237e2d84ba5afde1a1481f1f6b53d7d8bc79 100644 (file)
  *
  *  Per Node Memory Usage:
  *  ----------------------
- *     SFXHASH_NODE bytes
+ *     XHashNode bytes
  *     KEYSIZE bytes
- *     [DATASIZE bytes] if datasize > 0 during call to sfxhash_new.
+ *     [DATASIZE bytes] if datasize > 0 during call to xhash_new.
  *
- *  The hash node memory (sfxhash_node,key,and data) is allocated with
+ *  The hash node memory (xhash_node,key,and data) is allocated with
  *  one call to s_alloc/memcap_alloc.
  *
  *  Author: Marc Norton
  *
- *  2003-06-03: cmg - added sfxhash_{l,m}ru to return {least,most}
+ *  2003-06-03: cmg - added xhash_{l,m}ru to return {least,most}
  *              recently used node from the global list
  *
  *              - added _anrcount function
@@ -81,7 +81,7 @@
  *  2003-06-30: rdempster
  *              fixed bug in that would anr from the freelist
  *
- *  2005-11-15: modified sfxhash_add to check if 'data' is zero before memcpy'ing.
+ *  2005-11-15: modified xhash_add to check if 'data' is zero before memcpy'ing.
  *              this allows user to pass null for data, and set up the data area
  *              themselves after the call - this is much more flexible.
  *  8/31/2006: man - changed to use prime table lookup.
 #include "config.h"
 #endif
 
-#include "sfxhash.h"
+#include "xhash.h"
 
 #include <cassert>
 #include "utils/util.h"
-#include "sfhashfcn.h"
+#include "hashfcn.h"
 
 /*
- * Implements SFXHASH as specialized hash container
+ * Implements XHash as specialized hash container
  */
 
 /*
 * Private Malloc - abstract the memory system
 */
-static inline void* s_alloc(SFXHASH* t, int n)
+static inline void* s_alloc(XHash* t, int n)
 {
     return sfmemcap_alloc(&t->mc, n);
 }
 
-static inline void s_free(SFXHASH* t, void* p)
+static inline void s_free(XHash* t, void* p)
 {
     sfmemcap_free(&t->mc, p);
 }
 
-static int sfxhash_nearest_powerof2(int nrows)
+static int xhash_nearest_powerof2(int nrows)
 {
     nrows -= 1;
     for (unsigned i=1; i<sizeof(nrows) * 8; i <<= 1)
@@ -137,9 +137,9 @@ static int sfxhash_nearest_powerof2(int nrows)
  * anrfree  users Automatic Node Recovery memory release function
  * usrfree  users standard memory release function
  *
- * return SFXHASH*
+ * return XHash*
  * retval  0 out of memory
- * retval !0 Valid SFXHASH pointer
+ * retval !0 Valid XHash pointer
  */
 /*
   Notes:
@@ -148,17 +148,17 @@ static int sfxhash_nearest_powerof2(int nrows)
   maxmem of 0 indicates no memory limits.
 
 */
-SFXHASH* sfxhash_new(int nrows, int keysize, int datasize, unsigned long maxmem,
+XHash* xhash_new(int nrows, int keysize, int datasize, unsigned long maxmem,
     int anr_flag,
-    SFXHASH_FREE_FCN anrfree,
-    SFXHASH_FREE_FCN usrfree,
+    XHash_FREE_FCN anrfree,
+    XHash_FREE_FCN usrfree,
     int recycle_flag)
 {
     if ( nrows > 0 ) /* make sure we have a prime number */
     {
         /* If nrows is not a power of two, need to find the
          * next highest power of two */
-        nrows = sfxhash_nearest_powerof2(nrows);
+        nrows = xhash_nearest_powerof2(nrows);
     }
     else   /* use the magnitude of nrows as is */
     {
@@ -166,18 +166,18 @@ SFXHASH* sfxhash_new(int nrows, int keysize, int datasize, unsigned long maxmem,
     }
 
     /* Allocate the table structure from general memory */
-    SFXHASH* h = (SFXHASH*)snort_calloc(sizeof(SFXHASH));
+    XHash* h = (XHash*)snort_calloc(sizeof(XHash));
 
     /* this has a default hashing function */
-    h->sfhashfcn = sfhashfcn_new(nrows);
+    h->hashfcn = hashfcn_new(nrows);
     sfmemcap_init(&h->mc, maxmem);
 
     /* Allocate the array of node ptrs */
-    h->table = (SFXHASH_NODE**)s_alloc(h, sizeof(SFXHASH_NODE*) * nrows);
+    h->table = (XHashNode**)s_alloc(h, sizeof(XHashNode*) * nrows);
 
     if ( !h->table )
     {
-        snort_free(h->sfhashfcn);
+        snort_free(h->hashfcn);
         snort_free(h);
         return nullptr;
     }
@@ -218,11 +218,11 @@ SFXHASH* sfxhash_new(int nrows, int keysize, int datasize, unsigned long maxmem,
  *  Set the maximum nodes used in this hash table.
  *  Specifying 0 is unlimited (or otherwise limited by memcap).
  *
- * h SFXHASH table pointer
+ * h XHash table pointer
  * max_nodes maximum nodes to allow.
  *
  */
-void sfxhash_set_max_nodes(SFXHASH* h, int max_nodes)
+void xhash_set_max_nodes(XHash* h, int max_nodes)
 {
     if (h)
     {
@@ -237,17 +237,17 @@ void sfxhash_set_max_nodes(SFXHASH* h, int max_nodes)
  *  No need to call the user free, since that should've been
  *  done when those nodes were put back in the free list.
  *
- * h SFXHASH table pointer
+ * h XHash table pointer
  */
-static void sfxhash_delete_free_list(SFXHASH* t)
+static void xhash_delete_free_list(XHash* t)
 {
     if (t == nullptr || t->fhead == nullptr)
         return;
 
-    SFXHASH_NODE* cur = t->fhead;
+    XHashNode* cur = t->fhead;
     while (cur != nullptr)
     {
-        SFXHASH_NODE* next = cur->gnext;
+        XHashNode* next = cur->gnext;
         s_free(t, (void*)cur);
         cur = next;
     }
@@ -261,24 +261,24 @@ static void sfxhash_delete_free_list(SFXHASH* t)
  *
  *  free key's, free node's, and free the users data.
  *
- * h SFXHASH table pointer
+ * h XHash table pointer
  *
  */
-void sfxhash_delete(SFXHASH* h)
+void xhash_delete(XHash* h)
 {
     if ( !h )
         return;
 
-    if ( h->sfhashfcn )
-        sfhashfcn_free(h->sfhashfcn);
+    if ( h->hashfcn )
+        hashfcn_free(h->hashfcn);
 
     if ( h->table )
     {
         for (unsigned i = 0; i < h->nrows; i++)
         {
-            for ( SFXHASH_NODE* node = h->table[i]; node; )
+            for ( XHashNode* node = h->table[i]; node; )
             {
-                SFXHASH_NODE* onode = node;
+                XHashNode* onode = node;
                 node  = node->next;
 
                 /* Notify user that we are about to free this node function */
@@ -292,7 +292,7 @@ void sfxhash_delete(SFXHASH* h)
         h->table = nullptr;
     }
 
-    sfxhash_delete_free_list(h);
+    xhash_delete_free_list(h);
 
     snort_free(h);   /* free the table from general memory */
 }
@@ -300,23 +300,23 @@ void sfxhash_delete(SFXHASH* h)
 /*!
  *  Empty out the hash table
  *
- * h SFXHASH table pointer
+ * h XHash table pointer
  *
  * return -1 on error
  */
-int sfxhash_make_empty(SFXHASH* h)
+int xhash_make_empty(XHash* h)
 {
-    SFXHASH_NODE* tmp = nullptr;
+    XHashNode* tmp = nullptr;
 
     if (h == nullptr)
         return -1;
 
     for (unsigned i = 0; i < h->nrows; i++)
     {
-        for (SFXHASH_NODE* n = h->table[i]; n != nullptr; n = tmp)
+        for (XHashNode* n = h->table[i]; n != nullptr; n = tmp)
         {
             tmp = n->next;
-            if (sfxhash_free_node(h, n) != SFXHASH_OK)
+            if (xhash_free_node(h, n) != XHASH_OK)
             {
                 return -1;
             }
@@ -340,7 +340,7 @@ int sfxhash_make_empty(SFXHASH* h)
 /** Save the freed node for later use (recylcing).
  *  Free List - uses the NODE gnext/gprev fields
  */
-static void sfxhash_save_free_node(SFXHASH* t, SFXHASH_NODE* hnode)
+static void xhash_save_free_node(XHash* t, XHashNode* hnode)
 {
     /* Add A Node to the Free Node List */
     if ( t->fhead ) /* add the node to head of the the existing list */
@@ -362,9 +362,9 @@ static void sfxhash_save_free_node(SFXHASH* t, SFXHASH_NODE* hnode)
 
 /**Get a previously freed node for reuse.
  */
-static SFXHASH_NODE* sfxhash_get_free_node(SFXHASH* t)
+static XHashNode* xhash_get_free_node(XHash* t)
 {
-    SFXHASH_NODE* node = t->fhead;
+    XHashNode* node = t->fhead;
 
     /* Remove A Node from the Free Node List - remove the head node */
     if ( t->fhead  )
@@ -380,7 +380,7 @@ static SFXHASH_NODE* sfxhash_get_free_node(SFXHASH* t)
     return node;
 }
 
-static void sfxhash_glink_node(SFXHASH* t, SFXHASH_NODE* hnode)
+static void xhash_glink_node(XHash* t, XHashNode* hnode)
 {
     /* Add The Node */
     if ( t->ghead ) /* add the node to head of the the existing list */
@@ -400,7 +400,7 @@ static void sfxhash_glink_node(SFXHASH* t, SFXHASH_NODE* hnode)
     }
 }
 
-static void sfxhash_gunlink_node(SFXHASH* t, SFXHASH_NODE* hnode)
+static void xhash_gunlink_node(XHash* t, XHashNode* hnode)
 {
     if ( t->gnode == hnode ) /* if this was the global next node */
     {
@@ -426,19 +426,19 @@ static void sfxhash_gunlink_node(SFXHASH* t, SFXHASH_NODE* hnode)
 
 /**Move node to the front of global list. Node movement is application specific.
  */
-void sfxhash_gmovetofront(SFXHASH* t, SFXHASH_NODE* hnode)
+void xhash_gmovetofront(XHash* t, XHashNode* hnode)
 {
     if ( hnode != t->ghead )
     {
-        sfxhash_gunlink_node(t, hnode);
-        sfxhash_glink_node(t, hnode);
+        xhash_gunlink_node(t, hnode);
+        xhash_glink_node(t, hnode);
     }
 }
 
 /*
  *
  */
-static void sfxhash_link_node(SFXHASH* t, SFXHASH_NODE* hnode)
+static void xhash_link_node(XHash* t, XHashNode* hnode)
 {
     /* Add The Node to the Hash Table Row List */
     if ( t->table[hnode->rindex] ) /* add the node to the existing list */
@@ -456,7 +456,7 @@ static void sfxhash_link_node(SFXHASH* t, SFXHASH_NODE* hnode)
     }
 }
 
-static void sfxhash_unlink_node(SFXHASH* t, SFXHASH_NODE* hnode)
+static void xhash_unlink_node(XHash* t, XHashNode* hnode)
 {
     if ( hnode->prev )  // definitely not the 1st node in the list
     {
@@ -475,22 +475,22 @@ static void sfxhash_unlink_node(SFXHASH* t, SFXHASH_NODE* hnode)
 /*
  *  move a node to the front of the row list at row = 'index'
  */
-static void movetofront(SFXHASH* t, SFXHASH_NODE* n)
+static void movetofront(XHash* t, XHashNode* n)
 {
     /* Modify Hash Node Row List */
     if ( t->table[n->rindex] != n ) // if not at front of list already...
     {
         /* Unlink the node */
-        sfxhash_unlink_node(t, n);
+        xhash_unlink_node(t, n);
 
         /* Link at front of list */
-        sfxhash_link_node(t, n);
+        xhash_link_node(t, n);
     }
 
     /* Move node in the global hash node list to the front */
     if (n == t->gnode)
         t->gnode = n->gnext;
-    sfxhash_gmovetofront(t, n);
+    xhash_gmovetofront(t, n);
 }
 
 /*
@@ -503,17 +503,17 @@ static void movetofront(SFXHASH* t, SFXHASH_NODE* n)
  * to the front of the list. The oldest node is just the tail node.
  *
  */
-static SFXHASH_NODE* sfxhash_newnode(SFXHASH* t)
+static XHashNode* xhash_newnode(XHash* t)
 {
     /* Recycle Old Nodes - if any */
-    SFXHASH_NODE* hnode = sfxhash_get_free_node(t);
+    XHashNode* hnode = xhash_get_free_node(t);
 
     /* Allocate memory for a node */
     if ( !hnode )
     {
         if ((t->max_nodes == 0) || (t->count < t->max_nodes))
         {
-            hnode = (SFXHASH_NODE*)s_alloc(t, sizeof(SFXHASH_NODE) + t->pad +
+            hnode = (XHashNode*)s_alloc(t, sizeof(XHashNode) + t->pad +
                 t->keysize + t->datasize);
         }
     }
@@ -542,8 +542,8 @@ static SFXHASH_NODE* sfxhash_newnode(SFXHASH* t)
                 /* YES, user said we can recycle this node */
             }
 
-            sfxhash_gunlink_node(t, hnode);   /* unlink from the global list */
-            sfxhash_unlink_node(t, hnode);   /* unlink from the row list */
+            xhash_gunlink_node(t, hnode);   /* unlink from the global list */
+            xhash_unlink_node(t, hnode);   /* unlink from the row list */
             t->count--;
             t->anr_count++; /* count # of ANR operations */
             break;
@@ -567,9 +567,9 @@ static SFXHASH_NODE* sfxhash_newnode(SFXHASH* t)
 #define hashsize(n) ((uint32_t)1<<(n))
 #define hashmask(n) (hashsize(n)-1)
 
-static SFXHASH_NODE* sfxhash_find_node_row(SFXHASH* t, const void* key, int* rindex)
+static XHashNode* xhash_find_node_row(XHash* t, const void* key, int* rindex)
 {
-    unsigned hashkey = t->sfhashfcn->hash_fcn(t->sfhashfcn, (const unsigned char*)key, t->keysize);
+    unsigned hashkey = t->hashfcn->hash_fcn(t->hashfcn, (const unsigned char*)key, t->keysize);
 
 /*     printf("hashkey: %u t->keysize: %d\n", hashkey, t->keysize);
        flowkey_fprint(stdout, key);
@@ -580,9 +580,9 @@ static SFXHASH_NODE* sfxhash_find_node_row(SFXHASH* t, const void* key, int* rin
     int index  = hashkey & (t->nrows - 1);
     *rindex = index;
 
-    for (SFXHASH_NODE* hnode = t->table[index]; hnode; hnode = hnode->next )
+    for (XHashNode* hnode = t->table[index]; hnode; hnode = hnode->next )
     {
-        if ( !t->sfhashfcn->keycmp_fcn(hnode->key, key, t->keysize) )
+        if ( !t->hashfcn->keycmp_fcn(hnode->key, key, t->keysize) )
         {
             if ( t->splay > 0 )
                 movetofront(t, hnode);
@@ -605,40 +605,40 @@ static SFXHASH_NODE* sfxhash_find_node_row(SFXHASH* t, const void* key, int* rin
  *
  *    This is done because of the successful find.
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  * key  users key pointer
  * data  users data pointer
  *
  * return integer
- * retval SFXHASH_OK      success
- * retval SFXHASH_INTABLE already in the table, t->cnode points to the node
- * retval SFXHASH_NOMEM   not enough memory
+ * retval XHASH_OK      success
+ * retval XHASH_INTABLE already in the table, t->cnode points to the node
+ * retval XHASH_NOMEM   not enough memory
  */
-static int sfxhash_add_ex(SFXHASH* t, const void* key, void* data, void** data_ptr)
+static int xhash_add_ex(XHash* t, const void* key, void* data, void** data_ptr)
 {
     int index = 0;
 
     /* Enforce uniqueness: Check for the key in the table */
-    SFXHASH_NODE* hnode = sfxhash_find_node_row(t, key, &index);
+    XHashNode* hnode = xhash_find_node_row(t, key, &index);
     if ( hnode )
     {
         t->cnode = hnode;
         if (data_ptr)
             *data_ptr = hnode->data;
-        return SFXHASH_INTABLE; /* found it - return it. */
+        return XHASH_INTABLE; /* found it - return it. */
     }
 
     /*
      *  Alloc new hash node - allocate key space and data space at the same time.
      */
-    hnode = sfxhash_newnode(t);
+    hnode = xhash_newnode(t);
     if ( !hnode )
     {
-        return SFXHASH_NOMEM;
+        return XHASH_NOMEM;
     }
 
     /* Set up the new key pointer */
-    hnode->key = (char*)hnode + sizeof(SFXHASH_NODE);
+    hnode->key = (char*)hnode + sizeof(XHashNode);
 
     /* Copy the key */
     memcpy(hnode->key,key,t->keysize);
@@ -650,7 +650,7 @@ static int sfxhash_add_ex(SFXHASH* t, const void* key, void* data, void** data_p
     if ( t->datasize )
     {
         /* Set up the new data pointer */
-        hnode->data= (char*)hnode + sizeof(SFXHASH_NODE) + t->pad + t->keysize;
+        hnode->data= (char*)hnode + sizeof(XHashNode) + t->pad + t->keysize;
 
         if (data)
         {
@@ -665,20 +665,20 @@ static int sfxhash_add_ex(SFXHASH* t, const void* key, void* data, void** data_p
     }
 
     /* Link the node into the table row list */
-    sfxhash_link_node (t, hnode);
+    xhash_link_node (t, hnode);
 
     /* Link at the front of the global node list */
-    sfxhash_glink_node(t, hnode);
+    xhash_glink_node(t, hnode);
 
     /* Track # active nodes */
     t->count++;
 
-    return SFXHASH_OK;
+    return XHASH_OK;
 }
 
-int sfxhash_add(SFXHASH* t, void* key, void* data)
+int xhash_add(XHash* t, void* key, void* data)
 {
-    return sfxhash_add_ex(t, key, data, nullptr);
+    return xhash_add_ex(t, key, data, nullptr);
 }
 
 /*!
@@ -690,20 +690,20 @@ int sfxhash_add(SFXHASH* t, void* key, void* data)
  *
  *    This is done because of the successful find.
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  * key  users key pointer
  *
  * return integer
- * retval SFXHASH_OK      success
- * retval SFXHASH_INTABLE already in the table, t->cnode points to the node
- * retval SFXHASH_NOMEM   not enough memory
+ * retval XHASH_OK      success
+ * retval XHASH_INTABLE already in the table, t->cnode points to the node
+ * retval XHASH_NOMEM   not enough memory
  */
-SFXHASH_NODE* sfxhash_get_node(SFXHASH* t, const void* key)
+XHashNode* xhash_get_node(XHash* t, const void* key)
 {
     int index = 0;
 
     /* Enforce uniqueness: Check for the key in the table */
-    SFXHASH_NODE* hnode = sfxhash_find_node_row(t, key, &index);
+    XHashNode* hnode = xhash_find_node_row(t, key, &index);
     if ( hnode )
     {
         t->cnode = hnode;
@@ -714,14 +714,14 @@ SFXHASH_NODE* sfxhash_get_node(SFXHASH* t, const void* key)
     /*
      *  Alloc new hash node - allocate key space and data space at the same time.
      */
-    hnode = sfxhash_newnode(t);
+    hnode = xhash_newnode(t);
     if ( !hnode )
     {
         return nullptr;
     }
 
     /* Set up the new key pointer */
-    hnode->key = (char*)hnode + sizeof(SFXHASH_NODE);
+    hnode->key = (char*)hnode + sizeof(XHashNode);
 
     /* Copy the key */
     memcpy(hnode->key,key,t->keysize);
@@ -733,7 +733,7 @@ SFXHASH_NODE* sfxhash_get_node(SFXHASH* t, const void* key)
     if ( t->datasize )
     {
         /* Set up the new data pointer */
-        hnode->data = (char*)hnode + sizeof(SFXHASH_NODE) + t->pad + t->keysize;
+        hnode->data = (char*)hnode + sizeof(XHashNode) + t->pad + t->keysize;
     }
     else
     {
@@ -741,10 +741,10 @@ SFXHASH_NODE* sfxhash_get_node(SFXHASH* t, const void* key)
     }
 
     /* Link the node into the table row list */
-    sfxhash_link_node (t, hnode);
+    xhash_link_node (t, hnode);
 
     /* Link at the front of the global node list */
-    sfxhash_glink_node(t, hnode);
+    xhash_glink_node(t, hnode);
 
     /* Track # active nodes */
     t->count++;
@@ -755,34 +755,34 @@ SFXHASH_NODE* sfxhash_get_node(SFXHASH* t, const void* key)
 /*!
  * Find a Node based on the key
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  * key  users key pointer
  *
- * return SFXHASH_NODE*   valid pointer to the hash node
+ * return XHashNode*   valid pointer to the hash node
  * retval 0               node not found
  *
  */
-SFXHASH_NODE* sfxhash_find_node(SFXHASH* t, const void* key)
+XHashNode* xhash_find_node(XHash* t, const void* key)
 {
     int rindex = 0;
 
-    return sfxhash_find_node_row(t, key, &rindex);
+    return xhash_find_node_row(t, key, &rindex);
 }
 
 /*!
  * Find the users data based associated with the key
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  * key  users key pointer
  *
  * return void*   valid pointer to the users data
  * retval 0       node not found
  *
  */
-void* sfxhash_find(SFXHASH* t, void* key)
+void* xhash_find(XHash* t, void* key)
 {
     int rindex = 0;
-    SFXHASH_NODE* hnode = sfxhash_find_node_row(t, key, &rindex);
+    XHashNode* hnode = xhash_find_node_row(t, key, &rindex);
     if ( hnode )
         return hnode->data;
 
@@ -796,7 +796,7 @@ void* sfxhash_find(SFXHASH* t, void* key)
  *
  * return the head of the list or nullptr
  */
-SFXHASH_NODE* sfxhash_ghead(SFXHASH* t)
+XHashNode* xhash_ghead(XHash* t)
 {
     if (t)
     {
@@ -813,9 +813,9 @@ SFXHASH_NODE* sfxhash_ghead(SFXHASH* t)
  *
  * return the next node in the list or nullptr when at the end
  */
-SFXHASH_NODE* sfxhash_gfindnext(SFXHASH* t)
+XHashNode* xhash_gfindnext(XHash* t)
 {
-    SFXHASH_NODE* n = t->gnode;
+    XHashNode* n = t->gnode;
     if (n)
         t->gnode = n->gnext;
     return n;
@@ -828,7 +828,7 @@ SFXHASH_NODE* sfxhash_gfindnext(SFXHASH* t)
  *
  * return the head of the list or nullptr
  */
-SFXHASH_NODE* sfxhash_gfindfirst(SFXHASH* t)
+XHashNode* xhash_gfindfirst(XHash* t)
 {
     if (t)
     {
@@ -844,15 +844,15 @@ SFXHASH_NODE* sfxhash_gfindfirst(SFXHASH* t)
 /*!
  * Return the most recently used data from the global list
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  *
  * return void*   valid pointer to the users data
  * retval 0       node not found
  *
  */
-void* sfxhash_mru(SFXHASH* t)
+void* xhash_mru(XHash* t)
 {
-    SFXHASH_NODE* hnode = sfxhash_ghead(t);
+    XHashNode* hnode = xhash_ghead(t);
     if ( hnode )
         return hnode->data;
 
@@ -862,15 +862,15 @@ void* sfxhash_mru(SFXHASH* t)
 /*!
  * Return the least recently used data from the global list
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  *
  * return void*   valid pointer to the users data
  * retval 0       node not found
  *
  */
-void* sfxhash_lru(SFXHASH* t)
+void* xhash_lru(XHash* t)
 {
-    SFXHASH_NODE* hnode = t->gtail;
+    XHashNode* hnode = t->gtail;
     if ( hnode )
         return hnode->data;
 
@@ -880,11 +880,11 @@ void* sfxhash_lru(SFXHASH* t)
 /*
  *  Unlink and free the node
  */
-int sfxhash_free_node(SFXHASH* t, SFXHASH_NODE* hnode)
+int xhash_free_node(XHash* t, XHashNode* hnode)
 {
-    sfxhash_unlink_node(t, hnode);   /* unlink from the hash table row list */
+    xhash_unlink_node(t, hnode);   /* unlink from the hash table row list */
 
-    sfxhash_gunlink_node(t, hnode);   /* unlink from global-hash-node list */
+    xhash_gunlink_node(t, hnode);   /* unlink from global-hash-node list */
 
     t->count--;
 
@@ -895,49 +895,49 @@ int sfxhash_free_node(SFXHASH* t, SFXHASH_NODE* hnode)
 
     if ( t->recycle_nodes )
     {
-        sfxhash_save_free_node(t, hnode);
+        xhash_save_free_node(t, hnode);
     }
     else
     {
         s_free(t, hnode);
     }
 
-    return SFXHASH_OK;
+    return XHASH_OK;
 }
 
 /*!
  * Remove a Key + Data Pair from the table.
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  * key  users key pointer
  *
  * return 0   success
  * retval !0  failed
  *
  */
-int sfxhash_remove(SFXHASH* t, void* key)
+int xhash_remove(XHash* t, void* key)
 {
-    unsigned hashkey = t->sfhashfcn->hash_fcn(t->sfhashfcn, (unsigned char*)key, t->keysize);
+    unsigned hashkey = t->hashfcn->hash_fcn(t->hashfcn, (unsigned char*)key, t->keysize);
 
 //    index = hashkey % t->nrows;
     /* Modulus is slow */
     unsigned index   = hashkey & (t->nrows - 1);
 
-    for ( SFXHASH_NODE* hnode = t->table[index]; hnode; hnode = hnode->next )
+    for ( XHashNode* hnode = t->table[index]; hnode; hnode = hnode->next )
     {
-        if ( !t->sfhashfcn->keycmp_fcn(hnode->key, key, t->keysize) )
+        if ( !t->hashfcn->keycmp_fcn(hnode->key, key, t->keysize) )
         {
-            return sfxhash_free_node(t, hnode);
+            return xhash_free_node(t, hnode);
         }
     }
 
-    return SFXHASH_ERR;
+    return XHASH_ERR;
 }
 
 /*
    Internal use only
 */
-static void sfxhash_next(SFXHASH* t)
+static void xhash_next(XHash* t)
 {
     if ( !t->cnode )
         return;
@@ -964,13 +964,13 @@ static void sfxhash_next(SFXHASH* t)
 /*!
  * Find and return the first hash table node
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  *
  * return 0   failed
- * retval !0  valid SFXHASH_NODE *
+ * retval !0  valid XHashNode *
  *
  */
-SFXHASH_NODE* sfxhash_findfirst(SFXHASH* t)
+XHashNode* xhash_findfirst(XHash* t)
 {
     if (!t)
         return nullptr;
@@ -982,8 +982,8 @@ SFXHASH_NODE* sfxhash_findfirst(SFXHASH* t)
         t->cnode = t->table[ t->crow ];
         if ( t->cnode )
         {
-            SFXHASH_NODE* n = t->cnode;
-            sfxhash_next(t);   // load t->cnode with the next entry
+            XHashNode* n = t->cnode;
+            xhash_next(t);   // load t->cnode with the next entry
             return n;
         }
     }
@@ -994,15 +994,15 @@ SFXHASH_NODE* sfxhash_findfirst(SFXHASH* t)
 /*!
  * Find and return the next hash table node
  *
- * t SFXHASH table pointer
+ * t XHash table pointer
  *
  * return 0   failed
- * retval !0  valid SFXHASH_NODE *
+ * retval !0  valid XHashNode *
  *
  */
-SFXHASH_NODE* sfxhash_findnext(SFXHASH* t)
+XHashNode* xhash_findnext(XHash* t)
 {
-    SFXHASH_NODE* n = t->cnode;
+    XHashNode* n = t->cnode;
     if ( !n ) /* Done, no more entries */
     {
         return nullptr;
@@ -1011,17 +1011,17 @@ SFXHASH_NODE* sfxhash_findnext(SFXHASH* t)
     /*
       Preload next node into current node
     */
-    sfxhash_next(t);
+    xhash_next(t);
 
     return n;
 }
 
-// Make sfhashfcn use a separate set of opcodes for the backend.
+// Make hashfcn use a separate set of opcodes for the backend.
 
-void sfxhash_set_keyops(SFXHASH* h, hash_func hash_fcn, keycmp_func keycmp_fcn)
+void xhash_set_keyops(XHash* h, hash_func hash_fcn, keycmp_func keycmp_fcn)
 {
     assert(h and hash_fcn and keycmp_fcn);
-    sfhashfcn_set_keyops(h->sfhashfcn, hash_fcn, keycmp_fcn);
+    hashfcn_set_keyops(h->hashfcn, hash_fcn, keycmp_fcn);
 }
 
 /*
@@ -1029,7 +1029,7 @@ void sfxhash_set_keyops(SFXHASH* h, hash_func hash_fcn, keycmp_func keycmp_fcn)
  *   Test Driver for Hashing
  * -----------------------------------------------------------------------------------------
  */
-#ifdef SFXHASH_MAIN
+#ifdef XHash_MAIN
 
 /*
    This is called when the user releases a node or kills the table
@@ -1068,8 +1068,8 @@ int anrfree(void* key, void* data)
 int main(int argc, char** argv)
 {
     int i;
-    SFXHASH* t;
-    SFXHASH_NODE* n;
+    XHash* t;
+    XHashNode* n;
     char strkey[256], strdata[256];
     int num = 100;
     int mem = 0;
@@ -1088,7 +1088,7 @@ int main(int argc, char** argv)
     }
 
     /* Create a Hash Table */
-    t = sfxhash_new(100,         /* one row per element in table, when possible */
+    t = xhash_new(100,         /* one row per element in table, when possible */
         20,                     /* key size :  padded with zeros */
         20,                     /* data size:  padded with zeros */
         mem,                    /* max bytes,  0=no max */
@@ -1109,7 +1109,7 @@ int main(int argc, char** argv)
         snprintf(strdata, sizeof(strdata), "KeyWord%5.5d",i+1);
         strdata[sizeof(strdata) - 1] = '\0';
         //strupr(strdata);
-        sfxhash_add(t, strkey /* user key */,  strdata /* user data */);
+        xhash_add(t, strkey /* user key */,  strdata /* user data */);
     }
 
     /* Find and Display Nodes in the Hash Table */
@@ -1119,7 +1119,7 @@ int main(int argc, char** argv)
         snprintf(strkey, sizeof(strkey) - 1, "KeyWord%5.5d",i+1);
         strkey[sizeof(strkey) - 1] = '\0';
 
-        if ( char* p = (char*)sfxhash_find(t, strkey) )
+        if ( char* p = (char*)xhash_find(t, strkey) )
             printf("Hash-key=%*s, data=%*s\n", strlen(strkey),strkey, strlen(strkey), p);
     }
 
@@ -1130,16 +1130,16 @@ int main(int argc, char** argv)
 
     /* Display All Nodes in the Hash Table findfirst/findnext */
     printf("\n...FINDFIRST / FINDNEXT TEST\n");
-    for ( n  = sfxhash_findfirst(t);
+    for ( n  = xhash_findfirst(t);
         n != 0;
-        n  = sfxhash_findnext(t) )
+        n  = xhash_findnext(t) )
     {
         printf("hash-findfirst/next: n=%p, key=%s, data=%s\n", n, n->key, n->data);
 
         /*
           remove node we are looking at, this is first/next safe.
         */
-        if ( sfxhash_remove(t,n->key) )
+        if ( xhash_remove(t,n->key) )
         {
             printf("...ERROR: Could not remove the key node\n");
         }
@@ -1153,9 +1153,9 @@ int main(int argc, char** argv)
         t->anr_count);
 
     /* Free the table and it's user data */
-    printf("...sfxhash_delete\n");
+    printf("...xhash_delete\n");
 
-    sfxhash_delete(t);
+    xhash_delete(t);
 
     printf("\nnormal pgm finish\n\n");
 
similarity index 56%
rename from src/hash/sfxhash.h
rename to src/hash/xhash.h
index 37fd11a113771b628c7041045d5ae6e83fbf16bd..50668dc079706202f2bc75d09394df18d0dd6cfc 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-// sfxhash.h author Marc Norton
+// xhash.h author Marc Norton
 
-#ifndef SFXHASH_H
-#define SFXHASH_H
+#ifndef XHASH_H
+#define XHASH_H
 
 // generic hash table - stores and maps key + data pairs
 // (supports memcap and automatic memory recovery when out of memory)
 #include "utils/sfmemcap.h"
 #include "main/snort_types.h"
 
-struct SFHASHFCN;
+struct HashFnc;
 
-#define SFXHASH_NOMEM    (-2)
-#define SFXHASH_ERR      (-1)
-#define SFXHASH_OK        0
-#define SFXHASH_INTABLE   1
+#define XHASH_NOMEM    (-2)
+#define XHASH_ERR      (-1)
+#define XHASH_OK        0
+#define XHASH_INTABLE   1
 
-struct SFXHASH_NODE
+struct XHashNode
 {
-    struct SFXHASH_NODE* gnext; // global node list - used for aging nodes
-    struct SFXHASH_NODE* gprev;
-    struct SFXHASH_NODE* next;  // row node list
-    struct SFXHASH_NODE* prev;
+    struct XHashNode* gnext; // global node list - used for aging nodes
+    struct XHashNode* gprev;
+    struct XHashNode* next;  // row node list
+    struct XHashNode* prev;
 
     int rindex;  // row index of table this node belongs to.
 
@@ -48,20 +48,20 @@ struct SFXHASH_NODE
     void* data; // Pointer to the users data, this is not copied !
 };
 
-typedef int (* SFXHASH_FREE_FCN)(void* key, void* data);
+typedef int (* XHash_FREE_FCN)(void* key, void* data);
 
-struct SFXHASH
+struct XHash
 {
-    SFHASHFCN* sfhashfcn;    // hash function
+    HashFnc* hashfcn;    // hash function
     int keysize;             // bytes in key, if <= 0 -> keys are strings
     int datasize;            // bytes in key, if == 0 -> user data
-    SFXHASH_NODE** table;    // array of node ptr's */
+    XHashNode** table;    // array of node ptr's */
     unsigned nrows;          // # rows int the hash table use a prime number 211, 9871
     unsigned count;          // total # nodes in table
 
     unsigned crow;           // findfirst/next row in table
     unsigned pad;
-    SFXHASH_NODE* cnode;     // findfirst/next node ptr
+    XHashNode* cnode;     // findfirst/next node ptr
     int splay;               // whether to splay nodes with same hash bucket
 
     unsigned max_nodes;      // maximum # of nodes within a hash
@@ -72,9 +72,9 @@ struct SFXHASH
     unsigned find_fail;
     unsigned find_success;
 
-    SFXHASH_NODE* ghead, * gtail;  // global - root of all nodes allocated in table
-    SFXHASH_NODE* fhead, * ftail;  // list of free nodes, which are recycled
-    SFXHASH_NODE* gnode;           // gfirst/gnext node ptr */
+    XHashNode* ghead, * gtail;  // global - root of all nodes allocated in table
+    XHashNode* fhead, * ftail;  // list of free nodes, which are recycled
+    XHashNode* gnode;           // gfirst/gnext node ptr */
     int recycle_nodes;             // recycle nodes. Nodes are not freed, but are used for
                                    // subsequent new nodes
 
@@ -86,75 +86,75 @@ struct SFXHASH
     unsigned anr_count;      // # ANR ops performed
     int anr_flag;            // 0=off, !0=on
 
-    SFXHASH_FREE_FCN anrfree;
-    SFXHASH_FREE_FCN usrfree;
+    XHash_FREE_FCN anrfree;
+    XHash_FREE_FCN usrfree;
 };
 
-SO_PUBLIC SFXHASH* sfxhash_new(int nrows, int keysize, int datasize, unsigned long memcap,
+SO_PUBLIC XHash* xhash_new(int nrows, int keysize, int datasize, unsigned long memcap,
     int anr_flag,
-    SFXHASH_FREE_FCN anrfunc,
-    SFXHASH_FREE_FCN usrfunc,
+    XHash_FREE_FCN anrfunc,
+    XHash_FREE_FCN usrfunc,
     int recycle_flag);
 
-SO_PUBLIC void sfxhash_set_max_nodes(SFXHASH* h, int max_nodes);
+SO_PUBLIC void xhash_set_max_nodes(XHash* h, int max_nodes);
 
-SO_PUBLIC void sfxhash_delete(SFXHASH* h);
-SO_PUBLIC int sfxhash_make_empty(SFXHASH*);
+SO_PUBLIC void xhash_delete(XHash* h);
+SO_PUBLIC int xhash_make_empty(XHash*);
 
-SO_PUBLIC int sfxhash_add(SFXHASH* h, void* key, void* data);
-SO_PUBLIC SFXHASH_NODE* sfxhash_get_node(SFXHASH* t, const void* key);
-SO_PUBLIC int sfxhash_remove(SFXHASH* h, void* key);
+SO_PUBLIC int xhash_add(XHash* h, void* key, void* data);
+SO_PUBLIC XHashNode* xhash_get_node(XHash* t, const void* key);
+SO_PUBLIC int xhash_remove(XHash* h, void* key);
 
 //  Get the # of Nodes in HASH the table
-inline unsigned sfxhash_count(SFXHASH* t)
+inline unsigned xhash_count(XHash* t)
 { return t->count; }
 
 //  Get the # auto recovery
-inline unsigned sfxhash_anr_count(SFXHASH* t)
+inline unsigned xhash_anr_count(XHash* t)
 { return t->anr_count; }
 
 //  Get the # finds
-inline unsigned sfxhash_find_total(SFXHASH* t)
+inline unsigned xhash_find_total(XHash* t)
 { return t->find_success + t->find_fail; }
 
 //  Get the # unsuccessful finds
-inline unsigned sfxhash_find_fail(SFXHASH* t)
+inline unsigned xhash_find_fail(XHash* t)
 { return t->find_fail; }
 
 //  Get the # successful finds
-inline unsigned sfxhash_find_success(SFXHASH* t)
+inline unsigned xhash_find_success(XHash* t)
 { return t->find_success; }
 
 //  Get the # of overhead bytes
-inline unsigned sfxhash_overhead_bytes(SFXHASH* t)
+inline unsigned xhash_overhead_bytes(XHash* t)
 { return t->overhead_bytes; }
 
 // Get the # of overhead blocks
-inline unsigned sfxhash_overhead_blocks(SFXHASH* t)
+inline unsigned xhash_overhead_blocks(XHash* t)
 { return t->overhead_blocks; }
 
-SO_PUBLIC void* sfxhash_mru(SFXHASH* t);
-SO_PUBLIC void* sfxhash_lru(SFXHASH* t);
-SO_PUBLIC void* sfxhash_find(SFXHASH* h, void* key);
-SO_PUBLIC SFXHASH_NODE* sfxhash_find_node(SFXHASH* t, const void* key);
+SO_PUBLIC void* xhash_mru(XHash* t);
+SO_PUBLIC void* xhash_lru(XHash* t);
+SO_PUBLIC void* xhash_find(XHash* h, void* key);
+SO_PUBLIC XHashNode* xhash_find_node(XHash* t, const void* key);
 
-SO_PUBLIC SFXHASH_NODE* sfxhash_findfirst(SFXHASH* h);
-SO_PUBLIC SFXHASH_NODE* sfxhash_findnext(SFXHASH* h);
+SO_PUBLIC XHashNode* xhash_findfirst(XHash* h);
+SO_PUBLIC XHashNode* xhash_findnext(XHash* h);
 
-SO_PUBLIC SFXHASH_NODE* sfxhash_ghead(SFXHASH* h);
-SO_PUBLIC void sfxhash_gmovetofront(SFXHASH* t, SFXHASH_NODE* hnode);
+SO_PUBLIC XHashNode* xhash_ghead(XHash* h);
+SO_PUBLIC void xhash_gmovetofront(XHash* t, XHashNode* hnode);
 
-SO_PUBLIC int sfxhash_free_node(SFXHASH* t, SFXHASH_NODE* node);
+SO_PUBLIC int xhash_free_node(XHash* t, XHashNode* node);
 
-typedef uint32_t (* hash_func)(SFHASHFCN*, const unsigned char* d, int n);
+typedef uint32_t (* hash_func)(HashFnc*, const unsigned char* d, int n);
 
 // return 0 for ==, 1 for != ; FIXIT-L convert to bool
 typedef int (* keycmp_func)(const void* s1, const void* s2, size_t n);
 
-SO_PUBLIC void sfxhash_set_keyops(SFXHASH* h, hash_func, keycmp_func);
+SO_PUBLIC void xhash_set_keyops(XHash* h, hash_func, keycmp_func);
 
-SO_PUBLIC SFXHASH_NODE* sfxhash_gfindfirst(SFXHASH* t);
-SO_PUBLIC SFXHASH_NODE* sfxhash_gfindnext(SFXHASH* t);
+SO_PUBLIC XHashNode* xhash_gfindfirst(XHash* t);
+SO_PUBLIC XHashNode* xhash_gfindnext(XHash* t);
 
 #endif
 
index 1edb7b237fd6ce379bbc5cecd3a2e07551c46ddf..f3d7c6502c801794fe61fb7489266e0a698ffc41 100644 (file)
@@ -17,7 +17,7 @@
 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //--------------------------------------------------------------------------
 
-// zhash is based on sfxhash - see sfxhash.cc for details
+// zhash is based on sfxhash - see xhash.cc for details
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -27,7 +27,7 @@
 
 #include <cstring>
 
-#include "sfhashfcn.h"
+#include "hashfcn.h"
 
 //-------------------------------------------------------------------------
 // private stuff
@@ -199,8 +199,8 @@ void ZHash::move_to_front(ZHashNode* node)
 
 ZHashNode* ZHash::find_node_row(const void* key, int* rindex)
 {
-    unsigned hashkey = sfhashfcn->hash_fcn(
-        sfhashfcn, (const unsigned char*)key, keysize);
+    unsigned hashkey = hashfcn->hash_fcn(
+        hashfcn, (const unsigned char*)key, keysize);
 
     // Modulus is slow; use a table size that is a power of 2.
     int index = hashkey & (nrows - 1);
@@ -209,7 +209,7 @@ ZHashNode* ZHash::find_node_row(const void* key, int* rindex)
 
     for ( ZHashNode* node=table[index]; node; node=node->next )  // UNINITUSE
     {
-        if ( !sfhashfcn->keycmp_fcn(node->key,key,keysize) )
+        if ( !hashfcn->keycmp_fcn(node->key,key,keysize) )
         {
             move_to_front(node);
             find_success++;
@@ -241,7 +241,7 @@ ZHash::ZHash(int rows, int keysz)
     if ( rows > 0 )
     {
         // make sure we have a prime number
-        // rows = sf_nearest_prime(rows);
+        // rows = nearest_prime(rows);
 
         /* If rows is not a power of two, need to find the
          * next highest power of two */
@@ -253,7 +253,7 @@ ZHash::ZHash(int rows, int keysz)
     }
 
     /* this has a default hashing function */
-    sfhashfcn = sfhashfcn_new(rows);
+    hashfcn = hashfcn_new(rows);
 
     /* Allocate the array of node ptrs */
     table = new ZHashNode*[rows]();
@@ -268,8 +268,8 @@ ZHash::ZHash(int rows, int keysz)
 
 ZHash::~ZHash()
 {
-    if ( sfhashfcn )
-        sfhashfcn_free(sfhashfcn);
+    if ( hashfcn )
+        hashfcn_free(hashfcn);
 
     if ( table )
     {
@@ -416,11 +416,11 @@ bool ZHash::remove(const void* key)
 }
 
 int ZHash::set_keyops(
-    unsigned (* hash_fcn)(SFHASHFCN* p, const unsigned char* d, int n),
+    unsigned (* hash_fcn)(HashFnc* p, const unsigned char* d, int n),
     int (* keycmp_fcn)(const void* s1, const void* s2, size_t n))
 {
     if ( hash_fcn && keycmp_fcn )
-        return sfhashfcn_set_keyops(sfhashfcn, hash_fcn, keycmp_fcn);
+        return hashfcn_set_keyops(hashfcn, hash_fcn, keycmp_fcn);
 
     return -1;
 }
index 07e6b1e6975c92835195536f32c4bc44e910a711..9c4051f2729739b9eff9a99c4f21991f993c04fd 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <cstddef>
 
-struct SFHASHFCN;
+struct HashFnc;
 struct ZHashNode;
 
 class ZHash
@@ -51,7 +51,7 @@ public:
     inline unsigned get_count() { return count; }
 
     int set_keyops(
-        unsigned (* hash_fcn)(SFHASHFCN* p, const unsigned char* d, int n),
+        unsigned (* hash_fcn)(HashFnc* p, const unsigned char* d, int n),
         int (* keycmp_fcn)(const void* s1, const void* s2, size_t n));
 
 private:
@@ -72,7 +72,7 @@ private:
     int nearest_powerof2(int nrows);
 
 private:
-    SFHASHFCN* sfhashfcn;
+    HashFnc* hashfcn;
     int keysize;
 
     unsigned nrows;
index 386e185cfd94a9d1c544a9cc2f6ad8821b26f676..7fc6389ab3c24fc112575a77ae35e5dc5cd304c8 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler_defs.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
index 690a70118756a312d24ccef06e9ae1cbbd4a6046..fba768d7924b431b4ce2af0b28f8f989c9c4bd01 100644 (file)
@@ -56,7 +56,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index c94d8c7030316208ec594633ecb545f960b07184..812dac4c5af69d889ae5ad80cce6508e95475cd5 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "detection/detection_util.h"
 #include "detection/treenodes.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
index b8962aa33839cfa6371fa06b7ab2238910c9e101..42983759a97f7a53916e9391a3881fa1527b2d73 100644 (file)
@@ -25,7 +25,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 
 #define s_name "bufferlen"
index c06cd632f0c6464390f34f1605aea65fb8d6d58e..bcbd670daa93f71bff5531ae18b86dc6b5754b8c 100644 (file)
@@ -27,7 +27,7 @@
 #include "framework/endianness.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "protocols/packet.h"
 #include "profiler/profiler.h"
index 01eff7de29e6eda72e63258823c6a17f3da4548b..7fd58d1442d16a7048f5c3966561fb4dc68454d5 100644 (file)
@@ -81,7 +81,7 @@
 #include "framework/endianness.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 0a3fcd71aba1d7a7b23804b40a64910d31c86951..97f19d91d612cc40baab57ff20eb5db5497522b0 100644 (file)
@@ -27,7 +27,7 @@
 #include "framework/endianness.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 6fcc1d5348daf3df5388359df191b08c03b18336..e27ad6aec88f13fb69f91e0be18898ec1be6b5dc 100644 (file)
@@ -97,7 +97,7 @@
 #include "framework/endianness.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 69d71d373abd409ce1319ac9545ca8540757ee3c..4afee895c7f6d73564d2cbbff2eff007136d1c56 100644 (file)
@@ -26,7 +26,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "parser/parse_utils.h"
 #include "profiler/profiler.h"
index 2150b2476d25b429a7e11e9372aa7297521dadc5..0aed7b5fd46cc7000625dfae77f9cf083119e784 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 46e12ec08935fe2b62c65205ddf1c15389d5332d..aa2aad237a461290b99d332ee53135cbe1742ed2 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 71f8a2867a669b0bc1e0a6da70d42a3a87fbb8fa..f23e4e96f58bd872e73ad7714f3a1801ba1361c7 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 3e58bc79613cf0fbdaa3850999159e550e660003..e0d207ea7229c080ab163e93160dfb27823ee5f6 100644 (file)
@@ -27,7 +27,7 @@
 #include "detection/treenodes.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 73f3ca0363791c3dcadc64ba2f822f95d438e28b..8eccfffa8a86d2f61dc770e47b2c41b0b22152eb 100644 (file)
@@ -45,8 +45,8 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfghash.h"
-#include "hash/sfhashfcn.h"
+#include "hash/ghash.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "parser/mstring.h"
 #include "protocols/packet.h"
@@ -131,8 +131,8 @@ typedef struct _FLOWBITS_GRP
 
 static std::forward_list<const FLOWBITS_OP*> op_list;
 
-static SFGHASH* flowbits_hash = nullptr;
-static SFGHASH* flowbits_grp_hash = nullptr;
+static GHash* flowbits_hash = nullptr;
+static GHash* flowbits_grp_hash = nullptr;
 static SF_QUEUE* flowbits_bit_queue = nullptr;
 
 static unsigned flowbits_count = 0;
@@ -284,7 +284,7 @@ static inline int clear_group_bit(BitOp* bitop, char* group)
     // FIXIT-M why is the hash lookup done at runtime for flowbits groups?
     // a pointer to flowbis_grp should be in flowbits config data
     // this *should* be safe but iff splay mode is disabled
-    auto flowbits_grp = (FLOWBITS_GRP*)sfghash_find(flowbits_grp_hash, group);
+    auto flowbits_grp = (FLOWBITS_GRP*)ghash_find(flowbits_grp_hash, group);
 
     if ( !flowbits_grp )
         return 0;
@@ -308,7 +308,7 @@ static inline int toggle_group_bit(BitOp* bitop, char* group)
     if ( !group  )
         return 0;
 
-    auto flowbits_grp = (FLOWBITS_GRP*)sfghash_find(flowbits_grp_hash, group);
+    auto flowbits_grp = (FLOWBITS_GRP*)ghash_find(flowbits_grp_hash, group);
 
     if ( !flowbits_grp )
         return 0;
@@ -365,7 +365,7 @@ static inline int is_set_flowbits(
         return 0;
 
     case FLOWBITS_ALL:
-        flowbits_grp = (FLOWBITS_GRP*)sfghash_find(flowbits_grp_hash, group);
+        flowbits_grp = (FLOWBITS_GRP*)ghash_find(flowbits_grp_hash, group);
         if ( flowbits_grp == nullptr )
             return 0;
         for ( i = 0; i <= (unsigned int)(flowbits_grp->max_id >>3); i++ )
@@ -378,7 +378,7 @@ static inline int is_set_flowbits(
         return 1;
 
     case FLOWBITS_ANY:
-        flowbits_grp = (FLOWBITS_GRP*)sfghash_find(flowbits_grp_hash, group);
+        flowbits_grp = (FLOWBITS_GRP*)ghash_find(flowbits_grp_hash, group);
         if ( flowbits_grp == nullptr )
             return 0;
         for ( i = 0; i <= (unsigned int)(flowbits_grp->max_id >>3); i++ )
@@ -520,9 +520,9 @@ void FlowbitResetCounts()
     if ( !flowbits_hash )
         return;
 
-    for (SFGHASH_NODE* n = sfghash_findfirst(flowbits_hash);
+    for (GHashNode* n = ghash_findfirst(flowbits_hash);
         n != nullptr;
-        n = sfghash_findnext(flowbits_hash))
+        n = ghash_findnext(flowbits_hash))
     {
         FLOWBITS_OBJECT* fb = (FLOWBITS_OBJECT*)n->data;
         fb->set = 0;
@@ -571,7 +571,7 @@ static FLOWBITS_OBJECT* getFlowBitItem(char* flowbitName, FLOWBITS_OP* flowbits)
             s_name, ALLOWED_SPECIAL_CHARS);
     }
 
-    flowbits_item = (FLOWBITS_OBJECT*)sfghash_find(flowbits_hash, flowbitName);
+    flowbits_item = (FLOWBITS_OBJECT*)ghash_find(flowbits_hash, flowbitName);
 
     if (flowbits_item == nullptr)
     {
@@ -592,9 +592,9 @@ static FLOWBITS_OBJECT* getFlowBitItem(char* flowbitName, FLOWBITS_OP* flowbits)
             }
         }
 
-        int hstatus = sfghash_add(flowbits_hash, flowbitName, flowbits_item);
+        int hstatus = ghash_add(flowbits_hash, flowbitName, flowbits_item);
 
-        if (hstatus != SFGHASH_OK)
+        if (hstatus != GHASH_OK)
             ParseError("Could not add flowbits key (%s) to hash.",flowbitName);
     }
     flowbits_item->toggle = flowbits_toggle;
@@ -782,15 +782,15 @@ static FLOWBITS_GRP* getFlowBitGroup(char* groupName)
             s_name, ALLOWED_SPECIAL_CHARS);
     }
 
-    flowbits_grp = (FLOWBITS_GRP*)sfghash_find(flowbits_grp_hash, groupName);
+    flowbits_grp = (FLOWBITS_GRP*)ghash_find(flowbits_grp_hash, groupName);
 
     if ( !flowbits_grp )
     {
         // new group defined, add (bitop set later once we know size)
         flowbits_grp = (FLOWBITS_GRP*)snort_calloc(sizeof(*flowbits_grp));
-        int hstatus = sfghash_add(flowbits_grp_hash, groupName, flowbits_grp);
+        int hstatus = ghash_add(flowbits_grp_hash, groupName, flowbits_grp);
 
-        if (hstatus != SFGHASH_OK)
+        if (hstatus != GHASH_OK)
             ParseAbort("Could not add flowbits group (%s) to hash.\n",groupName);
 
         flowbits_grp_count++;
@@ -963,9 +963,9 @@ static void init_groups()
     if ( !flowbits_hash or !flowbits_grp_hash )
         return;
 
-    for ( SFGHASH_NODE* n = sfghash_findfirst(flowbits_grp_hash);
+    for ( GHashNode* n = ghash_findfirst(flowbits_grp_hash);
         n != nullptr;
-        n= sfghash_findnext(flowbits_grp_hash) )
+        n= ghash_findnext(flowbits_grp_hash) )
     {
         FLOWBITS_GRP* fbg = (FLOWBITS_GRP*)n->data;
         fbg->GrpBitOp = new BitOp(flowbits_count);
@@ -975,7 +975,7 @@ static void init_groups()
     while ( !op_list.empty() )
     {
         const FLOWBITS_OP* fbop = op_list.front();
-        FLOWBITS_GRP* fbg = (FLOWBITS_GRP*)sfghash_find(flowbits_grp_hash, fbop->group);
+        FLOWBITS_GRP* fbg = (FLOWBITS_GRP*)ghash_find(flowbits_grp_hash, fbop->group);
         assert(fbg);
 
         for ( int i = 0; i < fbop->num_ids; ++i )
@@ -987,23 +987,23 @@ static void init_groups()
 
 static void FlowBitsVerify()
 {
-    SFGHASH_NODE* n;
+    GHashNode* n;
     unsigned num_flowbits = 0;
     unsigned unchecked = 0, unset = 0;
 
     if (flowbits_hash == nullptr)
         return;
 
-    for (n = sfghash_findfirst(flowbits_hash);
+    for (n = ghash_findfirst(flowbits_hash);
         n != nullptr;
-        n= sfghash_findnext(flowbits_hash))
+        n= ghash_findnext(flowbits_hash))
     {
         FLOWBITS_OBJECT* fb = (FLOWBITS_OBJECT*)n->data;
 
         if (fb->toggle != flowbits_toggle)
         {
             sfqueue_add(flowbits_bit_queue, (NODE_DATA)(uintptr_t)fb->id);
-            sfghash_remove(flowbits_hash, n->key);
+            ghash_remove(flowbits_hash, n->key);
             continue;
         }
 
@@ -1061,14 +1061,14 @@ static void FlowBitsGrpFree(void* d)
 
 static void flowbits_ginit(SnortConfig*)
 {
-    flowbits_hash = sfghash_new(10000, 0, 0, FlowItemFree);
+    flowbits_hash = ghash_new(10000, 0, 0, FlowItemFree);
 
     if ( !flowbits_hash )
         FatalError("Could not create flowbits hash.\n");
 
     // this is used during parse time and runtime so do NOT
     // enable splay mode (which is NOT useful here anyway)
-    flowbits_grp_hash = sfghash_new(10000, 0, 0, FlowBitsGrpFree);
+    flowbits_grp_hash = ghash_new(10000, 0, 0, FlowBitsGrpFree);
 
     if ( !flowbits_grp_hash )
         FatalError("could not create flowbits group hash.\n");
@@ -1083,13 +1083,13 @@ static void flowbits_gterm(SnortConfig*)
 {
     if ( flowbits_hash )
     {
-        sfghash_delete(flowbits_hash);
+        ghash_delete(flowbits_hash);
         flowbits_hash = nullptr;
     }
 
     if ( flowbits_grp_hash )
     {
-        sfghash_delete(flowbits_grp_hash);
+        ghash_delete(flowbits_grp_hash);
         flowbits_grp_hash = nullptr;
     }
 
index adcd428f48a64bfb7b190cd5f10807d4656a506f..693d6a7523720a0e758e4891b4c9def0fb035533 100644 (file)
@@ -50,7 +50,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 441e7c4ec586d9dc30c886aae1afc24f7d0087ec..a155a280931df1c2e0c7d19d575fbc725ebc4ca3 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index fdbbf0cd63ce09861076821abaa178d6e832f93f..acde3094903e248bd429ffd490fd985d2e2ce9af 100644 (file)
@@ -27,7 +27,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "hash/hashes.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "parser/parse_utils.h"
 #include "profiler/profiler.h"
index f810160d44f940bd52279ce87be3d7b61dc45ea6..04ee805b56a772825471c057bbc929b5c05a2f4f 100644 (file)
@@ -46,7 +46,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/icmp4.h"
 #include "protocols/icmp6.h"
index 94433ff52d0c98277698e800cebd19e23a36cb52..e4cae55912630ef6633cacf34ba36fd6ca0a4f2e 100644 (file)
@@ -46,7 +46,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/icmp4.h"
 #include "protocols/icmp6.h"
index 8f001da17ded70ec8fb92fd97e102afabc63bcbc..2038f155d1e84cb61c36988db5955bce99b549b5 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/icmp4.h"
 #include "protocols/packet.h"
index d6652104521f65626f90453aa27912fa219aa962..2bd8104698f0b29f0b05b47a732f82dcf784642b 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 44e821a0260371971a1d51c3c13ab02bb877d870..f25fc1a3d50378fa0eeb12a3d127cda872146386 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 95757c9b87cb856822436aa061fae89720d0512b..bb70897886f0c511ba343ccac56d9a925e8b1c0a 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/ipv4_options.h"
 #include "protocols/packet.h"
index e8e1903cc38d59c4305cdcaa789f90571b872249..9278924e5c3814e2efe02691779af834098934e4 100644 (file)
@@ -42,7 +42,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "parser/mstring.h"
 #include "profiler/profiler.h"
index 4026188643df9d210e309072705e2b114edd1536..d0322838cc721aec9f77a78976e6b78c791aaf6a 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/icmp4.h"
 #include "protocols/packet.h"
index f64179e11ac44803f5ffafbac6331192f9e5389b..43d0da7f44cd7abf72e2ab2ce93f363ac77cd0fc 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/cursor.h"
 #include "framework/decode_data.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "helpers/chunk.h"
 #include "lua/lua.h"
 #include "log/messages.h"
index 08ce82ba1d09efde44db10b7fdf8efee3dea72a8..3da14ec04384ff78097591384a1ec3051566160a 100644 (file)
@@ -32,7 +32,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "profiler/profiler.h"
index 7aa867794c9d4187ee979c146abce17043e4f7dc..91519d8348844b2c71794649ad9badab199ad227 100644 (file)
@@ -34,7 +34,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "profiler/profiler.h"
index be1de0d2286709c83f516fa29c8cebbf37917ab9..70b96d3e781bbb1748487d6c49bd536385b93a53 100644 (file)
@@ -27,7 +27,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "main/thread_config.h"
index 4f2262ede47014733f9b86769aeb3f8c4a555c78..728232817b1c7646eab123583bb1afd8360c2832 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 0a25e7041b3379b1b4cdba2a7ac77066c9530574..41e5de65b5d9479f929ae568ce68762bade6001f 100644 (file)
@@ -33,7 +33,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "log/obfuscator.h"
 #include "main/snort_config.h"
index e9ed05d8b4cd93dbbf00e7af24393c9fc5ac1ac6..b05d4f02378820a63b17444e4369db73f1ccc5c0 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
index 7d3d0241523dc79e4c6da35766b4efdd59ddd8db..4f36da70e0b9412879e710b18efed0150ea7cba6 100644 (file)
@@ -49,7 +49,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "profiler/profiler.h"
index 3df65a288bb45531979287a3df8bf47a404e6a8b..8d45419463a6847679d70579c572fb7a496d7d2a 100644 (file)
@@ -25,7 +25,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/so_rule.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "managers/so_manager.h"
 #include "profiler/profiler.h"
index 5c12d400af45ccb577c11369f2e517862c16ec04..12c09540171f5d9a69ca1fc3720c64c91bea1008 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 240f2d1994c2f4c04a804024631531935d2fbd21..b230a6d719a7fe59e0cb5d2a174af50b749c32ae 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 7a3930448cc6af8f7808b31acdde36103be94e5e..a140baf50288b13ac5a1ebda6ece5905a7bb18e7 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
index 8ce4a53153c949b9d8ee1edc2ba8c0134a211126..972a9052d803f81def58cbb99a60fb7e3ef96f00 100644 (file)
@@ -241,14 +241,14 @@ static void send_sar(uint8_t* data, unsigned len)
 // (actually, the whole reason for doing this needs to be rethought)
 static OptTreeNode* OptTreeNode_Search(uint32_t, uint32_t sid)
 {
-    SFGHASH_NODE* hashNode;
+    GHashNode* hashNode;
 
     if (sid == 0)
         return nullptr;
 
-    for (hashNode = sfghash_findfirst(SnortConfig::get_conf()->otn_map);
+    for (hashNode = ghash_findfirst(SnortConfig::get_conf()->otn_map);
         hashNode;
-        hashNode = sfghash_findnext(SnortConfig::get_conf()->otn_map))
+        hashNode = ghash_findnext(SnortConfig::get_conf()->otn_map))
     {
         OptTreeNode* otn = (OptTreeNode*)hashNode->data;
         RuleTreeNode* rtn = getRuntimeRtnFromOtn(otn);
index a94a6fea8aaab041da84733b6ed1fd9907f36ff9..c0f8f6b3a34d1613bbff908ce865f79ec4ee3a6d 100644 (file)
@@ -42,7 +42,7 @@ struct vartable_t;
 struct sfip_var_t;
 
 typedef unsigned int PolicyId;
-typedef struct SFGHASH PortVarTable;
+typedef struct GHash PortVarTable;
 
 enum PolicyMode
 {
index 5b27a8d7c45a95eae134b30dd2f497d560e6d0c9..19d140b7c417ccc4c7a58de72c20cbf4b9e39a60 100644 (file)
@@ -35,7 +35,7 @@
 #include "filters/rate_filter.h"
 #include "filters/sfrf.h"
 #include "filters/sfthreshold.h"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "helpers/process.h"
 #include "ips_options/ips_pcre.h"
 #include "latency/latency_config.h"
@@ -246,7 +246,7 @@ SnortConfig::~SnortConfig()
     fpDeleteFastPacketDetection(this);
 
     if (rtn_hash_table)
-        sfxhash_delete(rtn_hash_table);
+        xhash_delete(rtn_hash_table);
 
     if (eth_dst )
         snort_free(eth_dst);
index 584a2dc759d31f20e84cc05f1dac9e8d5ded16ba..fb7f494cd3044611759e19cec8e33265b20cb7fa 100644 (file)
@@ -117,7 +117,7 @@ enum TunnelFlags
 struct srmm_table_t;
 struct sopg_table_t;
 struct PORT_RULE_MAP;
-struct SFXHASH;
+struct XHash;
 struct ProfilerConfig;
 struct MemoryConfig;
 struct LatencyConfig;
@@ -293,7 +293,7 @@ public:
     struct RuleState* rule_state_list = nullptr;
     struct ClassType* classifications = nullptr;
     struct ReferenceSystemNode* references = nullptr;
-    struct SFGHASH* otn_map = nullptr;
+    struct GHash* otn_map = nullptr;
 
     class ProtocolReference* proto_ref = nullptr;
 
@@ -323,9 +323,9 @@ public:
     srmm_table_t* spgmmTable = nullptr;  /* srvc port_group map master table */
     sopg_table_t* sopgTable = nullptr;   /* service-ordinal to port_group table */
 
-    SFXHASH* detection_option_hash_table = nullptr;
-    SFXHASH* detection_option_tree_hash_table = nullptr;
-    SFXHASH* rtn_hash_table = nullptr;
+    XHash* detection_option_hash_table = nullptr;
+    XHash* detection_option_tree_hash_table = nullptr;
+    XHash* rtn_hash_table = nullptr;
 
     PolicyMap* policy_map = nullptr;
     struct VarNode* var_list = nullptr;
index 633186153bf9b296fe285c92b4eedfa60bd3d0f4..de65d62ac428794bcebfc2d0a0469f388e37a3b6 100644 (file)
 
 #include "app_forecast.h"
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "protocols/packet.h"
 #include "time/packet_time.h"
 #include "appid_session.h"
 
 static THREAD_LOCAL AFActKey master_key;
-static THREAD_LOCAL SFXHASH* AF_indicators = nullptr;     // list of "indicator apps"
-static THREAD_LOCAL SFXHASH* AF_actives = nullptr;        // list of hosts to watch
+static THREAD_LOCAL XHash* AF_indicators = nullptr;     // list of "indicator apps"
+static THREAD_LOCAL XHash* AF_actives = nullptr;        // list of hosts to watch
 
 int init_appid_forecast()
 {
-    if (!(AF_indicators = sfxhash_new(1024, sizeof(AppId), sizeof(AFElement),
+    if (!(AF_indicators = xhash_new(1024, sizeof(AppId), sizeof(AFElement),
             0, 0, nullptr, nullptr, 0)))
     {
         ErrorMessage("Config: failed to allocate memory for an AF Indicators hash.");
         return 0;
     }
 
-    if (!(AF_actives = sfxhash_new(1024, sizeof(AFActKey), sizeof(AFActVal),
-            (sizeof(SFXHASH_NODE)*2048), 1, nullptr,  nullptr, 1)))
+    if (!(AF_actives = xhash_new(1024, sizeof(AFActKey), sizeof(AFActVal),
+            (sizeof(XHashNode)*2048), 1, nullptr,  nullptr, 1)))
     {
-        sfxhash_delete(AF_indicators);
+        xhash_delete(AF_indicators);
         ErrorMessage("Config: failed to allocate memory for an AF Actives hash.");
         return 0;
     }
@@ -59,20 +59,20 @@ void clean_appid_forecast()
 {
     if (AF_indicators)
     {
-        sfxhash_delete(AF_indicators);
+        xhash_delete(AF_indicators);
         AF_indicators = nullptr;
     }
 
     if (AF_actives)
     {
-        sfxhash_delete(AF_actives);
+        xhash_delete(AF_actives);
         AF_actives = nullptr;
     }
 }
 
 void add_af_indicator(AppId indicator, AppId forecast, AppId target)
 {
-    if (sfxhash_find(AF_indicators, &indicator))
+    if (xhash_find(AF_indicators, &indicator))
     {
         ErrorMessage("LuaDetectorApi:Attempt to add more than one AFElement per appId %d",
             indicator);
@@ -83,7 +83,7 @@ void add_af_indicator(AppId indicator, AppId forecast, AppId target)
     val.indicator = indicator;
     val.forecast = forecast;
     val.target = target;
-    if (sfxhash_add(AF_indicators, &indicator, &val))
+    if (xhash_add(AF_indicators, &indicator, &val))
         ErrorMessage("LuaDetectorApi:Failed to add AFElement for appId %d", indicator);
 }
 
@@ -100,13 +100,13 @@ static inline void rekey_master_AF_key(Packet* p, int dir, AppId forecast)
 void check_session_for_AF_indicator(Packet* p, int dir, AppId indicator)
 {
     AFElement* ind_element;
-    if (!(ind_element = (AFElement*)sfxhash_find(AF_indicators, &indicator)))
+    if (!(ind_element = (AFElement*)xhash_find(AF_indicators, &indicator)))
         return;
 
     rekey_master_AF_key(p, dir, ind_element->forecast);
 
     AFActVal* test_active_value;
-    if ((test_active_value = (AFActVal*)sfxhash_find(AF_actives, &master_key)))
+    if ((test_active_value = (AFActVal*)xhash_find(AF_actives, &master_key)))
     {
         test_active_value->last = packet_time();
         test_active_value->target = ind_element->target;
@@ -117,7 +117,7 @@ void check_session_for_AF_indicator(Packet* p, int dir, AppId indicator)
     new_active_value.target = ind_element->target;
     new_active_value.last = packet_time();
 
-    sfxhash_add(AF_actives, &master_key, &new_active_value);
+    xhash_add(AF_actives, &master_key, &new_active_value);
 }
 
 AppId check_session_for_AF_forecast(AppIdSession* asd, Packet* p, int dir, AppId forecast)
@@ -127,7 +127,7 @@ AppId check_session_for_AF_forecast(AppIdSession* asd, Packet* p, int dir, AppId
     rekey_master_AF_key(p, dir, forecast);
 
     //get out if there is no value
-    if (!(check_act_val = (AFActVal*)sfxhash_find(AF_actives, &master_key)))
+    if (!(check_act_val = (AFActVal*)xhash_find(AF_actives, &master_key)))
         return APP_ID_UNKNOWN;
 
     //if the value is older than 5 minutes, remove it and get out
@@ -135,7 +135,7 @@ AppId check_session_for_AF_forecast(AppIdSession* asd, Packet* p, int dir, AppId
     age = packet_time() - check_act_val->last;
     if (age < 0 || age > 300)
     {
-        sfxhash_remove(AF_actives, &master_key);
+        xhash_remove(AF_actives, &master_key);
         return APP_ID_UNKNOWN;
     }
 
index 1e4f884d2fa0d412cfe6599e56369e1e64d54a4c..69ad00ff73ec8d8204410b129915acc7e99bd039 100644 (file)
@@ -39,7 +39,7 @@ int NetworkSetManager::create(NetworkSet** network_set)
 
     NetworkSet* tmp = (NetworkSet*)snort_calloc(sizeof(NetworkSet));
     sflist_init(&tmp->networks);
-    tmp->ids = sfxhash_new(64, sizeof(unsigned), 0, 0, 0, nullptr, nullptr, 1);
+    tmp->ids = xhash_new(64, sizeof(unsigned), 0, 0, 0, nullptr, nullptr, 1);
     if (tmp->ids == nullptr)
     {
         ErrorMessage("NetworkSet:Out of memory (wanted %zu bytes)", sizeof(NetworkSet));
@@ -48,7 +48,7 @@ int NetworkSetManager::create(NetworkSet** network_set)
     }
 
     sflist_init(&tmp->networks6);
-    tmp->ids6 = sfxhash_new(64, sizeof(unsigned), 0, 0, 0, nullptr, nullptr, 1);
+    tmp->ids6 = xhash_new(64, sizeof(unsigned), 0, 0, 0, nullptr, nullptr, 1);
     if (tmp->ids6 == nullptr)
     {
         ErrorMessage("NetworkSet:Out of memory (wanted %zu bytes)", sizeof(NetworkSet));
@@ -71,14 +71,14 @@ int NetworkSetManager::destroy(NetworkSet* network_set)
         network_set->pnetwork = nullptr;
     }
     sflist_static_free_all(&network_set->networks, &snort_free);
-    sfxhash_delete(network_set->ids);
+    xhash_delete(network_set->ids);
     if (network_set->pnetwork6)
     {
         snort_free(network_set->pnetwork6);
         network_set->pnetwork6 = nullptr;
     }
     sflist_static_free_all(&network_set->networks6, &snort_free);
-    sfxhash_delete(network_set->ids6);
+    xhash_delete(network_set->ids6);
     snort_free(network_set);
 
     return 0;
@@ -126,8 +126,8 @@ int NetworkSetManager::add_network_range_ex(NetworkSet* network_set, uint32_t ra
     }
 
     sflist_add_tail(&network_set->networks, (void*)network);
-    int rval = sfxhash_add(network_set->ids, &network->info.id, &network->info.id);
-    if (rval != SFXHASH_OK && rval != SFXHASH_INTABLE)
+    int rval = xhash_add(network_set->ids, &network->info.id, &network->info.id);
+    if (rval != XHASH_OK && rval != XHASH_INTABLE)
     {
         ErrorMessage("NetworkSet:Out of memory");
         snort_free(network);
@@ -186,8 +186,8 @@ int NetworkSetManager::add_network_range6(NetworkSet* network_set, NSIPv6Addr* r
     }
 
     sflist_add_tail(&network_set->networks6, (void*)network);
-    int rval = sfxhash_add(network_set->ids6, &network->info.id, &network->info.id);
-    if (rval != SFXHASH_OK && rval != SFXHASH_INTABLE)
+    int rval = xhash_add(network_set->ids6, &network->info.id, &network->info.id);
+    if (rval != XHASH_OK && rval != XHASH_INTABLE)
     {
         ErrorMessage("NetworkSet:Out of memory");
         snort_free(network);
@@ -943,7 +943,7 @@ int NetworkSetManager::reduce_network_set6(SF_LIST* networks)
 
 int NetworkSetManager::reduce(NetworkSet* network_set)
 {
-    SFXHASH_NODE* hnode;
+    XHashNode* hnode;
     unsigned id;
     int rval;
     SF_LIST ordered_networks;
@@ -955,9 +955,9 @@ int NetworkSetManager::reduce(NetworkSet* network_set)
     if (!network_set)
         return -1;
 
-    for (hnode = sfxhash_gfindfirst(network_set->ids);
+    for (hnode = xhash_gfindfirst(network_set->ids);
         hnode;
-        hnode=sfxhash_gfindnext(network_set->ids))
+        hnode=xhash_gfindnext(network_set->ids))
     {
         id = *(unsigned*)(hnode->data);
         if ((rval = order_by_netmask(&ordered_networks, &network_set->networks, id)) != 0)
@@ -1019,7 +1019,7 @@ int NetworkSetManager::reduce(NetworkSet* network_set)
         }
     }
 
-    for (hnode = sfxhash_gfindfirst(network_set->ids6); hnode; hnode=sfxhash_gfindnext(
+    for (hnode = xhash_gfindfirst(network_set->ids6); hnode; hnode=xhash_gfindnext(
             network_set->ids6))
     {
         id = *(unsigned*)(hnode->data);
index cf6d5bcda74720e59336ed68d3f5d091dc34e202..f5861a42b1a1e09a14aa285cc68576d66f8eb67f 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <cstdio>
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "protocols/ipv6.h"
 #include "utils/sflsq.h"
 
@@ -102,11 +102,11 @@ struct NetworkSet
 {
     NetworkSet* next;
     SF_LIST networks;
-    SFXHASH* ids;
+    XHash* ids;
     Network** pnetwork;
     unsigned count;
     SF_LIST networks6;
-    SFXHASH* ids6;
+    XHash* ids6;
     Network6** pnetwork6;
     unsigned count6;
 };
index fe979184aa389b0293a4d7c29c4ecaa2d694ff19..6edc0027ec749228d10c4948593b633637ef6493 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "utils/util.h"
index 227764b7fa749a57548edd6d993d63751675df58..831f7bf45f2735963b3cb11ee418ca4de286b3a4 100644 (file)
 #include "length_app_cache.h"
 
 #include "application_ids.h"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/thread.h"
 
 #define HASH_NUM_ROWS (1024)
 
-static THREAD_LOCAL SFXHASH* lengthCache = nullptr;
+static THREAD_LOCAL XHash* lengthCache = nullptr;
 
 void init_length_app_cache()
 {
-    if (!(lengthCache = sfxhash_new(HASH_NUM_ROWS, sizeof(LengthKey), sizeof(AppId),
+    if (!(lengthCache = xhash_new(HASH_NUM_ROWS, sizeof(LengthKey), sizeof(AppId),
             0, 0, nullptr, nullptr, 0)))
     {
         ErrorMessage("lengthAppCache: Failed to allocate length cache!");
@@ -47,14 +47,14 @@ void free_length_app_cache()
 {
     if (lengthCache)
     {
-        sfxhash_delete(lengthCache);
+        xhash_delete(lengthCache);
         lengthCache = nullptr;
     }
 }
 
 AppId find_length_app_cache(const LengthKey* key)
 {
-    AppId* val = (AppId*)sfxhash_find(lengthCache, (void*)key);
+    AppId* val = (AppId*)xhash_find(lengthCache, (void*)key);
     if (val == nullptr)
         return APP_ID_NONE;    /* no match */
     else
@@ -63,7 +63,7 @@ AppId find_length_app_cache(const LengthKey* key)
 
 bool add_length_app_cache(const LengthKey* key, AppId val)
 {
-    if (sfxhash_add(lengthCache, (void*)key, (void*)&val))
+    if (xhash_add(lengthCache, (void*)key, (void*)&val))
     {
         return false;
     }
index 815695901a8cf2b3174b03bb0e5a19b050226b70..16dc9f45788eca85c1f2aaacca57fcceb2cfc488 100644 (file)
@@ -43,7 +43,7 @@
 #include "detector_plugins/http_url_patterns.h"
 #include "detector_plugins/detector_sip.h"
 #include "detector_plugins/detector_pattern.h"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
@@ -66,7 +66,7 @@ ProfileStats luaDetectorsPerfStats;
 ProfileStats luaCiscoPerfStats;
 ProfileStats luaCustomPerfStats;
 
-static THREAD_LOCAL SFXHASH* CHP_glossary = nullptr;      // keep track of http multipatterns here
+static THREAD_LOCAL XHash* CHP_glossary = nullptr;      // keep track of http multipatterns here
 
 static int free_chp_data(void* /* key */, void* data)
 {
@@ -77,7 +77,7 @@ static int free_chp_data(void* /* key */, void* data)
 
 int init_chp_glossary()
 {
-    if (!(CHP_glossary = sfxhash_new(1024, sizeof(AppId), 0, 0, 0, nullptr, &free_chp_data, 0)))
+    if (!(CHP_glossary = xhash_new(1024, sizeof(AppId), 0, 0, 0, nullptr, &free_chp_data, 0)))
     {
         ErrorMessage("Config: failed to allocate memory for an sfxhash.");
         return 0;
@@ -89,7 +89,7 @@ int init_chp_glossary()
 void free_chp_glossary()
 {
     if (CHP_glossary)
-        sfxhash_delete(CHP_glossary);
+        xhash_delete(CHP_glossary);
     CHP_glossary = nullptr;
 }
 
@@ -1113,7 +1113,7 @@ static int create_chp_application(AppId appIdInstance, unsigned app_type_flags,
     new_app->app_type_flags = app_type_flags;
     new_app->num_matches = num_matches;
 
-    if (sfxhash_add(CHP_glossary, &(new_app->appIdInstance), new_app))
+    if (xhash_add(CHP_glossary, &(new_app->appIdInstance), new_app))
     {
         ErrorMessage("LuaDetectorApi:Failed to add CHP for appId %d, instance %d",
             CHP_APPIDINSTANCE_TO_ID(appIdInstance), CHP_APPIDINSTANCE_TO_INSTANCE(appIdInstance));
@@ -1137,7 +1137,7 @@ static int detector_chp_create_application(lua_State* L)
     int num_matches = lua_tointeger(L, ++index);
 
     // We only want one of these for each appId.
-    if (sfxhash_find(CHP_glossary, &appIdInstance))
+    if (xhash_find(CHP_glossary, &appIdInstance))
     {
         ErrorMessage(
             "LuaDetectorApi:Attempt to add more than one CHP for appId %d - use CHPMultiCreateApp",
@@ -1216,7 +1216,7 @@ static int add_chp_pattern_action(AppId appIdInstance, int isKeyPattern, Pattern
     AppInfoManager& app_info_mgr = AppInfoManager::get_instance();
 
     //find the CHP App for this
-    if (!(chpapp = (decltype(chpapp))sfxhash_find(CHP_glossary, &appIdInstance)))
+    if (!(chpapp = (decltype(chpapp))xhash_find(CHP_glossary, &appIdInstance)))
     {
         ErrorMessage(
             "LuaDetectorApi:Invalid attempt to add a CHP action for unknown appId %d, instance %d. - pattern:\"%s\" - action \"%s\"\n",
@@ -1364,7 +1364,7 @@ static int detector_create_chp_multi_application(lua_State* L)
     for (instance=0; instance < CHP_APPID_INSTANCE_MAX; instance++ )
     {
         appIdInstance = (appId << CHP_APPID_BITS_FOR_INSTANCE) + instance;
-        if ( sfxhash_find(CHP_glossary, &appIdInstance) )
+        if ( xhash_find(CHP_glossary, &appIdInstance) )
             continue;
         break;
     }
index 2a59cb23f161431a7355f39933e78eca6d686c56..8bb1810b007a69b5c22e0c71432fd0c3926714bb 100644 (file)
@@ -319,13 +319,13 @@ void AppIdServiceState::dump_stats()
     LogMessage("Service State:\n");
     if (serviceStateCache4)
     {
-        LogMessage("           IPv4 Count: %u\n", sfxhash_count(serviceStateCache4));
+        LogMessage("           IPv4 Count: %u\n", xhash_count(serviceStateCache4));
         LogMessage("    IPv4 Memory Limit: %lu\n", serviceStateCache4->mc.memcap);
         LogMessage("     IPv4 Memory Used: %lu\n", serviceStateCache4->mc.memused);
     }
     if (serviceStateCache6)
     {
-        LogMessage("           IPv6 Count: %u\n", sfxhash_count(serviceStateCache6));
+        LogMessage("           IPv6 Count: %u\n", xhash_count(serviceStateCache6));
         LogMessage("    IPv6 Memory Limit: %lu\n", serviceStateCache6->mc.memcap);
         LogMessage("     IPv6 Memory Used: %lu\n", serviceStateCache6->mc.memused);
     }
index d8e0247785179059ce91eb146c4d1b0c9a8bbe7d..4faa61a8070c5b84496278663695e46368e11b74 100644 (file)
@@ -56,10 +56,10 @@ FlowStateValue* FlowIPTracker::find_stats(const SfIp* src_addr, const SfIp* dst_
         *swapped = 1;
     }
 
-    value = (FlowStateValue*)sfxhash_find(ip_map, &key);
+    value = (FlowStateValue*)xhash_find(ip_map, &key);
     if (!value)
     {
-        SFXHASH_NODE* node = sfxhash_get_node(ip_map, &key);
+        XHashNode* node = xhash_get_node(ip_map, &key);
 
         if (!node)
         {
@@ -113,7 +113,7 @@ FlowIPTracker::FlowIPTracker(PerfConfig* perf) :
         &stats.state_changes[SFS_STATE_UDP_CREATED]);
     formatter->finalize_fields();
 
-    ip_map = sfxhash_new(1021, sizeof(FlowStateKey), sizeof(FlowStateValue),
+    ip_map = xhash_new(1021, sizeof(FlowStateKey), sizeof(FlowStateValue),
         perfmon_config->flowip_memcap, 1, nullptr, nullptr, 1);
 
     if (!ip_map)
@@ -123,12 +123,12 @@ FlowIPTracker::FlowIPTracker(PerfConfig* perf) :
 FlowIPTracker::~FlowIPTracker()
 {
     if (ip_map)
-        sfxhash_delete(ip_map);
+        xhash_delete(ip_map);
 }
 
 void FlowIPTracker::reset()
 {
-    sfxhash_make_empty(ip_map);
+    xhash_make_empty(ip_map);
 }
 
 void FlowIPTracker::update(Packet* p)
@@ -170,7 +170,7 @@ void FlowIPTracker::update(Packet* p)
 
 void FlowIPTracker::process(bool)
 {
-    for (auto node = sfxhash_findfirst(ip_map); node; node = sfxhash_findnext(ip_map))
+    for (auto node = xhash_findfirst(ip_map); node; node = xhash_findnext(ip_map))
     {
         FlowStateKey* key = (FlowStateKey*)node->key;
         FlowStateValue* cur_stats = (FlowStateValue*)node->data;
index 83b5999a60a948396171311aaf44d2ddb5851b7d..bcbb8f2586de03c34cf1201ba0fab8bba4f550f6 100644 (file)
@@ -22,7 +22,7 @@
 #define FLOW_IP_TRACKER_H
 
 #include "perf_tracker.h"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 
 enum FlowState
 {
@@ -70,7 +70,7 @@ public:
 
 private:
     FlowStateValue stats;
-    SFXHASH* ip_map;
+    XHash* ip_map;
     char ip_a[41], ip_b[41];
 
     FlowStateValue* find_stats(const SfIp* src_addr, const SfIp* dst_addr, int* swapped);
index 6fb08c68b548f86921934f19568a625eb67af041..9e162a7812a8f866d5673ad3061de6e3e17ca1be 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "ps_detect.h"
 
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "protocols/icmp4.h"
 #include "protocols/packet.h"
@@ -53,7 +53,7 @@ struct PS_HASH_KEY
 };
 PADDING_GUARD_END
 
-static THREAD_LOCAL SFXHASH* portscan_hash = nullptr;
+static THREAD_LOCAL XHash* portscan_hash = nullptr;
 
 PortscanConfig::PortscanConfig()
 {
@@ -102,7 +102,7 @@ void ps_cleanup()
 {
     if ( portscan_hash )
     {
-        sfxhash_delete(portscan_hash);
+        xhash_delete(portscan_hash);
         portscan_hash = nullptr;
     }
 }
@@ -117,7 +117,7 @@ void ps_init_hash(unsigned long memcap)
 
     int rows = memcap / ps_node_size();
 
-    portscan_hash = sfxhash_new(rows, sizeof(PS_HASH_KEY), sizeof(PS_TRACKER),
+    portscan_hash = xhash_new(rows, sizeof(PS_HASH_KEY), sizeof(PS_TRACKER),
         memcap, 1, ps_tracker_free, nullptr, 1);
 
     if ( !portscan_hash )
@@ -127,7 +127,7 @@ void ps_init_hash(unsigned long memcap)
 void ps_reset()
 {
     if ( portscan_hash )
-        sfxhash_make_empty(portscan_hash);
+        xhash_make_empty(portscan_hash);
 }
 
 //  Check scanner and scanned ips to see if we can filter them out.
@@ -267,15 +267,15 @@ bool PortScan::ps_filter_ignore(PS_PKT* ps_pkt)
 */
 static PS_TRACKER* ps_tracker_get(PS_HASH_KEY* key)
 {
-    PS_TRACKER* ht = (PS_TRACKER*)sfxhash_find(portscan_hash, (void*)key);
+    PS_TRACKER* ht = (PS_TRACKER*)xhash_find(portscan_hash, (void*)key);
 
     if ( ht )
         return ht;
 
-    if ( sfxhash_add(portscan_hash, (void*)key, nullptr) != SFXHASH_OK )
+    if ( xhash_add(portscan_hash, (void*)key, nullptr) != XHASH_OK )
         return nullptr;
 
-    ht = (PS_TRACKER*)sfxhash_mru(portscan_hash);
+    ht = (PS_TRACKER*)xhash_mru(portscan_hash);
 
     if ( ht )
         memset(ht, 0x00, sizeof(PS_TRACKER));
index 079f3916ea2d7c43c76573296a43b2c50c348920..6267a162a57bc61378f494a2d8e6d63ff6c9bb21 100644 (file)
@@ -167,7 +167,7 @@ void add_service_to_otn(
 
     if ( !otn->sigInfo.services )
         otn->sigInfo.services =
-            (ServiceInfo*)snort_calloc(sc->max_metadata_services, sizeof(ServiceInfo));
+            (SignatureServiceInfo*)snort_calloc(sc->max_metadata_services, sizeof(SignatureServiceInfo));
 
     int idx = otn->sigInfo.num_services++;
 
index b7201eb945f21b1aa308c2d8ba750432bd75273b..ee40f03552bc052f3436dbcf796f97f9618042fa 100644 (file)
@@ -29,7 +29,7 @@
 #include "detection/rtn_checks.h"
 #include "detection/treenodes.h"
 #include "framework/decode_data.h"
-#include "hash/sfxhash.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
 #include "main/snort_debug.h"
@@ -690,7 +690,7 @@ static RuleTreeNode* findHeadNode(
     if ( sc->rtn_hash_table )
     {
         RuleTreeNodeKey key { testNode, policyId };
-        return (RuleTreeNode*)sfxhash_find(sc->rtn_hash_table, &key);
+        return (RuleTreeNode*)xhash_find(sc->rtn_hash_table, &key);
     }
 
     return nullptr;
index 2c9c5c6cdccfde37d3a30a0892a509a46f0058c8..102919d37516c64c3b9272b1e0df351078d6c881 100644 (file)
@@ -33,8 +33,8 @@
 #include "filters/detection_filter.h"
 #include "filters/rate_filter.h"
 #include "filters/sfthreshold.h"
-#include "hash/sfhashfcn.h"
-#include "hash/sfxhash.h"
+#include "hash/hashfcn.h"
+#include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/shell.h"
 #include "main/snort_config.h"
@@ -101,14 +101,14 @@ static void FreeRuleTreeNodes(SnortConfig* sc)
 {
     RuleTreeNode* rtn;
     PolicyId policyId;
-    SFGHASH_NODE* hashNode;
+    GHashNode* hashNode;
 
     if (sc->otn_map == nullptr)
         return;
 
-    for (hashNode = sfghash_findfirst(sc->otn_map);
+    for (hashNode = ghash_findfirst(sc->otn_map);
         hashNode;
-        hashNode = sfghash_findnext(sc->otn_map))
+        hashNode = ghash_findnext(sc->otn_map))
     {
         OptTreeNode* otn = (OptTreeNode*)hashNode->data;
 
@@ -227,7 +227,7 @@ static void OtnInit(SnortConfig* sc)
     /* Init sid-gid -> otn map */
     sc->otn_map = OtnLookupNew();
     if (sc->otn_map == nullptr)
-        ParseAbort("ParseRulesFile otn_map sfghash_new failed.");
+        ParseAbort("ParseRulesFile otn_map ghash_new failed.");
 }
 
 #define IFACE_VARS_MAX 128
@@ -761,7 +761,7 @@ RuleTreeNode* deleteRtnFromOtn(OptTreeNode* otn, PolicyId policyId, SnortConfig*
         {
             RuleTreeNodeKey key{ rtn, policyId };
             if ( sc && sc->rtn_hash_table )
-                sfxhash_remove(sc->rtn_hash_table, &key);
+                xhash_remove(sc->rtn_hash_table, &key);
         }
 
         return rtn;
@@ -775,7 +775,7 @@ RuleTreeNode* deleteRtnFromOtn(OptTreeNode* otn, SnortConfig* sc)
     return deleteRtnFromOtn(otn, get_ips_policy()->policy_id, sc);
 }
 
-static uint32_t rtn_hash_func(SFHASHFCN*, const unsigned char *k, int)
+static uint32_t rtn_hash_func(HashFnc*, const unsigned char *k, int)
 {
     uint32_t a,b,c;
     const RuleTreeNodeKey* rtnk = (const RuleTreeNodeKey*)k;
@@ -859,19 +859,19 @@ int addRtnToOtn(SnortConfig* sc, OptTreeNode* otn, RuleTreeNode* rtn, PolicyId p
 
     if (!sc->rtn_hash_table)
     {
-        sc->rtn_hash_table = sfxhash_new(10000, sizeof(RuleTreeNodeKey), 0, 0, 0, nullptr, nullptr, 1);
+        sc->rtn_hash_table = xhash_new(10000, sizeof(RuleTreeNodeKey), 0, 0, 0, nullptr, nullptr, 1);
 
         if (sc->rtn_hash_table == nullptr)
             FatalError("Failed to create rule tree node hash table\n");
 
-        sfxhash_set_keyops(sc->rtn_hash_table, rtn_hash_func, rtn_compare_func);
+        xhash_set_keyops(sc->rtn_hash_table, rtn_hash_func, rtn_compare_func);
     }
 
     RuleTreeNodeKey key;
     memset(&key, 0, sizeof(key));
     key.rtn = rtn;
     key.policyId = policyId;
-    sfxhash_add(sc->rtn_hash_table, &key, rtn);
+    xhash_add(sc->rtn_hash_table, &key, rtn);
 
     return 0; //success
 }
index 8784cf670dded77d70641be5ad4400abf0c10145..6f3167602811e5efa5b1b98cc9aae157f60972ea 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "port_object2.h"
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "main/snort_debug.h"
 #include "parser/parser.h"
@@ -54,7 +54,7 @@
 #define SWAP_BYTES(a)
 #endif
 
-static unsigned po_rule_hash_func(SFHASHFCN* p, const unsigned char* k, int n)
+static unsigned po_rule_hash_func(HashFnc* p, const unsigned char* k, int n)
 {
     unsigned char* key;
     int ikey = *(const int*)k;
@@ -67,10 +67,10 @@ static unsigned po_rule_hash_func(SFHASHFCN* p, const unsigned char* k, int n)
     /* Set a pointer to the key to pass to the hashing function */
     key = (unsigned char*)&ikey;
 
-    return sfhashfcn_hash(p, key, n);
+    return hashfcn_hash(p, key, n);
 }
 
-static int* RuleHashToSortedArray(SFGHASH* rh)
+static int* RuleHashToSortedArray(GHash* rh)
 {
     if ( !rh or !rh->count )
         return nullptr;
@@ -78,9 +78,9 @@ static int* RuleHashToSortedArray(SFGHASH* rh)
     int* ra = (int*)snort_calloc(rh->count, sizeof(int));
     int k = 0;
 
-    for ( SFGHASH_NODE* node = sfghash_findfirst(rh);
+    for ( GHashNode* node = ghash_findfirst(rh);
         node != nullptr && k < (int)rh->count;
-        node = sfghash_findnext(rh) )
+        node = ghash_findnext(rh) )
     {
         if ( int* prid = (int*)node->data )
             ra[k++] = *prid;
@@ -106,7 +106,7 @@ PortObject2* PortObject2New(int nrules)
         return nullptr;
     }
 
-    po->rule_hash =(SFGHASH*)sfghash_new(nrules,sizeof(int), 0,
+    po->rule_hash =(GHash*)ghash_new(nrules,sizeof(int), 0,
         snort_free /* frees data - should be rule id ptrs == (int*) */);
     if ( !po->rule_hash )
     {
@@ -116,7 +116,7 @@ PortObject2* PortObject2New(int nrules)
     }
 
     /* Use hash function defined above for hashing the key as an int. */
-    sfghash_set_keyops(po->rule_hash, po_rule_hash_func, memcmp);
+    ghash_set_keyops(po->rule_hash, po_rule_hash_func, memcmp);
 
     return po;
 }
@@ -136,7 +136,7 @@ void PortObject2Free(PortObject2* po)
         sflist_free_all(po->item_list, snort_free);
 
     if ( po->rule_hash)
-        sfghash_delete(po->rule_hash);
+        ghash_delete(po->rule_hash);
 
     if (po->port_list)
         delete po->port_list;
@@ -152,7 +152,7 @@ void PortObject2Finalize(PortObject2* po)
     sflist_free_all(po->item_list, snort_free);
     po->item_list = nullptr;
 
-    sfghash_delete(po->rule_hash);
+    ghash_delete(po->rule_hash);
     po->rule_hash = nullptr;
 }
 
@@ -213,7 +213,7 @@ PortObject2* PortObject2Dup(PortObject* po)
             prule = (int*)snort_calloc(sizeof(int));
             *prule = *prid;
 
-            if ( sfghash_add(ponew->rule_hash, prule, prule) != SFGHASH_OK )
+            if ( ghash_add(ponew->rule_hash, prule, prule) != GHASH_OK )
             {
                 snort_free(prule);
             }
@@ -252,7 +252,7 @@ PortObject2* PortObject2AppendPortObject(PortObject2* poa, PortObject* pob)
         int* prid2 = (int*)snort_calloc(sizeof(int));
         *prid2 = *prid;
 
-        if ( sfghash_add(poa->rule_hash,prid2,prid2) != SFGHASH_OK )
+        if ( ghash_add(poa->rule_hash,prid2,prid2) != GHASH_OK )
             snort_free(prid2);
     }
     return poa;
@@ -261,9 +261,9 @@ PortObject2* PortObject2AppendPortObject(PortObject2* poa, PortObject* pob)
 /* Dup and append rule list numbers from pob to poa */
 PortObject2* PortObject2AppendPortObject2(PortObject2* poa, PortObject2* pob)
 {
-    for (SFGHASH_NODE* node = sfghash_findfirst(pob->rule_hash);
+    for (GHashNode* node = ghash_findfirst(pob->rule_hash);
         node!= nullptr;
-        node = sfghash_findnext(pob->rule_hash) )
+        node = ghash_findnext(pob->rule_hash) )
     {
         int* prid = (int*)node->data;
 
@@ -273,7 +273,7 @@ PortObject2* PortObject2AppendPortObject2(PortObject2* poa, PortObject2* pob)
         int* prid2 = (int*)snort_calloc(sizeof(int));
         *prid2 = *prid;
 
-        if ( sfghash_add(poa->rule_hash,prid2,prid2) != SFGHASH_OK )
+        if ( ghash_add(poa->rule_hash,prid2,prid2) != GHASH_OK )
             snort_free(prid2);
     }
     return poa;
index 097504e76492d47b0c87a89bd55a3ef54f4fe441..b4645a37bd8df7a4cca5bba9f14ac514447a6cad 100644 (file)
@@ -23,7 +23,7 @@
 #define PORT_OBJECT2_H
 
 #include "framework/bits.h"
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 #include "utils/sflsq.h"
 
 //-------------------------------------------------------------------------
@@ -40,7 +40,7 @@ struct PortObject2
     int id;                     /* internal tracking - compiling sets this value */
 
     SF_LIST* item_list;         /* list of port and port-range items */
-    SFGHASH* rule_hash;         /* hash of rule (rule-indexes) in use */
+    GHash* rule_hash;         /* hash of rule (rule-indexes) in use */
 
     PortBitSet* port_list;      /* for collecting ports that use this object */
     struct PortGroup* group;    /* PortGroup based on rule_hash  */
index 8f13613336023263f68cd9cce25389bda714d2b5..915dbd576bc800818226324d1becddbfa941c433 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <memory>
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "main/snort_debug.h"
 #include "utils/util.h"
@@ -88,7 +88,7 @@ static void plx_print(plx_t* p)
 }
 #endif
 
-static unsigned plx_hash(SFHASHFCN* p, const unsigned char* d, int)
+static unsigned plx_hash(HashFnc* p, const unsigned char* d, int)
 {
     unsigned hash = p->seed;
     const plx_t* plx = *(plx_t* const*)d;
@@ -164,13 +164,13 @@ static int PortObject_keycmp(const void* a, const void* b, size_t)
 /*
     Hash routine for hashing PortObjects as Keys
 
-    p - SFHASHFCN *
+    p - HashFnc *
     d - PortObject *
     n = 4 bytes (sizeof*) - not used
 
    Don't use this for type=ANY port objects
 */
-static unsigned PortObject_hash(SFHASHFCN* p, const unsigned char* d, int)
+static unsigned PortObject_hash(HashFnc* p, const unsigned char* d, int)
 {
     unsigned hash = p->seed;
     const PortObject* po = *(PortObject* const*)d;
@@ -235,7 +235,7 @@ static unsigned PortObject_hash(SFHASHFCN* p, const unsigned char* d, int)
  * lookup.
  */
 static PortObject2* _merge_N_pol(
-    SFGHASH* mhash, SFGHASH* mhashx,
+    GHash* mhash, GHash* mhashx,
     SF_LIST* plx_list, void** pol,
     int pol_cnt, plx_t* plx)
 {
@@ -247,8 +247,8 @@ static PortObject2* _merge_N_pol(
     /*
     * Check for the merged port object in the plx table
     */
-    DebugFormat(DEBUG_PORTLISTS, "++++n=%d sfghash_find-mhashx\n", pol_cnt);
-    ponew = (PortObject2*)sfghash_find(mhashx, &plx);
+    DebugFormat(DEBUG_PORTLISTS, "++++n=%d ghash_find-mhashx\n", pol_cnt);
+    ponew = (PortObject2*)ghash_find(mhashx, &plx);
 
     if ( ponew )
     {
@@ -291,24 +291,24 @@ static PortObject2* _merge_N_pol(
     * Add the Merged PortObject2 to the PortObject2 hash table
     * keyed by ports.
     */
-    DebugFormat(DEBUG_PORTLISTS, "n=%d sfghash_add-mhash\n", pol_cnt);
-    stat =sfghash_add(mhash, &ponew, ponew);
-    if ( stat != SFGHASH_OK )
+    DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_add-mhash\n", pol_cnt);
+    stat =ghash_add(mhash, &ponew, ponew);
+    if ( stat != GHASH_OK )
     {
         /* This is possible since PLX hash on a different key */
-        if ( stat == SFGHASH_INTABLE )
+        if ( stat == GHASH_INTABLE )
         {
-            DebugFormat(DEBUG_PORTLISTS, "n=%d sfghash_add-mhash ponew in table\n", pol_cnt);
-            DebugFormat(DEBUG_PORTLISTS, "n=%d sfghash_find-mhash ponew\n", pol_cnt);
-            pox = (PortObject2*)sfghash_find(mhash, &ponew);
+            DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_add-mhash ponew in table\n", pol_cnt);
+            DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_find-mhash ponew\n", pol_cnt);
+            pox = (PortObject2*)ghash_find(mhash, &ponew);
             if ( pox )
             {
                 PortObject2AppendPortObject2(pox, ponew);
-                DebugMessage(DEBUG_PORTLISTS, "sfportobject.c: merge_N_pol() SFGHASH_INTABLE\n");
+                DebugMessage(DEBUG_PORTLISTS, "sfportobject.c: merge_N_pol() GHASH_INTABLE\n");
                 PortObject2Free(ponew);
                 ponew = pox;
                 DebugFormat(DEBUG_PORTLISTS,
-                    "n=%d sfghash_find-mhash ponew found, new rules merged\n", pol_cnt);
+                    "n=%d ghash_find-mhash ponew found, new rules merged\n", pol_cnt);
             }
             else
             {
@@ -337,11 +337,11 @@ static PortObject2* _merge_N_pol(
     /*
      * Add the plx node to the PLX hash table
      */
-    DebugFormat(DEBUG_PORTLISTS, "n=%d sfghash_add-mhashx\n", pol_cnt);
-    stat = sfghash_add(mhashx, &plx_tmp, ponew);
-    if ( stat != SFGHASH_OK )
+    DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_add-mhashx\n", pol_cnt);
+    stat = ghash_add(mhashx, &plx_tmp, ponew);
+    if ( stat != GHASH_OK )
     {
-        if ( stat == SFGHASH_INTABLE )
+        if ( stat == GHASH_INTABLE )
         {
             FatalError("Could not add merged plx to PLX HASH table-INTABLE\n");
         }
@@ -356,7 +356,7 @@ static PortObject2* _merge_N_pol(
     /*
     *  Validate hash table entry
     */
-    if ( sfghash_find(mhashx, &plx_tmp) != ponew )
+    if ( ghash_find(mhashx, &plx_tmp) != ponew )
     {
         FatalError("Find after add failed on PLX HASH table key\n");
     }
@@ -380,7 +380,7 @@ static PortObject2* _merge_N_pol(
  *
  */
 static PortObject2* PortTableCompileMergePortObjectList2(
-    SFGHASH* mhash, SFGHASH* mhashx, SF_LIST* plx_list,
+    GHash* mhash, GHash* mhashx, SF_LIST* plx_list,
     PortObject* pol[], int pol_cnt, unsigned int lcnt)
 {
     std::unique_ptr<void*[]> upA(new void*[SFPO_MAX_LPORTS]);
@@ -589,18 +589,18 @@ static int PortTableCompileMergePortObjects(PortTable* p)
     PortObject** pol = upA.get();
 
     // Create a Merged Port Object Table - hash by ports, no user keys, don't free data
-    SFGHASH* mhash = sfghash_new(PO_HASH_TBL_ROWS, sizeof(PortObject*), 0, nullptr);
+    GHash* mhash = ghash_new(PO_HASH_TBL_ROWS, sizeof(PortObject*), 0, nullptr);
 
     /* Setup hashing function and key comparison function */
-    sfhashfcn_set_keyops(mhash->sfhashfcn, PortObject_hash, PortObject_keycmp);
+    hashfcn_set_keyops(mhash->hashfcn, PortObject_hash, PortObject_keycmp);
 
     p->pt_mpo_hash = mhash;
 
     // Create a Merged Port Object Table - hash by pointers, no user keys, don't free data
-    SFGHASH* mhashx = sfghash_new(PO_HASH_TBL_ROWS, sizeof(plx_t*), 0, nullptr);
+    GHash* mhashx = ghash_new(PO_HASH_TBL_ROWS, sizeof(plx_t*), 0, nullptr);
 
     /* Setup hashing function and key comparison function */
-    sfhashfcn_set_keyops(mhashx->sfhashfcn, plx_hash, plx_keycmp);
+    hashfcn_set_keyops(mhashx->hashfcn, plx_hash, plx_keycmp);
 
     p->pt_mpxo_hash = mhashx;
 
@@ -669,9 +669,9 @@ static int PortTableCompileMergePortObjects(PortTable* p)
      */
 
     /* 1st- Setup bitmasks for collecting ports */
-    for (SFGHASH_NODE* node=sfghash_findfirst(mhashx);
+    for (GHashNode* node=ghash_findfirst(mhashx);
         node;
-        node=sfghash_findnext(mhashx) )
+        node=ghash_findnext(mhashx) )
     {
         PortObject2* poa = (PortObject2*)node->data;
 
@@ -705,9 +705,9 @@ static int PortTableCompileMergePortObjects(PortTable* p)
     }
 
     /* Process Port map and print final port-object usage stats */
-    for (SFGHASH_NODE* node=sfghash_findfirst(mhashx);
+    for (GHashNode* node=ghash_findfirst(mhashx);
         node;
-        node=sfghash_findnext(mhashx) )
+        node=ghash_findnext(mhashx) )
     {
         PortObject2* po = (PortObject2*)node->data;
 
@@ -774,7 +774,7 @@ static int _po2_include_po_rules(PortObject2* po2, PortObject* po)
         pid = (int*)sflist_next(&rpos) )
     {
         /* find it in po2 */
-        int* id = (int*)sfghash_find(po2->rule_hash, pid);
+        int* id = (int*)ghash_find(po2->rule_hash, pid);
 
         /* make sure it's in po2 */
         if ( !id )
@@ -792,9 +792,9 @@ static bool PortTableConsistencyCheck(PortTable* p)
     char* parray = upA.get();
     memset(parray, 0, SFPO_MAX_PORTS);
 
-    for ( SFGHASH_NODE* node=sfghash_findfirst(p->pt_mpo_hash);
+    for ( GHashNode* node=ghash_findfirst(p->pt_mpo_hash);
         node;
-        node=sfghash_findnext(p->pt_mpo_hash) )
+        node=ghash_findnext(p->pt_mpo_hash) )
     {
         PortObject2* po = (PortObject2*)node->data;
 
@@ -912,18 +912,18 @@ void PortTableFree(PortTable* p)
     if (p->pt_mpo_hash)
     {
 
-        for ( SFGHASH_NODE* node = sfghash_findfirst(p->pt_mpo_hash);
+        for ( GHashNode* node = ghash_findfirst(p->pt_mpo_hash);
             node;
-            node = sfghash_findnext(p->pt_mpo_hash) )
+            node = ghash_findnext(p->pt_mpo_hash) )
         {
             PortObject2* po = (PortObject2*)node->data;
             PortObject2Free(po);
         }
-        sfghash_delete(p->pt_mpo_hash);
+        ghash_delete(p->pt_mpo_hash);
     }
     if (p->pt_mpxo_hash)
     {
-        sfghash_delete(p->pt_mpxo_hash);
+        ghash_delete(p->pt_mpxo_hash);
     }
 
     snort_free(p);
@@ -932,7 +932,7 @@ void PortTableFree(PortTable* p)
 // FIXIT-P we should be able to free pt_mpo_hash early too
 void PortTableFinalize(PortTable* p)
 {
-    sfghash_delete(p->pt_mpxo_hash);
+    ghash_delete(p->pt_mpxo_hash);
     p->pt_mpxo_hash = nullptr;
 }
 
@@ -1032,9 +1032,9 @@ int PortTablePrintCompiledEx(PortTable* p, rim_print_f print_index_map)
     LogMessage(" *** PortTableCompiled  [ %d compiled port groups ] \n\n",
         p->pt_mpo_hash->count);
 
-    for ( SFGHASH_NODE* node = sfghash_findfirst(p->pt_mpo_hash);
+    for ( GHashNode* node = ghash_findfirst(p->pt_mpo_hash);
         node!= nullptr;
-        node = sfghash_findnext(p->pt_mpo_hash) )
+        node = ghash_findnext(p->pt_mpo_hash) )
     {
         PortObject2* po = (PortObject2*)node->data;
         PortObject2PrintEx(po, print_index_map);
@@ -1084,9 +1084,9 @@ void PortTablePrintPortGroups(PortTable* p)
     LogMessage(">>>PortTable - Compiled Port Groups\n");
     LogMessage("   [ %d port groups ] \n\n", p->pt_mpo_hash->count);
 
-    for ( SFGHASH_NODE* ponode = sfghash_findfirst(p->pt_mpo_hash);
+    for ( GHashNode* ponode = ghash_findfirst(p->pt_mpo_hash);
         ponode!= nullptr;
-        ponode = sfghash_findnext(p->pt_mpo_hash) )
+        ponode = ghash_findnext(p->pt_mpo_hash) )
     {
         PortObject2* po = (PortObject2*)ponode->data;
         PortObject2Print(po);
index 5adfcddb47e6092cb6c9c9daedb99c2148a77abe..aefd2dd3c3843f12f61408dc63f62d91147618ca 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef PORT_TABLE_H
 #define PORT_TABLE_H
 
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 #include "ports/port_item.h"
 #include "ports/port_object.h"
 #include "ports/port_object2.h"
@@ -49,8 +49,8 @@ struct PortTable
     int pt_poid;
 
     /* Compiled / merged port object hash table */
-    SFGHASH* pt_mpo_hash;
-    SFGHASH* pt_mpxo_hash;
+    GHash* pt_mpo_hash;
+    GHash* pt_mpxo_hash;
 
     /*
     * Final Port/Rule Groupings, one port object per port, or null
index 326d25d1597053704d712094a73ef5f0841cb1af..3594f274d950da56262ae6b3b8a48a9323691e1d 100644 (file)
 PortVarTable* PortVarTableCreate()
 {
     PortObject* po;
-    SFGHASH* h;
+    GHash* h;
 
     /*
      * This is used during parsing of config,
      * so 1000 entries is ok, worst that happens is somewhat slower
      * config/rule processing.
      */
-    h = sfghash_new(1000,0,0,PortObjectFree);
+    h = ghash_new(1000,0,0,PortObjectFree);
     if ( !h )
         return nullptr;
 
@@ -68,7 +68,7 @@ int PortVarTableFree(PortVarTable* pvt)
 {
     if ( pvt )
     {
-        sfghash_delete(pvt);
+        ghash_delete(pvt);
     }
     return 0;
 }
@@ -84,10 +84,10 @@ int PortVarTableFree(PortVarTable* pvt)
 int PortVarTableAdd(PortVarTable* h, PortObject* po)
 {
     int stat;
-    stat = sfghash_add(h,po->name,po);
-    if ( stat == SFGHASH_INTABLE )
+    stat = ghash_add(h,po->name,po);
+    if ( stat == GHASH_INTABLE )
         return 1;
-    if ( stat == SFGHASH_OK )
+    if ( stat == GHASH_OK )
         return 0;
     return -1;
 }
@@ -97,6 +97,6 @@ PortObject* PortVarTableFind(PortVarTable* h, const char* name)
     if (!h || !name)
         return nullptr;
 
-    return (PortObject*)sfghash_find(h,name);
+    return (PortObject*)ghash_find(h,name);
 }
 
index 9edb7436a7e3c71f1a68518faf6f5e8107b539ee..84d8eb8a434a56ca63e6fee324bbc7df99ed3db9 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef PORT_VAR_TABLE_H
 #define PORT_VAR_TABLE_H
 
-#include "hash/sfghash.h"
+#include "hash/ghash.h"
 #include "ports/port_object.h"
 #include "ports/port_table.h"
 
@@ -32,7 +32,7 @@
 // PortVars are internally stored in PortObjects
 //-------------------------------------------------------------------------
 
-typedef SFGHASH PortVarTable;
+typedef GHash PortVarTable;
 
 PortVarTable* PortVarTableCreate();
 int PortVarTableFree(PortVarTable* pvt);
index 37d196575212e1f3e3d49b83469ad855a313cb5b..076eaa4213f1c0238c02e2e7d210d368f69da77e 100644 (file)
@@ -196,7 +196,7 @@ static std::vector<View> build_entries()
 
     std::vector<View> entries;
 
-    for ( auto* h = sfghash_findfirst(otn_map); h; h = sfghash_findnext(otn_map) )
+    for ( auto* h = ghash_findfirst(otn_map); h; h = ghash_findnext(otn_map) )
     {
         auto* otn = static_cast<OptTreeNode*>(h->data);
         assert(otn);
@@ -311,7 +311,7 @@ void reset_rule_profiler_stats()
     assert(SnortConfig::get_conf());
     auto* otn_map = SnortConfig::get_conf()->otn_map;
 
-    for ( auto* h = sfghash_findfirst(otn_map); h; h = sfghash_findnext(otn_map) )
+    for ( auto* h = ghash_findfirst(otn_map); h; h = ghash_findnext(otn_map) )
     {
         auto* otn = static_cast<OptTreeNode*>(h->data);
         assert(otn);
index 052188b6a0e669bc48ea7af5c5310967ba8725a7..02436127b5f2cbfffd62a63352248ccd05f59b3a 100644 (file)
@@ -29,7 +29,7 @@
 #include "framework/module.h"
 #include "framework/ips_option.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "target_based/snort_protocols.h"
 #include "utils/util.h"
index f38254e60c4a29b2e4a3b6c13595e68d1603bf0f..17a0063bcb8800bb748810979f8f613e3149289d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "utils/util.h"
 
index abfd00d8f162bf9c49de871498cdd109bed4c7cc..907d030968606d56c412847cdf02dbe0398cd39b 100644 (file)
@@ -26,7 +26,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 
 #include "dce_common.h"
index c12ad85f2d696752d58676dbbea6b5510d20ed2a..2d8fb8a871fa7ce7355afc37dd866e30976093ca 100644 (file)
@@ -26,7 +26,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "protocols/packet.h"
 #include "profiler/profiler.h"
 
index 900d91b4f24dc74fa467c559b4bba3a5af93cc25..2c94a3ba1fb34f764de02b8e14d2f9529720ed72 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 8a73d4f05af22da69836ddade291804f4a087e9e..31f0052836daaf3811d4faead7d8c607d8f261a0 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index b3de3475321ac6e32830fd1fd69308be233c0387..b12dec7afe0a053587cc040cc7c562928552c840 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index 557f756a4ab62b0b4dbcf921dfbc74c938365d47..5dec271cf902cdff3efbb3b2f2c1ac3cfb2b8113 100644 (file)
@@ -24,7 +24,7 @@
 
 // gtp_info rule option implementation
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
index c5308c73fb0a6408b829da7c60248ad7b67c9c7d..3ed1b397e9ee426c93146f95f2ea4c0a46935efa 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "protocols/packet.h"
 #include "profiler/profiler.h"
 
index c0e3c6f621173adca00418756a7fdb9f2c36adae..c6b9e7440e56eee23bf889aca0cace6d79923b4a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "protocols/packet.h"
 #include "profiler/profiler.h"
 
index df5f5690ea9b887df89d1daefbc65566e7899824..23c77704ad33fa03aac668a95dd4c92b84977eaa 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "http_uri.h"
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 
 using namespace HttpEnums;
 
index ba57d7cd6772c836406d58eefbbcf05118f5642c..bcd8ee921b10b25b54a55d67afe7f55fdb64038e 100644 (file)
@@ -24,7 +24,7 @@
 #include "ips_http.h"
 
 #include "framework/cursor.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "protocols/packet.h"
 
index c8a35bcab362f7e698add0ef5dccf2a8f4bec3fa..9f78846963a2a42cc70f452b6959d10130b5523e 100644 (file)
@@ -26,7 +26,7 @@
 #include "framework/cursor.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 
index cad2c7a457d7361c7ffe79d5ef9b6c5a2acd6761..64d7acd91325c3573b205cdfd0bd1de58c54088c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "protocols/packet.h"
 #include "profiler/profiler.h"
 
index 735453cfcba86072e1ad1876e0aa543f795f26cb..724a83e07764d02e7fd9a41b8961f55134833a2d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "protocols/packet.h"
 #include "profiler/profiler.h"
 
index ad1251315adc0c238abeb98a0a1f06e60db07074..909c70cd76eb45ce435d6a62a0f5d8bd0e82eaa5 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 34a0219e049ca89d1c7e0221308c8943f774a25c..cb9f09bee89a44ecc2eac5403d495be4a1b5b425 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
index 174cc90a5e8616bbbafb178e7947e459f8242027..7bce98b5d99e3eafd02eff82d96aee88716e40bd 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <cstring>
 
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 
 /*
  * Trim spaces non-destructively on both sides of string : '', \t, \n, \r
index 51cacdf9281b20f0fd718238d19d7ad68c007872..8894e1ab047eb372fd67f1887448d81b085fbf83 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/ssl.h"
index d36c6628c5a23ddcbe9ea7d3fbb7f45be9ac4c44..b2faefe0945a99249c11c3d27cd5c0413cdc08a2 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler.h"
 #include "protocols/packet.h"
 #include "protocols/ssl.h"
index ccbdc6bc5853dec0f4cf665205ecfeedd6acd238..baad5fa08dbddd46b69d0e23d9e1c32754996c16 100644 (file)
@@ -24,7 +24,7 @@
 #include "detection/detection_engine.h"
 #include "framework/ips_option.h"
 #include "framework/module.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "main/snort_config.h"
 #include "profiler/profiler.h"
 
index 57c76daea49ce32548522b9b354c998fdfa1882d..c6ccfda32e10f9f5064e446f66f6e9a03a247eff 100644 (file)
@@ -24,7 +24,7 @@
 #include "framework/ips_option.h"
 #include "framework/module.h"
 #include "framework/range.h"
-#include "hash/sfhashfcn.h"
+#include "hash/hashfcn.h"
 #include "profiler/profiler_defs.h"
 
 #include "tcp_session.h"
index 3a9a5af461941ff5b7aa146f8be0df969728a9a2..16ff6018d0cd129c551a42742b86648e53f41c09 100644 (file)
@@ -54,7 +54,7 @@ static void UdpSessionCleanup(Flow* lwssn)
 }
 
 static int ProcessUdp(
-    Flow* lwssn, Packet* p, StreamUdpConfig*, SFXHASH_NODE*)
+    Flow* lwssn, Packet* p, StreamUdpConfig*, XHashNode*)
 {
     assert(lwssn->pkt_type == PktType::UDP);