Blame gl/arpa_inet.in.h

Packit aea12f
/* A GNU-like <arpa/inet.h>.
Packit aea12f
Packit Service 991b93
   Copyright (C) 2005-2006, 2008-2020 Free Software Foundation, Inc.
Packit aea12f
Packit aea12f
   This program is free software; you can redistribute it and/or modify
Packit Service 991b93
   it under the terms of the GNU Lesser General Public License as published by
Packit Service 991b93
   the Free Software Foundation; either version 2.1, or (at your option)
Packit aea12f
   any later version.
Packit aea12f
Packit aea12f
   This program is distributed in the hope that it will be useful,
Packit aea12f
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit aea12f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 991b93
   GNU Lesser General Public License for more details.
Packit aea12f
Packit Service 991b93
   You should have received a copy of the GNU Lesser General Public License
Packit aea12f
   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
Packit aea12f
Packit aea12f
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
Packit aea12f
Packit aea12f
#if __GNUC__ >= 3
Packit aea12f
@PRAGMA_SYSTEM_HEADER@
Packit aea12f
#endif
Packit aea12f
@PRAGMA_COLUMNS@
Packit aea12f
Packit aea12f
#if @HAVE_FEATURES_H@
Packit aea12f
# include <features.h> /* for __GLIBC__ */
Packit aea12f
#endif
Packit aea12f
Packit aea12f
/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
Packit aea12f
   for pulling in winsock2.h etc. under MinGW.
Packit aea12f
   But avoid namespace pollution on glibc systems.  */
Packit aea12f
#ifndef __GLIBC__
Packit aea12f
# include <sys/socket.h>
Packit aea12f
#endif
Packit aea12f
Packit aea12f
/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
Packit aea12f
   But avoid namespace pollution on glibc systems.  */
Packit aea12f
#if defined __TANDEM && !defined __GLIBC__
Packit aea12f
# include <netdb.h>
Packit aea12f
#endif
Packit aea12f
Packit aea12f
#if @HAVE_ARPA_INET_H@
Packit aea12f
Packit aea12f
/* The include_next requires a split double-inclusion guard.  */
Packit aea12f
# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
Packit aea12f
Packit aea12f
#endif
Packit aea12f
Packit aea12f
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
Packit aea12f
#define _@GUARD_PREFIX@_ARPA_INET_H
Packit aea12f
Packit Service 991b93
/* Get all possible declarations of inet_ntop() and inet_pton().  */
Packit Service 991b93
#if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \
Packit Service 991b93
    && @HAVE_WS2TCPIP_H@
Packit Service 991b93
# include <ws2tcpip.h>
Packit Service 991b93
#endif
Packit Service 991b93
Packit aea12f
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
Packit aea12f
Packit aea12f
/* The definition of _GL_ARG_NONNULL is copied here.  */
Packit aea12f
Packit aea12f
/* The definition of _GL_WARN_ON_USE is copied here.  */
Packit aea12f
Packit aea12f
Packit aea12f
#if @GNULIB_INET_NTOP@
Packit aea12f
/* Converts an internet address from internal format to a printable,
Packit aea12f
   presentable format.
Packit aea12f
   AF is an internet address family, such as AF_INET or AF_INET6.
Packit aea12f
   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
Packit aea12f
   (for AF_INET6).
Packit aea12f
   DST points to a buffer having room for CNT bytes.
Packit aea12f
   The printable representation of the address (in numeric form, not
Packit aea12f
   surrounded by [...], no reverse DNS is done) is placed in DST, and
Packit aea12f
   DST is returned.  If an error occurs, the return value is NULL and
Packit aea12f
   errno is set.  If CNT bytes are not sufficient to hold the result,
Packit aea12f
   the return value is NULL and errno is set to ENOSPC.  A good value
Packit aea12f
   for CNT is 46.
Packit aea12f
Packit Service 991b93
   For more details, see the POSIX:2008 specification
Packit Service 991b93
   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>.  */
Packit aea12f
# if @REPLACE_INET_NTOP@
Packit aea12f
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit aea12f
#   undef inet_ntop
Packit aea12f
#   define inet_ntop rpl_inet_ntop
Packit aea12f
#  endif
Packit aea12f
_GL_FUNCDECL_RPL (inet_ntop, const char *,
Packit aea12f
                  (int af, const void *restrict src,
Packit aea12f
                   char *restrict dst, socklen_t cnt)
Packit aea12f
                  _GL_ARG_NONNULL ((2, 3)));
Packit aea12f
_GL_CXXALIAS_RPL (inet_ntop, const char *,
Packit aea12f
                  (int af, const void *restrict src,
Packit aea12f
                   char *restrict dst, socklen_t cnt));
Packit aea12f
# else
Packit aea12f
#  if !@HAVE_DECL_INET_NTOP@
Packit aea12f
_GL_FUNCDECL_SYS (inet_ntop, const char *,
Packit aea12f
                  (int af, const void *restrict src,
Packit aea12f
                   char *restrict dst, socklen_t cnt)
Packit aea12f
                  _GL_ARG_NONNULL ((2, 3)));
Packit aea12f
#  endif
Packit aea12f
/* Need to cast, because on NonStop Kernel, the fourth parameter is
Packit aea12f
                                            size_t cnt.  */
Packit aea12f
_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
Packit aea12f
                       (int af, const void *restrict src,
Packit aea12f
                        char *restrict dst, socklen_t cnt));
Packit aea12f
# endif
Packit Service 991b93
# if __GLIBC__ >= 2
Packit aea12f
_GL_CXXALIASWARN (inet_ntop);
Packit Service 991b93
# endif
Packit aea12f
#elif defined GNULIB_POSIXCHECK
Packit aea12f
# undef inet_ntop
Packit aea12f
# if HAVE_RAW_DECL_INET_NTOP
Packit aea12f
_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
Packit aea12f
                 "use gnulib module inet_ntop for portability");
Packit aea12f
# endif
Packit aea12f
#endif
Packit aea12f
Packit aea12f
#if @GNULIB_INET_PTON@
Packit aea12f
# if @REPLACE_INET_PTON@
Packit aea12f
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit aea12f
#   undef inet_pton
Packit aea12f
#   define inet_pton rpl_inet_pton
Packit aea12f
#  endif
Packit aea12f
_GL_FUNCDECL_RPL (inet_pton, int,
Packit aea12f
                  (int af, const char *restrict src, void *restrict dst)
Packit aea12f
                  _GL_ARG_NONNULL ((2, 3)));
Packit aea12f
_GL_CXXALIAS_RPL (inet_pton, int,
Packit aea12f
                  (int af, const char *restrict src, void *restrict dst));
Packit aea12f
# else
Packit aea12f
#  if !@HAVE_DECL_INET_PTON@
Packit aea12f
_GL_FUNCDECL_SYS (inet_pton, int,
Packit aea12f
                  (int af, const char *restrict src, void *restrict dst)
Packit aea12f
                  _GL_ARG_NONNULL ((2, 3)));
Packit aea12f
#  endif
Packit aea12f
_GL_CXXALIAS_SYS (inet_pton, int,
Packit aea12f
                  (int af, const char *restrict src, void *restrict dst));
Packit aea12f
# endif
Packit Service 991b93
# if __GLIBC__ >= 2
Packit aea12f
_GL_CXXALIASWARN (inet_pton);
Packit Service 991b93
# endif
Packit aea12f
#elif defined GNULIB_POSIXCHECK
Packit aea12f
# undef inet_pton
Packit aea12f
# if HAVE_RAW_DECL_INET_PTON
Packit aea12f
_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
Packit aea12f
                 "use gnulib module inet_pton for portability");
Packit aea12f
# endif
Packit aea12f
#endif
Packit aea12f
Packit aea12f
Packit aea12f
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
Packit aea12f
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */