annotate lib/inet_ntop.h @ 9268:a553c18c572d

Rename sys_time_.h to sys_time.in.h.
author Bruno Haible <bruno@clisp.org>
date Tue, 02 Oct 2007 00:37:40 +0200
parents 9f7f0714a40a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Convert internet address from internal to printable, presentable format.
6573
d6fe320d0a0d Fix inet_ntop on mingw32.
Simon Josefsson <simon@josefsson.org>
parents: 6445
diff changeset
2 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 5825
diff changeset
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #include <sys/types.h>
6573
d6fe320d0a0d Fix inet_ntop on mingw32.
Simon Josefsson <simon@josefsson.org>
parents: 6445
diff changeset
19 #include <sys/socket.h>
7064
9f7f0714a40a Use netinet_in module.
Simon Josefsson <simon@josefsson.org>
parents: 7062
diff changeset
20 #include <netinet/in.h>
7062
532bc2e00710 Use arpa_inet in inet_?to?.
Simon Josefsson <simon@josefsson.org>
parents: 7060
diff changeset
21 #include <arpa/inet.h>
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 /* Converts an internet address from internal format to a printable,
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 presentable format.
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 AF is an internet address family, such as AF_INET or AF_INET6.
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 (for AF_INET6).
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 DST points to a buffer having room for CNT bytes.
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 The printable representation of the address (in numeric form, not
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 surrounded by [...], no reverse DNS is done) is placed in DST, and
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 DST is returned. If an error occurs, the return value is NULL and
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 errno is set. If CNT bytes are not sufficient to hold the result,
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 the return value is NULL and errno is set to ENOSPC. A good value
5979
5cc92ab8ce76 Use shortcut links to the POSIX specification.
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
34 for CNT is 46.
5cc92ab8ce76 Use shortcut links to the POSIX specification.
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
35
5cc92ab8ce76 Use shortcut links to the POSIX specification.
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
36 For more details, see the POSIX:2001 specification
5cc92ab8ce76 Use shortcut links to the POSIX specification.
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
37 <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38
6445
87f075c0178d * inet_ntop.h: Use #if !, not #ifndef, for AC_CHECK_DECLS.
Simon Josefsson <simon@josefsson.org>
parents: 6435
diff changeset
39 #if !HAVE_DECL_INET_NTOP
6435
be00741570b7 Fix inet_ntop on mingw32.
Simon Josefsson <simon@josefsson.org>
parents: 5979
diff changeset
40 extern const char *inet_ntop (int af, const void *restrict src,
be00741570b7 Fix inet_ntop on mingw32.
Simon Josefsson <simon@josefsson.org>
parents: 5979
diff changeset
41 char *restrict dst, socklen_t cnt);
5825
96441be32be1 New module 'inet_ntop'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 #endif