1 .\" Copyright 2000 Sam Varshavchik <mrsam@courier-mta.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" References: RFC 2553
6 .TH getipnodebyname 3 (date) "Linux man-pages (unreleased)"
8 getipnodebyname, getipnodebyaddr, freehostent \- get network
9 hostnames and addresses
12 .RI ( libc ", " \-lc )
15 .B #include <sys/types.h>
16 .B #include <sys/socket.h>
19 .BI "[[deprecated]] struct hostent *getipnodebyname(const char *" name ", int " af ,
20 .BI " int " flags ", int *" error_num );
21 .BI "[[deprecated]] struct hostent *getipnodebyaddr(const void *" addr ,
22 .BI " size_t " len ", int " af ,
23 .BI " int *" "error_num" );
24 .BI "[[deprecated]] void freehostent(struct hostent *" "ip" );
27 These functions are deprecated (and unavailable in glibc).
35 .BR getipnodebyname ()
37 .BR getipnodebyaddr ()
38 functions return the names and addresses of a network host.
39 These functions return a pointer to the
54 These functions replace the
58 functions, which could access only the IPv4 network address family.
60 .BR getipnodebyname ()
62 .BR getipnodebyaddr ()
63 functions can access multiple network address families.
68 these functions return pointers to dynamically allocated memory.
71 function is used to release the dynamically allocated memory
72 after the caller no longer needs the
75 .SS getipnodebyname() arguments
77 .BR getipnodebyname ()
79 looks up network addresses for the host
85 argument specifies one of the following values:
90 argument points to a dotted-quad IPv4 address or a name
91 of an IPv4 network host.
96 argument points to a hexadecimal IPv6 address or a name
97 of an IPv6 network host.
101 argument specifies additional options.
102 More than one option can be specified by bitwise OR-ing
106 if no options are desired.
109 This flag is used with
111 to request a query for IPv4 addresses instead of
112 IPv6 addresses; the IPv4 addresses will
113 be mapped to IPv6 addresses.
116 This flag is used with
118 to request a query for both IPv4 and IPv6 addresses.
119 Any IPv4 address found will be mapped to an IPv6 address.
122 This flag is used with
125 further request that queries for IPv6 addresses should not be made unless
126 the system has at least one IPv6 address assigned to a network interface,
127 and that queries for IPv4 addresses should not be made unless the
128 system has at least one IPv4 address assigned to a network interface.
129 This flag may be used by itself or with the
134 This flag is equivalent to
135 .BR "(AI_ADDRCONFIG | AI_V4MAPPED)" .
136 .SS getipnodebyaddr() arguments
138 .BR getipnodebyaddr ()
140 looks up the name of the host whose
147 argument specifies one of the following values:
157 .IR "sizeof(struct in_addr)" .
167 .IR "sizeof(struct in6_addr)" .
169 NULL is returned if an error occurred, and
171 will contain an error code from the following list:
174 The hostname or network address was not found.
177 The domain name server recognized the network address or name,
178 but no answer was returned.
179 This can happen if the network host has only IPv4 addresses and
180 a request has been made for IPv6 information only, or vice versa.
183 The domain name server returned a permanent failure response.
186 The domain name server returned a temporary failure response.
187 You might have better luck next time.
189 A successful query returns a pointer to a
191 structure that contains the following fields:
194 This is the official name of this network host.
197 This is an array of pointers to unofficial aliases for the same host.
198 The array is terminated by a null pointer.
201 This is a copy of the
204 .BR getipnodebyname ()
206 .BR getipnodebyaddr ().
223 This field will be set to
224 .I sizeof(struct in_addr)
230 .I sizeof(struct in6_addr)
237 This is an array of one or more pointers to network address structures for the
239 The array is terminated by a null pointer.
242 .\" Not in POSIX.1-2001.
244 These functions were present in glibc 2.1.91-95, but were
246 Several UNIX-like systems support them, but all
247 call them deprecated.