Commit | Line | Data |
---|---|---|
8bb980a3 C |
1 | INET(3) BSD Programmer's Manual INET(3) |
2 | ||
3 | N\bNA\bAM\bME\bE | |
4 | i\bin\bne\bet\bt_\b_a\bat\bto\bon\bn, i\bin\bne\bet\bt_\b_a\bad\bdd\bdr\br, i\bin\bne\bet\bt_\b_n\bne\bet\btw\bwo\bor\brk\bk, i\bin\bne\bet\bt_\b_n\bnt\bto\boa\ba, i\bin\bne\bet\bt_\b_m\bma\bak\bke\bea\bad\bdd\bdr\br, i\bin\bne\bet\bt_\b_l\bln\bna\bao\bof\bf, | |
5 | i\bin\bne\bet\bt_\b_n\bne\bet\bto\bof\bf - Internet address manipulation routines | |
6 | ||
7 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
8 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bso\boc\bck\bke\bet\bt.\b.h\bh>\b> | |
9 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<n\bne\bet\bti\bin\bne\bet\bt/\b/i\bin\bn.\b.h\bh>\b> | |
10 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<a\bar\brp\bpa\ba/\b/i\bin\bne\bet\bt.\b.h\bh>\b> | |
11 | ||
12 | _\bi_\bn_\bt | |
13 | i\bin\bne\bet\bt_\b_a\bat\bto\bon\bn(_\bc_\bh_\ba_\br _\b*_\bc_\bp, _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bn_\b__\ba_\bd_\bd_\br _\b*_\bp_\bi_\bn); | |
14 | ||
15 | _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg | |
16 | i\bin\bne\bet\bt_\b_a\bad\bdd\bdr\br(_\bc_\bh_\ba_\br _\b*_\bc_\bp); | |
17 | ||
18 | _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg | |
19 | i\bin\bne\bet\bt_\b_n\bne\bet\btw\bwo\bor\brk\bk(_\bc_\bh_\ba_\br _\b*_\bc_\bp); | |
20 | ||
21 | _\bc_\bh_\ba_\br _\b* | |
22 | i\bin\bne\bet\bt_\b_n\bnt\bto\boa\ba(_\bs_\bt_\br_\bu_\bc_\bt _\bi_\bn_\b__\ba_\bd_\bd_\br _\bi_\bn); | |
23 | ||
24 | _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bn_\b__\ba_\bd_\bd_\br | |
25 | i\bin\bne\bet\bt_\b_m\bma\bak\bke\bea\bad\bdd\bdr\br(_\bi_\bn_\bt _\bn_\be_\bt, _\bi_\bn_\bt _\bl_\bn_\ba); | |
26 | ||
27 | _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg | |
28 | i\bin\bne\bet\bt_\b_l\bln\bna\bao\bof\bf(_\bs_\bt_\br_\bu_\bc_\bt _\bi_\bn_\b__\ba_\bd_\bd_\br _\bi_\bn); | |
29 | ||
30 | _\bu_\bn_\bs_\bi_\bg_\bn_\be_\bd _\bl_\bo_\bn_\bg | |
31 | i\bin\bne\bet\bt_\b_n\bne\bet\bto\bof\bf(_\bs_\bt_\br_\bu_\bc_\bt _\bi_\bn_\b__\ba_\bd_\bd_\br _\bi_\bn); | |
32 | ||
33 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
34 | The routines i\bin\bne\bet\bt_\b_a\bat\bto\bon\bn(), i\bin\bne\bet\bt_\b_a\bad\bdd\bdr\br() and i\bin\bne\bet\bt_\b_n\bne\bet\btw\bwo\bor\brk\bk() interpret char- | |
35 | acter strings representing numbers expressed in the Internet standard `.' | |
36 | notation. The i\bin\bne\bet\bt_\b_a\bat\bto\bon\bn() routine interprets the specified character | |
37 | string as an Internet address, placing the address into the structure | |
38 | provided. It returns 1 if the string was successfully interpreted, or 0 | |
39 | if the string is invalid. The i\bin\bne\bet\bt_\b_a\bad\bdd\bdr\br() and i\bin\bne\bet\bt_\b_n\bne\bet\btw\bwo\bor\brk\bk() functions | |
40 | return numbers suitable for use as Internet addresses and Internet net- | |
41 | work numbers, respectively. The routine i\bin\bne\bet\bt_\b_n\bnt\bto\boa\ba() takes an Internet | |
42 | address and returns an ASCII string representing the address in `.' nota- | |
43 | tion. The routine i\bin\bne\bet\bt_\b_m\bma\bak\bke\bea\bad\bdd\bdr\br() takes an Internet network number and a | |
44 | local network address and constructs an Internet address from it. The | |
45 | routines i\bin\bne\bet\bt_\b_n\bne\bet\bto\bof\bf() and i\bin\bne\bet\bt_\b_l\bln\bna\bao\bof\bf() break apart Internet host address- | |
46 | es, returning the network number and local network address part, respec- | |
47 | tively. | |
48 | ||
49 | All Internet addresses are returned in network order (bytes ordered from | |
50 | left to right). All network numbers and local address parts are returned | |
51 | as machine format integer values. | |
52 | ||
53 | I\bIN\bNT\bTE\bER\bRN\bNE\bET\bT A\bAD\bDD\bDR\bRE\bES\bSS\bSE\bES\bS | |
54 | Values specified using the `.' notation take one of the following forms: | |
55 | ||
56 | a.b.c.d | |
57 | a.b.c | |
58 | a.b | |
59 | a | |
60 | ||
61 | When four parts are specified, each is interpreted as a byte of data and | |
62 | assigned, from left to right, to the four bytes of an Internet address. | |
63 | Note that when an Internet address is viewed as a 32-bit integer quantity | |
64 | on the VAX the bytes referred to above appear as ``d.c.b.a''. That is, | |
65 | VAX bytes are ordered from right to left. | |
66 | ||
67 | When a three part address is specified, the last part is interpreted as a | |
68 | 16-bit quantity and placed in the right-most two bytes of the network ad- | |
69 | dress. This makes the three part address format convenient for specify- | |
70 | ing Class B network addresses as ``128.net.host''. | |
71 | ||
72 | When a two part address is supplied, the last part is interpreted as a | |
73 | 24-bit quantity and placed in the right most three bytes of the network | |
74 | address. This makes the two part address format convenient for specify- | |
75 | ing Class A network addresses as ``net.host''. | |
76 | ||
77 | When only one part is given, the value is stored directly in the network | |
78 | address without any byte rearrangement. | |
79 | ||
80 | All numbers supplied as ``parts'' in a `.' notation may be decimal, oc- | |
81 | tal, or hexadecimal, as specified in the C language (i.e., a leading 0x | |
82 | or 0X implies hexadecimal; otherwise, a leading 0 implies octal; other- | |
83 | wise, the number is interpreted as decimal). | |
84 | ||
85 | D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS | |
86 | The constant INADDR_NONE is returned by i\bin\bne\bet\bt_\b_a\bad\bdd\bdr\br() and i\bin\bne\bet\bt_\b_n\bne\bet\btw\bwo\bor\brk\bk() | |
87 | for malformed requests. | |
88 | ||
89 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
90 | gethostbyname(3), getnetent(3), hosts(5), networks(5), | |
91 | ||
92 | H\bHI\bIS\bST\bTO\bOR\bRY\bY | |
93 | These functions appeared in 4.2BSD. | |
94 | ||
95 | B\bBU\bUG\bGS\bS | |
96 | The value INADDR_NONE (0xffffffff) is a valid broadcast address, but | |
97 | i\bin\bne\bet\bt_\b_a\bad\bdd\bdr\br() cannot return that value without indicating failure. The | |
98 | newer i\bin\bne\bet\bt_\b_a\bat\bto\bon\bn() function does not share this problem. The problem of | |
99 | host byte ordering versus network byte ordering is confusing. The string | |
100 | returned by i\bin\bne\bet\bt_\b_n\bnt\bto\boa\ba() resides in a static memory area. | |
101 | ||
102 | Inet_addr should return a _\bs_\bt_\br_\bu_\bc_\bt _\bi_\bn_\b__\ba_\bd_\bd_\br. | |
103 | ||
104 | 4.2 Berkeley Distribution June 4, 1993 2 |