Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.
[bpt/guile.git] / lib / arpa_inet.in.h
CommitLineData
8912421c
LC
1/* A GNU-like <arpa/inet.h>.
2
49114fd4 3 Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
8912421c
LC
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser 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. */
18
19#ifndef _GL_ARPA_INET_H
20
a927b6c1
LC
21#if __GNUC__ >= 3
22@PRAGMA_SYSTEM_HEADER@
23#endif
0f00f2c3
LC
24@PRAGMA_COLUMNS@
25
26#if @HAVE_FEATURES_H@
27# include <features.h> /* for __GLIBC__ */
28#endif
a927b6c1 29
8912421c 30/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
61cd9dc9
LC
31 under MinGW.
32 But avoid namespace pollution on glibc systems. */
33#ifndef __GLIBC__
34# include <sys/socket.h>
35#endif
8912421c 36
49114fd4
LC
37/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
38 But avoid namespace pollution on glibc systems. */
39#if defined __TANDEM && !defined __GLIBC__
40# include <netdb.h>
41#endif
42
8912421c
LC
43#if @HAVE_ARPA_INET_H@
44
8912421c
LC
45/* The include_next requires a split double-inclusion guard. */
46# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
47
48#endif
49
50#ifndef _GL_ARPA_INET_H
51#define _GL_ARPA_INET_H
52
49114fd4
LC
53/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
54
1cd4fffc
LC
55/* The definition of _GL_ARG_NONNULL is copied here. */
56
61cd9dc9
LC
57/* The definition of _GL_WARN_ON_USE is copied here. */
58
8912421c
LC
59
60#if @GNULIB_INET_NTOP@
61# if !@HAVE_DECL_INET_NTOP@
62/* Converts an internet address from internal format to a printable,
63 presentable format.
64 AF is an internet address family, such as AF_INET or AF_INET6.
65 SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
66 (for AF_INET6).
67 DST points to a buffer having room for CNT bytes.
68 The printable representation of the address (in numeric form, not
69 surrounded by [...], no reverse DNS is done) is placed in DST, and
70 DST is returned. If an error occurs, the return value is NULL and
71 errno is set. If CNT bytes are not sufficient to hold the result,
72 the return value is NULL and errno is set to ENOSPC. A good value
73 for CNT is 46.
74
75 For more details, see the POSIX:2001 specification
76 <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
49114fd4
LC
77_GL_FUNCDECL_SYS (inet_ntop, const char *,
78 (int af, const void *restrict src,
79 char *restrict dst, socklen_t cnt)
80 _GL_ARG_NONNULL ((2, 3)));
8912421c 81# endif
49114fd4
LC
82/* Need to cast, because on NonStop Kernel, the fourth parameter is
83 size_t cnt. */
84_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
85 (int af, const void *restrict src,
86 char *restrict dst, socklen_t cnt));
87_GL_CXXALIASWARN (inet_ntop);
8912421c
LC
88#elif defined GNULIB_POSIXCHECK
89# undef inet_ntop
61cd9dc9
LC
90# if HAVE_RAW_DECL_INET_NTOP
91_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
92 "use gnulib module inet_ntop for portability");
93# endif
8912421c
LC
94#endif
95
96#if @GNULIB_INET_PTON@
97# if !@HAVE_DECL_INET_PTON@
49114fd4
LC
98_GL_FUNCDECL_SYS (inet_pton, int,
99 (int af, const char *restrict src, void *restrict dst)
100 _GL_ARG_NONNULL ((2, 3)));
8912421c 101# endif
49114fd4
LC
102_GL_CXXALIAS_SYS (inet_pton, int,
103 (int af, const char *restrict src, void *restrict dst));
104_GL_CXXALIASWARN (inet_pton);
8912421c
LC
105#elif defined GNULIB_POSIXCHECK
106# undef inet_pton
61cd9dc9
LC
107# if HAVE_RAW_DECL_INET_PTON
108_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
109 "use gnulib module inet_pton for portability");
110# endif
8912421c
LC
111#endif
112
8912421c
LC
113
114#endif /* _GL_ARPA_INET_H */
115#endif /* _GL_ARPA_INET_H */