2 * Copyright (c) 2004-2006, 2008, 2009 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef __DNSINFO_CREATE_H__
25 #define __DNSINFO_CREATE_H__
28 * These routines provide access to the systems DNS configuration
31 #include <TargetConditionals.h>
32 #include <Availability.h>
33 #include <sys/cdefs.h>
35 #include <sys/types.h>
36 #include <sys/socket.h>
37 #include <netinet/in.h>
41 typedef const struct __dns_create_config
* dns_create_config_t
;
42 typedef const struct __dns_create_resolver
* dns_create_resolver_t
;
45 #ifndef _PATH_RESOLVER_DIR
46 #define _PATH_RESOLVER_DIR "/etc/resolver"
48 #endif /* !TARGET_OS_IPHONE */
53 * NOTE: __private_extern__ and __OSX_AVAILABLE_STARTING() cannot be mixed
54 * due to a "visibility" conflict
58 * DNS configuration creation APIs
62 _dns_configuration_create (void) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
66 _dns_configuration_add_resolver (dns_create_config_t
*_config
,
67 dns_create_resolver_t _resolver
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
71 _dns_configuration_store (dns_create_config_t
*_config
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
75 _dns_configuration_free (dns_create_config_t
*_config
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
78 * DNS [resolver] configuration creation APIs
82 _dns_resolver_create (void) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
86 _dns_resolver_set_domain (dns_create_resolver_t
*_resolver
,
87 const char *domain
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
91 _dns_resolver_add_nameserver (dns_create_resolver_t
*_resolver
,
92 struct sockaddr
*nameserver
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
96 _dns_resolver_set_port (dns_create_resolver_t
*_resolver
,
97 uint16_t port
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/; // host byte order
101 _dns_resolver_add_search (dns_create_resolver_t
*_resolver
,
102 const char *search
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
106 _dns_resolver_add_sortaddr (dns_create_resolver_t
*_resolver
,
107 dns_sortaddr_t
*sortaddr
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
111 _dns_resolver_set_options (dns_create_resolver_t
*_resolver
,
112 const char *options
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
116 _dns_resolver_set_timeout (dns_create_resolver_t
*_resolver
,
117 uint32_t timeout
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
121 _dns_resolver_set_order (dns_create_resolver_t
*_resolver
,
122 uint32_t order
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
126 _dns_resolver_free (dns_create_resolver_t
*_resolver
) /*__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0)*/;
128 #if !TARGET_OS_IPHONE
130 * DNS [resolver] flat-file configuration creation APIs
134 _dnsinfo_flatfile_add_resolvers (dns_create_config_t
*config
) /*__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)*/;
135 #endif // !TARGET_OS_IPHONE
139 #endif /* __DNSINFO_CREATE_H__ */