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):
26 Revision 1.9.2.1 2004/04/03 05:26:08 bradley
27 Integrated changes from TOT to remove legacy port 53 support.
29 Revision 1.10 2003/10/24 23:23:02 bradley
30 Removed legacy port 53 support as it is no longer needed.
32 Revision 1.9 2003/08/20 06:21:25 bradley
33 Updated to latest internal version of the Rendezvous for Windows platform plugin: Added support
34 for Windows CE/PocketPC 2003; re-did interface-related code to emulate getifaddrs/freeifaddrs for
35 restricting usage to only active, multicast-capable, and non-point-to-point interfaces and to ease
36 the addition of IPv6 support in the future; Changed init code to serialize thread initialization to
37 enable ThreadID improvement to wakeup notification; Define platform support structure locally to
38 allow portable mDNS_Init usage; Removed dependence on modified mDNSCore: define interface ID<->name
39 structures/prototypes locally; Changed to use _beginthreadex()/_endthreadex() on non-Windows CE
40 platforms (re-mapped to CreateThread on Window CE) to avoid a leak in the Microsoft C runtime;
41 Added IPv4/IPv6 string<->address conversion routines; Cleaned up some code and added HeaderDoc.
43 Revision 1.8 2003/08/12 19:56:27 cheshire
46 Revision 1.7 2003/07/23 02:23:01 cheshire
47 Updated mDNSPlatformUnlock() to work correctly, now that <rdar://problem/3160248>
48 "ScheduleNextTask needs to be smarter" has refined the way m->NextScheduledEvent is set
50 Revision 1.6 2003/07/02 21:20:04 cheshire
51 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
53 Revision 1.5 2003/04/29 00:06:09 cheshire
54 <rdar://problem/3242673> mDNSWindows needs a wakeupEvent object to signal the main thread
56 Revision 1.4 2003/03/22 02:57:44 cheshire
57 Updated mDNSWindows to use new "mDNS_Execute" model (see "mDNSCore/Implementer Notes.txt")
59 Revision 1.3 2002/09/21 20:44:54 zarzycki
62 Revision 1.2 2002/09/20 05:55:16 bradley
63 Multicast DNS platform plugin for Win32
67 #ifndef __MDNS_WIN32__
68 #define __MDNS_WIN32__
70 #if( !defined( WIN32_LEAN_AND_MEAN ) )
71 #define WIN32_LEAN_AND_MEAN // Needed to avoid redefinitions by Windows interfaces.
78 #include "mDNSClientAPI.h"
84 //---------------------------------------------------------------------------------------------------------------------------
85 /*! @typedef SocketRef
87 @abstract Socket file descriptor alias for improved readability.
90 typedef SOCKET SocketRef
;
92 //---------------------------------------------------------------------------------------------------------------------------
93 /*! @struct mDNSInterfaceData
95 @abstract Structure containing interface-specific data.
98 typedef struct mDNSInterfaceData mDNSInterfaceData
;
99 struct mDNSInterfaceData
101 mDNSInterfaceData
* next
;
104 HANDLE readPendingEvent
;
105 NetworkInterfaceInfo hostSet
;
106 mDNSBool hostRegistered
;
108 int sendMulticastCounter
;
109 int sendUnicastCounter
;
110 int sendErrorCounter
;
113 int recvErrorCounter
;
116 //---------------------------------------------------------------------------------------------------------------------------
117 /*! @struct mDNS_PlatformSupport_struct
119 @abstract Structure containing platform-specific data.
122 struct mDNS_PlatformSupport_struct
124 CRITICAL_SECTION lock
;
125 mDNSBool lockInitialized
;
128 HANDLE interfaceListChangedEvent
;
133 SocketRef interfaceListChangedSocketRef
;
135 mDNSInterfaceData
* interfaceList
;
139 //---------------------------------------------------------------------------------------------------------------------------
142 @abstract Interface information
147 struct ifaddrs
* ifa_next
;
150 struct sockaddr
* ifa_addr
;
151 struct sockaddr
* ifa_netmask
;
152 struct sockaddr
* ifa_broadaddr
;
153 struct sockaddr
* ifa_dstaddr
;
157 //---------------------------------------------------------------------------------------------------------------------------
158 /*! @function getifaddrs
160 @abstract Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
163 int getifaddrs( struct ifaddrs
**outAddrs
);
165 //---------------------------------------------------------------------------------------------------------------------------
166 /*! @function freeifaddrs
168 @abstract Frees a linked list of interfaces built with getifaddrs.
171 void freeifaddrs( struct ifaddrs
*inAddrs
);
173 //---------------------------------------------------------------------------------------------------------------------------
174 /*! @function sock_pton
176 @abstract Converts a 'p'resentation address string into a 'n'umeric sockaddr structure.
178 @result 0 if successful or an error code on failure.
181 int sock_pton( const char *inString
, int inFamily
, void *outAddr
, size_t inAddrSize
, size_t *outAddrSize
);
183 //---------------------------------------------------------------------------------------------------------------------------
184 /*! @function sock_ntop
186 @abstract Converts a 'n'umeric sockaddr structure into a 'p'resentation address string.
188 @result Ptr to 'p'resentation address string buffer if successful or NULL on failure.
191 char * sock_ntop( const void *inAddr
, size_t inAddrSize
, char *inBuffer
, size_t inBufferSize
);
197 #endif // __MDNS_WIN32__