trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan M. Carroll" <>
Subject sockaddr_storage
Date Fri, 22 Apr 2011 17:45:01 GMT
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

  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.

View raw message