]> git.saurik.com Git - apple/mdnsresponder.git/blame - mDNSWindows/mDNSWin32.h
mDNSResponder-108.6.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / mDNSWin32.h
CommitLineData
c9d2d929 1/*
8e92c31c 2 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
c9b9ae52 3 *
c9d2d929 4 * @APPLE_LICENSE_HEADER_START@
c9b9ae52 5 *
c9d2d929
A
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.
c9b9ae52 12 *
c9d2d929
A
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
c9b9ae52 19 * limitations under the License.
c9d2d929
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
c9b9ae52
A
22
23 Change History (most recent first):
24
25$Log: mDNSWin32.h,v $
4aea607d
A
26Revision 1.23 2005/10/05 20:55:14 herscher
27<rdar://problem/4096464> Don't call SetLLRoute on loopback interface
28
7cb34e5c
A
29Revision 1.22 2005/03/04 22:44:53 shersche
30<rdar://problem/4022802> mDNSResponder did not notice changes to DNS server config
31
32Revision 1.21 2005/03/03 02:29:00 shersche
33Use the RegNames.h header file for registry key names
34
283ee3ff
A
35Revision 1.20 2005/01/25 08:12:52 shersche
36<rdar://problem/3947417> Enable Unicast and add Dynamic DNS support.
37Bug #: 3947417
38
39Revision 1.19 2004/12/15 07:34:45 shersche
40Add platform support for IPv4 and IPv6 unicast sockets
41
7f0064bd
A
42Revision 1.18 2004/10/11 21:53:15 shersche
43<rdar://problem/3832450> Change GetWindowsVersionString link scoping from static to non-static so that it can be accessed from other compilation units. The information returned in this function will be used to determine what service dependencies to use when calling CreateService().
44Bug #: 3832450
45
46Revision 1.17 2004/09/17 01:08:57 cheshire
47Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
48 The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
49 declared in that file are ONLY appropriate to single-address-space embedded applications.
50 For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used.
51
52Revision 1.16 2004/08/05 05:43:01 shersche
53<rdar://problem/3751566> Add HostDescriptionChangedCallback so callers can choose to handle it when mDNSWin32 core detects that the computer description string has changed
54Bug #: 3751566
55
56Revision 1.15 2004/07/26 05:42:50 shersche
57use "Computer Description" for nicename if available, track dynamic changes to "Computer Description"
58
59Revision 1.14 2004/07/13 21:24:25 rpantos
60Fix for <rdar://problem/3701120>.
61
62Revision 1.13 2004/06/24 15:23:24 shersche
63Add InterfaceListChanged callback. This callback is used in Service.c to add link local routes to the routing table
64Submitted by: herscher
65
66Revision 1.12 2004/06/18 05:22:16 rpantos
67Integrate Scott's changes
68
8e92c31c
A
69Revision 1.11 2004/01/30 02:44:32 bradley
70Added support for IPv6 (v4 & v6, v4-only, v6-only, AAAA over v4, etc.). Added support for DNS-SD
71InterfaceID<->Interface Index mappings. Added support for loopback usage when no other interfaces
72are available. Updated unlock signaling to no longer require timenow - NextScheduledTime to be >= 0
73(it no longer is). Added unicast-capable detection to avoid using unicast when there is other mDNS
74software running on the same machine. Removed unneeded sock_XtoY routines. Added support for
75reporting HINFO records with the Windows and mDNSResponder version information.
73792575
A
76
77Revision 1.10 2003/10/24 23:23:02 bradley
78Removed legacy port 53 support as it is no longer needed.
79
c9b9ae52 80Revision 1.9 2003/08/20 06:21:25 bradley
7f0064bd 81Updated to latest internal version of the mDNSWindows platform layer: Added support
c9b9ae52
A
82for Windows CE/PocketPC 2003; re-did interface-related code to emulate getifaddrs/freeifaddrs for
83restricting usage to only active, multicast-capable, and non-point-to-point interfaces and to ease
84the addition of IPv6 support in the future; Changed init code to serialize thread initialization to
85enable ThreadID improvement to wakeup notification; Define platform support structure locally to
86allow portable mDNS_Init usage; Removed dependence on modified mDNSCore: define interface ID<->name
87structures/prototypes locally; Changed to use _beginthreadex()/_endthreadex() on non-Windows CE
88platforms (re-mapped to CreateThread on Window CE) to avoid a leak in the Microsoft C runtime;
89Added IPv4/IPv6 string<->address conversion routines; Cleaned up some code and added HeaderDoc.
90
91Revision 1.8 2003/08/12 19:56:27 cheshire
92Update to APSL 2.0
93
94Revision 1.7 2003/07/23 02:23:01 cheshire
95Updated mDNSPlatformUnlock() to work correctly, now that <rdar://problem/3160248>
96"ScheduleNextTask needs to be smarter" has refined the way m->NextScheduledEvent is set
97
98Revision 1.6 2003/07/02 21:20:04 cheshire
99<rdar://problem/3313413> Update copyright notices, etc., in source code comments
100
101Revision 1.5 2003/04/29 00:06:09 cheshire
102<rdar://problem/3242673> mDNSWindows needs a wakeupEvent object to signal the main thread
103
104Revision 1.4 2003/03/22 02:57:44 cheshire
105Updated mDNSWindows to use new "mDNS_Execute" model (see "mDNSCore/Implementer Notes.txt")
106
107Revision 1.3 2002/09/21 20:44:54 zarzycki
108Added APSL info
109
110Revision 1.2 2002/09/20 05:55:16 bradley
111Multicast DNS platform plugin for Win32
112
113*/
114
115#ifndef __MDNS_WIN32__
116#define __MDNS_WIN32__
117
8e92c31c 118#include "CommonServices.h"
c9b9ae52 119
8e92c31c
A
120#if( !defined( _WIN32_WCE ) )
121 #include <mswsock.h>
122#endif
c9b9ae52 123
7f0064bd 124#include "mDNSEmbeddedAPI.h"
283ee3ff 125#include "dDNS.h"
c9b9ae52
A
126
127#ifdef __cplusplus
128 extern "C" {
129#endif
130
c9b9ae52
A
131//---------------------------------------------------------------------------------------------------------------------------
132/*! @struct mDNSInterfaceData
133
134 @abstract Structure containing interface-specific data.
135*/
136
137typedef struct mDNSInterfaceData mDNSInterfaceData;
138struct mDNSInterfaceData
139{
140 mDNSInterfaceData * next;
8e92c31c
A
141 char name[ 128 ];
142 uint32_t index;
143 uint32_t scopeID;
73792575 144 SocketRef sock;
8e92c31c
A
145#if( !defined( _WIN32_WCE ) )
146 LPFN_WSARECVMSG wsaRecvMsgFunctionPtr;
147#endif
73792575 148 HANDLE readPendingEvent;
8e92c31c
A
149 NetworkInterfaceInfo interfaceInfo;
150 mDNSAddr defaultAddr;
c9b9ae52 151 mDNSBool hostRegistered;
c9b9ae52
A
152};
153
7f0064bd
A
154//---------------------------------------------------------------------------------------------------------------------------
155/*! @typedef IdleThreadCallback
156
157 @abstract mDNSWin32 core will call out through this function pointer
158 after calling mDNS_Execute
159*/
160typedef mDNSs32 (*IdleThreadCallback)(mDNS * const inMDNS, mDNSs32 interval);
161//---------------------------------------------------------------------------------------------------------------------------
162
163//---------------------------------------------------------------------------------------------------------------------------
164/*! @typedef InterfaceListChangedCallback
165
166 @abstract mDNSWin32 core will call out through this function pointer
167 after detecting an interface list changed event
168*/
169typedef void (*InterfaceListChangedCallback)(mDNS * const inMDNS);
170//---------------------------------------------------------------------------------------------------------------------------
171
172
173//---------------------------------------------------------------------------------------------------------------------------
174/*! @typedef HostDescriptionChangedCallback
175
176 @abstract mDNSWin32 core will call out through this function pointer
177 after detecting that the computer description has changed
178*/
179typedef void (*HostDescriptionChangedCallback)(mDNS * const inMDNS);
180//---------------------------------------------------------------------------------------------------------------------------
181
182
c9b9ae52
A
183//---------------------------------------------------------------------------------------------------------------------------
184/*! @struct mDNS_PlatformSupport_struct
185
186 @abstract Structure containing platform-specific data.
187*/
188
189struct mDNS_PlatformSupport_struct
190{
191 CRITICAL_SECTION lock;
192 mDNSBool lockInitialized;
193 HANDLE cancelEvent;
194 HANDLE quitEvent;
195 HANDLE interfaceListChangedEvent;
283ee3ff 196 HANDLE descChangedEvent; // Computer description changed event
7cb34e5c 197 HANDLE tcpipChangedEvent; // TCP/IP config changed
283ee3ff 198 HANDLE ddnsChangedEvent; // DynDNS config changed
c9b9ae52
A
199 HANDLE wakeupEvent;
200 HANDLE initEvent;
283ee3ff 201 HKEY descKey;
7cb34e5c 202 HKEY tcpipKey;
283ee3ff 203 HKEY ddnsKey;
c9b9ae52 204 mStatus initStatus;
4aea607d 205 mDNSBool registeredLoopback4;
8e92c31c 206 SocketRef interfaceListChangedSocket;
c9b9ae52
A
207 int interfaceCount;
208 mDNSInterfaceData * interfaceList;
7f0064bd 209 mDNSInterfaceData * inactiveInterfaceList;
c9b9ae52 210 DWORD threadID;
7f0064bd
A
211 IdleThreadCallback idleThreadCallback;
212 InterfaceListChangedCallback interfaceListChangedCallback;
213 HostDescriptionChangedCallback hostDescriptionChangedCallback;
283ee3ff
A
214 SocketRef unicastSock4;
215 HANDLE unicastSock4ReadEvent;
216 mDNSAddr unicastSock4DestAddr;
217#if( !defined( _WIN32_WCE ) )
218 LPFN_WSARECVMSG unicastSock4RecvMsgPtr;
219#endif
220 SocketRef unicastSock6;
221 HANDLE unicastSock6ReadEvent;
222 mDNSAddr unicastSock6DestAddr;
223#if( !defined( _WIN32_WCE ) )
224 LPFN_WSARECVMSG unicastSock6RecvMsgPtr;
225#endif
c9b9ae52
A
226};
227
228//---------------------------------------------------------------------------------------------------------------------------
229/*! @struct ifaddrs
230
231 @abstract Interface information
232*/
233
234struct ifaddrs
235{
236 struct ifaddrs * ifa_next;
237 char * ifa_name;
238 u_int ifa_flags;
239 struct sockaddr * ifa_addr;
240 struct sockaddr * ifa_netmask;
241 struct sockaddr * ifa_broadaddr;
242 struct sockaddr * ifa_dstaddr;
243 void * ifa_data;
8e92c31c
A
244
245 struct
246 {
247 uint32_t index;
248
249 } ifa_extra;
c9b9ae52
A
250};
251
7f0064bd
A
252
253//---------------------------------------------------------------------------------------------------------------------------
254/*! @function GetWindowsVersionString
255
256 @abstract Stores Windows version information in the string passed in (inBuffer)
257*/
258
259OSStatus GetWindowsVersionString( char *inBuffer, size_t inBufferSize );
260
261
c9b9ae52
A
262//---------------------------------------------------------------------------------------------------------------------------
263/*! @function getifaddrs
264
265 @abstract Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
266*/
267
268int getifaddrs( struct ifaddrs **outAddrs );
269
270//---------------------------------------------------------------------------------------------------------------------------
271/*! @function freeifaddrs
272
273 @abstract Frees a linked list of interfaces built with getifaddrs.
274*/
275
276void freeifaddrs( struct ifaddrs *inAddrs );
277
283ee3ff 278
c9b9ae52
A
279#ifdef __cplusplus
280 }
281#endif
282
283#endif // __MDNS_WIN32__