Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/lib/ape/man/0/in.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<netinet/in.h>" 0P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <netinet/in.h> 
.SH NAME
netinet/in.h \- Internet address family
.SH SYNOPSIS
.LP
\fB#include <netinet/in.h>\fP
.SH DESCRIPTION
.LP
The \fI<netinet/in.h>\fP header shall define the following types:
.TP 7
\fBin_port_t\fP
Equivalent to the type \fBuint16_t\fP as defined in \fI<inttypes.h>\fP
\&.
.TP 7
\fBin_addr_t\fP
Equivalent to the type \fBuint32_t\fP as defined in \fI<inttypes.h>\fP
\&.
.sp
.LP
The \fBsa_family_t\fP type shall be defined as described in \fI<sys/socket.h>\fP
\&.
.LP
The \fBuint8_t\fP and \fBuint32_t\fP type shall be defined as described
in \fI<inttypes.h>\fP. Inclusion of the \fI<netinet/in.h>\fP header
may also make
visible all symbols from \fI<inttypes.h>\fP and \fI<sys/socket.h>\fP.
.LP
The \fI<netinet/in.h>\fP header shall define the \fBin_addr\fP structure
that includes at least the following
member:
.sp
.RS
.nf

\fBin_addr_t  s_addr
\fP
.fi
.RE
.LP
The \fI<netinet/in.h>\fP header shall define the \fBsockaddr_in\fP
structure that includes at least the following
members (all in network byte order):
.sp
.RS
.nf

\fBsa_family_t     sin_family  \fP AF_INET. \fB
in_port_t       sin_port    \fP Port number. \fB
struct in_addr  sin_addr    \fP IP address. \fB
\fP
.fi
.RE
.LP
The \fBsockaddr_in\fP structure is used to store addresses for the
Internet address family. Values of this type shall be cast
by applications to \fBstruct sockaddr\fP for use with socket functions.
.LP
The \fI<netinet/in.h>\fP header shall define the \fBin6_addr\fP structure
that contains at least the following
member:
.sp
.RS
.nf

\fBuint8_t s6_addr[16]
\fP
.fi
.RE
.LP
This array is used to contain a 128-bit IPv6 address, stored in network
byte order.
.LP
The \fI<netinet/in.h>\fP header shall define the \fBsockaddr_in6\fP
structure that includes at least the following
members (all in network byte order):
.sp
.RS
.nf

\fBsa_family_t      sin6_family   \fP AF_INET6. \fB
in_port_t        sin6_port     \fP Port number. \fB
uint32_t         sin6_flowinfo \fP IPv6 traffic class and flow information. \fB
struct in6_addr  sin6_addr     \fP IPv6 address. \fB
uint32_t         sin6_scope_id \fP Set of interfaces for a scope. \fB
\fP
.fi
.RE
.LP
The \fBsockaddr_in6\fP structure shall be set to zero by an application
prior to using it, since implementations are free to
have additional, implementation-defined fields in \fBsockaddr_in6\fP.
.LP
The \fIsin6_scope_id\fP field is a 32-bit integer that identifies
a set of interfaces as appropriate for the scope of the
address carried in the \fIsin6_addr\fP field. For a link scope \fIsin6_addr\fP,
the application shall ensure that
\fIsin6_scope_id\fP is a link index. For a site scope \fIsin6_addr\fP,
the application shall ensure that \fIsin6_scope_id\fP is
a site index. The mapping of \fIsin6_scope_id\fP to an interface or
set of interfaces is implementation-defined.
.LP
The \fI<netinet/in.h>\fP header shall declare the following external
variable:
.sp
.RS
.nf

\fBconst struct in6_addr in6addr_any
\fP
.fi
.RE
.LP
This variable is initialized by the system to contain the wildcard
IPv6 address. The \fI<netinet/in.h>\fP header also
defines the IN6ADDR_ANY_INIT macro. This macro must be constant at
compile time and can be used to initialize a variable of type
\fBstruct in6_addr\fP to the IPv6 wildcard address.
.LP
The \fI<netinet/in.h>\fP header shall declare the following external
variable:
.sp
.RS
.nf

\fBconst struct in6_addr in6addr_loopback
\fP
.fi
.RE
.LP
This variable is initialized by the system to contain the loopback
IPv6 address. The \fI<netinet/in.h>\fP header also
defines the IN6ADDR_LOOPBACK_INIT macro. This macro must be constant
at compile time and can be used to initialize a variable of
type \fBstruct in6_addr\fP to the IPv6 loopback address.
.LP
The \fI<netinet/in.h>\fP header shall define the \fBipv6_mreq\fP structure
that includes at least the following
members:
.sp
.RS
.nf

\fBstruct in6_addr  ipv6mr_multiaddr \fP IPv6 multicast address. \fB
unsigned         ipv6mr_interface \fP Interface index. \fB
\fP
.fi
.RE
.LP
The \fI<netinet/in.h>\fP header shall define the following macros
for use as values of the \fIlevel\fP argument of \fIgetsockopt\fP()
and \fIsetsockopt\fP():
.TP 7
IPPROTO_IP
Internet protocol.
.TP 7
IPPROTO_IPV6
Internet Protocol Version 6. 
.TP 7
IPPROTO_ICMP
Control message protocol.
.TP 7
IPPROTO_RAW
Raw IP Packets Protocol. 
.TP 7
IPPROTO_TCP
Transmission control protocol.
.TP 7
IPPROTO_UDP
User datagram protocol.
.sp
.LP
The \fI<netinet/in.h>\fP header shall define the following macros
for use as destination addresses for \fIconnect\fP(), \fIsendmsg\fP(),
and \fIsendto\fP():
.TP 7
INADDR_ANY
IPv4 local host address.
.TP 7
INADDR_BROADCAST
IPv4 broadcast address.
.sp
.LP
The \fI<netinet/in.h>\fP header shall define the following macro to
help applications declare buffers of the proper size
to store IPv4 addresses in string form:
.TP 7
INET_ADDRSTRLEN
16. Length of the string form for IP.
.sp
.LP
The \fIhtonl\fP(), \fIhtons\fP(), \fIntohl\fP(), and \fIntohs\fP()
functions shall be
available as defined in \fI<arpa/inet.h>\fP . Inclusion of the
\fI<netinet/in.h>\fP header may also make visible all symbols from
\fI<arpa/inet.h>\fP .
.LP
The \fI<netinet/in.h>\fP header shall define the following macro to
help applications declare buffers of the proper
size to store IPv6 addresses in string form:
.TP 7
INET6_ADDRSTRLEN
46. Length of the string form for IPv6.
.sp
.LP
The \fI<netinet/in.h>\fP header shall define the following macros,
with distinct integer values, for use in the
\fIoption_name\fP argument in the \fIgetsockopt\fP() or \fIsetsockopt\fP()
functions at protocol level IPPROTO_IPV6:
.TP 7
IPV6_JOIN_GROUP
Join a multicast group.
.TP 7
IPV6_LEAVE_GROUP
Quit a multicast group.
.TP 7
IPV6_MULTICAST_HOPS
.sp
Multicast hop limit.
.TP 7
IPV6_MULTICAST_IF
Interface to use for outgoing multicast packets.
.TP 7
IPV6_MULTICAST_LOOP
.sp
Multicast packets are delivered back to the local application.
.TP 7
IPV6_UNICAST_HOPS
Unicast hop limit.
.TP 7
IPV6_V6ONLY
Restrict AF_INET6 socket to IPv6 communications only.
.sp
.LP
The \fI<netinet/in.h>\fP header shall define the following macros
that test for special IPv6 addresses. Each macro is of
type \fBint\fP and takes a single argument of type \fBconst struct
in6_addr *\fP:
.TP 7
IN6_IS_ADDR_UNSPECIFIED
.sp
Unspecified address.
.TP 7
IN6_IS_ADDR_LOOPBACK
.sp
Loopback address.
.TP 7
IN6_IS_ADDR_MULTICAST
.sp
Multicast address.
.TP 7
IN6_IS_ADDR_LINKLOCAL
.sp
Unicast link-local address.
.TP 7
IN6_IS_ADDR_SITELOCAL
.sp
Unicast site-local address.
.TP 7
IN6_IS_ADDR_V4MAPPED
.sp
IPv4 mapped address.
.TP 7
IN6_IS_ADDR_V4COMPAT
.sp
IPv4-compatible address.
.TP 7
IN6_IS_ADDR_MC_NODELOCAL
.sp
Multicast node-local address.
.TP 7
IN6_IS_ADDR_MC_LINKLOCAL
.sp
Multicast link-local address.
.TP 7
IN6_IS_ADDR_MC_SITELOCAL
.sp
Multicast site-local address.
.TP 7
IN6_IS_ADDR_MC_ORGLOCAL
.sp
Multicast organization-local address.
.TP 7
IN6_IS_ADDR_MC_GLOBAL
.sp
Multicast global address. 
.sp
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIHost and Network Byte Orders\fP, \fI<arpa/inet.h>\fP, \fI<inttypes.h>\fP,
\fI<sys/socket.h>\fP, the System Interfaces volume of IEEE\ Std\ 1003.1-2001,
\fIconnect\fP(), \fIgetsockopt\fP(), \fIhtonl\fP(), \fIhtons\fP(),
\fIntohl\fP(), \fIntohs\fP(), \fIsendmsg\fP(), \fIsendto\fP(), \fIsetsockopt\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.