X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..HEAD:/net/FreeBSD/addr2ascii.3 diff --git a/net/FreeBSD/addr2ascii.3 b/net/FreeBSD/addr2ascii.3 index b72566c..3660991 100644 --- a/net/FreeBSD/addr2ascii.3 +++ b/net/FreeBSD/addr2ascii.3 @@ -27,7 +27,7 @@ .\" SUCH DAMAGE. .\" .\" $ANA: addr2ascii.3,v 1.1 1996/06/13 18:41:46 wollman Exp $ -.\" $FreeBSD: src/lib/libc/net/addr2ascii.3,v 1.13 2002/12/19 09:40:22 ru Exp $ +.\" $FreeBSD: src/lib/libc/net/addr2ascii.3,v 1.17 2004/10/09 17:13:58 maxim Exp $ .\" .Dd June 13, 1996 .Dt ADDR2ASCII 3 @@ -39,8 +39,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h -.In netinet/in.h .In arpa/inet.h .Ft "char *" .Fn addr2ascii "int af" "const void *addrp" "int len" "char *buf" @@ -52,7 +50,8 @@ The routines and .Fn ascii2addr are used to convert network addresses between binary form and a -printable form appropriate to the address family. Both functions take +printable form appropriate to the address family. +Both functions take an .Fa af argument, specifying the address family to be used in the conversion @@ -67,14 +66,17 @@ The .Fn addr2ascii function is used to convert binary, network-format addresses into printable -form. In addition to +form. +In addition to .Fa af , -there are three other arguments. The +there are three other arguments. +The .Fa addrp argument is a pointer to the network address to be converted. The .Fa len -argument is the length of the address. The +argument is the length of the address. +The .Fa buf argument is an optional pointer to a caller-allocated buffer to hold the result; if a null pointer is passed, @@ -94,7 +96,8 @@ and The .Fa ascii argument is a pointer to the string which is to be converted into -binary. The +binary. +The .Fa result argument is a pointer to an appropriate network address structure for the specified family. @@ -106,16 +109,19 @@ addresses in the specified family: .It Dv AF_INET .Li struct in_addr (in -.Aq Pa netinet/in.h ) +.In arpa/inet.h ) .It Dv AF_LINK .Li struct sockaddr_dl (in -.Aq Pa net/if_dl.h ) +.In net/if_dl.h ) .\" .It Dv AF_INET6 .\" .Li struct in6_addr .\" (in -.\" .Aq Pa netinet6/in6.h ) +.\" .In netinet6/in6.h ) .El +.Pp +.Dv AF_INET and AF_LINK constants are defined in +.In sys/socket.h .Sh RETURN VALUES The .Fn addr2ascii @@ -135,9 +141,7 @@ and .Fn inet_aton could be implemented thusly: .Bd -literal -offset indent -#include #include -#include #include char * @@ -192,7 +196,8 @@ was improperly formatted for address family .Xr inet 4 .Sh HISTORY An interface close to this one was originally suggested by Craig -Partridge. This particular interface originally appeared in the +Partridge. +This particular interface originally appeared in the .Tn INRIA .Tn IPv6 implementation. @@ -201,8 +206,10 @@ Code and documentation by .An Garrett A. Wollman , MIT Laboratory for Computer Science. .Sh BUGS -The original implementations supported IPv6. This support should -eventually be resurrected. The +The original implementations supported IPv6. +This support should +eventually be resurrected. +The .Tn NRL implementation also included support for the .Dv AF_ISO @@ -210,13 +217,16 @@ and .Dv AF_NS address families. .Pp -The genericity of this interface is somewhat questionable. A truly +The genericity of this interface is somewhat questionable. +A truly generic interface would provide a means for determining the length of the buffer to be used so that it could be dynamically allocated, and would always require a .Dq Li "struct sockaddr" -to hold the binary address. Unfortunately, this is incompatible with existing -practice. This limitation means that a routine for printing network +to hold the binary address. +Unfortunately, this is incompatible with existing +practice. +This limitation means that a routine for printing network addresses from arbitrary address families must still have internal knowledge of the maximum buffer length needed and the appropriate part of the address to use as the binary address.