----- Original Message -----
> I have started work on converting ATS to use sockaddr_storage
> internally as much as possible. Looking at some early progress, I
> think I will be taking the approach of storing, passing, and
> returning sockaddr_storage basically everywhere. I will provide a
> number of inline functions to make protocol specific access easy,
> e.g. if you really want the IPv4 address, you would do
>
>   uint32_t addr = ip4_cast(thing->get_ip_addr()).sin_addr.s_addr;
>
> IPv4 and IPv6 specific methods would be removed (e.g.
> NetVConnection::get_remote_ip - use
> ip4_cast(netv->get_remote_addr()) instead). I think we might want to
> put debug asserts in these functions which go off if the ss_family
> value isn't appropriate.
>
> I think I will also provide equality and inequality operators for
> sockaddr_storage which will, in a number of cases, remove the need
> for protocol casting entirely while improving IPv6 compatibility.
> The cases not covered are where an address should be compared to a
> list (e.g., is this address a local machine address?). I am still
> thinking about what to do there.


An immensely useful operation is (range) comparison with subnets
See: http://httpd.apache.org/docs/trunk/expr.html#binaryother
and http://httpd.apache.org/docs/trunk/mod/mod_setenvif.html#setenvifexpr

i

--
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.ga...@brainsware.org
URL: http://brainsware.org/

Reply via email to