1 .\" Copyright 2000 Sam Varshavchik <mrsam@courier-mta.com>
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References: RFC 2553
25 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
26 .\" Translated Sun Jan 14 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
27 .\" Updated Tue Nov 26 2002 by Kentaro Shirakata <argrath@ub32.org>
29 .\"WORD: null pointer ¥Ì¥ë¡¦¥Ý¥¤¥ó¥¿¡¼
31 .TH GETIPNODEBYNAME 3 2010-09-04 "Linux" "Linux Programmer's Manual"
33 .\"O getipnodebyname, getipnodebyaddr, freehostent \- get network
34 .\"O hostnames and addresses
36 getipnodebyname, getipnodebyaddr, freehostent \- ¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤Î̾Á°¤È¥¢¥É¥ì¥¹¤Î¼èÆÀ
40 .B #include <sys/types.h>
41 .B #include <sys/socket.h>
44 .BI "struct hostent *getipnodebyname(const char *" name ", int " af ,
45 .BI " int " flags ", int *" error_num );
47 .BI "struct hostent *getipnodebyaddr(const void *" addr ", size_t " len ,
48 .BI " int " af ", int *" "error_num" );
50 .BI "void freehostent(struct hostent *" "ip" );
54 .\"O These functions are deprecated (and unavailable in glibc).
56 .\"O .BR getaddrinfo (3)
58 .\"O .BR getnameinfo (3)
60 ¤³¤ì¤é¤Î´Ø¿ô¤ÏÈó¿ä¾©¤Ç¤¢¤ë (glibc ¤Ç¤ÏÍøÍѤǤ¤Ê¤¤)¡£
68 .\"O .BR getipnodebyname ()
70 .\"O .BR getipnodebyaddr ()
71 .\"O functions return the names and addresses of a network host.
72 .\"O These functions return a pointer to the
73 .\"O following structure:
74 .BR getipnodebyname ()
76 .BR getipnodebyaddr ()
77 ¤Ï¡¢¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤Î̾Á°¤È¥¢¥É¥ì¥¹¤òÊÖ¤¹¡£
78 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢°Ê²¼¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
92 .\"O These functions replace the
93 .\"O .BR gethostbyname (3)
95 .\"O .BR gethostbyaddr (3)
96 .\"O functions, which could only access the IPv4 network address family.
98 .\"O .BR getipnodebyname ()
100 .\"O .BR getipnodebyaddr ()
101 .\"O functions can access multiple network address families.
102 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢ IPv4 ¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¥Õ¥¡¥ß¥ê¤Ë¤·¤«¥¢¥¯¥»¥¹¤Ç¤¤Ê¤¤
103 .BR gethostbyname (3)
105 .BR gethostbyaddr (3)
106 ¤òÃÖ¤´¹¤¨¤ë¤â¤Î¤Ç¤¢¤ë¡£
107 .BR getipnodebyname ()
109 .BR getipnodebyaddr ()
110 ´Ø¿ô¤ÏÊ£¿ô¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¥Õ¥¡¥ß¥ê¡¼¤Ë¥¢¥¯¥»¥¹²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
115 .\"O these functions return pointers to dynamically allocated memory.
117 .\"O .BR freehostent ()
118 .\"O function is used to release the dynamically allocated memory
119 .\"O after the caller no longer needs the
124 ¤Î´Ø¿ô·²¤È°Û¤Ê¤ê¡¢Æ°Åª¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
127 ¹½Â¤ÂΤòɬÍפȤ·¤Ê¤¯¤Ê¤Ã¤¿¸å¤Ï¡¢
129 ´Ø¿ô¤òÍѤ¤¤ì¤ÐưŪ¤Ê³ä¤êÅö¤Æ¥á¥â¥ê¤ò²òÊü¤Ç¤¤ë¡£
130 .\"O .SS getipnodebyname() arguments
131 .SS getipnodebyname() ¤Î°ú¤¿ô
133 .\"O .BR getipnodebyname ()
135 .\"O looks up network addresses for the host
136 .\"O specified by the
141 .\"O argument specifies one of the following values:
142 .BR getipnodebyname ()
145 °ú¤¿ô¤Ç»ØÄꤵ¤ì¤¿¥Û¥¹¥È¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤ò°ú¤¯¡£
147 °ú¤¿ô¤Ë¤Ï°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«¤ò»ØÄꤹ¤ë¡£
152 .\"O argument points to a dotted-quad IPv4 address or a name
153 .\"O of an IPv4 network host.
155 °ú¤¿ô¤Ï¡¢¥É¥Ã¥È¤Ç 4 ¤Ä¤Ë¶èÀÚ¤é¤ì¤¿ IPv4 ¥¢¥É¥ì¥¹¤«¡¢
156 IPv4 ¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤Î̾Á°¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
161 .\"O argument points to a hexadecimal IPv6 address or a name
162 .\"O of an IPv6 network host.
164 °ú¤¿ô¤Ï¡¢16 ¿Ê¤Î IPv6 ¥¢¥É¥ì¥¹¤«¡¢
165 IPv6 ¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤Î̾Á°¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
169 .\"O argument specifies additional options.
170 .\"O More than one option can be specified by bitwise OR-ing
173 .\"O should be set to 0
174 .\"O if no options are desired.
176 ¥Ñ¥é¥á¡¼¥¿¤Ë¤ÏÄɲäΥª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¡£
177 Ê£¿ô¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤Ë¤Ï¡¢¤½¤ì¤é¤Î¥Ó¥Ã¥Èñ°Ì¤Î OR ¤ò¤È¤Ã¤Æ»ØÄꤹ¤ì¤Ð¤è¤¤¡£
178 ¥ª¥×¥·¥ç¥ó¤ò¤Ò¤È¤Ä¤â»ØÄꤷ¤¿¤¯¤Ê¤¤¤È¤¤Ë¤Ï¡¢
180 ¤Ë 0 ¤òÀßÄꤹ¤ëɬÍפ¬¤¢¤ë¡£
183 .\"O This flag is used with
185 .\"O to request a query for IPv4 addresses instead of
186 .\"O IPv6 addresses; the IPv4 addresses will
187 .\"O be mapped to IPv6 addresses.
190 ¤È¶¦¤ËÍѤ¤¤é¤ì¡¢IPv6 ¥¢¥É¥ì¥¹¤ÎÂå¤ï¤ê¤Ë IPv4 ¥¢¥É¥ì¥¹¤òÌ䤤¹ç¤ï¤»¤ë¡£
191 Ì䤤¹ç¤ï¤»¤ë IPv4 ¥¢¥É¥ì¥¹¤Ï IPv6 ¥¢¥É¥ì¥¹¤Ë¥Þ¥Ã¥×¤µ¤ì¤ë¡£
194 .\"O This flag is used with
196 .\"O to request a query for both IPv4 and IPv6 addresses.
197 .\"O Any IPv4 address found will be mapped to an IPv6 address.
200 ¤È¶¦¤ËÍѤ¤¤é¤ì¡¢IPv4 ¥¢¥É¥ì¥¹¤È IPv6 ¥¢¥É¥ì¥¹¤ÎξÊý¤òÌ䤤¹ç¤ï¤»¤ë¡£
201 ¸«¤Ä¤«¤Ã¤¿ IPv4 ¥¢¥É¥ì¥¹¤Ï¡¢¤¹¤Ù¤Æ IPv6 ¥¢¥É¥ì¥¹¤Ë¥Þ¥Ã¥×¤µ¤ì¤ë¡£
204 .\"O This flag is used with
207 .\"O further request that queries for IPv6 addresses should not be made unless
208 .\"O the system has at least one IPv6 address assigned to a network interface,
209 .\"O and that queries for IPv4 addresses should not be made unless the
210 .\"O system has at least one IPv4 address assigned to a network interface.
211 .\"O This flag may be used by itself or with the
217 IPv6 ¤¬³ä¤êÅö¤Æ¤é¤ì¤¿¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤¬
218 ¥·¥¹¥Æ¥à¤Ë¤Ò¤È¤Ä¤â¤Ê¤±¤ì¤Ð IPv6 ¥¢¥É¥ì¥¹¤ÎÌ䤤¹ç¤ï¤»¤ò¹Ô¤ï¤º¡¢
219 IPv4 ¤¬³ä¤êÅö¤Æ¤é¤ì¤¿¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤¬
220 ¥·¥¹¥Æ¥à¤Ë¤Ò¤È¤Ä¤â¤Ê¤±¤ì¤Ð IPv4 ¥¢¥É¥ì¥¹¤ÎÌ䤤¹ç¤ï¤»¤ò¹Ô¤ï¤Ê¤¤¤è¤¦¤ËÍ׵᤹¤ë¡£
221 ¤³¤Î¥Õ¥é¥°¤ÏñÆȤǤ⡢¤¢¤ë¤¤¤Ï
223 ¥Õ¥é¥°¤È¶¦¤Ë¤Ç¤âÍѤ¤¤ë¤³¤È¤¬¤Ç¤¤ë¡£
226 .\"O This flag is equivalent to
227 .\"O .BR "(AI_ADDRCONFIG | AI_V4MAPPED)" .
229 .BR (AI_ADDRCONFIG | AI_V4MAPPED)
231 .\"O .SS getipnodebyaddr() arguments
232 .SS "getipnodebyaddr() ¤Î°ú¤¿ô"
234 .\"O .BR getipnodebyaddr ()
236 .\"O looks up the name of the host whose
237 .\"O network address is
238 .\"O specified by the
243 .\"O argument specifies one of the following values:
244 .BR getipnodebyaddr ()
245 ´Ø¿ô¤Ï¡¢¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤¬
247 °ú¤¿ô¤Ç»ØÄꤵ¤ì¤¿¥Û¥¹¥È¤Î̾Á°¤ò°ú¤¯¡£
249 °ú¤¿ô¤Ë¤Ï°Ê²¼¤ÎÃͤΤ¤¤º¤ì¤«¤ò»ØÄꤹ¤ë¡£
254 .\"O argument points to a
255 .\"O .I struct in_addr
259 .\"O .IR "sizeof(struct in_addr)" .
263 ¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤Ç¤¢¤ê¡¢
266 .I sizeof(struct in_addr)
267 ¤ËÀßÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
272 .\"O argument points to a
273 .\"O .I struct in6_addr
277 .\"O .IR "sizeof(struct in6_addr)" .
281 ¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤Ç¤¢¤ê¡¢
284 .I sizeof(struct in6_addr)
285 ¤ËÀßÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
286 .\"O .SH "RETURN VALUE"
288 .\"O A NULL pointer is returned if an error occurred, and
290 .\"O will contain an error code from the following list:
291 ¥¨¥é¡¼¤¬µ¯¤³¤ë¤È¥Ì¥ë¡¦¥Ý¥¤¥ó¥¿¡¼¤¬ÊÖ¤µ¤ì¡¢
293 ¤Ë°Ê²¼¤Ë¥ê¥¹¥È¤µ¤ì¤¿¥¨¥é¡¼¥³¡¼¥É¤Î¤¤¤º¤ì¤«¤¬ÀßÄꤵ¤ì¤ë¡£
296 .\"O The hostname or network address was not found.
297 ¥Û¥¹¥È̾¤Þ¤¿¤Ï¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤¬¸«¤Ä¤«¤é¤Ê¤«¤Ã¤¿¡£
300 .\"O The domain name server recognized the network address or name,
301 .\"O but no answer was returned.
302 .\"O This can happen if the network host has only IPv4 addresses and
303 .\"O a request has been made for IPv6 information only, or vice versa.
304 ¥É¥á¥¤¥ó¥Í¡¼¥à¥µ¡¼¥Ð¡¼¤Ï
305 ¤½¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤Þ¤¿¤Ï¥Í¥Ã¥È¥ï¡¼¥¯Ì¾¤òǧ¼±¤·¤¿¤¬¡¢
306 ÊÖ»ö¤¬Ê֤äƤ³¤Ê¤«¤Ã¤¿¡£¸¶°ø¤È¤·¤Æ¤Ï¡¢
307 Î㤨¤Ð IPv4 ¥¢¥É¥ì¥¹¤·¤«»ý¤¿¤Ê¤¤¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤ËÂФ·¤Æ
308 IPv6 ¤Î¾ðÊó¤ÎÌ䤤¹ç¤ï¤»¤¬¹Ô¤ï¤ì¤¿ (¤ª¤è¤Ó¤½¤ÎµÕ) ¤Ê¤É¤¬¹Í¤¨¤é¤ì¤ë¡£
311 .\"O The domain name server returned a permanent failure response.
312 ¥É¥á¥¤¥ó¥Í¡¼¥à¥µ¡¼¥Ð¡¼¤«¤é¹±µ×Ū¤Ê¼ºÇÔ (permanent failure)
313 ¤ò°ÕÌ£¤¹¤ëÊÖ»ö¤¬ÊÖ¤µ¤ì¤¿¡£
316 .\"O The domain name server returned a temporary failure response.
317 .\"O You might have better luck next time.
318 ¥Í¡¼¥à¥µ¡¼¥Ð¡¼¤«¤é°ì»þŪ¤Ê¼ºÇÔ (temporary failure)
319 ¤ò°ÕÌ£¤¹¤ëÊÖ»ö¤¬ÊÖ¤µ¤ì¤¿¡£¼¡¤Ë¤Ï¤â¤¦¤Á¤ç¤Ã¤È±¿¤¬É¬Íפ«¤â¡£
321 .\"O A successful query returns a pointer to a
323 .\"O structure that contains the following fields:
324 Ì䤤¹ç¤ï¤»¤ËÀ®¸ù¤¹¤ë¤È¡¢
326 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
327 ¤³¤Î¹½Â¤ÂΤϰʲ¼¤Î¥Õ¥£¡¼¥ë¥É¤«¤é¤Ê¤ë¡£
330 .\"O This is the official name of this network host.
331 ¤³¤ì¤Ï¤³¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤Î¥ª¥Õ¥£¥·¥ã¥ë¤Ê̾Á°¤Ç¤¢¤ë¡£
334 .\"O This is an array of pointers to unofficial aliases for the same host.
335 .\"O The array is terminated by a NULL pointer.
336 ¤³¤ì¤Ï¡¢¤½¤Î¥Û¥¹¥È¤Î¥ª¥Õ¥£¥·¥ã¥ë¤Ç¤Ê¤¤ÊÌ̾¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤ÎÇÛÎó¤Ç¤¢¤ë¡£
337 ÇÛÎó¤Ï¥Ì¥ë¡¦¥Ý¥¤¥ó¥¿¡¼¤Ç½ªÃ¼¤¹¤ë¡£
340 .\"O This is a copy of the
343 .\"O .BR getipnodebyname ()
345 .\"O .BR getipnodebyaddr ().
361 .BR getipnodebyname ()
363 .BR getipnodebyaddr ()
366 °ú¤¿ô¤Î¥³¥Ô¡¼¤Ç¤¢¤ë¡£
385 .\"O This field will be set to
386 .\"O .I sizeof(struct in_addr)
392 .\"O .I sizeof(struct in6_addr)
402 .I sizeof(struct in_addr)
408 .I sizeof(struct in6_addr)
412 .\"O This is an array of one or more pointers to network address structures for the
414 .\"O The array is terminated by a NULL pointer.
415 ¤³¤ì¤Ï¤Ò¤È¤Ä°Ê¾å¤Î¥Ý¥¤¥ó¥¿¡¼¤ÎÇÛÎó¤Ç¡¢
416 ¤½¤ì¤¾¤ì¤Î¥Ý¥¤¥ó¥¿¡¼¤Ï¡¢
417 ¤½¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥Û¥¹¥È¤ËÂбþ¤¹¤ë¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¹½Â¤ÂΤò»Ø¤¹¡£
418 ¤³¤ÎÇÛÎó¤Ï¥Ì¥ë¡¦¥Ý¥¤¥ó¥¿¡¼¤Ç½ªÃ¼¤¹¤ë¡£
419 .\"O .SH "CONFORMING TO"
422 .\"O .\" Not in POSIX.1-2001.
423 .\" POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£
426 .\"O These functions were present in glibc 2.1.91-95, but were
428 .\"O Several UNIX-like systems support them, but all
429 .\"O call them deprecated.
430 ¤³¤ì¤é¤Î´Ø¿ô¤Ï glibc 2.1.91-95 ¤Ë¸ºß¤·¤¿¤¬¡¢ºÆ¤Óºï½ü¤µ¤ì¤¿¡£
431 ¤¤¤¯¤Ä¤«¤Î UNIX É÷¥·¥¹¥Æ¥à¤Ï¤³¤ì¤é¤Î´Ø¿ô¤ËÂбþ¤·¤Æ¤¤¤ë¤¬¡¢
432 ¤³¤ì¤é¤Î´Ø¿ô¤ÏÁ´¤Æ¿ä¾©¤µ¤ì¤Ê¤¤¡£