Fix inet_ntop on mingw32.
[gnulib.git] / lib / inet_ntop.h
1 /* Convert internet address from internal to printable, presentable format.
2    Copyright (C) 2005 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17
18 #include <sys/types.h>
19 #ifdef HAVE_SYS_SOCKET_H
20 # include <sys/socket.h>
21 #endif
22 #ifdef HAVE_ARPA_INET_H
23 # include <arpa/inet.h>
24 #endif
25
26 /* Converts an internet address from internal format to a printable,
27    presentable format.
28    AF is an internet address family, such as AF_INET or AF_INET6.
29    SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
30    (for AF_INET6).
31    DST points to a buffer having room for CNT bytes.
32    The printable representation of the address (in numeric form, not
33    surrounded by [...], no reverse DNS is done) is placed in DST, and
34    DST is returned.  If an error occurs, the return value is NULL and
35    errno is set.  If CNT bytes are not sufficient to hold the result,
36    the return value is NULL and errno is set to ENOSPC.  A good value
37    for CNT is 46.
38
39    For more details, see the POSIX:2001 specification
40    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
41
42 #ifndef HAVE_DECL_INET_NTOP
43 extern const char *inet_ntop (int af, const void *restrict src,
44                               char *restrict dst, socklen_t cnt);
45 #endif