netinet_in.h(3)            POSIX Programmer's Manual           netinet_in.h(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       netinet/in.h -- Internet address family

SSYYNNOOPPSSIISS
       #include <netinet/in.h>

DDEESSCCRRIIPPTTIIOONN
       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the following types:

       iinn__ppoorrtt__tt Equivalent to the type uuiinntt1166__tt as described in _<_i_n_t_t_y_p_e_s_._h_>.

       iinn__aaddddrr__tt Equivalent to the type uuiinntt3322__tt as described in _<_i_n_t_t_y_p_e_s_._h_>.

       The _<_n_e_t_i_n_e_t___i_n_._h_> header shall define the ssaa__ffaammiillyy__tt type as
       described in _<_s_y_s_/_s_o_c_k_e_t_._h_>.

       The _<_n_e_t_i_n_e_t___i_n_._h_> header shall define the uuiinntt88__tt and uuiinntt3322__tt types
       as described in _<_i_n_t_t_y_p_e_s_._h_>.  Inclusion of the _<_n_e_t_i_n_e_t_/_i_n_._h_> header
       may also make visible all symbols from _<_i_n_t_t_y_p_e_s_._h_> and _<_s_y_s_/_s_o_c_k_e_t_._h_>.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the iinn__aaddddrr structure, which
       shall include at least the following member:

           iinn__aaddddrr__tt  ss__aaddddrr

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the ssoocckkaaddddrr__iinn structure, which
       shall include at least the following members:

           ssaa__ffaammiillyy__tt     ssiinn__ffaammiillyy   AF_INET.
           in_port_t       sin_port     Port number.
           struct in_addr  sin_addr     IP address.

       The _s_i_n___p_o_r_t and _s_i_n___a_d_d_r members shall be in network byte order.

       The ssoocckkaaddddrr__iinn structure is used to store addresses for the Internet
       address family.  Pointers to this type shall be cast by applications to
       ssttrruucctt ssoocckkaaddddrr ** for use with socket functions.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the iinn66__aaddddrr structure, which
       shall include at least the following member:

           uuiinntt88__tt ss66__aaddddrr[[1166]]

       This array is used to contain a 128-bit IPv6 address, stored in network
       byte order.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the ssoocckkaaddddrr__iinn66 structure,
       which shall include at least the following members:

           ssaa__ffaammiillyy__tt      ssiinn66__ffaammiillyy    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.

       The _s_i_n_6___p_o_r_t and _s_i_n_6___a_d_d_r members shall be in network byte order.

       The ssoocckkaaddddrr__iinn66 structure shall be set to zero by an application prior
       to using it, since implementations are free to have additional,
       implementation-defined fields in ssoocckkaaddddrr__iinn66.

       The _s_i_n_6___s_c_o_p_e___i_d field is a 32-bit integer that identifies a set of
       interfaces as appropriate for the scope of the address carried in the
       _s_i_n_6___a_d_d_r field. For a link scope _s_i_n_6___a_d_d_r, the application shall
       ensure that _s_i_n_6___s_c_o_p_e___i_d is a link index. For a site scope _s_i_n_6___a_d_d_r,
       the application shall ensure that _s_i_n_6___s_c_o_p_e___i_d is a site index. The
       mapping of _s_i_n_6___s_c_o_p_e___i_d to an interface or set of interfaces is
       implementation-defined.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall declare the following external
       variable:

           ccoonnsstt ssttrruucctt iinn66__aaddddrr iinn66aaddddrr__aannyy

       This variable is initialized by the system to contain the wildcard IPv6
       address. The _<_n_e_t_i_n_e_t_/_i_n_._h_> 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 ssttrruucctt iinn66__aaddddrr to the IPv6 wildcard
       address.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall declare the following external
       variable:

           ccoonnsstt ssttrruucctt iinn66__aaddddrr iinn66aaddddrr__llooooppbbaacckk

       This variable is initialized by the system to contain the loopback IPv6
       address. The _<_n_e_t_i_n_e_t_/_i_n_._h_> 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 ssttrruucctt iinn66__aaddddrr
       to the IPv6 loopback address.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the iippvv66__mmrreeqq structure, which
       shall include at least the following members:

           ssttrruucctt iinn66__aaddddrr  iippvv66mmrr__mmuullttiiaaddddrr  IPv6 multicast address.
           unsigned         ipv6mr_interface  Interface index.

       The _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the following symbolic constants
       for use as values of the _l_e_v_e_l argument of _g_e_t_s_o_c_k_o_p_t() and
       _s_e_t_s_o_c_k_o_p_t():

       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 _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the following symbolic constants
       for use as destination addresses for _c_o_n_n_e_c_t(), _s_e_n_d_m_s_g(), and
       _s_e_n_d_t_o():

       INADDR_ANY      IPv4 local host address.

       INADDR_BROADCAST
                       IPv4 broadcast address.

       The _<_n_e_t_i_n_e_t_/_i_n_._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 _h_t_o_n_l(), _h_t_o_n_s(), _n_t_o_h_l(), and _n_t_o_h_s() functions shall be available
       as described in _<_a_r_p_a_/_i_n_e_t_._h_>.  Inclusion of the _<_n_e_t_i_n_e_t_/_i_n_._h_> header
       may also make visible all symbols from _<_a_r_p_a_/_i_n_e_t_._h_>.

       The _<_n_e_t_i_n_e_t_/_i_n_._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 _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the following symbolic
       constants, with distinct integer values, for use in the _o_p_t_i_o_n___n_a_m_e
       argument in the _g_e_t_s_o_c_k_o_p_t() or _s_e_t_s_o_c_k_o_p_t() 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 _<_n_e_t_i_n_e_t_/_i_n_._h_> header shall define the following macros that test
       for special IPv6 addresses. Each macro is of type iinntt and takes a
       single argument of type ccoonnsstt ssttrruucctt iinn66__aaddddrr **:

       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.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _S_e_c_t_i_o_n _4_._9, _H_o_s_t _a_n_d _N_e_t_w_o_r_k _B_y_t_e _O_r_d_e_r_s, <<aarrppaa__iinneett..hh>>, <<iinnttttyyppeess..hh>>,
       <<ssyyss__ssoocckkeett..hh>>

       The System Interfaces volume of POSIX.1-2008, _c_o_n_n_e_c_t(), _g_e_t_s_o_c_k_o_p_t(),
       _h_t_o_n_l(), _s_e_n_d_m_s_g(), _s_e_n_d_t_o(), _s_e_t_s_o_c_k_o_p_t()

CCOOPPYYRRIIGGHHTT
       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 .



IEEE/The Open Group                  2013                      netinet_in.h(3)
