www.LinuxHowtos.org
netinet_in.h
Section: POSIX Programmer's Manual (0P)Updated: 2013
Index Return to Main Contents
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.NAME
netinet/in.h --- Internet address familySYNOPSIS
#include <netinet/in.h>
DESCRIPTION
The <netinet/in.h> header shall define the following types:- in_port_t
- Equivalent to the type uint16_t as described in <inttypes.h>.
- in_addr_t
-
Equivalent to the type
uint32_t
as described in
<inttypes.h>.
The
<netinet_in.h>
header shall define the
sa_family_t
type as described in
<sys/socket.h>.
The
<netinet_in.h>
header shall define the
uint8_t
and
uint32_t
types as described in
<inttypes.h>.
Inclusion of the
<netinet/in.h>
header may also make visible all symbols from
<inttypes.h>
and
<sys/socket.h>.
The
<netinet/in.h>
header shall define the
in_addr
structure, which shall include at least the following member:
-
in_addr_t s_addr
-
sa_family_t sin_family AF_INET. in_port_t sin_port Port number. struct in_addr sin_addr IP address.
-
uint8_t s6_addr[16]
-
sa_family_t sin6_family AF_INET6. in_port_t sin6_port Port number. uint32_t sin6_flowinfo IPv6 traffic class and flow information. struct in6_addr sin6_addr IPv6 address. uint32_t sin6_scope_id Set of interfaces for a scope.
-
const struct in6_addr in6addr_any
-
const struct in6_addr in6addr_loopback
-
struct in6_addr ipv6mr_multiaddr IPv6 multicast address. unsigned ipv6mr_interface Interface index.
-
- IPPROTO_IP
- Internet protocol.
- IPPROTO_IPV6
- Internet Protocol Version 6.
- IPPROTO_ICMP
- Control message protocol.
- IPPROTO_RAW
- Raw IP Packets Protocol.
- IPPROTO_TCP
- Transmission control protocol.
- IPPROTO_UDP
- User datagram protocol. The <netinet/in.h> header shall define the following symbolic constants for use as destination addresses for connect(), sendmsg(), and sendto():
- INADDR_ANY
- IPv4 local host address.
- INADDR_BROADCAST
- IPv4 broadcast address. The <netinet/in.h> header shall define the following symbolic constant, with the value specified, to help applications declare buffers of the proper size to store IPv4 addresses in string form:
- INET_ADDRSTRLEN
- 16. Length of the string form for IP. The htonl(), htons(), ntohl(), and ntohs() functions shall be available as described in <arpa/inet.h>. Inclusion of the <netinet/in.h> header may also make visible all symbols from <arpa/inet.h>. The <netinet/in.h> header shall define the following symbolic constant, with the value specified, to help applications declare buffers of the proper size to store IPv6 addresses in string form:
- INET6_ADDRSTRLEN
-
46. Length of the string form for IPv6.
The <netinet/in.h> header shall define the following symbolic constants, with distinct integer values, for use in the option_name argument in the getsockopt() or setsockopt() functions at protocol level IPPROTO_IPV6: - IPV6_JOIN_GROUP
- Join a multicast group.
- IPV6_LEAVE_GROUP
- Quit a multicast group.
- IPV6_MULTICAST_HOPS
-
Multicast hop limit. - IPV6_MULTICAST_IF
- Interface to use for outgoing multicast packets.
- IPV6_MULTICAST_LOOP
-
Multicast packets are delivered back to the local application. - IPV6_UNICAST_HOPS
- Unicast hop limit.
- IPV6_V6ONLY
- Restrict AF_INET6 socket to IPv6 communications only. The <netinet/in.h> header shall define the following macros that test for special IPv6 addresses. Each macro is of type int and takes a single argument of type const struct in6_addr *:
- IN6_IS_ADDR_UNSPECIFIED
-
Unspecified address. - IN6_IS_ADDR_LOOPBACK
-
Loopback address. - IN6_IS_ADDR_MULTICAST
-
Multicast address. - IN6_IS_ADDR_LINKLOCAL
-
Unicast link-local address. - IN6_IS_ADDR_SITELOCAL
-
Unicast site-local address. - IN6_IS_ADDR_V4MAPPED
-
IPv4 mapped address. - IN6_IS_ADDR_V4COMPAT
-
IPv4-compatible address. - IN6_IS_ADDR_MC_NODELOCAL
-
Multicast node-local address. - IN6_IS_ADDR_MC_LINKLOCAL
-
Multicast link-local address. - IN6_IS_ADDR_MC_SITELOCAL
-
Multicast site-local address. - IN6_IS_ADDR_MC_ORGLOCAL
-
Multicast organization-local address. - IN6_IS_ADDR_MC_GLOBAL
-
Multicast global address.
The following sections are informative.
APPLICATION USAGE
None.RATIONALE
None.FUTURE DIRECTIONS
None.SEE ALSO
Section 4.9, Host and Network Byte Orders, <arpa_inet.h>, <inttypes.h>, <sys_socket.h> The System Interfaces volume of POSIX.1-2008, connect(), getsockopt(), htonl(), sendmsg(), sendto(), setsockopt()COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/online.html .Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .