Web site traffic - 14 2.2 Why Programs Need to Be Address-Family

14 2.2 Why Programs Need to Be Address-Family Independent? u_int32_t sin6_flowinfo; /* IP6 flow information */ struct in6_addr sin6_addr; /* IP6 address*/ u_int32_t sin6_scope_id; /* scope zone index*/ }; To identify IPv6 peers on the socket API, we use a C structure called sockaddr_in6. For instance, to issue operations such as connect(2) on a socket created with AF_INET6 specified, we use sockaddr_in6. Compared with sockaddr_in, sockaddr_in6 adds two fields: sin6_flowinfo and sin6_scope_id. Standardization of sin6_flowinfo is not finished yet; therefore, this book does not go into its details. We discuss sin6_scope_id in detail later in the book. 2.2 Why Programs Need to Be Address-Family Independent? In this book we advocate address-family independent socket layer programming for IPv6 transition. By following the instructions in the book, your code will become independent from the address family (such as AF_INET or AF_INET6). Here are several reasons for taking this direction: To support the IPv4/v6 dual stack environment, programs must be able to handle both IPv4 and IPv6 properly. If you hardcode AF_INET or AF_INET6 into your programs, your program ends up not working properly in the IPv4/v6 dual stack environment. We would like to avoid rewriting network applications when a new protocol becomes available. It includes both the IP layer (as with IPv7 there are currently no plans, but we don t know about the future) as well as the transport/ session layer (similar to using SCTP instead of TCP). For instance, in some systems, it could be possible that your program becomes capable of supporting AppleTalk by using address-family independent APIs. We have enough tools for address-family independent programming, such as sockaddr_storage, getaddrinfo(3), and getnameinfo(3). If you hardcode address family into your program, your program will not function if the operating system kernel does not support the address family. With a program independent of address family, you can ship a single source/binary for any operating system kernel configuration. From my experience, it is cleaner and more portable to write a program this way than to write a program in an IPv6-only manner.
We feature a web hosting shopping cart and live support solution. Just try our web hosting shopping cartwhich provides a secure way of obtaining payments through your website.

Leave a Reply