version 4 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
INET |
|
|
2 |
!!!INET |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
CONFORMING TO |
|
|
7 |
SEE ALSO |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
inet_aton, inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, inet_netof - Internet address manipulation routines |
|
|
13 |
!!SYNOPSIS |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
__#include |
|
|
17 |
__''cp''__, struct in_addr *__''inp''__); |
|
|
18 |
in_addr_t inet_addr(const char *__''cp''__); |
|
|
19 |
in_addr_t inet_network(const char *__''cp''__); |
|
|
20 |
char *inet_ntoa(struct in_addr__ ''in''__); |
|
|
21 |
struct in_addr inet_makeaddr(int__ ''net''__, int__ ''host''__); |
|
|
22 |
in_addr_t inet_lnaof(struct in_addr__ ''in''__); |
|
|
23 |
in_addr_t inet_netof(struct in_addr__ ''in''__); |
|
|
24 |
__ |
|
|
25 |
!!DESCRIPTION |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
__inet_aton()__ converts the Internet host address |
|
|
29 |
''cp'' from the standard numbers-and-dots notation into |
|
|
30 |
binary data and stores it in the structure that ''inp'' |
|
|
31 |
points to. __inet_aton__ returns nonzero if the address |
|
|
32 |
is valid, zero if not. |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
The __inet_addr()__ function converts the Internet host |
|
|
36 |
address ''cp'' from numbers-and-dots notation into binary |
|
|
37 |
data in network byte order. If the input is invalid, |
|
|
38 |
INADDR_NONE (usually -1) is returned. This is an |
|
|
39 |
''obsolete'' interface to __inet_aton__, described |
|
|
40 |
immediately above; it is obsolete because -1 is a valid |
|
|
41 |
address (255.255.255.255), and __inet_aton__ provides a |
|
|
42 |
cleaner way to indicate error return. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
The __inet_network()__ function extracts the network |
|
|
46 |
number in host byte order from the address ''cp'' in |
|
|
47 |
numbers-and-dots notation. If the input is invalid, -1 is |
|
|
48 |
returned. |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
The __inet_ntoa()__ function converts the Internet host |
|
|
52 |
address ''in'' given in network byte order to a string in |
|
|
53 |
standard numbers-and-dots notation. The string is returned |
|
|
54 |
in a statically allocated buffer, which subsequent calls |
|
|
55 |
will overwrite. |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
The __inet_makeaddr()__ function makes an Internet host |
|
|
59 |
address in network byte order by combining the network |
|
|
60 |
number ''net'' with the local address ''host'' in |
|
|
61 |
network ''net'', both in local host byte |
|
|
62 |
order. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
The __inet_lnaof()__ function returns the local host |
|
|
66 |
address part of the Internet address ''in''. The local |
|
|
67 |
host address is returned in local host byte |
|
|
68 |
order. |
|
|
69 |
|
|
|
70 |
|
|
|
71 |
The __inet_netof()__ function returns the network number |
|
|
72 |
part of the Internet Address ''in''. The network number |
|
|
73 |
is returned in local host byte order. |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
The structure ''in_addr'' as used in __inet_ntoa()__, |
|
|
77 |
__inet_makeaddr()__, __inet_lnoaf()__ and |
|
|
78 |
__inet_netof()__ is defined in ''netinet/in.h'' |
|
|
79 |
as: |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
struct in_addr { |
|
|
83 |
unsigned long int s_addr; |
|
|
84 |
} |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
Note that on the i80x86 the host byte order is Least |
|
|
88 |
Significant Byte first, whereas the network byte order, as |
|
|
89 |
used on the Internet, is Most Significant Byte |
|
|
90 |
first. |
|
|
91 |
!!CONFORMING TO |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
BSD 4.3 |
|
|
95 |
!!SEE ALSO |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
gethostbyname(3), getnetent(3), |
|
|
99 |
inet_ntop(3), __inet_pton__(3), hosts(5), |
|
|
100 |
networks(5) |
|
|
101 |
---- |