xref: /386bsd/usr/share/man/cat3/inet.0 (revision a2142627)
1INET(3)                   386BSD Programmer's Manual                   INET(3)
2
3NNAAMMEE
4     iinneett__aattoonn, iinneett__aaddddrr, iinneett__nneettwwoorrkk, iinneett__nnttooaa, iinneett__mmaakkeeaaddddrr, iinneett__llnnaaooff,
5     iinneett__nneettooff - Internet address manipulation routines
6
7SSYYNNOOPPSSIISS
8     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
9     ##iinncclluuddee <<nneettiinneett//iinn..hh>>
10     ##iinncclluuddee <<aarrppaa//iinneett..hh>>
11
12     _i_n_t
13     iinneett__aattoonn(_c_h_a_r *_c_p, _s_t_r_u_c_t _i_n__a_d_d_r *_p_i_n)
14
15     _u_n_s_i_g_n_e_d _l_o_n_g
16     iinneett__aaddddrr(_c_h_a_r *_c_p)
17
18     _u_n_s_i_g_n_e_d _l_o_n_g
19     iinneett__nneettwwoorrkk(_c_h_a_r *_c_p)
20
21     _c_h_a_r *
22     iinneett__nnttooaa(_s_t_r_u_c_t _i_n__a_d_d_r _i_n)
23
24     _s_t_r_u_c_t _i_n__a_d_d_r
25     iinneett__mmaakkeeaaddddrr(_i_n_t _n_e_t, _i_n_t _l_n_a)
26
27     _u_n_s_i_g_n_e_d _l_o_n_g
28     iinneett__llnnaaooff(_s_t_r_u_c_t _i_n__a_d_d_r _i_n)
29
30     _u_n_s_i_g_n_e_d _l_o_n_g
31     iinneett__nneettooff(_s_t_r_u_c_t _i_n__a_d_d_r _i_n)
32
33DDEESSCCRRIIPPTTIIOONN
34     The routines iinneett__aattoonn(), iinneett__aaddddrr() and iinneett__nneettwwoorrkk() interpret
35     character strings representing numbers expressed in the Internet standard
36     `.' notation.  The iinneett__aattoonn() 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 iinneett__aaddddrr() and iinneett__nneettwwoorrkk() functions
40     return numbers suitable for use as Internet addresses and Internet
41     network numbers, respectively.  The routine iinneett__nnttooaa() takes an Internet
42     address and returns an ASCII string representing the address in `.'
43     notation.  The routine iinneett__mmaakkeeaaddddrr() takes an Internet network number
44     and a local network address and constructs an Internet address from it.
45     The routines iinneett__nneettooff() and iinneett__llnnaaooff() break apart Internet host
46     addresses, returning the network number and local network address part,
47     respectively.
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
53IINNTTEERRNNEETT AADDDDRREESSSSEESS
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
69     address.  This makes the three part address format convenient for
70     specifying 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
75     specifying 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,
81     octal, or hexadecimal, as specified in the C language (i.e., a leading 0x
82     or 0X implies hexadecimal; otherwise, a leading 0 implies octal;
83     otherwise, the number is interpreted as decimal).
84
85DDIIAAGGNNOOSSTTIICCSS
86     The constant INADDR_NONE is returned by iinneett__aaddddrr() and iinneett__nneettwwoorrkk()
87     for malformed requests.
88
89SSEEEE AALLSSOO
90     gethostbyname(3),  getnetent(3),  hosts(5),  networks(5),
91
92HHIISSTTOORRYY
93     These functions appeared in 4.2BSD.
94
95BBUUGGSS
96     The value INADDR_NONE (0xffffffff) is a valid broadcast address, but
97     iinneett__aaddddrr() cannot return that value without indicating failure.  The
98     newer iinneett__aattoonn() function does not share this problem.  The problem of
99     host byte ordering versus network byte ordering is confusing.  The string
100     returned by iinneett__nnttooaa() resides in a static memory area.
101
102     Inet_addr should return a _s_t_r_u_c_t _i_n__a_d_d_r.
103
1044.2 Berkeley Distribution       April 19, 1991                               2
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133