1inet_addr(3XNET) X/Open Networking Services Library Functions inet_addr(3XNET)
2
3
4

NAME

6       inet_addr,   inet_network,   inet_makeaddr,   inet_lnaof,   inet_netof,
7       inet_ntoa - Internet address manipulation
8

SYNOPSIS

10       cc [ flag ... ] file ... -lxnet [ library ... ]
11       #include <arpa/inet.h>
12
13       in_addr_t inet_addr(const char *cp);
14
15
16       in_addr_t inet_lnaof(struct in_addr in);
17
18
19       struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna);
20
21
22       in_addr_t inet_netof(struct in_addr in);
23
24
25       in_addr_t inet_network(const char *cp);
26
27
28       char *inet_ntoa(struct in_addr in);
29
30

DESCRIPTION

32       The inet_addr() function converts the string pointed to by cp,  in  the
33       Internet standard dot notation, to an integer value suitable for use as
34       an Internet address.
35
36
37       The inet_lnaof() function takes an Internet host address  specified  by
38       in and extracts the local network address part, in host byte order.
39
40
41       The  inet_makeaddr()  function takes the Internet network number speci‐
42       fied by net and the local network address specified  by  lna,  both  in
43       host byte order, and constructs an Internet address from them.
44
45
46       The  inet_netof()  function takes an Internet host address specified by
47       in and extracts the network number part, in host byte order.
48
49
50       The inet_network() function converts the string pointed to  by  cp,  in
51       the  Internet  standard  dot notation, to an integer value suitable for
52       use as an Internet network number.
53
54
55       The inet_ntoa() function converts the Internet host  address  specified
56       by in to a string in the Internet standard dot notation.
57
58
59       All  Internet  addresses  are  returned in network order (bytes ordered
60       from left to right).
61
62
63       Values specified using dot notation take one of the following forms:
64
65       a.b.c.d    When four parts are specified, each is interpreted as a byte
66                  of  data and assigned, from left to right, to the four bytes
67                  of an Internet address.
68
69
70       a.b.c      When a three-part address is specified,  the  last  part  is
71                  interpreted as a 16-bit quantity and placed in the rightmost
72                  two bytes of the network address. This makes the  three-part
73                  address  format  convenient  for  specifying Class B network
74                  addresses as 128.net.host.
75
76
77       a.b        When a two-part address is supplied, the last part is inter‐
78                  preted  as  a  24-bit  quantity  and placed in the rightmost
79                  three bytes of the network address. This makes the  two-part
80                  address  format  convenient  for  specifying Class A network
81                  addresses as net.host.
82
83
84       a          When only one part is given, the value is stored directly in
85                  the network address without any byte rearrangement.
86
87
88
89       All numbers supplied as parts in dot notation may be decimal, octal, or
90       hexadecimal, that is, a leading 0x or 0X implies hexadecimal, as speci‐
91       fied  in the ISO C standard; otherwise, a leading 0 implies octal; oth‐
92       erwise, the number is interpreted as decimal.
93

USAGE

95       The return value of inet_ntoa() may point to static data  that  may  be
96       overwritten by subsequent calls to inet_ntoa().
97

RETURN VALUES

99       Upon  successful  completion, inet_addr() returns the Internet address.
100       Otherwise, it returns (in_addr_t)(−1).
101
102
103       Upon successful completion, inet_network() returns the converted Inter‐
104       net network number. Otherwise, it returns (in_addr_t)(−1).
105
106
107       The inet_makeaddr() function returns the constructed Internet address.
108
109
110       The inet_lnaof() function returns the local network address part.
111
112
113       The inet_netof() function returns the network number.
114
115
116       The  inet_ntoa()  function  returns a pointer to the network address in
117       Internet-standard dot notation.
118

ERRORS

120       No errors are defined.
121

ATTRIBUTES

123       See attributes(5) for descriptions of the following attributes:
124
125
126
127
128       ┌─────────────────────────────┬─────────────────────────────┐
129       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
130       ├─────────────────────────────┼─────────────────────────────┤
131       │Interface Stability          │Standard                     │
132       ├─────────────────────────────┼─────────────────────────────┤
133       │MT-Level                     │MT-Safe                      │
134       └─────────────────────────────┴─────────────────────────────┘
135

SEE ALSO

137       endhostent(3XNET), endnetent(3XNET), attributes(5), standards(5)
138
139
140
141SunOS 5.11                        10 Jun 2002                 inet_addr(3XNET)
Impressum