]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/mDNSWin32.h
mDNSResponder-66.3.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / mDNSWin32.h
1 /*
2 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24
25 Change History (most recent first):
26
27 $Log: mDNSWin32.h,v $
28 Revision 1.11 2004/01/30 02:44:32 bradley
29 Added support for IPv6 (v4 & v6, v4-only, v6-only, AAAA over v4, etc.). Added support for DNS-SD
30 InterfaceID<->Interface Index mappings. Added support for loopback usage when no other interfaces
31 are available. Updated unlock signaling to no longer require timenow - NextScheduledTime to be >= 0
32 (it no longer is). Added unicast-capable detection to avoid using unicast when there is other mDNS
33 software running on the same machine. Removed unneeded sock_XtoY routines. Added support for
34 reporting HINFO records with the Windows and mDNSResponder version information.
35
36 Revision 1.10 2003/10/24 23:23:02 bradley
37 Removed legacy port 53 support as it is no longer needed.
38
39 Revision 1.9 2003/08/20 06:21:25 bradley
40 Updated to latest internal version of the Rendezvous for Windows platform plugin: Added support
41 for Windows CE/PocketPC 2003; re-did interface-related code to emulate getifaddrs/freeifaddrs for
42 restricting usage to only active, multicast-capable, and non-point-to-point interfaces and to ease
43 the addition of IPv6 support in the future; Changed init code to serialize thread initialization to
44 enable ThreadID improvement to wakeup notification; Define platform support structure locally to
45 allow portable mDNS_Init usage; Removed dependence on modified mDNSCore: define interface ID<->name
46 structures/prototypes locally; Changed to use _beginthreadex()/_endthreadex() on non-Windows CE
47 platforms (re-mapped to CreateThread on Window CE) to avoid a leak in the Microsoft C runtime;
48 Added IPv4/IPv6 string<->address conversion routines; Cleaned up some code and added HeaderDoc.
49
50 Revision 1.8 2003/08/12 19:56:27 cheshire
51 Update to APSL 2.0
52
53 Revision 1.7 2003/07/23 02:23:01 cheshire
54 Updated mDNSPlatformUnlock() to work correctly, now that <rdar://problem/3160248>
55 "ScheduleNextTask needs to be smarter" has refined the way m->NextScheduledEvent is set
56
57 Revision 1.6 2003/07/02 21:20:04 cheshire
58 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
59
60 Revision 1.5 2003/04/29 00:06:09 cheshire
61 <rdar://problem/3242673> mDNSWindows needs a wakeupEvent object to signal the main thread
62
63 Revision 1.4 2003/03/22 02:57:44 cheshire
64 Updated mDNSWindows to use new "mDNS_Execute" model (see "mDNSCore/Implementer Notes.txt")
65
66 Revision 1.3 2002/09/21 20:44:54 zarzycki
67 Added APSL info
68
69 Revision 1.2 2002/09/20 05:55:16 bradley
70 Multicast DNS platform plugin for Win32
71
72 */
73
74 #ifndef __MDNS_WIN32__
75 #define __MDNS_WIN32__
76
77 #include "CommonServices.h"
78
79 #if( !defined( _WIN32_WCE ) )
80 #include <mswsock.h>
81 #endif
82
83 #include "mDNSClientAPI.h"
84
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
88
89 //---------------------------------------------------------------------------------------------------------------------------
90 /*! @struct mDNSInterfaceData
91
92 @abstract Structure containing interface-specific data.
93 */
94
95 typedef struct mDNSInterfaceData mDNSInterfaceData;
96 struct mDNSInterfaceData
97 {
98 mDNSInterfaceData * next;
99 char name[ 128 ];
100 uint32_t index;
101 uint32_t scopeID;
102 SocketRef sock;
103 #if( !defined( _WIN32_WCE ) )
104 LPFN_WSARECVMSG wsaRecvMsgFunctionPtr;
105 #endif
106 HANDLE readPendingEvent;
107 NetworkInterfaceInfo interfaceInfo;
108 mDNSAddr defaultAddr;
109 mDNSBool hostRegistered;
110 };
111
112 //---------------------------------------------------------------------------------------------------------------------------
113 /*! @struct mDNS_PlatformSupport_struct
114
115 @abstract Structure containing platform-specific data.
116 */
117
118 struct mDNS_PlatformSupport_struct
119 {
120 CRITICAL_SECTION lock;
121 mDNSBool lockInitialized;
122 HANDLE cancelEvent;
123 HANDLE quitEvent;
124 HANDLE interfaceListChangedEvent;
125 HANDLE wakeupEvent;
126 HANDLE initEvent;
127 mStatus initStatus;
128 SocketRef interfaceListChangedSocket;
129 int interfaceCount;
130 mDNSInterfaceData * interfaceList;
131 DWORD threadID;
132 };
133
134 //---------------------------------------------------------------------------------------------------------------------------
135 /*! @struct ifaddrs
136
137 @abstract Interface information
138 */
139
140 struct ifaddrs
141 {
142 struct ifaddrs * ifa_next;
143 char * ifa_name;
144 u_int ifa_flags;
145 struct sockaddr * ifa_addr;
146 struct sockaddr * ifa_netmask;
147 struct sockaddr * ifa_broadaddr;
148 struct sockaddr * ifa_dstaddr;
149 void * ifa_data;
150
151 struct
152 {
153 uint32_t index;
154
155 } ifa_extra;
156 };
157
158 //---------------------------------------------------------------------------------------------------------------------------
159 /*! @function getifaddrs
160
161 @abstract Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
162 */
163
164 int getifaddrs( struct ifaddrs **outAddrs );
165
166 //---------------------------------------------------------------------------------------------------------------------------
167 /*! @function freeifaddrs
168
169 @abstract Frees a linked list of interfaces built with getifaddrs.
170 */
171
172 void freeifaddrs( struct ifaddrs *inAddrs );
173
174 #ifdef __cplusplus
175 }
176 #endif
177
178 #endif // __MDNS_WIN32__