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