Imported Upstream version 2.5.2p1
[debian/amanda] / gnulib / inet_ntop.h
1 /* Convert internet address from internal to printable, presentable format.
2    Copyright (C) 2005, 2006 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 #include <sys/socket.h>
20 #include <netinet/in.h>
21 #include <arpa/inet.h>
22
23 /* Converts an internet address from internal format to a printable,
24    presentable format.
25    AF is an internet address family, such as AF_INET or AF_INET6.
26    SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
27    (for AF_INET6).
28    DST points to a buffer having room for CNT bytes.
29    The printable representation of the address (in numeric form, not
30    surrounded by [...], no reverse DNS is done) is placed in DST, and
31    DST is returned.  If an error occurs, the return value is NULL and
32    errno is set.  If CNT bytes are not sufficient to hold the result,
33    the return value is NULL and errno is set to ENOSPC.  A good value
34    for CNT is 46.
35
36    For more details, see the POSIX:2001 specification
37    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
38
39 #if !HAVE_DECL_INET_NTOP
40 extern const char *inet_ntop (int af, const void *restrict src,
41                               char *restrict dst, socklen_t cnt);
42 #endif