Blame gl/arpa_inet.in.h

Packit Service 4684c1
/* A GNU-like <arpa/inet.h>.
Packit Service 4684c1
Packit Service 4684c1
   Copyright (C) 2005-2006, 2008-2020 Free Software Foundation, Inc.
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
#ifndef _@GUARD_PREFIX@_ARPA_INET_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_FEATURES_H@
Packit Service 4684c1
# include <features.h> /* for __GLIBC__ */
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
Packit Service 4684c1
   for pulling in winsock2.h etc. under MinGW.
Packit Service 4684c1
   But avoid namespace pollution on glibc systems.  */
Packit Service 4684c1
#ifndef __GLIBC__
Packit Service 4684c1
# include <sys/socket.h>
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
Packit Service 4684c1
   But avoid namespace pollution on glibc systems.  */
Packit Service 4684c1
#if defined __TANDEM && !defined __GLIBC__
Packit Service 4684c1
# include <netdb.h>
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#if @HAVE_ARPA_INET_H@
Packit Service 4684c1
Packit Service 4684c1
/* The include_next requires a split double-inclusion guard.  */
Packit Service 4684c1
# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
Packit Service 4684c1
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
Packit Service 4684c1
#define _@GUARD_PREFIX@_ARPA_INET_H
Packit Service 4684c1
Packit Service 4684c1
/* Get all possible declarations of inet_ntop() and inet_pton().  */
Packit Service 4684c1
#if (@GNULIB_INET_NTOP@ || @GNULIB_INET_PTON@ || defined GNULIB_POSIXCHECK) \
Packit Service 4684c1
    && @HAVE_WS2TCPIP_H@
Packit Service 4684c1
# include <ws2tcpip.h>
Packit Service 4684c1
#endif
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
Packit Service 4684c1
#if @GNULIB_INET_NTOP@
Packit Service 4684c1
/* Converts an internet address from internal format to a printable,
Packit Service 4684c1
   presentable format.
Packit Service 4684c1
   AF is an internet address family, such as AF_INET or AF_INET6.
Packit Service 4684c1
   SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
Packit Service 4684c1
   (for AF_INET6).
Packit Service 4684c1
   DST points to a buffer having room for CNT bytes.
Packit Service 4684c1
   The printable representation of the address (in numeric form, not
Packit Service 4684c1
   surrounded by [...], no reverse DNS is done) is placed in DST, and
Packit Service 4684c1
   DST is returned.  If an error occurs, the return value is NULL and
Packit Service 4684c1
   errno is set.  If CNT bytes are not sufficient to hold the result,
Packit Service 4684c1
   the return value is NULL and errno is set to ENOSPC.  A good value
Packit Service 4684c1
   for CNT is 46.
Packit Service 4684c1
Packit Service 4684c1
   For more details, see the POSIX:2008 specification
Packit Service 4684c1
   <https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html>.  */
Packit Service 4684c1
# if @REPLACE_INET_NTOP@
Packit Service 4684c1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 4684c1
#   undef inet_ntop
Packit Service 4684c1
#   define inet_ntop rpl_inet_ntop
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_FUNCDECL_RPL (inet_ntop, const char *,
Packit Service 4684c1
                  (int af, const void *restrict src,
Packit Service 4684c1
                   char *restrict dst, socklen_t cnt)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((2, 3)));
Packit Service 4684c1
_GL_CXXALIAS_RPL (inet_ntop, const char *,
Packit Service 4684c1
                  (int af, const void *restrict src,
Packit Service 4684c1
                   char *restrict dst, socklen_t cnt));
Packit Service 4684c1
# else
Packit Service 4684c1
#  if !@HAVE_DECL_INET_NTOP@
Packit Service 4684c1
_GL_FUNCDECL_SYS (inet_ntop, const char *,
Packit Service 4684c1
                  (int af, const void *restrict src,
Packit Service 4684c1
                   char *restrict dst, socklen_t cnt)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((2, 3)));
Packit Service 4684c1
#  endif
Packit Service 4684c1
/* Need to cast, because on NonStop Kernel, the fourth parameter is
Packit Service 4684c1
                                            size_t cnt.  */
Packit Service 4684c1
_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
Packit Service 4684c1
                       (int af, const void *restrict src,
Packit Service 4684c1
                        char *restrict dst, socklen_t cnt));
Packit Service 4684c1
# endif
Packit Service 4684c1
# if __GLIBC__ >= 2
Packit Service 4684c1
_GL_CXXALIASWARN (inet_ntop);
Packit Service 4684c1
# endif
Packit Service 4684c1
#elif defined GNULIB_POSIXCHECK
Packit Service 4684c1
# undef inet_ntop
Packit Service 4684c1
# if HAVE_RAW_DECL_INET_NTOP
Packit Service 4684c1
_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
Packit Service 4684c1
                 "use gnulib module inet_ntop for portability");
Packit Service 4684c1
# endif
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
#if @GNULIB_INET_PTON@
Packit Service 4684c1
# if @REPLACE_INET_PTON@
Packit Service 4684c1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 4684c1
#   undef inet_pton
Packit Service 4684c1
#   define inet_pton rpl_inet_pton
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_FUNCDECL_RPL (inet_pton, int,
Packit Service 4684c1
                  (int af, const char *restrict src, void *restrict dst)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((2, 3)));
Packit Service 4684c1
_GL_CXXALIAS_RPL (inet_pton, int,
Packit Service 4684c1
                  (int af, const char *restrict src, void *restrict dst));
Packit Service 4684c1
# else
Packit Service 4684c1
#  if !@HAVE_DECL_INET_PTON@
Packit Service 4684c1
_GL_FUNCDECL_SYS (inet_pton, int,
Packit Service 4684c1
                  (int af, const char *restrict src, void *restrict dst)
Packit Service 4684c1
                  _GL_ARG_NONNULL ((2, 3)));
Packit Service 4684c1
#  endif
Packit Service 4684c1
_GL_CXXALIAS_SYS (inet_pton, int,
Packit Service 4684c1
                  (int af, const char *restrict src, void *restrict dst));
Packit Service 4684c1
# endif
Packit Service 4684c1
# if __GLIBC__ >= 2
Packit Service 4684c1
_GL_CXXALIASWARN (inet_pton);
Packit Service 4684c1
# endif
Packit Service 4684c1
#elif defined GNULIB_POSIXCHECK
Packit Service 4684c1
# undef inet_pton
Packit Service 4684c1
# if HAVE_RAW_DECL_INET_PTON
Packit Service 4684c1
_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
Packit Service 4684c1
                 "use gnulib module inet_pton for portability");
Packit Service 4684c1
# endif
Packit Service 4684c1
#endif
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
Packit Service 4684c1
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */