< draft-ietf-ipngwg-bsd-api-new-05.txt   draft-ietf-ipngwg-bsd-api-new-06.txt >
Internet Engineering Task Force R.E. Gilligan (FreeGate) Internet Engineering Task Force R.E. Gilligan (FreeGate)
INTERNET-DRAFT S. Thomson (Bellcore) INTERNET-DRAFT S. Thomson (Bellcore)
Obsoletes draft-ietf-ipngwg-bsd-api-new-04.txt Jim Bound (Compaq) Obsoletes RFC 2133 Jim Bound (Compaq)
W. R. Stevens (Consultant) W. R. Stevens (Consultant)
December 22, 1998 January 25, 1999
Basic Socket Interface Extensions for IPv6 Basic Socket Interface Extensions for IPv6
<draft-ietf-ipngwg-bsd-api-new-05.txt> <draft-ietf-ipngwg-bsd-api-new-06.txt>
Status of this Memo Status of this Memo
This document is a submission by the Internet Protocol IPv6 This document is a submission by the Internet Protocol IPv6
Working Group of the Internet Engineering Task Force (IETF). Working Group of the Internet Engineering Task Force (IETF).
Comments should be submitted to the ipng@sunroof.eng.sun.com Comments should be submitted to the ipng@sunroof.eng.sun.com
mailing list. mailing list.
This document is an Internet-Draft. Internet-Drafts are working This document is an Internet-Draft. Internet-Drafts are working
documents of the Internet Engineering Task Force (IETF), its documents of the Internet Engineering Task Force (IETF), its
skipping to change at page 2, line 40 skipping to change at page 2, line 40
5.1 Unicast Hop Limit..........................................16 5.1 Unicast Hop Limit..........................................16
5.2 Sending and Receiving Multicast Packets....................16 5.2 Sending and Receiving Multicast Packets....................16
6. Library Functions...........................................18 6. Library Functions...........................................18
6.1 Nodename-to-Address Translation............................18 6.1 Nodename-to-Address Translation............................18
6.2 Address-To-Nodename Translation............................21 6.2 Address-To-Nodename Translation............................21
6.3 Freeing memory for getipnodebyname and getipnodebyaddr.....22 6.3 Freeing memory for getipnodebyname and getipnodebyaddr.....22
6.4 Protocol-Independent Nodename and Service Name Translation.22 6.4 Protocol-Independent Nodename and Service Name Translation.22
6.5 Socket Address Structure to Nodename and Service Name......25 6.5 Socket Address Structure to Nodename and Service Name......25
6.6 Address Conversion Functions...............................26 6.6 Address Conversion Functions...............................26
6.7 Address Testing Macros.....................................27 6.7 Address Testing Macros.....................................27
7. Summary of New Definitions..................................27 7. Summary of New Definitions..................................28
8. Security Considerations.....................................29 8. Security Considerations.....................................29
9. Year 2000 Considerations....................................29 9. Year 2000 Considerations....................................29
Changes From RFC 2133..........................................29 Changes From RFC 2133..........................................30
Acknowledgments................................................32 Acknowledgments................................................32
References.....................................................32 References.....................................................33
Authors' Addresses.............................................33 Authors' Addresses.............................................33
1. Introduction 1. Introduction
While IPv4 addresses are 32 bits long, IPv6 interfaces are identified by While IPv4 addresses are 32 bits long, IPv6 interfaces are identified by
128-bit addresses. The socket interface makes the size of an IP address 128-bit addresses. The socket interface makes the size of an IP address
quite visible to an application; virtually all TCP/IP applications for quite visible to an application; virtually all TCP/IP applications for
BSD-based systems have knowledge of the size of an IP address. Those BSD-based systems have knowledge of the size of an IP address. Those
parts of the API that expose the addresses must be changed to parts of the API that expose the addresses must be changed to
accommodate the larger IPv6 address size. IPv6 also introduces new accommodate the larger IPv6 address size. IPv6 also introduces new
features (e.g., traffic class and flowlabel), some of which must be made features (e.g., traffic class and flowlabel), some of which must be made
skipping to change at page 26, line 14 skipping to change at page 26, line 14
returned if the host's name cannot be located in the DNS. returned if the host's name cannot be located in the DNS.
If the flag bit NI_NUMERICSERV is set, the numeric form of the service If the flag bit NI_NUMERICSERV is set, the numeric form of the service
address is returned (e.g., its port number) instead of its name. The address is returned (e.g., its port number) instead of its name. The
two NI_NUMERICxxx flags are required to support the "-n" flag that many two NI_NUMERICxxx flags are required to support the "-n" flag that many
commands provide. commands provide.
A fifth flag bit, NI_DGRAM, specifies that the service is a datagram A fifth flag bit, NI_DGRAM, specifies that the service is a datagram
service, and causes getservbyport() to be called with a second argument service, and causes getservbyport() to be called with a second argument
of "udp" instead of its default of "tcp". This is required for the few of "udp" instead of its default of "tcp". This is required for the few
ports (512-514) that have different services for UDP and TCP. ports (e.g. 512-514) that have different services for UDP and TCP.
These NI_xxx flags are defined in <netdb.h> along with the AI_xxx flags These NI_xxx flags are defined in <netdb.h> along with the AI_xxx flags
already defined for getaddrinfo(). already defined for getaddrinfo().
6.6 Address Conversion Functions 6.6 Address Conversion Functions
The two functions inet_addr() and inet_ntoa() convert an IPv4 address The two functions inet_addr() and inet_ntoa() convert an IPv4 address
between binary and text form. IPv6 applications need similar functions. between binary and text form. IPv6 applications need similar functions.
The following two functions convert both IPv6 and IPv4 addresses: The following two functions convert both IPv6 and IPv4 addresses:
skipping to change at page 27, line 9 skipping to change at page 27, line 9
accept these formats. accept these formats.
If the af argument is AF_INET6, then the function accepts a string in If the af argument is AF_INET6, then the function accepts a string in
one of the standard IPv6 text forms defined in Section 2.2 of the one of the standard IPv6 text forms defined in Section 2.2 of the
addressing architecture specification [2]. addressing architecture specification [2].
The inet_ntop() function converts a numeric address into a text string The inet_ntop() function converts a numeric address into a text string
suitable for presentation. The af argument specifies the family of the suitable for presentation. The af argument specifies the family of the
address. This can be AF_INET or AF_INET6. The src argument points to a address. This can be AF_INET or AF_INET6. The src argument points to a
buffer holding an IPv4 address if the af argument is AF_INET, or an IPv6 buffer holding an IPv4 address if the af argument is AF_INET, or an IPv6
address if the af argument is AF_INET6. The dst argument points to a address if the af argument is AF_INET6, the address must be in network
buffer where the function will store the resulting text string. The byte order. The dst argument points to a buffer where the function will
size argument specifies the size of this buffer. The application must store the resulting text string. The size argument specifies the size
specify a non-NULL dst argument. For IPv6 addresses, the buffer must be of this buffer. The application must specify a non-NULL dst argument.
at least 46-octets. For IPv4 addresses, the buffer must be at least For IPv6 addresses, the buffer must be at least 46-octets. For IPv4
16-octets. In order to allow applications to easily declare buffers of addresses, the buffer must be at least 16-octets. In order to allow
the proper size to store IPv4 and IPv6 addresses in string form, the applications to easily declare buffers of the proper size to store IPv4
following two constants are defined in <netinet/in.h>: and IPv6 addresses in string form, the following two constants are
defined in <netinet/in.h>:
#define INET_ADDRSTRLEN 16 #define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46 #define INET6_ADDRSTRLEN 46
The inet_ntop() function returns a pointer to the buffer containing the The inet_ntop() function returns a pointer to the buffer containing the
text string if the conversion succeeds, and NULL otherwise. Upon text string if the conversion succeeds, and NULL otherwise. Upon
failure, errno is set to EAFNOSUPPORT if the af argument is invalid or failure, errno is set to EAFNOSUPPORT if the af argument is invalid or
ENOSPC if the size of the result buffer is inadequate. ENOSPC if the size of the result buffer is inadequate.
6.7 Address Testing Macros 6.7 Address Testing Macros
skipping to change at page 28, line 55 skipping to change at page 28, line 60
<netinet/in.h> IPV6_UNICAST_HOPS <netinet/in.h> IPV6_UNICAST_HOPS
<netinet/in.h> SIN6_LEN <netinet/in.h> SIN6_LEN
<netinet/in.h> extern const struct in6_addr in6addr_any; <netinet/in.h> extern const struct in6_addr in6addr_any;
<netinet/in.h> extern const struct in6_addr in6addr_loopback; <netinet/in.h> extern const struct in6_addr in6addr_loopback;
<netinet/in.h> struct in6_addr{}; <netinet/in.h> struct in6_addr{};
<netinet/in.h> struct ipv6_mreq{}; <netinet/in.h> struct ipv6_mreq{};
<netinet/in.h> struct sockaddr_in6{}; <netinet/in.h> struct sockaddr_in6{};
<sys/socket.h> AF_INET6 <sys/socket.h> AF_INET6
<sys/socket.h> PF_INET6 <sys/socket.h> PF_INET6
<sys/socket.h> union sockaddr_storage; <sys/socket.h> struct sockaddr_storage;
The following list summarizes the function and macro prototypes The following list summarizes the function and macro prototypes
discussed in this memo, sorted by header. discussed in this memo, sorted by header.
<arpa/inet.h> int inet_pton(int, const char *, void *); <arpa/inet.h> int inet_pton(int, const char *, void *);
<arpa/inet.h> const char *inet_ntop(int, const void *, <arpa/inet.h> const char *inet_ntop(int, const void *,
char *, size_t); char *, size_t);
<net/if.h> char *if_indextoname(unsigned int, char *); <net/if.h> char *if_indextoname(unsigned int, char *);
<net/if.h> unsigned int if_nametoindex(const char *); <net/if.h> unsigned int if_nametoindex(const char *);
 End of changes. 9 change blocks. 
16 lines changed or deleted 17 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/