]> git.ipfire.org Git - thirdparty/glibc.git/blame - inet/arpa/inet.h
Update.
[thirdparty/glibc.git] / inet / arpa / inet.h
CommitLineData
ad483238 1/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
26dee9c4
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 The GNU C Library 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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
18
19#ifndef _ARPA_INET_H
26dee9c4 20#define _ARPA_INET_H 1
5107cf1d 21
26dee9c4 22#include <features.h>
c224a18a 23#include <sys/types.h>
5290baf0 24#include <netinet/in.h> /* To define `struct in_addr'. */
28f540f4
RM
25
26__BEGIN_DECLS
26dee9c4
UD
27
28/* Convert Internet host address from numbers-and-dots notation in CP
29 into binary data in network byte order. */
ad483238 30extern in_addr_t inet_addr (__const char *__cp) __THROW;
26dee9c4
UD
31
32/* Return the local host address part of the Internet address in IN. */
ad483238 33extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
26dee9c4
UD
34
35/* Make Internet host address in network byte order by combining the
36 network number NET with the local address HOST. */
ad483238
UD
37extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
38 __THROW;
26dee9c4
UD
39
40/* Return network number part of the Internet address IN. */
ad483238 41extern in_addr_t inet_netof (struct in_addr __in) __THROW;
26dee9c4
UD
42
43/* Extract the network number in network byte order from the address
44 in numbers-and-dots natation starting at CP. */
ad483238 45extern in_addr_t inet_network (__const char *__cp) __THROW;
26dee9c4
UD
46
47/* Convert Internet number in IN to ASCII representation. The return value
48 is a pointer to an internal array containing the string. */
4d3a563f 49extern char *inet_ntoa (struct in_addr __in) __THROW;
26dee9c4
UD
50
51/* Convert from presentation format of an Internet number in buffer
52 starting at CP to the binary network format and store result for
53 interface type AF in buffer starting at BUF. */
98cbe360
UD
54extern int inet_pton (int __af, __const char *__restrict __cp,
55 void *__restrict __buf) __THROW;
26dee9c4
UD
56
57/* Convert a Internet address in binary network format for interface
58 type AF in buffer starting at CP to presentation form and place
59 result in buffer of length LEN astarting at BUF. */
98cbe360
UD
60extern __const char *inet_ntop (int __af, __const void *__restrict __cp,
61 char *__restrict __buf, socklen_t __len)
62 __THROW;
ad483238
UD
63
64
65/* The following functions are not part of XNS 5.2. */
66#ifdef __USE_MISC
67/* Convert Internet host address from numbers-and-dots notation in CP
68 into binary data and store the result in the structure INP. */
69extern in_addr_t inet_aton (__const char *__cp, struct in_addr *__inp) __THROW;
70
71/* Format a network number NET into presentation format and place result
72 in buffer starting at BUF with length of LEN bytes. */
73extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
74
75/* Convert network number for interface type AF in buffer starting at
76 CP to presentation format. The result will specifiy BITS bits of
77 the number. */
78extern char *inet_net_ntop (int __af, __const void *__cp, int __bits,
79 char *__buf, size_t __len) __THROW;
80
81/* Convert network number for interface type AF from presentation in
82 buffer starting at CP to network format and store result int
83 buffer starting at BUF of size LEN. */
84extern int inet_net_pton (int __af, __const char *__cp,
85 void *__buf, size_t __len) __THROW;
26dee9c4
UD
86
87/* Convert ASCII representation in hexadecimal form of the Internet
88 address to binary form and place result in buffer of length LEN
89 starting at BUF. */
4d3a563f
UD
90extern unsigned int inet_nsap_addr (__const char *__cp,
91 unsigned char *__buf, int __len) __THROW;
26dee9c4
UD
92
93/* Convert internet address in binary form in LEN bytes starting at CP
94 a presentation form and place result in BUF. */
4d3a563f
UD
95extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp,
96 char *__buf) __THROW;
ad483238 97#endif
26dee9c4 98
28f540f4
RM
99__END_DECLS
100
26dee9c4 101#endif /* arpa/inet.h */