]> git.saurik.com Git - apple/configd.git/blob - dnsinfo/dnsinfo_create.h
configd-963.tar.gz
[apple/configd.git] / dnsinfo / dnsinfo_create.h
1 /*
2 * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015, 2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef __DNSINFO_CREATE_H__
25 #define __DNSINFO_CREATE_H__
26
27 /*
28 * These routines provide access to the systems DNS configuration
29 */
30
31 #include <TargetConditionals.h>
32 #include <Availability.h>
33 #include <sys/cdefs.h>
34 #include <stdint.h>
35 #include <sys/types.h>
36 #include <sys/socket.h>
37 #include <netinet/in.h>
38
39 #include <dnsinfo.h>
40
41 typedef const struct __dns_create_config * dns_create_config_t;
42 typedef const struct __dns_create_resolver * dns_create_resolver_t;
43
44 #if !TARGET_OS_IPHONE
45 #ifndef _PATH_RESOLVER_DIR
46 #define _PATH_RESOLVER_DIR "/etc/resolver"
47 #endif
48 #endif /* !TARGET_OS_IPHONE */
49
50 __BEGIN_DECLS
51
52 /*
53 * DNS configuration creation APIs
54 */
55 dns_create_config_t
56 _dns_configuration_create (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
57
58 void
59 _dns_configuration_add_resolver (dns_create_config_t *_config,
60 dns_create_resolver_t _resolver) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
61
62 void
63 _dns_configuration_signature (dns_create_config_t *_config,
64 unsigned char *signature,
65 size_t signature_len) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0); // signature_len >= CC_SHA1_DIGEST_LENGTH
66
67 void
68 _dns_configuration_free (dns_create_config_t *_config) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
69
70 /*
71 * DNS [resolver] configuration creation APIs
72 */
73 dns_create_resolver_t
74 _dns_resolver_create (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
75
76 void
77 _dns_resolver_set_domain (dns_create_resolver_t *_resolver,
78 const char *domain) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
79
80 void
81 _dns_resolver_add_nameserver (dns_create_resolver_t *_resolver,
82 struct sockaddr *nameserver) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
83
84 void
85 _dns_resolver_add_search (dns_create_resolver_t *_resolver,
86 const char *search) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
87
88 void
89 _dns_resolver_add_sortaddr (dns_create_resolver_t *_resolver,
90 dns_sortaddr_t *sortaddr) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
91
92 void
93 _dns_resolver_set_configuration_identifier
94 (dns_create_resolver_t *_resolver,
95 const char *config_identifier) __OSX_AVAILABLE_STARTING(__MAC_10_11,__IPHONE_9_0);
96
97 void
98 _dns_resolver_set_flags (dns_create_resolver_t *_resolver,
99 uint32_t flags) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
100
101 void
102 _dns_resolver_set_if_index (dns_create_resolver_t *_resolver,
103 uint32_t if_index,
104 const char *if_name) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);
105
106 void
107 _dns_resolver_set_options (dns_create_resolver_t *_resolver,
108 const char *options) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
109
110 void
111 _dns_resolver_set_order (dns_create_resolver_t *_resolver,
112 uint32_t order) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
113
114 void
115 _dns_resolver_set_port (dns_create_resolver_t *_resolver,
116 uint16_t port) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0); // host byte order
117
118 void
119 _dns_resolver_set_timeout (dns_create_resolver_t *_resolver,
120 uint32_t timeout) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
121
122 void
123 _dns_resolver_set_service_identifier
124 (dns_create_resolver_t *_resolver,
125 uint32_t service_identifier) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
126
127 void
128 _dns_resolver_free (dns_create_resolver_t *_resolver) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_2_0);
129
130 #if !TARGET_OS_IPHONE
131 /*
132 * DNS [resolver] flat-file configuration creation APIs
133 */
134 void
135 _dnsinfo_flatfile_add_resolvers (dns_create_config_t *config) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
136
137 void
138 _dnsinfo_flatfile_set_flags (uint32_t flags) __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_NA);
139 #endif // !TARGET_OS_IPHONE
140
141 __END_DECLS
142
143 #endif /* __DNSINFO_CREATE_H__ */