1
1
/* A GNU-like <arpa/inet.h>.
3
Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
3
Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
5
5
This program is free software; you can redistribute it and/or modify
6
6
it under the terms of the GNU General Public License as published by
13
13
GNU General Public License for more details.
15
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software Foundation,
17
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
16
along with this program; if not, see <http://www.gnu.org/licenses/>. */
19
#ifndef _GL_ARPA_INET_H
18
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
22
21
@PRAGMA_SYSTEM_HEADER@
25
/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
26
# include <features.h> /* for __GLIBC__ */
29
/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
30
for pulling in winsock2.h etc. under MinGW.
27
31
But avoid namespace pollution on glibc systems. */
29
33
# include <sys/socket.h>
36
/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
37
But avoid namespace pollution on glibc systems. */
38
#if defined __TANDEM && !defined __GLIBC__
32
42
#if @HAVE_ARPA_INET_H@
34
44
/* The include_next requires a split double-inclusion guard. */
39
#ifndef _GL_ARPA_INET_H
40
#define _GL_ARPA_INET_H
49
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
50
#define _@GUARD_PREFIX@_ARPA_INET_H
52
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
42
54
/* The definition of _GL_ARG_NONNULL is copied here. */
44
56
/* The definition of _GL_WARN_ON_USE is copied here. */
50
59
#if @GNULIB_INET_NTOP@
51
# if !@HAVE_DECL_INET_NTOP@
52
60
/* Converts an internet address from internal format to a printable,
53
61
presentable format.
54
62
AF is an internet address family, such as AF_INET or AF_INET6.
65
73
For more details, see the POSIX:2001 specification
66
74
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
67
extern const char *inet_ntop (int af, const void *restrict src,
68
char *restrict dst, socklen_t cnt)
69
_GL_ARG_NONNULL ((2, 3));
75
# if @REPLACE_INET_NTOP@
76
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
78
# define inet_ntop rpl_inet_ntop
80
_GL_FUNCDECL_RPL (inet_ntop, const char *,
81
(int af, const void *restrict src,
82
char *restrict dst, socklen_t cnt)
83
_GL_ARG_NONNULL ((2, 3)));
84
_GL_CXXALIAS_RPL (inet_ntop, const char *,
85
(int af, const void *restrict src,
86
char *restrict dst, socklen_t cnt));
88
# if !@HAVE_DECL_INET_NTOP@
89
_GL_FUNCDECL_SYS (inet_ntop, const char *,
90
(int af, const void *restrict src,
91
char *restrict dst, socklen_t cnt)
92
_GL_ARG_NONNULL ((2, 3)));
94
/* Need to cast, because on NonStop Kernel, the fourth parameter is
96
_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
97
(int af, const void *restrict src,
98
char *restrict dst, socklen_t cnt));
100
_GL_CXXALIASWARN (inet_ntop);
71
101
#elif defined GNULIB_POSIXCHECK
73
103
# if HAVE_RAW_DECL_INET_NTOP
79
109
#if @GNULIB_INET_PTON@
80
# if !@HAVE_DECL_INET_PTON@
81
extern int inet_pton (int af, const char *restrict src, void *restrict dst)
82
_GL_ARG_NONNULL ((2, 3));
110
# if @REPLACE_INET_PTON@
111
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
113
# define inet_pton rpl_inet_pton
115
_GL_FUNCDECL_RPL (inet_pton, int,
116
(int af, const char *restrict src, void *restrict dst)
117
_GL_ARG_NONNULL ((2, 3)));
118
_GL_CXXALIAS_RPL (inet_pton, int,
119
(int af, const char *restrict src, void *restrict dst));
121
# if !@HAVE_DECL_INET_PTON@
122
_GL_FUNCDECL_SYS (inet_pton, int,
123
(int af, const char *restrict src, void *restrict dst)
124
_GL_ARG_NONNULL ((2, 3)));
126
_GL_CXXALIAS_SYS (inet_pton, int,
127
(int af, const char *restrict src, void *restrict dst));
129
_GL_CXXALIASWARN (inet_pton);
84
130
#elif defined GNULIB_POSIXCHECK
86
132
# if HAVE_RAW_DECL_INET_PTON