aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2002-07-31 06:15:26 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2002-07-31 06:15:26 +0000
commite930dd4a315b0f4da1d03ab40497d15bb4e521f7 (patch)
tree61d0e5d932b0433f29404efb92028869b3b530c6
parente04fc7ebfd1fe50707dbde9f3e7589f7e4a61f90 (diff)
downloadwireshark-e930dd4a315b0f4da1d03ab40497d15bb4e521f7.tar.gz
wireshark-e930dd4a315b0f4da1d03ab40497d15bb4e521f7.tar.bz2
wireshark-e930dd4a315b0f4da1d03ab40497d15bb4e521f7.zip
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. svn path=/trunk/; revision=5917
-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) \