diff options
Diffstat (limited to 'manual')
-rw-r--r-- | manual/libc.texinfo | 2 | ||||
-rw-r--r-- | manual/socket.texi | 134 | ||||
-rw-r--r-- | manual/texinfo.tex | 17 |
3 files changed, 126 insertions, 27 deletions
diff --git a/manual/libc.texinfo b/manual/libc.texinfo index 7d81247cdb..2d79d960af 100644 --- a/manual/libc.texinfo +++ b/manual/libc.texinfo @@ -514,7 +514,7 @@ Socket Addresses Internet Domain -* Internet Address Format:: How socket addresses are specified in the +* Internet Address Formats:: How socket addresses are specified in the Internet namespace. * Host Addresses:: All about host addresses of Internet hosts. * Protocols Database:: Referring to protocols by name. diff --git a/manual/socket.texi b/manual/socket.texi index c122106e2b..6efc54d1a5 100644 --- a/manual/socket.texi +++ b/manual/socket.texi @@ -323,7 +323,13 @@ This is a synonym for @code{AF_FILE}, for compatibility. @vindex AF_INET This designates the address format that goes with the Internet namespace. (@code{PF_INET} is the name of that namespace.) -@xref{Internet Address Format}. +@xref{Internet Address Formats}. + +@comment sys/socket.h +@comment IPv6 Basic API +@item AF_INET6 +This is similar to @code{AF_INET}, but refers to the IPv6 protocol. +(@code{PF_INET6} is the name of the corresponding namespace.) @comment sys/socket.h @comment BSD @@ -566,7 +572,7 @@ A socket address for the Internet namespace includes the following components: @item The address of the machine you want to connect to. Internet addresses can be specified in several ways; these are discussed in @ref{Internet -Address Format}, @ref{Host Addresses}, and @ref{Host Names}. +Address Formats}, @ref{Host Addresses}, and @ref{Host Names}. @item A port number for that machine. @xref{Ports}. @@ -577,7 +583,7 @@ canonical format called @dfn{network byte order}. @xref{Byte Order}, for information about this. @menu -* Internet Address Format:: How socket addresses are specified in the +* Internet Address Formats:: How socket addresses are specified in the Internet namespace. * Host Addresses:: All about host addresses of internet host. * Protocols Database:: Referring to protocols by name. @@ -589,16 +595,17 @@ for information about this. * Inet Example:: Putting it all together. @end menu -@node Internet Address Format -@subsection Internet Socket Address Format +@node Internet Address Formats +@subsection Internet Socket Address Formats -In the Internet namespace, a socket address consists of a host address +In the Internet namespace, for both IPv4 (@code{AF_INET}) and IPv6 +(@code{AF_INET6}), a socket address consists of a host address and a port on that host. In addition, the protocol you choose serves effectively as a part of the address because local port numbers are meaningful only within a particular protocol. -The data type for representing socket addresses in the Internet namespace -is defined in the header file @file{netinet/in.h}. +The data types for representing socket addresses in the Internet namespace +are defined in the header file @file{netinet/in.h}. @pindex netinet/in.h @comment netinet/in.h @@ -627,13 +634,39 @@ When you call @code{bind} or @code{getsockname}, you should specify @code{sizeof (struct sockaddr_in)} as the @var{length} parameter if you are using an Internet namespace socket address. +@deftp {Data Type} {struct sockaddr_in6} +This is the data type used to represent socket addresses in the IPv6 +namespace. It has the following members: + +@table @code +@item short int sin6_family +This identifies the address family or format of the socket address. +You should store the value of @code{AF_INET6} in this member. +@xref{Socket Addresses}. + +@item struct in6_addr sin6_addr +This is the IPv6 address of the host machine. @xref{Host +Addresses}, and @ref{Host Names}, for how to get a value to store +here. + +@item uint32_t sin6_flowinfo +This is a currently unimplemented field. + +@item uint16_t sin6_port +This is the port number. @xref{Ports}. + +@end table +@end deftp + @node Host Addresses @subsection Host Addresses Each computer on the Internet has one or more @dfn{Internet addresses}, numbers which identify that computer among all those on the Internet. -Users typically write numeric host addresses as sequences of four -numbers, separated by periods, as in @samp{128.52.46.32}. +Users typically write IPv4 numeric host addresses as sequences of four +numbers, separated by periods, as in @samp{128.52.46.32}, and IPv6 +numeric host addresses as sequences of up to eight numbers seperated by +colons, as in @samp{5f03:1200:836f:c100::1}. Each computer also has one or more @dfn{host names}, which are strings of words separated by periods, as in @samp{churchy.gnu.ai.mit.edu}. @@ -660,6 +693,9 @@ Each computer on the Internet has one or more Internet addresses, numbers which identify that computer among all those on the Internet. @end ifinfo +@c I think this whole section could possibly be removed. It is slightly +@c misleading these days. + @cindex network number @cindex local network address number An Internet host address is a number containing four bytes of data. @@ -779,6 +815,31 @@ This constant is the address you use to send a broadcast message. This constant is returned by some functions to indicate an error. @end deftypevr +@comment netinet/in.h +@comment IPv6 basic API +@deftp {Data Type} {struct in6_addr} +This data type is used to store an IPv6 address. It stores 128 bits of +data, which can be accessed (via a union) in a variety of ways. +@end deftp + +@comment netinet/in.h +@comment IPv6 basic API +@deftypevr Constant {struct in6_addr} in6addr_loopback. +This constant is the IPv6 address @samp{::1}, the loopback address. See +above for a description of what this means. The macro +@code{IN6ADDR_LOOPBACK_INIT} is provided to allow you to initialise your +own variables to this value. +@end deftypevr + +@comment netinet/in.h +@comment IPv6 basic API +@deftypevr Constant {struct in6_addr} in6addr_any +This constant is the IPv6 address @samp{::}, the unspecified address. See +above for a description of what this means. The macro +@code{IN6ADDR_ANY_INIT} is provided to allow you to initialise your +own variables to this value. +@end deftypevr + @node Host Address Functions @subsubsection Host Address Functions @@ -854,6 +915,30 @@ This function returns the network number part of the Internet host address @var{addr}. @end deftypefun +@comment arpa/inet.h +@comment IPv6 basic API +@deftypefun int inet_pton (int @var{af}, const char *@var{cp}, void +*@var{buf}) +This function converts an Internet address (either IPv4 or IPv6) from +presentation (textual) to network (binary) format. @var{af} should be +either @code{AF_INET} or @code{AF_INET6}, as appropriate for the type of +address being converted. @var{cp} is a pointer to the input string, and +@var{buf} is a pointer to a buffer for the result. It is the caller's +responsibility to make sure the buffer is large enough. +@end deftypefun + +@comment arpa/inet.h +@comment IPv6 basic API +@deftypefun char *inet_ntop(int @var{af}, const void *@var{cp}, char +*@var{buf}, size_t @var{len}) +This function converts an Internet address (either IPv4 or IPv6) from +network (binary) to presentation (textual) form. @var{af} should be +either @code{AF_INET} or @code{AF_INET6}, as appropriate. @var{cp} is a +pointer to the address to be converted. @var{buf} should be a pointer +to a buffer to hold the result, and @var{len} is the length of this +buffer. The return value from the function will be this buffer address. +@end deftypefun + @node Host Names @subsubsection Host Names @cindex hosts database @@ -891,11 +976,12 @@ These are alternative names for the host, represented as a null-terminated vector of strings. @item int h_addrtype -This is the host address type; in practice, its value is always -@code{AF_INET}. In principle other kinds of addresses could be -represented in the data base as well as Internet addresses; if this were -done, you might find a value in this field other than @code{AF_INET}. -@xref{Socket Addresses}. +This is the host address type; in practice, its value is always either +@code{AF_INET} or @code{AF_INET6}, with the latter being used for IPv6 +hosts. In principle other kinds of addresses could be represented in +the data base as well as Internet addresses; if this were done, you +might find a value in this field other than @code{AF_INET} or +@code{AF_INET6}. @xref{Socket Addresses}. @item int h_length This is the length, in bytes, of each address. @@ -917,10 +1003,12 @@ implicit assumption that you can convert this to a @code{struct in_addr} or an @code{unsigned long int}. Host addresses in a @code{struct hostent} structure are always given in network byte order; see @ref{Byte Order}. -You can use @code{gethostbyname} or @code{gethostbyaddr} to search the -hosts database for information about a particular host. The information -is returned in a statically-allocated structure; you must copy the -information if you need to save it across calls. +You can use @code{gethostbyname}, @code{gethostbyname2} or +@code{gethostbyaddr} to search the hosts database for information about +a particular host. The information is returned in a +statically-allocated structure; you must copy the information if you +need to save it across calls. You can also use @code{getaddrinfo} and +@code{getnameinfo} to obtain this information. @comment netdb.h @comment BSD @@ -930,6 +1018,14 @@ named @var{name}. If the lookup fails, it returns a null pointer. @end deftypefun @comment netdb.h +@comment IPv6 Basic API +@deftypefun {struct hostent *} gethostbyname2 (const char *@var{name}, int @var{af}) +The @code{gethostbyname2} function is like @code{gethostbyname}, but +allows the caller to specify the desired address family (e.g.@: +@code{AF_INET} or @code{AF_INET6}) for the result. +@end deftypefun + +@comment netdb.h @comment BSD @deftypefun {struct hostent *} gethostbyaddr (const char *@var{addr}, int @var{length}, int @var{format}) The @code{gethostbyaddr} function returns information about the host diff --git a/manual/texinfo.tex b/manual/texinfo.tex index fd306fa290..813d3c2bb7 100644 --- a/manual/texinfo.tex +++ b/manual/texinfo.tex @@ -1,5 +1,5 @@ %% TeX macros to handle Texinfo files. -%% $Id: texinfo.tex,v 2.210 1997/07/15 19:22:46 drepper Exp $ +%% $Id: texinfo.tex,v 2.211 1997/07/28 21:55:24 drepper Exp $ % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, % 94, 95, 96, 97 Free Software Foundation, Inc. @@ -36,7 +36,7 @@ % This automatically updates the version number based on RCS. \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} -\deftexinfoversion$Revision: 2.210 $ +\deftexinfoversion$Revision: 2.211 $ \message{Loading texinfo package [Version \texinfoversion]:} % If in a .fmt file, print the version number @@ -1406,14 +1406,12 @@ where each line of input produces a line of output.} \else{\tclose{\kbdfont\look}}\fi \else{\tclose{\kbdfont\look}}\fi} -% @url, @email. Quotes do not seem necessary. -\let\url=\code % perhaps include a hypertex \special eventually -% rms does not like the angle brackets --karl, 17may97. -%\def\email#1{$\langle${\tt #1}$\rangle$} -\let\email=\code +% @url. Quotes do not seem necessary, so use \code. +\let\url=\code % @uref (abbreviation for `urlref') takes an optional second argument % specifying the text to display. First (mandatory) arg is the url. +% Perhaps eventually put in a hypertex \special here. % \def\uref#1{\urefxxx #1,,\finish} \def\urefxxx#1,#2,#3\finish{% @@ -1425,6 +1423,11 @@ where each line of input produces a line of output.} \fi } +% rms does not like the angle brackets --karl, 17may97. +% So now @email is just like @uref. +%\def\email#1{$\langle${\tt #1}$\rangle$} +\let\email=\uref + % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have |