Wireshark-dev: Re: [Wireshark-dev] Comparing address type
From: Stephen Fisher <[email protected]>
Date: Wed, 26 Nov 2008 15:46:04 -0700
On Wed, Nov 26, 2008 at 05:38:31PM -0500, Qifan Xi wrote:

> I have a need to compare the addresses of two packets. Attempting to 
> use the binary comparison operator, ==, on the packet info's address 
> field fails miserably with "error: invalid operands to binary == (have 
> ‘address’ and ‘address’)". Is there a relatively pain-free way to 
> perform such a comparison?

Include epan/address.h if you haven't already and use the macro 
ADDRESSES_EQUAL(addr1, addr2), which will "return true if they are equal 
and false otherwise."  This is assuming you're using the "address" type 
of variable to hold the addresses.