[Bro-Dev] [Bro-Commits] [git/bro] topic/v6-addr: Interface draft for new IP address wrapper class. (0868317)
Matthias Vallentin
vallentin at icir.org
Mon Jan 23 21:42:35 PST 2012
> Interface draft for new IP address wrapper class.
This looks like a good start; a few comments below.
> +public:
> + /// Address family.
> + enum { IPv4, IPv6 } Family;
Why is that (and ByteOrder) a public member? Intuitively, I would
imagine that the constructor sets this value once and then clients only
use the family() const member function to inspect it.
> + /// Byte order.
> + enum { Host, Network } ByteOrder;
Why is it necessary to discern between the two? I might oversee a use
case that requires this differentiation, but in my naive mental model,
only a single internal representation is necessary (with a constructor
argument specifying the order when creating an instance from raw bytes).
> +/// Comparision operator for IP addresss.
> +extern bool operator==(const IPAddr& addr1, const IPAddr& addr2) const;
> +
> +/// Comparision operator IP addresses. This defines a well-defined order for
> +/// IP addresses. However, the order does not necessarily correspond to their
> +/// numerical values.
> +extern bool operator<(const IPAddr& addr1, const IPAddr& addr2) const;
These could be members, too. Then you could directory access the in6
member.
Matthias
More information about the bro-dev
mailing list