Mercurial > hg > octave-kai > gnulib-hg
annotate lib/arpa_inet.in.h @ 11527:4fe203c3f828
Replace wcrtomb, wcsrtombs, wcsnrtombs if mbstate_t has to be replaced.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 01 May 2009 18:01:52 +0200 |
parents | 96c5472dd7a2 |
children | e8d2c6fc33ad |
rev | line source |
---|---|
10010
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
1 /* A GNU-like <arpa/inet.h>. |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
2 |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
3 Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc. |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
4 |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
5 This program is free software; you can redistribute it and/or modify |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
7 the Free Software Foundation; either version 2, or (at your option) |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
8 any later version. |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
9 |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
13 GNU General Public License for more details. |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
14 |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
16 along with this program; if not, write to the Free Software Foundation, |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
18 |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
19 #ifndef _GL_ARPA_INET_H |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
20 |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
21 /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
22 under MinGW. */ |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
23 #include <sys/socket.h> |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
24 |
10010
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
25 #if @HAVE_ARPA_INET_H@ |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
26 |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10498
diff
changeset
|
27 # if __GNUC__ >= 3 |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10010
diff
changeset
|
28 @PRAGMA_SYSTEM_HEADER@ |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10498
diff
changeset
|
29 # endif |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10010
diff
changeset
|
30 |
10010
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
31 /* The include_next requires a split double-inclusion guard. */ |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
32 # @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@ |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
33 |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
34 #endif |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
35 |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
36 #ifndef _GL_ARPA_INET_H |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
37 #define _GL_ARPA_INET_H |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
38 |
10498
8bc209f25988
Provide the definition of GL_LINK-WARNING.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
39 /* The definition of GL_LINK_WARNING is copied here. */ |
8bc209f25988
Provide the definition of GL_LINK-WARNING.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
40 |
11022
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
41 #ifdef __cplusplus |
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
42 extern "C" { |
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
43 #endif |
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
44 |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
45 #if @GNULIB_INET_NTOP@ |
9993
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
46 # if !@HAVE_DECL_INET_NTOP@ |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
47 /* Converts an internet address from internal format to a printable, |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
48 presentable format. |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
49 AF is an internet address family, such as AF_INET or AF_INET6. |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
50 SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr' |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
51 (for AF_INET6). |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
52 DST points to a buffer having room for CNT bytes. |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
53 The printable representation of the address (in numeric form, not |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
54 surrounded by [...], no reverse DNS is done) is placed in DST, and |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
55 DST is returned. If an error occurs, the return value is NULL and |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
56 errno is set. If CNT bytes are not sufficient to hold the result, |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
57 the return value is NULL and errno is set to ENOSPC. A good value |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
58 for CNT is 46. |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
59 |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
60 For more details, see the POSIX:2001 specification |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
61 <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */ |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
62 extern const char *inet_ntop (int af, const void *restrict src, |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
63 char *restrict dst, socklen_t cnt); |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
64 # endif |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
65 #elif defined GNULIB_POSIXCHECK |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
66 # undef inet_ntop |
10010
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
67 # define inet_ntop(af,src,dst,cnt) \ |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
68 (GL_LINK_WARNING ("inet_ntop is unportable - " \ |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
69 "use gnulib module inet_ntop for portability"), \ |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
70 inet_ntop (af, src, dst, cnt)) |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
71 #endif |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
72 |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
73 #if @GNULIB_INET_PTON@ |
9993
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
74 # if !@HAVE_DECL_INET_PTON@ |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
75 extern int inet_pton (int af, const char *restrict src, void *restrict dst); |
4d5ba95a0dec
Move inet_ntop and inet_pton declarations to arpa/inet.h.
Simon Josefsson <simon@josefsson.org>
parents:
9965
diff
changeset
|
76 # endif |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
77 #elif defined GNULIB_POSIXCHECK |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
78 # undef inet_pton |
10010
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
79 # define inet_pton(af,src,dst) \ |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
80 (GL_LINK_WARNING ("inet_pton is unportable - " \ |
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
81 "use gnulib module inet_pton for portability"), \ |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
82 inet_pton (af, src, dst)) |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
83 #endif |
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
84 |
11022
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
85 #ifdef __cplusplus |
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
86 } |
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
87 #endif |
96c5472dd7a2
lib/arpa_inet.in.h: Add extern "C" block for C++.
Albert Chin-A-Young <china@thewrittenword.com>
parents:
10655
diff
changeset
|
88 |
9965
e624bf7756b1
Add file, was missing from last commit.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
89 #endif /* _GL_ARPA_INET_H */ |
10010
d26ac8a528f7
Enable gnulib's <arpa/inet.h> replacement also when inet_ntop or inet_pton need to be declared.
Bruno Haible <bruno@clisp.org>
parents:
9993
diff
changeset
|
90 #endif /* _GL_ARPA_INET_H */ |