diff options
author | Guy Harris <guy@alum.mit.edu> | 2007-04-26 00:51:33 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2007-04-26 00:51:33 +0000 |
commit | 1ed26d317caa512ae730a84e0b41bb35f7b10216 (patch) | |
tree | 1420e4c5a71174ced5607e725f5620ae3fe1f8a7 /epan/address.h | |
parent | 41cafa2212976006aee5e58efecd9b6d0a028335 (diff) |
Add a macro for hashing the bytes of an address into a hash value.
Use it in the IAX2 dissector and in the conversation code.
svn path=/trunk/; revision=21577
Diffstat (limited to 'epan/address.h')
-rw-r--r-- | epan/address.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/epan/address.h b/epan/address.h index a47046fd54..11f19d269e 100644 --- a/epan/address.h +++ b/epan/address.h @@ -122,6 +122,19 @@ typedef struct _address { (to)->data = SE_COPY_ADDRESS_data; \ } +/* + * Hash an address into a hash value. + */ +#define HASH_ADDRESS(hash_val, addr) { \ + const guint8 *HASH_ADDRESS_data; \ + int HASH_ADDRESS_index; \ + HASH_ADDRESS_data = (addr).data; \ + for (HASH_ADDRESS_index = 0; \ + HASH_ADDRESS_index < (addr).len; + HASH_ADDRESS_index++) \ + hash_val += addrdata[HASH_ADDRESS_index]; \ + } + /* Types of port numbers Wireshark knows about. */ typedef enum { PT_NONE, /* no port number */ |