Jun-ichiro itojun Hagino <[EMAIL PROTECTED]> writes: > due to the IPv6 address architecture (scoped), 16 bytes does not > identify a node. we need 4 byte more information to identify the > outgoing scope zone.
OK -- then we create an `ipv6_address_t' which carries all the needed information. sockaddr_in and sockaddr_in6 carries needless baggage such as the port number and the family. There is no reason to cache all that. >>typedef unsigned char ipv4_address[4]; >>typedef ... whatever ... ipv6_address; >> >>enum address_list_type { ADDRESSES_IPV4, ADDRESSES_IPV6 }; > > this basically is a re-invention of sockaddr_{in,in6}. The difference is that address_list_type specifies the type for all the addresses, not just one. Is it possible that the host name lookup returns some addresses in IPv4 and some in IPv6? Also, I really dislike the idea of using the socket types and concepts in code that should only be concerned with host name resolution. The code in host.c should translate host names to addresses. The code in connect.c should copy those addresses into socket structures. > what I'm planning to do is to make "addresses" in address_list > to a pointer to sockaddr (struct sockaddr *). let me know if > you are okay with it. Please don't do that.