aboutsummaryrefslogtreecommitdiffstats
path: root/epan/packet_info.h
diff options
context:
space:
mode:
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2002-07-31 06:15:26 +0000
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>2002-07-31 06:15:26 +0000
commitfb72d472d2ce5a8bfb6f0775604a90a6901ddf07 (patch)
tree61d0e5d932b0433f29404efb92028869b3b530c6 /epan/packet_info.h
parentca7f212d1342717fb06afc6a4ce22b98528bb234 (diff)
Adding a new macro CMP_ADDRESS similar to ADDRESS_EQUAL but this one will return
-1,0,1 as the xxxcmp() functions will instead of just true/false. Useful if you not only want to check for equality but also if you want to have a way to order the elements. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5917 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/packet_info.h')
-rw-r--r--epan/packet_info.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/epan/packet_info.h b/epan/packet_info.h
index c6ac1d52fe..18840b6cdc 100644
--- a/epan/packet_info.h
+++ b/epan/packet_info.h
@@ -1,7 +1,7 @@
/* packet_info.h
* Definitions for packet info structures and routines
*
- * $Id: packet_info.h,v 1.15 2002/06/28 20:13:03 guy Exp $
+ * $Id: packet_info.h,v 1.16 2002/07/31 06:15:26 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -55,6 +55,20 @@ typedef struct _address {
}
/*
+ * Given two addresses, return
+ * 0 if the addresses are equal,
+ * 1 if addr1>addr2 in some nondefined metric
+ * -1 if addr1<addr2 in some nondefined metric
+ */
+#define CMP_ADDRESS(addr1, addr2) \
+ ( ((addr1)->type > (addr2)->type)?1: \
+ ((addr1)->type < (addr2)->type)?-1: \
+ ((addr1)->len > (addr2)->len) ?1: \
+ ((addr1)->len < (addr2)->len) ?-1: \
+ memcmp((addr1)-data, (addr2)->data, (addr1)->len)\
+ )
+
+/*
* Given two addresses, return "true" if they're equal, "false" otherwise.
*/
#define ADDRESSES_EQUAL(addr1, addr2) \