aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2010-10-26 08:31:16 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2010-10-26 08:31:16 +0000
commit8652fe8e9cea88fabeee2389bd134ba710afc5fc (patch)
treee2673fec6aada376e7845a0a9df5391ae357b5af
parent21d8ef8aff5d3b0b79f0e958854910bc88066ec1 (diff)
You may not use g_int64_hash() or g_int64_equal(), as they are not
present in the minimum version of GLib that we support. Create a ieee802154_long_addr structure for long addresses, create hash routines for those addresses, and use them. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@34651 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--epan/dissectors/packet-ieee802154.c16
-rw-r--r--epan/dissectors/packet-ieee802154.h5
2 files changed, 18 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 1f10f91ac5..463b17f1d8 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -2226,6 +2226,18 @@ gboolean ieee802154_short_addr_equal(gconstpointer a, gconstpointer b)
(((ieee802154_short_addr *)a)->addr == ((ieee802154_short_addr *)b)->addr);
}
+/* Key hash function. */
+guint ieee802154_long_addr_hash(gconstpointer key)
+{
+ return (((ieee802154_long_addr *)key)->addr) & 0xFFFFFFFF;
+}
+
+/* Key equal function. */
+gboolean ieee802154_long_addr_equal(gconstpointer a, gconstpointer b)
+{
+ return (((ieee802154_long_addr *)a)->addr == ((ieee802154_long_addr *)b)->addr);
+}
+
/*FUNCTION:------------------------------------------------------
* NAME
* ieee802154_addr_update
@@ -2821,9 +2833,7 @@ proto_init_ieee802154(void)
/* Create the hash tables. */
ieee802154_addr.short_table = g_hash_table_new(ieee802154_short_addr_hash, ieee802154_short_addr_equal);
-#if GLIB_CHECK_VERSION(2,22,0)
- ieee802154_addr.long_table = g_hash_table_new(g_int64_hash, g_int64_equal);
-#endif
+ ieee802154_addr.long_table = g_hash_table_new(ieee802154_long_addr_hash, ieee802154_long_addr_equal);
/* Re-load the hash table from the static address UAT. */
for (i=0; (i<num_static_addrs) && (static_addrs); i++) {
ieee802154_addr_update(&ieee802154_addr,(guint16)static_addrs[i].addr16, (guint16)static_addrs[i].pan,
diff --git a/epan/dissectors/packet-ieee802154.h b/epan/dissectors/packet-ieee802154.h
index 8cbce7aa4b..25c7d4275a 100644
--- a/epan/dissectors/packet-ieee802154.h
+++ b/epan/dissectors/packet-ieee802154.h
@@ -216,6 +216,11 @@ typedef struct {
guint16 addr;
} ieee802154_short_addr;
+/* Key used by the long address hash table. */
+typedef struct {
+ guint64 addr;
+} ieee802154_long_addr;
+
/* A mapping record for a frame, pointed to by hash table */
typedef struct {
int proto; /* protocol that created this record */