]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/mDNSMacOSX.h
mDNSResponder-108.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / mDNSMacOSX.h
1 /*
2 * Copyright (c) 2002-2003 Apple Computer, 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 Change History (most recent first):
24
25 $Log: mDNSMacOSX.h,v $
26 Revision 1.51 2005/07/04 22:24:36 cheshire
27 Export NotifyOfElusiveBug() so other files can call it
28
29 Revision 1.50 2005/02/19 00:04:18 cheshire
30 Add comments
31
32 Revision 1.49 2004/12/17 23:37:47 cheshire
33 <rdar://problem/3485365> Guard against repeating wireless dissociation/re-association
34 (and other repetitive configuration changes)
35
36 Revision 1.48 2004/12/07 01:31:31 cheshire
37 mDNSMacOSXSystemBuildNumber() returns int, not mDNSBool
38
39 Revision 1.47 2004/11/30 03:24:03 cheshire
40 <rdar://problem/3854544> Defer processing network configuration changes until configuration has stabilized
41
42 Revision 1.46 2004/11/03 03:45:16 cheshire
43 <rdar://problem/3863627> mDNSResponder does not inform user of Computer Name collisions
44
45 Revision 1.45 2004/10/28 00:53:57 cheshire
46 Export mDNSMacOSXNetworkChanged() so it's callable from outside this mDNSMacOSX.c;
47 Add LogOperation() call to record when we get network change events
48
49 Revision 1.44 2004/10/23 01:16:01 cheshire
50 <rdar://problem/3851677> uDNS operations not always reliable on multi-homed hosts
51
52 Revision 1.43 2004/10/15 23:00:18 ksekar
53 <rdar://problem/3799242> Need to update LLQs on location changes
54
55 Revision 1.42 2004/10/04 05:56:04 cheshire
56 <rdar://problem/3824730> mDNSResponder doesn't respond to certain AirPort changes
57
58 Revision 1.41 2004/09/30 00:24:59 ksekar
59 <rdar://problem/3695802> Dynamically update default registration domains on config change
60
61 Revision 1.40 2004/09/17 01:08:52 cheshire
62 Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
63 The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
64 declared in that file are ONLY appropriate to single-address-space embedded applications.
65 For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used.
66
67 Revision 1.39 2004/08/18 17:35:41 ksekar
68 <rdar://problem/3651443>: Feature #9586: Need support for Legacy NAT gateways
69
70 Revision 1.38 2004/07/13 21:24:25 rpantos
71 Fix for <rdar://problem/3701120>.
72
73 Revision 1.37 2004/06/04 08:58:30 ksekar
74 <rdar://problem/3668624>: Keychain integration for secure dynamic update
75
76 Revision 1.36 2004/05/26 17:06:33 cheshire
77 <rdar://problem/3668515>: Don't rely on CFSocketInvalidate() to remove RunLoopSource
78
79 Revision 1.35 2004/05/18 23:51:26 cheshire
80 Tidy up all checkin comments to use consistent "<rdar://problem/xxxxxxx>" format for bug numbers
81
82 Revision 1.34 2004/05/12 22:03:09 ksekar
83 Made GetSearchDomainList a true platform-layer call (declaration moved
84 from mDNSMacOSX.h to mDNSEmbeddedAPI.h), impelemted to return "local"
85 only on non-OSX platforms. Changed call to return a copy of the list
86 to avoid shared memory issues. Added a routine to free the list.
87
88 Revision 1.33 2004/05/12 02:03:25 ksekar
89 Non-local domains will only be browsed by default, and show up in
90 _browse domain enumeration, if they contain an _browse._dns-sd ptr record.
91
92 Revision 1.32 2004/04/21 02:20:47 cheshire
93 Rename interface field 'CurrentlyActive' to more descriptive 'Exists'
94
95 Revision 1.31 2004/04/09 17:40:26 cheshire
96 Remove unnecessary "Multicast" field -- it duplicates the semantics of the existing TxAndRx field
97
98 Revision 1.30 2004/01/28 02:30:08 ksekar
99 Added default Search Domains to unicast browsing, controlled via
100 Networking sharing prefs pane. Stopped sending unicast messages on
101 every interface. Fixed unicast resolving via mach-port API.
102
103 Revision 1.29 2004/01/27 22:57:48 cheshire
104 <rdar://problem/3534352>: Need separate socket for issuing unicast queries
105
106 Revision 1.28 2004/01/27 20:15:23 cheshire
107 <rdar://problem/3541288>: Time to prune obsolete code for listening on port 53
108
109 Revision 1.27 2004/01/24 08:46:26 bradley
110 Added InterfaceID<->Index platform interfaces since they are now used by all platforms for the DNS-SD APIs.
111
112 Revision 1.26 2003/12/08 21:00:46 rpantos
113 Changes to support mDNSResponder on Linux.
114
115 Revision 1.25 2003/11/08 22:18:29 cheshire
116 <rdar://problem/3477870>: Don't need to show process ID in *every* mDNSResponder syslog message
117
118 Revision 1.24 2003/11/08 22:13:00 cheshire
119 Move extern declarations inside '#ifdef __cplusplus extern "C" {' section
120
121 Revision 1.23 2003/09/23 16:38:25 cheshire
122 When LogAllOperations is false, treat LogOperation() like debugf()
123 (i.e. show in debug builds), rather than unconditionally ignoring
124
125 Revision 1.22 2003/09/23 02:12:43 cheshire
126 Also include port number in list of services registered via new UDS API
127
128 Revision 1.21 2003/08/19 22:20:00 cheshire
129 <rdar://problem/3376721> Don't use IPv6 on interfaces that have a routable IPv4 address configured
130 More minor refinements
131
132 Revision 1.20 2003/08/19 05:39:43 cheshire
133 <rdar://problem/3380097> SIGINFO dump should include resolves started by DNSServiceQueryRecord
134
135 Revision 1.19 2003/08/19 05:36:45 cheshire
136 Add missing "extern" directives
137
138 Revision 1.18 2003/08/19 03:04:43 cheshire
139 <rdar://problem/3376721> Don't use IPv6 on interfaces that have a routable IPv4 address configured
140
141 Revision 1.17 2003/08/12 19:56:25 cheshire
142 Update to APSL 2.0
143
144 Revision 1.16 2003/08/08 18:36:04 cheshire
145 <rdar://problem/3344154> Only need to revalidate on interface removal on platforms that have the PhantomInterfaces bug
146
147 Revision 1.15 2003/08/05 00:32:28 cheshire
148 <rdar://problem/3326712> Time to turn off MACOSX_MDNS_MALLOC_DEBUGGING
149
150 Revision 1.14 2003/07/20 03:38:51 ksekar
151 <rdar://problem/3320722> Completed support for Unix-domain socket based API.
152
153 Revision 1.13 2003/07/18 00:30:00 cheshire
154 <rdar://problem/3268878> Remove mDNSResponder version from packet header and use HINFO record instead
155
156 Revision 1.12 2003/07/12 03:15:20 cheshire
157 <rdar://problem/3324848> After SCDynamicStore notification, mDNSResponder updates
158 m->hostlabel even if user hasn't actually actually changed their dot-local hostname
159
160 Revision 1.11 2003/07/02 21:19:51 cheshire
161 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
162
163 Revision 1.10 2003/06/25 23:42:19 ksekar
164 <rdar://problem/3249292>: Feature: New DNS-SD APIs (#7875)
165 Reviewed by: Stuart Cheshire
166 Added files necessary to implement Unix domain sockets based enhanced
167 DNS-SD APIs, and integrated with existing Mach-port based daemon.
168
169 Revision 1.9 2003/06/10 01:14:11 cheshire
170 <rdar://problem/3286004> New APIs require a mDNSPlatformInterfaceIDfromInterfaceIndex() call
171
172 Revision 1.8 2003/05/14 07:08:37 cheshire
173 <rdar://problem/3159272> mDNSResponder should be smarter about reconfigurations
174 Previously, when there was any network configuration change, mDNSResponder
175 would tear down the entire list of active interfaces and start again.
176 That was very disruptive, and caused the entire cache to be flushed,
177 and caused lots of extra network traffic. Now it only removes interfaces
178 that have really gone, and only adds new ones that weren't there before.
179
180 Revision 1.7 2003/04/26 02:39:24 cheshire
181 Remove extern void LogMsg(const char *format, ...);
182
183 Revision 1.6 2003/03/05 21:59:56 cheshire
184 <rdar://problem/3189097> Additional debugging code in mDNSResponder
185
186 Revision 1.5 2003/03/05 01:50:38 cheshire
187 <rdar://problem/3189097> Additional debugging code in mDNSResponder
188
189 Revision 1.4 2003/02/21 01:54:10 cheshire
190 <rdar://problem/3099194> mDNSResponder needs performance improvements
191 Switched to using new "mDNS_Execute" model (see "Implementer Notes.txt")
192
193 Revision 1.3 2002/09/21 20:44:51 zarzycki
194 Added APSL info
195
196 Revision 1.2 2002/09/19 04:20:44 cheshire
197 Remove high-ascii characters that confuse some systems
198
199 Revision 1.1 2002/09/17 01:04:09 cheshire
200 Defines mDNS_PlatformSupport_struct for OS X
201
202 */
203
204 #ifndef __mDNSOSX_h
205 #define __mDNSOSX_h
206
207 #ifdef __cplusplus
208 extern "C" {
209 #endif
210
211 #include <SystemConfiguration/SystemConfiguration.h>
212 #include <IOKit/pwr_mgt/IOPMLib.h>
213 #include <sys/socket.h>
214 #include <netinet/in.h>
215 #include "mDNSEmbeddedAPI.h" // for domain name structure
216
217 typedef struct NetworkInterfaceInfoOSX_struct NetworkInterfaceInfoOSX;
218
219 typedef struct
220 {
221 mDNS *m;
222 NetworkInterfaceInfoOSX *info;
223 int sktv4;
224 CFSocketRef cfsv4;
225 CFRunLoopSourceRef rlsv4;
226 int sktv6;
227 CFSocketRef cfsv6;
228 CFRunLoopSourceRef rlsv6;
229 } CFSocketSet;
230
231 struct NetworkInterfaceInfoOSX_struct
232 {
233 NetworkInterfaceInfo ifinfo; // MUST be the first element in this structure
234 NetworkInterfaceInfoOSX *next;
235 mDNSu32 Exists; // 1 = currently exists in getifaddrs list; 0 = doesn't
236 // 2 = exists, but McastTxRx state changed
237 mDNSs32 LastSeen; // If Exists==0, last time this interface appeared in getifaddrs list
238 char *ifa_name; // Memory for this is allocated using malloc
239 mDNSu32 scope_id; // interface index / IPv6 scope ID
240 mDNSEthAddr BSSID; // BSSID of 802.11 base station, if applicable
241 u_short sa_family;
242 mDNSBool Multicast;
243 CFSocketSet ss;
244 };
245
246 struct mDNS_PlatformSupport_struct
247 {
248 NetworkInterfaceInfoOSX *InterfaceList;
249 CFSocketSet unicastsockets;
250 domainlabel userhostlabel; // The hostlabel as it was set in System Preferences the last time we looked
251 domainlabel usernicelabel; // The nicelabel as it was set in System Preferences the last time we looked
252 mDNSs32 NotifyUser;
253 mDNSs32 NetworkChanged;
254 SCDynamicStoreRef Store;
255 CFRunLoopSourceRef StoreRLS;
256 io_connect_t PowerConnection;
257 io_object_t PowerNotifier;
258 CFRunLoopSourceRef PowerRLS;
259 };
260
261 extern void NotifyOfElusiveBug(const char *title, mDNSu32 radarid, const char *msg);
262 extern void mDNSMacOSXNetworkChanged(mDNS *const m);
263 extern int mDNSMacOSXSystemBuildNumber(char *HINFO_SWstring);
264
265 extern const char mDNSResponderVersionString[];
266
267 // Legacy NAT Traversal Support Setup/Teardown
268 extern int LegacyNATDestroy(void);
269 extern int LegacyNATInit(void);
270
271 // Allow platform layer to tell daemon when default registration/browse domains
272 extern void DefaultRegDomainChanged(const domainname *d, mDNSBool add);
273 extern void DefaultBrowseDomainChanged(const domainname *d, mDNSBool add);
274
275 #ifdef __cplusplus
276 }
277 #endif
278
279 #endif