1 /****** bsdsocket.library/inet_addr *****************************************
4 * inet_addr, inet_network, Inet_MakeAddr, Inet_LnaOf,
5 * Inet_NetOf, Inet_NtoA - Internet address manipulation
7 * inet_makeaddr, inet_lnaof, inet_netof,
8 * inet_ntoa -- inline/stub functions to handle structure arguments
11 * #include <netinet/in.h>
13 * addr = inet_addr(cp)
16 * unsigned long inet_addr(char *);
18 * net = inet_network(cp)
21 * unsigned long inet_network(char *);
23 * in_addr = Inet_MakeAddr(net, lna)
26 * unsigned long Inet_MakeAddr(long, long);
28 * lna = Inet_LnaOf(in)
31 * long Inet_LnaOf(unsigned long);
33 * net = Inet_NetOf(in)
36 * long Inet_NetOf(unsigned long);
38 * addr = Inet_NtoA(in)
41 * char * Inet_NtoA(unsigned long);
44 * in_addr = inet_makeaddr(net, lna)
46 * struct in_addr inet_makeaddr(long, long);
48 * lna = inet_lnaof(in)
50 * int inet_lnaof(struct in_addr);
52 * net = inet_netof(in)
54 * int inet_netof(struct in_addr);
56 * addr = inet_ntoa(in)
58 * char * inet_ntoa(struct in_addr);
61 * Return value of Inet_MakeAddr() and argument types of
62 * Inet_LnaOf(), Inet_NetOf() and Inet_NtoA() are longs instead
63 * of struct in_addr. The original behaviour is achieved by
64 * using included stub functions (lower case function names)
65 * which handle structure arguments.
68 * The routines inet_addr() and inet_network() each interpret
69 * character strings representing numbers expressed in the
70 * Internet standard `.' notation, returning numbers suitable
71 * for use as Internet addresses and Internet network numbers,
72 * respectively. The routine inet_makeaddr() takes an Internet
73 * network number and a local network address and constructs an
74 * Internet address from it. The routines inet_netof() and
75 * inet_lnaof() break apart Internet host addresses, returning
76 * the network number and local network address part, respec-
79 * The routine inet_ntoa() returns a pointer to a string in the
80 * base 256 notation ``d.d.d.d'' described below.
82 * All Internet address are returned in network order (bytes
83 * ordered from left to right). All network numbers and local
84 * address parts are returned as machine format integer values.
87 * Values specified using the `.' notation take one of the
96 * When four parts are specified, each is interpreted as a byte
97 * of data and assigned, from left to right, to the four bytes
98 * of an Internet address. Note: when an Internet address is
99 * viewed as a 32-bit integer quantity on little endian
100 * systems, the bytes referred to above appear as d.c.b.a.
101 * bytes are ordered from right to left.
103 * When a three part address is specified, the last part is
104 * interpreted as a 16-bit quantity and placed in the right
105 * most two bytes of the network address. This makes the three
106 * part address format convenient for specifying Class B net-
107 * work addresses as "128.net.host".
109 * When a two part address is supplied, the last part is inter-
110 * preted as a 24-bit quantity and placed in the right most
111 * three bytes of the network address. This makes the two part
112 * address format convenient for specifying Class A network
113 * addresses as "net.host".
115 * When only one part is given, the value is stored directly in
116 * the network address without any byte rearrangement.
118 * All numbers supplied as ``parts'' in a `.' notation may be
119 * decimal, octal, or hexadecimal, as specified in the C
120 * language (that is, a leading 0x or 0X implies hexadecimal;
121 * otherwise, a leading 0 implies octal; otherwise, the number
122 * is interpreted as decimal).
125 * The value -1 is returned by inet_addr() and inet_network()
126 * for malformed requests.
129 * The problem of host byte ordering versus network byte order-
130 * ing is confusing. A simple way to specify Class C network
131 * addresses in a manner similar to that for Class B and Class
134 * The return value from inet_ntoa() points to static buffer
135 * which is overwritten in each inet_ntoa() call.
137 *****************************************************************************
142 /****** bsdsocket.library/Inet_LnaOf ****************************************
147 *****************************************************************************
152 /****** bsdsocket.library/inet_lnaof ****************************************
157 *****************************************************************************
162 /****** bsdsocket.library/inet_MakeAddr *************************************
167 *****************************************************************************
172 /****** bsdsocket.library/inet_makeaddr *************************************
177 *****************************************************************************
182 /****** bsdsocket.library/Inet_NetOf ****************************************
187 *****************************************************************************
192 /****** bsdsocket.library/inet_netof ****************************************
197 *****************************************************************************
202 /****** bsdsocket.library/inet_network **************************************
207 *****************************************************************************
212 /****** bsdsocket.library/Inet_NtoA *****************************************
217 *****************************************************************************
222 /****** bsdsocket.library/inet_ntoa *****************************************
227 *****************************************************************************