]> git.saurik.com Git - apple/configd.git/blob - dnsinfo/dnsinfo_create.h
configd-1061.141.1.tar.gz
[apple/configd.git] / dnsinfo / dnsinfo_create.h
1 /*
2 * Copyright (c) 2004-2006, 2008, 2009, 2011-2013, 2015, 2017, 2018 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 <os/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 #ifndef _PATH_RESOLVER_DIR
45 #if TARGET_OS_OSX
46 #define _PATH_RESOLVER_DIR "/etc/resolver"
47 #else
48 #define _PATH_RESOLVER_DIR "/Library/Preferences/SystemConfiguration/resolver"
49 #endif
50 #endif
51
52 __BEGIN_DECLS
53
54 /*
55 * DNS configuration creation APIs
56 */
57 dns_create_config_t
58 _dns_configuration_create (void) API_AVAILABLE(macos(10.4), ios(2.0));
59
60 void
61 _dns_configuration_add_resolver (dns_create_config_t *_config,
62 dns_create_resolver_t _resolver) API_AVAILABLE(macos(10.4), ios(2.0));
63
64 void
65 _dns_configuration_signature (dns_create_config_t *_config,
66 unsigned char *signature,
67 size_t signature_len) API_AVAILABLE(macos(10.7), ios(5.0)); // signature_len >= CC_SHA256_DIGEST_LENGTH
68
69 void
70 _dns_configuration_free (dns_create_config_t *_config) API_AVAILABLE(macos(10.4), ios(2.0));
71
72 /*
73 * DNS [resolver] configuration creation APIs
74 */
75 dns_create_resolver_t
76 _dns_resolver_create (void) API_AVAILABLE(macos(10.4), ios(2.0));
77
78 void
79 _dns_resolver_set_domain (dns_create_resolver_t *_resolver,
80 const char *domain) API_AVAILABLE(macos(10.4), ios(2.0));
81
82 void
83 _dns_resolver_add_nameserver (dns_create_resolver_t *_resolver,
84 struct sockaddr *nameserver) API_AVAILABLE(macos(10.4), ios(2.0));
85
86 void
87 _dns_resolver_add_search (dns_create_resolver_t *_resolver,
88 const char *search) API_AVAILABLE(macos(10.4), ios(2.0));
89
90 void
91 _dns_resolver_add_sortaddr (dns_create_resolver_t *_resolver,
92 dns_sortaddr_t *sortaddr) API_AVAILABLE(macos(10.4), ios(2.0));
93
94 void
95 _dns_resolver_set_configuration_identifier
96 (dns_create_resolver_t *_resolver,
97 const char *config_identifier) API_AVAILABLE(macos(10.11), ios(9.0));
98
99 void
100 _dns_resolver_set_flags (dns_create_resolver_t *_resolver,
101 uint32_t flags) API_AVAILABLE(macos(10.7), ios(4.0));
102
103 void
104 _dns_resolver_set_if_index (dns_create_resolver_t *_resolver,
105 uint32_t if_index,
106 const char *if_name) API_AVAILABLE(macos(10.7), ios(4.0));
107
108 void
109 _dns_resolver_set_options (dns_create_resolver_t *_resolver,
110 const char *options) API_AVAILABLE(macos(10.4), ios(2.0));
111
112 void
113 _dns_resolver_set_order (dns_create_resolver_t *_resolver,
114 uint32_t order) API_AVAILABLE(macos(10.4), ios(2.0));
115
116 void
117 _dns_resolver_set_port (dns_create_resolver_t *_resolver,
118 uint16_t port) API_AVAILABLE(macos(10.4), ios(2.0)); // host byte order
119
120 void
121 _dns_resolver_set_timeout (dns_create_resolver_t *_resolver,
122 uint32_t timeout) API_AVAILABLE(macos(10.4), ios(2.0));
123
124 void
125 _dns_resolver_set_service_identifier
126 (dns_create_resolver_t *_resolver,
127 uint32_t service_identifier) API_AVAILABLE(macos(10.9), ios(7.0));
128
129 void
130 _dns_resolver_free (dns_create_resolver_t *_resolver) API_AVAILABLE(macos(10.4), ios(2.0));
131
132 /*
133 * DNS [resolver] flat-file configuration creation APIs
134 */
135 void
136 _dnsinfo_flatfile_add_resolvers (dns_create_config_t *config) API_AVAILABLE(macos(10.6)) SPI_AVAILABLE(ios(10.15), tvos(13.0), watchos(6.0), bridgeos(6.0));
137
138 void
139 _dnsinfo_flatfile_set_flags (uint32_t flags) API_AVAILABLE(macos(10.9)) SPI_AVAILABLE(ios(10.15), tvos(13.0), watchos(6.0), bridgeos(6.0));
140
141 __END_DECLS
142
143 #endif /* __DNSINFO_CREATE_H__ */