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