"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/irs/win32/include/irs/netdb.h" (7 Sep 2020, 4935 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "netdb.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 
   13 /*! \file */
   14 
   15 #ifndef IRS_NETDB_H
   16 #define IRS_NETDB_H 1
   17 
   18 #include <stddef.h> /* Required on FreeBSD (and  others?) for size_t. */
   19 
   20 /*
   21  * Define if <netdb.h> does not declare struct addrinfo.
   22  */
   23 #undef ISC_IRS_NEEDADDRINFO
   24 
   25 #ifdef ISC_IRS_NEEDADDRINFO
   26 struct addrinfo {
   27     int     ai_flags;      /* AI_PASSIVE, AI_CANONNAME */
   28     int     ai_family;     /* PF_xxx */
   29     int     ai_socktype;   /* SOCK_xxx */
   30     int     ai_protocol;   /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
   31     size_t      ai_addrlen;    /* Length of ai_addr */
   32     char        *ai_canonname; /* Canonical name for hostname */
   33     struct sockaddr *ai_addr;      /* Binary address */
   34     struct addrinfo *ai_next;      /* Next structure in linked list */
   35 };
   36 #endif
   37 
   38 /*
   39  * Undefine all #defines we are interested in as <netdb.h> may or may not have
   40  * defined them.
   41  */
   42 
   43 /*
   44  * Error return codes from gethostbyname() and gethostbyaddr()
   45  * (left in extern int h_errno).
   46  */
   47 
   48 #undef  NETDB_INTERNAL
   49 #undef  NETDB_SUCCESS
   50 #undef  HOST_NOT_FOUND
   51 #undef  TRY_AGAIN
   52 #undef  NO_RECOVERY
   53 #undef  NO_DATA
   54 #undef  NO_ADDRESS
   55 
   56 #define NETDB_INTERNAL  -1  /* see errno */
   57 #define NETDB_SUCCESS   0   /* no problem */
   58 #define HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
   59 #define TRY_AGAIN   2 /* Non-Authoritive Host not found, or SERVERFAIL */
   60 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
   61 #define NO_DATA     4 /* Valid name, no data record of requested type */
   62 #define NO_ADDRESS  NO_DATA     /* no address, look for MX record */
   63 
   64 /*
   65  * Error return codes from getaddrinfo().  EAI_INSECUREDATA is our own extension
   66  * and it's very unlikely to be already defined, but undef it just in case; it
   67  * at least doesn't do any harm.
   68  */
   69 
   70 #undef  EAI_ADDRFAMILY
   71 #undef  EAI_AGAIN
   72 #undef  EAI_BADFLAGS
   73 #undef  EAI_FAIL
   74 #undef  EAI_FAMILY
   75 #undef  EAI_MEMORY
   76 #undef  EAI_NODATA
   77 #undef  EAI_NONAME
   78 #undef  EAI_SERVICE
   79 #undef  EAI_SOCKTYPE
   80 #undef  EAI_SYSTEM
   81 #undef  EAI_BADHINTS
   82 #undef  EAI_PROTOCOL
   83 #undef  EAI_OVERFLOW
   84 #undef  EAI_INSECUREDATA
   85 #undef  EAI_MAX
   86 
   87 #define EAI_ADDRFAMILY   1  /* address family for hostname not supported */
   88 #define EAI_AGAIN    2  /* temporary failure in name resolution */
   89 #define EAI_BADFLAGS     3  /* invalid value for ai_flags */
   90 #define EAI_FAIL     4  /* non-recoverable failure in name resolution */
   91 #define EAI_FAMILY   5  /* ai_family not supported */
   92 #define EAI_MEMORY   6  /* memory allocation failure */
   93 #define EAI_NODATA   7  /* no address associated with hostname */
   94 #define EAI_NONAME   8  /* hostname nor servname provided, or not known */
   95 #define EAI_SERVICE  9  /* servname not supported for ai_socktype */
   96 #define EAI_SOCKTYPE    10  /* ai_socktype not supported */
   97 #define EAI_SYSTEM  11  /* system error returned in errno */
   98 #define EAI_BADHINTS    12
   99 #define EAI_PROTOCOL    13
  100 #define EAI_OVERFLOW    14
  101 #define EAI_INSECUREDATA 15
  102 #define EAI_MAX     16
  103 
  104 /*
  105  * Flag values for getaddrinfo()
  106  */
  107 #undef  AI_PASSIVE
  108 #undef  AI_CANONNAME
  109 #undef  AI_NUMERICHOST
  110 
  111 #define AI_PASSIVE  0x00000001
  112 #define AI_CANONNAME    0x00000002
  113 #define AI_NUMERICHOST  0x00000004
  114 
  115 /*
  116  * Flag values for getipnodebyname()
  117  */
  118 #undef AI_V4MAPPED
  119 #undef AI_ALL
  120 #undef AI_ADDRCONFIG
  121 #undef AI_DEFAULT
  122 
  123 #define AI_V4MAPPED 0x00000008
  124 #define AI_ALL      0x00000010
  125 #define AI_ADDRCONFIG   0x00000020
  126 #define AI_DEFAULT  (AI_V4MAPPED|AI_ADDRCONFIG)
  127 
  128 /*
  129  * Constants for lwres_getnameinfo()
  130  */
  131 #undef  NI_MAXHOST
  132 #undef  NI_MAXSERV
  133 
  134 #define NI_MAXHOST  1025
  135 #define NI_MAXSERV  32
  136 
  137 /*
  138  * Flag values for lwres_getnameinfo()
  139  */
  140 #undef  NI_NOFQDN
  141 #undef  NI_NUMERICHOST
  142 #undef  NI_NAMEREQD
  143 #undef  NI_NUMERICSERV
  144 #undef  NI_DGRAM
  145 #undef  NI_NUMERICSCOPE
  146 
  147 #define NI_NOFQDN   0x00000001
  148 #define NI_NUMERICHOST  0x00000002
  149 #define NI_NAMEREQD 0x00000004
  150 #define NI_NUMERICSERV  0x00000008
  151 #define NI_DGRAM    0x00000010
  152 
  153 /*
  154  * Define to map into irs_ namespace.
  155  */
  156 
  157 #define IRS_NAMESPACE
  158 
  159 #ifdef IRS_NAMESPACE
  160 
  161 /*
  162  * Use our versions not the ones from the C library.
  163  */
  164 
  165 #ifdef getnameinfo
  166 #undef getnameinfo
  167 #endif
  168 #define getnameinfo irs_getnameinfo
  169 
  170 #ifdef getaddrinfo
  171 #undef getaddrinfo
  172 #endif
  173 #define getaddrinfo irs_getaddrinfo
  174 
  175 #ifdef freeaddrinfo
  176 #undef freeaddrinfo
  177 #endif
  178 #define freeaddrinfo irs_freeaddrinfo
  179 
  180 #ifdef gai_strerror
  181 #undef gai_strerror
  182 #endif
  183 #define gai_strerror irs_gai_strerror
  184 
  185 #endif
  186 
  187 int getaddrinfo(const char *, const char *,
  188         const struct addrinfo *, struct addrinfo **);
  189 int getnameinfo(const struct sockaddr *, socklen_t, char *,
  190         DWORD, char *, DWORD, int);
  191 void freeaddrinfo(struct addrinfo *);
  192 char *gai_strerror(int);
  193 
  194 /*
  195  * Tell Emacs to use C mode on this file.
  196  * Local variables:
  197  * mode: c
  198  * End:
  199  */
  200 
  201 #endif /* IRS_NETDB_H */