src/Network/Address.hh
changeset 383 2a57f0a871b0
parent 382 190f81d30624
child 399 c7295b72731a
equal deleted inserted replaced
382:190f81d30624 383:2a57f0a871b0
    88          * Free an addrinfo returned by get_addrinfo
    88          * Free an addrinfo returned by get_addrinfo
    89          */
    89          */
    90         virtual void free_addrinfo (addrinfo *info) const;
    90         virtual void free_addrinfo (addrinfo *info) const;
    91 
    91 
    92         /**
    92         /**
    93          * Equal-to comparison operator. Invalid addresses compare equal and are always smaller
    93          * Equal-to comparison operator. Invalid addresses compare equal and are always smaller.
       
    94          *
       
    95          * XXX: use of memcmp is broken... there's garbage in the padding
    94          */
    96          */
    95         bool operator== (const NetworkAddress &other) const {
    97         bool operator== (const NetworkAddress &other) const {
    96             return (address_length == other.address_length) && memcmp(&address, &other.address, address_length) == 0;
    98             return (address_length == other.address_length) && memcmp(&address, &other.address, address_length) == 0;
    97         }
    99         }
    98 
   100 
    99         /**
   101         /**
   100          * Not-equal-to comparison operator. Invalid addresses compare equal and are always smaller
   102          * Not-equal-to comparison operator. Invalid addresses compare equal and are always smaller.
   101          */
   103          */
   102         bool operator!= (const NetworkAddress &other) const {
   104         bool operator!= (const NetworkAddress &other) const {
   103             return (address_length != other.address_length) || memcmp(&address, &other.address, address_length) != 0;
   105             return (address_length != other.address_length) || memcmp(&address, &other.address, address_length) != 0;
   104         }
   106         }
   105 
   107