1135446Strhodes/*
2193149Sdougb * Copyright (C) 2004-2007, 2009  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 2001  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18234010Sdougb/* $Id: getaddresses.h,v 1.11 2009/01/17 23:47:42 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef BIND9_GETADDRESSES_H
21135446Strhodes#define BIND9_GETADDRESSES_H 1
22135446Strhodes
23193149Sdougb/*! \file bind9/getaddresses.h */
24170222Sdougb
25135446Strhodes#include <isc/lang.h>
26135446Strhodes#include <isc/types.h>
27135446Strhodes
28135446Strhodes#include <isc/net.h>
29135446Strhodes
30135446StrhodesISC_LANG_BEGINDECLS
31135446Strhodes
32135446Strhodesisc_result_t
33135446Strhodesbind9_getaddresses(const char *hostname, in_port_t port,
34135446Strhodes		   isc_sockaddr_t *addrs, int addrsize, int *addrcount);
35170222Sdougb/*%<
36135446Strhodes * Use the system resolver to get the addresses associated with a hostname.
37135446Strhodes * If successful, the number of addresses found is returned in 'addrcount'.
38135446Strhodes * If a hostname lookup is performed and addresses of an unknown family is
39135446Strhodes * seen, it is ignored.  If more than 'addrsize' addresses are seen, the
40135446Strhodes * first 'addrsize' are returned and the remainder silently truncated.
41135446Strhodes *
42135446Strhodes * This routine may block.  If called by a program using the isc_app
43193149Sdougb * framework, it should be surrounded by isc_app_block()/isc_app_unblock().
44135446Strhodes *
45135446Strhodes *  Requires:
46170222Sdougb *\li	'hostname' is not NULL.
47170222Sdougb *\li	'addrs' is not NULL.
48170222Sdougb *\li	'addrsize' > 0
49170222Sdougb *\li	'addrcount' is not NULL.
50135446Strhodes *
51193149Sdougb *
52135446Strhodes * Returns:
53170222Sdougb *\li	#ISC_R_SUCCESS
54170222Sdougb *\li	#ISC_R_NOTFOUND
55170222Sdougb *\li	#ISC_R_NOFAMILYSUPPORT - 'hostname' is an IPv6 address, and IPv6 is
56135446Strhodes *		not supported.
57135446Strhodes */
58135446Strhodes
59135446StrhodesISC_LANG_ENDDECLS
60135446Strhodes
61135446Strhodes#endif /* BIND9_GETADDRESSES_H */
62