Blame gnulib-tests/arpa_inet.in.h

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