On 04/22/2011 11:45 AM, Alan M. Carroll wrote:
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.
Sounds good. One suggestions, can we combine the existing
sockaddr_storage container that was added for IPv6 to the client? I.e.
lets avoid duplicating this stuff if possible?
Also, the public InkAPIs needs to change with this. Let me know if you
need any help with any of this.
Cheers,
-- leif