netdb.h(3)                 POSIX Programmer's Manual                netdb.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
       netdb.h -- definitions for network database operations

SSYYNNOOPPSSIISS
       #include <netdb.h>

DDEESSCCRRIIPPTTIIOONN
       The _<_n_e_t_d_b_._h_> header may define the iinn__ppoorrtt__tt type and the iinn__aaddddrr__tt
       type as described in _<_n_e_t_i_n_e_t_/_i_n_._h_>.

       The _<_n_e_t_d_b_._h_> header shall define the hhoosstteenntt structure, which shall
       include at least the following members:

           cchhaarr   **hh__nnaammee       Official name of the host.
           char  **h_aliases    A pointer to an array of pointers to
                                alternative host names, terminated by a
                                null pointer.
           int     h_addrtype   Address type.
           int     h_length     The length, in bytes, of the address.
           char  **h_addr_list  A pointer to an array of pointers to network
                                addresses (in network byte order) for the host,
                                terminated by a null pointer.

       The _<_n_e_t_d_b_._h_> header shall define the nneetteenntt structure, which shall
       include at least the following members:

           cchhaarr     **nn__nnaammee      Official, fully-qualified (including the
                                 domain) name of the host.
           char    **n_aliases   A pointer to an array of pointers to
                                 alternative network names, terminated by a
                                 null pointer.
           int       n_addrtype  The address type of the network.
           uint32_t  n_net       The network number, in host byte order.

       The _<_n_e_t_d_b_._h_> header shall define the uuiinntt3322__tt type as described in
       _<_i_n_t_t_y_p_e_s_._h_>.

       The _<_n_e_t_d_b_._h_> header shall define the pprroottooeenntt structure, which shall
       include at least the following members:

           cchhaarr   **pp__nnaammee     Official name of the protocol.
           char  **p_aliases  A pointer to an array of pointers to
                              alternative protocol names, terminated by
                              a null pointer.
           int     p_proto    The protocol number.

       The _<_n_e_t_d_b_._h_> header shall define the sseerrvveenntt structure, which shall
       include at least the following members:

           cchhaarr   **ss__nnaammee     Official name of the service.
           char  **s_aliases  A pointer to an array of pointers to
                              alternative service names, terminated by
                              a null pointer.
           int     s_port     A value which, when converted to uint16_t,
                              yields the port number in network byte order
                              at which the service resides.
           char   *s_proto    The name of the protocol to use when
                              contacting the service.

       The _<_n_e_t_d_b_._h_> header shall define the IPPORT_RESERVED symbolic constant
       with the value of the highest reserved Internet port number.

   AAddddrreessss IInnffoorrmmaattiioonn SSttrruuccttuurree
       The _<_n_e_t_d_b_._h_> header shall define the aaddddrriinnffoo structure, which shall
       include at least the following members:

           iinntt               aaii__ffllaaggss      Input flags.
           int               ai_family     Address family of socket.
           int               ai_socktype   Socket type.
           int               ai_protocol   Protocol of socket.
           socklen_t         ai_addrlen    Length of socket address.
           struct sockaddr  *ai_addr       Socket address of socket.
           char             *ai_canonname  Canonical name of service location.
           struct addrinfo  *ai_next       Pointer to next in list.

       The _<_n_e_t_d_b_._h_> header shall define the following symbolic constants that
       evaluate to bitwise-distinct integer constants for use in the _f_l_a_g_s
       field of the aaddddrriinnffoo structure:

       AI_PASSIVE    Socket address is intended for _b_i_n_d().

       AI_CANONNAME  Request for canonical name.

       AI_NUMERICHOST
                     Return numeric host address as name.

       AI_NUMERICSERV
                     Inhibit service name resolution.

       AI_V4MAPPED   If no IPv6 addresses are found, query for IPv4 addresses
                     and return them to the caller as IPv4-mapped IPv6
                     addresses.

       AI_ALL        Query for both IPv4 and IPv6 addresses.

       AI_ADDRCONFIG Query for IPv4 addresses only when an IPv4 address is
                     configured; query for IPv6 addresses only when an IPv6
                     address is configured.

       The _<_n_e_t_d_b_._h_> header shall define the following symbolic constants that
       evaluate to bitwise-distinct integer constants for use in the _f_l_a_g_s
       argument to _g_e_t_n_a_m_e_i_n_f_o():

       NI_NOFQDN     Only the nodename portion of the FQDN is returned for
                     local hosts.

       NI_NUMERICHOST
                     The numeric form of the node's address is returned
                     instead of its name.

       NI_NAMEREQD   Return an error if the node's name cannot be located in
                     the database.

       NI_NUMERICSERV
                     The numeric form of the service address is returned
                     instead of its name.

       NI_NUMERICSCOPE
                     For IPv6 addresses, the numeric form of the scope
                     identifier is returned instead of its name.

       NI_DGRAM      Indicates that the service is a datagram service
                     (SOCK_DGRAM).

   AAddddrreessss IInnffoorrmmaattiioonn EErrrroorrss
       The _<_n_e_t_d_b_._h_> header shall define the following symbolic constants for
       use as error values for _g_e_t_a_d_d_r_i_n_f_o() and _g_e_t_n_a_m_e_i_n_f_o().  The values
       shall be suitable for use in ##iiff preprocessing directives.

       EAI_AGAIN     The name could not be resolved at this time. Future
                     attempts may succeed.

       EAI_BADFLAGS  The flags had an invalid value.

       EAI_FAIL      A non-recoverable error occurred.

       EAI_FAMILY    The address family was not recognized or the address
                     length was invalid for the specified family.

       EAI_MEMORY    There was a memory allocation failure.

       EAI_NONAME    The name does not resolve for the supplied parameters.

                     NI_NAMEREQD is set and the host's name cannot be located,
                     or both _n_o_d_e_n_a_m_e and _s_e_r_v_n_a_m_e were null.

       EAI_SERVICE   The service passed was not recognized for the specified
                     socket type.

       EAI_SOCKTYPE  The intended socket type was not recognized.

       EAI_SYSTEM    A system error occurred. The error code can be found in
                     _e_r_r_n_o.

       EAI_OVERFLOW  An argument buffer overflowed.

       The following shall be declared as functions and may also be defined as
       macros. Function prototypes shall be provided.

           vvooiidd              eennddhhoosstteenntt((vvooiidd));;
           vvooiidd              eennddnneetteenntt((vvooiidd));;
           vvooiidd              eennddpprroottooeenntt((vvooiidd));;
           vvooiidd              eennddsseerrvveenntt((vvooiidd));;
           vvooiidd              ffrreeeeaaddddrriinnffoo((ssttrruucctt aaddddrriinnffoo **));;
           ccoonnsstt cchhaarr       **ggaaii__ssttrreerrrroorr((iinntt));;
           iinntt               ggeettaaddddrriinnffoo((ccoonnsstt cchhaarr **rreessttrriicctt,, ccoonnsstt cchhaarr **rreessttrriicctt,,
                                 ccoonnsstt ssttrruucctt aaddddrriinnffoo **rreessttrriicctt,,
                                 ssttrruucctt aaddddrriinnffoo ****rreessttrriicctt));;
           ssttrruucctt hhoosstteenntt   **ggeetthhoosstteenntt((vvooiidd));;
           iinntt               ggeettnnaammeeiinnffoo((ccoonnsstt ssttrruucctt ssoocckkaaddddrr **rreessttrriicctt,, ssoocckklleenn__tt,,
                                 cchhaarr **rreessttrriicctt,, ssoocckklleenn__tt,, cchhaarr **rreessttrriicctt,,
                                 ssoocckklleenn__tt,, iinntt));;
           ssttrruucctt nneetteenntt    **ggeettnneettbbyyaaddddrr((uuiinntt3322__tt,, iinntt));;
           ssttrruucctt nneetteenntt    **ggeettnneettbbyynnaammee((ccoonnsstt cchhaarr **));;
           ssttrruucctt nneetteenntt    **ggeettnneetteenntt((vvooiidd));;
           ssttrruucctt pprroottooeenntt  **ggeettpprroottoobbyynnaammee((ccoonnsstt cchhaarr **));;
           ssttrruucctt pprroottooeenntt  **ggeettpprroottoobbyynnuummbbeerr((iinntt));;
           ssttrruucctt pprroottooeenntt  **ggeettpprroottooeenntt((vvooiidd));;
           ssttrruucctt sseerrvveenntt   **ggeettsseerrvvbbyynnaammee((ccoonnsstt cchhaarr **,, ccoonnsstt cchhaarr **));;
           ssttrruucctt sseerrvveenntt   **ggeettsseerrvvbbyyppoorrtt((iinntt,, ccoonnsstt cchhaarr **));;
           ssttrruucctt sseerrvveenntt   **ggeettsseerrvveenntt((vvooiidd));;
           vvooiidd              sseetthhoosstteenntt((iinntt));;
           vvooiidd              sseettnneetteenntt((iinntt));;
           vvooiidd              sseettpprroottooeenntt((iinntt));;
           vvooiidd              sseettsseerrvveenntt((iinntt));;

       The _<_n_e_t_d_b_._h_> header shall define the ssoocckklleenn__tt type through ttyyppeeddeeff,
       as described in _<_s_y_s_/_s_o_c_k_e_t_._h_>.

       Inclusion of the _<_n_e_t_d_b_._h_> header may also make visible all symbols
       from _<_n_e_t_i_n_e_t_/_i_n_._h_>, _<_s_y_s_/_s_o_c_k_e_t_._h_>, and _<_i_n_t_t_y_p_e_s_._h_>.

       _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
       <<iinnttttyyppeess..hh>>, <<nneettiinneett__iinn..hh>>, <<ssyyss__ssoocckkeett..hh>>

       The System Interfaces volume of POSIX.1-2008, _b_i_n_d(), _e_n_d_h_o_s_t_e_n_t(),
       _e_n_d_n_e_t_e_n_t(), _e_n_d_p_r_o_t_o_e_n_t(), _e_n_d_s_e_r_v_e_n_t(), _f_r_e_e_a_d_d_r_i_n_f_o(),
       _g_a_i___s_t_r_e_r_r_o_r(), _g_e_t_n_a_m_e_i_n_f_o()

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                           netdb.h(3)
