Blame gl/netdb.in.h

Packit Service 4684c1
/* Provide a netdb.h header file for systems lacking it (read: MinGW).
Packit Service 4684c1
   Copyright (C) 2008-2020 Free Software Foundation, Inc.
Packit Service 4684c1
   Written by Simon Josefsson.
Packit Service 4684c1
Packit Service 4684c1
   This program is free software; you can redistribute it and/or modify
Packit Service 4684c1
   it under the terms of the GNU Lesser General Public License as published by
Packit Service 4684c1
   the Free Software Foundation; either version 2.1, or (at your option)
Packit Service 4684c1
   any later version.
Packit Service 4684c1
Packit Service 4684c1
   This program is distributed in the hope that it will be useful,
Packit Service 4684c1
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 4684c1
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 4684c1
   GNU Lesser General Public License for more details.
Packit Service 4684c1
Packit Service 4684c1
   You should have received a copy of the GNU Lesser General Public License
Packit Service 4684c1
   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
Packit Service 4684c1
Packit Service 4684c1
/* This file is supposed to be used on platforms that lack <netdb.h>.
Packit Service 4684c1
   It is intended to provide definitions and prototypes needed by an
Packit Service 4684c1
   application.  */
Packit Service 4684c1
Packit Service 4684c1
#ifndef _@GUARD_PREFIX@_NETDB_H
Packit Service 4684c1
Packit Service 4684c1
#if __GNUC__ >= 3
Packit Service 4684c1
@PRAGMA_SYSTEM_HEADER@
Packit Service 4684c1
#endif
Packit Service 4684c1
@PRAGMA_COLUMNS@
Packit Service 4684c1
Packit Service 4684c1
#if @HAVE_NETDB_H@
Packit Service 4684c1
Packit Service 4684c1
/* The include_next requires a split double-inclusion guard.  */
Packit Service 4684c1
# @INCLUDE_NEXT@ @NEXT_NETDB_H@
Packit Service 4684c1
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#ifndef _@GUARD_PREFIX@_NETDB_H
Packit Service 4684c1
#define _@GUARD_PREFIX@_NETDB_H
Packit Service 4684c1
Packit Service 4684c1
/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
Packit Service 4684c1
   'struct hostent' on MinGW.  */
Packit Service 4684c1
#include <sys/socket.h>
Packit Service 4684c1
Packit Service 4684c1
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
Packit Service 4684c1
Packit Service 4684c1
/* The definition of _GL_ARG_NONNULL is copied here.  */
Packit Service 4684c1
Packit Service 4684c1
/* The definition of _GL_WARN_ON_USE is copied here.  */
Packit Service 4684c1
Packit Service 4684c1
/* Declarations for a platform that lacks <netdb.h>, or where it is
Packit Service 4684c1
   incomplete.  */
Packit Service 4684c1
Packit Service 4684c1
#if @GNULIB_GETADDRINFO@
Packit Service 4684c1
Packit Service 4684c1
# if !@HAVE_STRUCT_ADDRINFO@
Packit Service 4684c1
Packit Service 4684c1
#  ifdef __cplusplus
Packit Service 4684c1
extern "C" {
Packit Service 4684c1
#  endif
Packit Service 4684c1
Packit Service 4684c1
#  if !GNULIB_defined_struct_addrinfo
Packit Service 4684c1
/* Structure to contain information about address of a service provider.  */
Packit Service 4684c1
struct addrinfo
Packit Service 4684c1
{
Packit Service 4684c1
  int ai_flags;                 /* Input flags.  */
Packit Service 4684c1
  int ai_family;                /* Protocol family for socket.  */
Packit Service 4684c1
  int ai_socktype;              /* Socket type.  */
Packit Service 4684c1
  int ai_protocol;              /* Protocol for socket.  */
Packit Service 4684c1
  socklen_t ai_addrlen;         /* Length of socket address.  */
Packit Service 4684c1
  struct sockaddr *ai_addr;     /* Socket address for socket.  */
Packit Service 4684c1
  char *ai_canonname;           /* Canonical name for service location.  */
Packit Service 4684c1
  struct addrinfo *ai_next;     /* Pointer to next in list.  */
Packit Service 4684c1
};
Packit Service 4684c1
#   define GNULIB_defined_struct_addrinfo 1
Packit Service 4684c1
#  endif
Packit Service 4684c1
Packit Service 4684c1
#  ifdef __cplusplus
Packit Service 4684c1
}
Packit Service 4684c1
#  endif
Packit Service 4684c1
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
/* Possible values for 'ai_flags' field in 'addrinfo' structure.  */
Packit Service 4684c1
# ifndef AI_PASSIVE
Packit Service 4684c1
#  define AI_PASSIVE    0x0001  /* Socket address is intended for 'bind'.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef AI_CANONNAME
Packit Service 4684c1
#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef AI_NUMERICSERV
Packit Service 4684c1
#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
# if 0
Packit Service 4684c1
#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
/* These symbolic constants are required to be present by POSIX, but
Packit Service 4684c1
   our getaddrinfo replacement doesn't use them (yet).  Setting them
Packit Service 4684c1
   to 0 on systems that doesn't have them avoids causing problems for
Packit Service 4684c1
   system getaddrinfo implementations that would be confused by
Packit Service 4684c1
   unknown values.  */
Packit Service 4684c1
# ifndef AI_V4MAPPED
Packit Service 4684c1
#  define AI_V4MAPPED    0 /* 0x0008: IPv4 mapped addresses are acceptable.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef AI_ALL
Packit Service 4684c1
#  define AI_ALL         0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef AI_ADDRCONFIG
Packit Service 4684c1
#  define AI_ADDRCONFIG  0 /* 0x0020: Use configuration of this host to choose
Packit Service 4684c1
                                      returned address type.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
/* Error values for 'getaddrinfo' function.  */
Packit Service 4684c1
# ifndef EAI_BADFLAGS
Packit Service 4684c1
#  define EAI_BADFLAGS    -1    /* Invalid value for 'ai_flags' field.  */
Packit Service 4684c1
#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
Packit Service 4684c1
#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
Packit Service 4684c1
#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
Packit Service 4684c1
#  define EAI_NODATA      -5    /* No address associated with NAME.  */
Packit Service 4684c1
#  define EAI_FAMILY      -6    /* 'ai_family' not supported.  */
Packit Service 4684c1
#  define EAI_SOCKTYPE    -7    /* 'ai_socktype' not supported.  */
Packit Service 4684c1
#  define EAI_SERVICE     -8    /* SERVICE not supported for 'ai_socktype'.  */
Packit Service 4684c1
#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
Packit Service 4684c1
   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
Packit Service 4684c1
   in favor of EAI_NONAME.  */
Packit Service 4684c1
# if !defined EAI_NODATA && defined EAI_NONAME
Packit Service 4684c1
#  define EAI_NODATA EAI_NONAME
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
# ifndef EAI_OVERFLOW
Packit Service 4684c1
/* Not defined on mingw32 and Haiku. */
Packit Service 4684c1
#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef EAI_ADDRFAMILY
Packit Service 4684c1
/* Not defined on mingw32. */
Packit Service 4684c1
#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef EAI_SYSTEM
Packit Service 4684c1
/* Not defined on mingw32. */
Packit Service 4684c1
#  define EAI_SYSTEM      -11   /* System error returned in 'errno'.  */
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
# if 0
Packit Service 4684c1
/* The commented out definitions below are not yet implemented in the
Packit Service 4684c1
   GNULIB getaddrinfo() replacement, so are not yet needed.
Packit Service 4684c1
Packit Service 4684c1
   If they are restored, be sure to protect the definitions with #ifndef.  */
Packit Service 4684c1
#  ifndef EAI_INPROGRESS
Packit Service 4684c1
#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
Packit Service 4684c1
#   define EAI_CANCELED         -101    /* Request canceled.  */
Packit Service 4684c1
#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
Packit Service 4684c1
#   define EAI_ALLDONE          -103    /* All requests done.  */
Packit Service 4684c1
#   define EAI_INTR             -104    /* Interrupted by a signal.  */
Packit Service 4684c1
#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
Packit Service 4684c1
#  endif
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
/* Translate name of a service location and/or a service name to set of
Packit Service 4684c1
   socket addresses.
Packit Service 4684c1
   For more details, see the POSIX:2008 specification
Packit Service 4684c1
   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>.  */
Packit Service 4684c1
# if @REPLACE_GETADDRINFO@
Packit Service 4684c1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 4684c1
#   undef getaddrinfo
Packit Service 4684c1
#   define getaddrinfo rpl_getaddrinfo
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_FUNCDECL_RPL (getaddrinfo, int,
Packit Service 4684c1
                  (const char *restrict nodename,
Packit Service 4684c1
                   const char *restrict servname,
Packit Service 4684c1
                   const struct addrinfo *restrict hints,
Packit Service 4684c1
                   struct addrinfo **restrict res)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((4)));
Packit Service 4684c1
_GL_CXXALIAS_RPL (getaddrinfo, int,
Packit Service 4684c1
                  (const char *restrict nodename,
Packit Service 4684c1
                   const char *restrict servname,
Packit Service 4684c1
                   const struct addrinfo *restrict hints,
Packit Service 4684c1
                   struct addrinfo **restrict res));
Packit Service 4684c1
# else
Packit Service 4684c1
#  if !@HAVE_DECL_GETADDRINFO@
Packit Service 4684c1
_GL_FUNCDECL_SYS (getaddrinfo, int,
Packit Service 4684c1
                  (const char *restrict nodename,
Packit Service 4684c1
                   const char *restrict servname,
Packit Service 4684c1
                   const struct addrinfo *restrict hints,
Packit Service 4684c1
                   struct addrinfo **restrict res)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((4)));
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_CXXALIAS_SYS (getaddrinfo, int,
Packit Service 4684c1
                  (const char *restrict nodename,
Packit Service 4684c1
                   const char *restrict servname,
Packit Service 4684c1
                   const struct addrinfo *restrict hints,
Packit Service 4684c1
                   struct addrinfo **restrict res));
Packit Service 4684c1
# endif
Packit Service 4684c1
_GL_CXXALIASWARN (getaddrinfo);
Packit Service 4684c1
Packit Service 4684c1
/* Free 'addrinfo' structure AI including associated storage.
Packit Service 4684c1
   For more details, see the POSIX:2008 specification
Packit Service 4684c1
   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>.  */
Packit Service 4684c1
# if @REPLACE_GETADDRINFO@
Packit Service 4684c1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 4684c1
#   undef freeaddrinfo
Packit Service 4684c1
#   define freeaddrinfo rpl_freeaddrinfo
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai)
Packit Service 4684c1
                                      _GL_ARG_NONNULL ((1)));
Packit Service 4684c1
_GL_CXXALIAS_RPL (freeaddrinfo, void, (struct addrinfo *ai));
Packit Service 4684c1
# else
Packit Service 4684c1
#  if !@HAVE_DECL_FREEADDRINFO@
Packit Service 4684c1
_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
Packit Service 4684c1
                                      _GL_ARG_NONNULL ((1)));
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
Packit Service 4684c1
# endif
Packit Service 4684c1
_GL_CXXALIASWARN (freeaddrinfo);
Packit Service 4684c1
Packit Service 4684c1
# if @REPLACE_GAI_STRERROR@
Packit Service 4684c1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 4684c1
#   undef gai_strerror
Packit Service 4684c1
#   define gai_strerror rpl_gai_strerror
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
Packit Service 4684c1
_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
Packit Service 4684c1
# else
Packit Service 4684c1
#  if !@HAVE_DECL_GAI_STRERROR@
Packit Service 4684c1
/* Convert error return from getaddrinfo() to a string.
Packit Service 4684c1
   For more details, see the POSIX:2008 specification
Packit Service 4684c1
   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html>.  */
Packit Service 4684c1
_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
Packit Service 4684c1
# endif
Packit Service 4684c1
_GL_CXXALIASWARN (gai_strerror);
Packit Service 4684c1
Packit Service 4684c1
# if !@HAVE_DECL_GETNAMEINFO@
Packit Service 4684c1
/* Convert socket address to printable node and service names.
Packit Service 4684c1
   For more details, see the POSIX:2008 specification
Packit Service 4684c1
   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html>.  */
Packit Service 4684c1
_GL_FUNCDECL_SYS (getnameinfo, int,
Packit Service 4684c1
                  (const struct sockaddr *restrict sa, socklen_t salen,
Packit Service 4684c1
                   char *restrict node, socklen_t nodelen,
Packit Service 4684c1
                   char *restrict service, socklen_t servicelen,
Packit Service 4684c1
                   int flags)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((1)));
Packit Service 4684c1
# endif
Packit Service 4684c1
/* Need to cast, because on glibc systems, the seventh parameter is
Packit Service 4684c1
                        unsigned int flags.  */
Packit Service 4684c1
_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
Packit Service 4684c1
                       (const struct sockaddr *restrict sa, socklen_t salen,
Packit Service 4684c1
                        char *restrict node, socklen_t nodelen,
Packit Service 4684c1
                        char *restrict service, socklen_t servicelen,
Packit Service 4684c1
                        int flags));
Packit Service 4684c1
_GL_CXXALIASWARN (getnameinfo);
Packit Service 4684c1
Packit Service 4684c1
/* Possible flags for getnameinfo.  */
Packit Service 4684c1
# ifndef NI_NUMERICHOST
Packit Service 4684c1
#  define NI_NUMERICHOST 1
Packit Service 4684c1
# endif
Packit Service 4684c1
# ifndef NI_NUMERICSERV
Packit Service 4684c1
#  define NI_NUMERICSERV 2
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
#elif defined GNULIB_POSIXCHECK
Packit Service 4684c1
Packit Service 4684c1
# undef getaddrinfo
Packit Service 4684c1
# if HAVE_RAW_DECL_GETADDRINFO
Packit Service 4684c1
_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
Packit Service 4684c1
                 "use gnulib module getaddrinfo for portability");
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
# undef freeaddrinfo
Packit Service 4684c1
# if HAVE_RAW_DECL_FREEADDRINFO
Packit Service 4684c1
_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
Packit Service 4684c1
                 "use gnulib module getaddrinfo for portability");
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
# undef gai_strerror
Packit Service 4684c1
# if HAVE_RAW_DECL_GAI_STRERROR
Packit Service 4684c1
_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
Packit Service 4684c1
                 "use gnulib module getaddrinfo for portability");
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
# undef getnameinfo
Packit Service 4684c1
# if HAVE_RAW_DECL_GETNAMEINFO
Packit Service 4684c1
_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
Packit Service 4684c1
                 "use gnulib module getaddrinfo for portability");
Packit Service 4684c1
# endif
Packit Service 4684c1
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#endif /* _@GUARD_PREFIX@_NETDB_H */
Packit Service 4684c1
#endif /* _@GUARD_PREFIX@_NETDB_H */