2 - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2001, 2003 Internet Software Consortium.
5 - Permission to use, copy, modify, and distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 - PERFORMANCE OF THIS SOFTWARE.
18 <!-- $Id: lwres_getaddrinfo.html,v 1.8.2.3 2004/03/15 04:45:02 marka Exp $ -->
23 >lwres_getaddrinfo
</TITLE
26 CONTENT=
"Modular DocBook HTML Stylesheet Version 1.73
47 >lwres_getaddrinfo, lwres_freeaddrinfo
--
socket address structure to host and service name
</DIV
49 CLASS=
"REFSYNOPSISDIV"
63 CLASS=
"FUNCSYNOPSISINFO"
64 >#include
<lwres/netdb.h
></PRE
70 lwres_getaddrinfo
</CODE
71 >(const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res);
</CODE
78 lwres_freeaddrinfo
</CODE
79 >(struct addrinfo *ai);
</CODE
85 >If the operating system does not provide a
88 >struct addrinfo
</SPAN
90 the following structure is used:
93 CLASS=
"PROGRAMLISTING"
95 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
96 int ai_family; /* PF_xxx */
97 int ai_socktype; /* SOCK_xxx */
98 int ai_protocol; /*
0 or IPPROTO_xxx for IPv4 and IPv6 */
99 size_t ai_addrlen; /* length of ai_addr */
100 char *ai_canonname; /* canonical name for hostname */
101 struct sockaddr *ai_addr; /* binary address */
102 struct addrinfo *ai_next; /* next structure in linked list */
116 >lwres_getaddrinfo()
</TT
118 is used to get a list of IP addresses and port numbers for host
133 The function is the lightweight resolver's implementation of
138 as defined in RFC2133.
152 are pointers to null-terminated
165 is either a host name or a numeric host address string: a dotted decimal
166 IPv4 address or an IPv6 address.
173 is either a decimal port number or a service name as listed in
185 is an optional pointer to a
188 >struct addrinfo
</SPAN
190 This structure can be used to provide hints concerning the type of socket
191 that the caller supports or wishes to use.
192 The caller can supply the following structure elements in
212 >The protocol family that should be used.
223 it means the caller will accept any protocol family supported by the
233 >denotes the type of socket
—
247 — that is wanted.
253 is zero the caller will accept any socket type.
</P
262 >indicates which transport protocol is wanted: IPPROTO_UDP or
269 is zero the caller will accept any protocol.
</P
284 bit is set, a successful call to
287 >lwres_getaddrinfo()
</TT
289 will return a null-terminated string containing the canonical name
290 of the specified hostname in
306 bit indicates that the returned socket address structure is intended
307 for used in a call to
311 CLASS=
"REFENTRYTITLE"
316 In this case, if the hostname argument is a
321 pointer, then the IP address portion of the socket
322 address structure will be set to
327 for an IPv4 address or
330 >IN6ADDR_ANY_INIT
</SPAN
332 for an IPv6 address.
</P
344 bit, the returned socket address structure will be ready
349 CLASS=
"REFENTRYTITLE"
353 for a connection-oriented protocol or
357 CLASS=
"REFENTRYTITLE"
365 CLASS=
"REFENTRYTITLE"
374 CLASS=
"REFENTRYTITLE"
378 if a connectionless protocol was chosen.
379 The IP address portion of the socket address structure will be
380 set to the loopback address if
411 >AI_NUMERICHOST
</SPAN
420 should be treated as a numeric string defining an IPv4 or IPv6 address
421 and no name resolution should be attempted.
</P
427 >All other elements of the
<SPAN
429 >struct addrinfo
</SPAN
447 the caller provided a
<SPAN
449 >struct addrinfo
</SPAN
450 > initialized to zero
460 >After a successful call to
463 >lwres_getaddrinfo()
</TT
471 is a pointer to a linked list of one or more
480 >struct addrinfo
</SPAN
482 in this list cn be processed by following
493 pointer is encountered.
514 structure contain the corresponding arguments for a call to
518 CLASS=
"REFENTRYTITLE"
527 structure in the list, the
532 member points to a filled-in socket address structure of length
538 >All of the information returned by
541 >lwres_getaddrinfo()
</TT
543 is dynamically allocated: the addrinfo structures, and the socket
544 address structures and canonical host name strings pointed to by the
549 Memory allocated for the dynamically allocated structures created by
553 >lwres_getaddrinfo()
</TT
558 >lwres_freeaddrinfo()
</TT
569 >struct addrinfo
</SPAN
574 >lwres_getaddrinfo()
</TT
587 >lwres_getaddrinfo()
</TT
589 returns zero on success or one of the error codes listed in
593 CLASS=
"REFENTRYTITLE"
619 >lwres_getaddrinfo()
</TT
638 CLASS=
"REFENTRYTITLE"
646 CLASS=
"REFENTRYTITLE"
647 >lwres_getaddrinfo
</SPAN
654 CLASS=
"REFENTRYTITLE"
655 >lwres_freeaddrinfo
</SPAN
662 CLASS=
"REFENTRYTITLE"
663 >lwres_gai_strerror
</SPAN
670 CLASS=
"REFENTRYTITLE"
678 CLASS=
"REFENTRYTITLE"
686 CLASS=
"REFENTRYTITLE"
694 CLASS=
"REFENTRYTITLE"
702 CLASS=
"REFENTRYTITLE"
710 CLASS=
"REFENTRYTITLE"
718 CLASS=
"REFENTRYTITLE"