2 * Copyright (c) 2002-2003 Apple Computer, 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@
23 Change History (most recent first):
25 $Log: mDNSMacOSX.h,v $
26 Revision 1.21 2003/08/19 22:20:00 cheshire
27 <rdar://problem/3376721> Don't use IPv6 on interfaces that have a routable IPv4 address configured
28 More minor refinements
30 Revision 1.20 2003/08/19 05:39:43 cheshire
31 <rdar://problem/3380097> SIGINFO dump should include resolves started by DNSServiceQueryRecord
33 Revision 1.19 2003/08/19 05:36:45 cheshire
34 Add missing "extern" directives
36 Revision 1.18 2003/08/19 03:04:43 cheshire
37 <rdar://problem/3376721> Don't use IPv6 on interfaces that have a routable IPv4 address configured
39 Revision 1.17 2003/08/12 19:56:25 cheshire
42 Revision 1.16 2003/08/08 18:36:04 cheshire
43 <rdar://problem/3344154> Only need to revalidate on interface removal on platforms that have the PhantomInterfaces bug
45 Revision 1.15 2003/08/05 00:32:28 cheshire
46 <rdar://problem/3326712> Time to turn off MACOSX_MDNS_MALLOC_DEBUGGING
48 Revision 1.14 2003/07/20 03:38:51 ksekar
50 Completed support for Unix-domain socket based API.
52 Revision 1.13 2003/07/18 00:30:00 cheshire
53 <rdar://problem/3268878> Remove mDNSResponder version from packet header and use HINFO record instead
55 Revision 1.12 2003/07/12 03:15:20 cheshire
56 <rdar://problem/3324848> After SCDynamicStore notification, mDNSResponder updates
57 m->hostlabel even if user hasn't actually actually changed their dot-local hostname
59 Revision 1.11 2003/07/02 21:19:51 cheshire
60 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
62 Revision 1.10 2003/06/25 23:42:19 ksekar
63 Bug #: <rdar://problem/3249292>: Feature: New Rendezvous APIs (#7875)
64 Reviewed by: Stuart Cheshire
65 Added files necessary to implement Unix domain sockets based enhanced
66 Rendezvous APIs, and integrated with existing Mach-port based daemon.
68 Revision 1.9 2003/06/10 01:14:11 cheshire
69 <rdar://problem/3286004> New APIs require a mDNSPlatformInterfaceIDfromInterfaceIndex() call
71 Revision 1.8 2003/05/14 07:08:37 cheshire
72 <rdar://problem/3159272> mDNSResponder should be smarter about reconfigurations
73 Previously, when there was any network configuration change, mDNSResponder
74 would tear down the entire list of active interfaces and start again.
75 That was very disruptive, and caused the entire cache to be flushed,
76 and caused lots of extra network traffic. Now it only removes interfaces
77 that have really gone, and only adds new ones that weren't there before.
79 Revision 1.7 2003/04/26 02:39:24 cheshire
80 Remove extern void LogMsg(const char *format, ...);
82 Revision 1.6 2003/03/05 21:59:56 cheshire
83 Bug #: 3189097 Additional debugging code in mDNSResponder
85 Revision 1.5 2003/03/05 01:50:38 cheshire
86 Bug #: 3189097 Additional debugging code in mDNSResponder
88 Revision 1.4 2003/02/21 01:54:10 cheshire
89 Bug #: 3099194 mDNSResponder needs performance improvements
90 Switched to using new "mDNS_Execute" model (see "Implementer Notes.txt")
92 Revision 1.3 2002/09/21 20:44:51 zarzycki
95 Revision 1.2 2002/09/19 04:20:44 cheshire
96 Remove high-ascii characters that confuse some systems
98 Revision 1.1 2002/09/17 01:04:09 cheshire
99 Defines mDNS_PlatformSupport_struct for OS X
110 #include <SystemConfiguration/SystemConfiguration.h>
111 #include <IOKit/pwr_mgt/IOPMLib.h>
112 #include <sys/socket.h>
113 #include <netinet/in.h>
115 typedef struct NetworkInterfaceInfoOSX_struct NetworkInterfaceInfoOSX
;
116 struct NetworkInterfaceInfoOSX_struct
118 NetworkInterfaceInfo ifinfo
; // MUST be the first element in this structure
119 NetworkInterfaceInfoOSX
*next
;
121 mDNSu32 CurrentlyActive
; // 0 not active; 1 active; 2 active but TxRx state changed
122 char *ifa_name
; // Memory for this is allocated using malloc
123 mDNSu32 scope_id
; // interface index / IPv6 scope ID
135 struct mDNS_PlatformSupport_struct
137 NetworkInterfaceInfoOSX
*InterfaceList
;
138 domainlabel userhostlabel
;
139 SCDynamicStoreRef Store
;
140 CFRunLoopSourceRef StoreRLS
;
141 io_connect_t PowerConnection
;
142 io_object_t PowerNotifier
;
143 CFRunLoopSourceRef PowerRLS
;
146 extern mDNSInterfaceID
mDNSPlatformInterfaceIDfromInterfaceIndex(const mDNS
*const m
, mDNSu32 index
);
147 extern mDNSu32
mDNSPlatformInterfaceIndexfromInterfaceID(const mDNS
*const m
, mDNSInterfaceID id
);
148 extern mDNSBool
mDNSMacOSXSystemBuildNumber(char *HINFO_SWstring
);
150 extern const char mDNSResponderVersionString
[];
152 // Set this symbol to 1 to do extra debug checks on malloc() and free()
153 // Set this symbol to 2 to write a log message for every malloc() and free()
154 #define MACOSX_MDNS_MALLOC_DEBUGGING 0
156 #if MACOSX_MDNS_MALLOC_DEBUGGING >= 1
157 extern void *mallocL(char *msg
, unsigned int size
);
158 extern void freeL(char *msg
, void *x
);
160 #define mallocL(X,Y) malloc(Y)
161 #define freeL(X,Y) free(Y)
164 #if MACOSX_MDNS_MALLOC_DEBUGGING >= 2
165 #define LogMalloc LogMsg
167 #define LogMalloc(ARGS...) ((void)0)
170 #define LogAllOperations 0
173 #define LogOperation LogMsg
175 #define LogOperation(ARGS...) ((void)0)
182 // UDS Server <-> daemon crossover routines/globals
183 extern mDNS mDNSStorage
;
184 extern int udsserver_init(void);
185 extern int udsserver_add_rl_source(void);
186 extern mDNSs32
udsserver_idle(mDNSs32 nextevent
); // takes the next scheduled event time, does idle work,
187 // and returns the updated nextevent time
188 extern void udsserver_info(void);
189 extern void udsserver_handle_configchange(void);
190 extern int udsserver_exit(void);