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 2003/08/20 06:21:25 bradley
27 Updated to latest internal version of the Rendezvous for Windows platform plugin: Added support
28 for Windows CE/PocketPC 2003; re-did interface-related code to emulate getifaddrs/freeifaddrs for
29 restricting usage to only active, multicast-capable, and non-point-to-point interfaces and to ease
30 the addition of IPv6 support in the future; Changed init code to serialize thread initialization to
31 enable ThreadID improvement to wakeup notification; Define platform support structure locally to
32 allow portable mDNS_Init usage; Removed dependence on modified mDNSCore: define interface ID<->name
33 structures/prototypes locally; Changed to use _beginthreadex()/_endthreadex() on non-Windows CE
34 platforms (re-mapped to CreateThread on Window CE) to avoid a leak in the Microsoft C runtime;
35 Added IPv4/IPv6 string<->address conversion routines; Cleaned up some code and added HeaderDoc.
37 Revision 1.8 2003/08/12 19:56:27 cheshire
40 Revision 1.7 2003/07/23 02:23:01 cheshire
41 Updated mDNSPlatformUnlock() to work correctly, now that <rdar://problem/3160248>
42 "ScheduleNextTask needs to be smarter" has refined the way m->NextScheduledEvent is set
44 Revision 1.6 2003/07/02 21:20:04 cheshire
45 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
47 Revision 1.5 2003/04/29 00:06:09 cheshire
48 <rdar://problem/3242673> mDNSWindows needs a wakeupEvent object to signal the main thread
50 Revision 1.4 2003/03/22 02:57:44 cheshire
51 Updated mDNSWindows to use new "mDNS_Execute" model (see "mDNSCore/Implementer Notes.txt")
53 Revision 1.3 2002/09/21 20:44:54 zarzycki
56 Revision 1.2 2002/09/20 05:55:16 bradley
57 Multicast DNS platform plugin for Win32
61 #ifndef __MDNS_WIN32__
62 #define __MDNS_WIN32__
64 #if( !defined( WIN32_LEAN_AND_MEAN ) )
65 #define WIN32_LEAN_AND_MEAN // Needed to avoid redefinitions by Windows interfaces.
72 #include "mDNSClientAPI.h"
78 //---------------------------------------------------------------------------------------------------------------------------
79 /*! @typedef SocketRef
81 @abstract Socket file descriptor alias for improved readability.
84 typedef SOCKET SocketRef
;
86 //---------------------------------------------------------------------------------------------------------------------------
87 /*! @struct mDNSInterfaceData
89 @abstract Structure containing interface-specific data.
92 typedef struct mDNSInterfaceData mDNSInterfaceData
;
93 struct mDNSInterfaceData
95 mDNSInterfaceData
* next
;
97 SocketRef multicastSocketRef
;
98 HANDLE multicastReadPendingEvent
;
99 SocketRef unicastSocketRef
;
100 HANDLE unicastReadPendingEvent
;
101 NetworkInterfaceInfo hostSet
;
102 mDNSBool hostRegistered
;
104 int sendMulticastCounter
;
105 int sendUnicastCounter
;
106 int sendErrorCounter
;
108 int recvMulticastCounter
;
109 int recvUnicastCounter
;
110 int recvErrorCounter
;
113 //---------------------------------------------------------------------------------------------------------------------------
114 /*! @struct mDNS_PlatformSupport_struct
116 @abstract Structure containing platform-specific data.
119 struct mDNS_PlatformSupport_struct
121 CRITICAL_SECTION lock
;
122 mDNSBool lockInitialized
;
125 HANDLE interfaceListChangedEvent
;
130 SocketRef interfaceListChangedSocketRef
;
132 mDNSInterfaceData
* interfaceList
;
136 //---------------------------------------------------------------------------------------------------------------------------
139 @abstract Interface information
144 struct ifaddrs
* ifa_next
;
147 struct sockaddr
* ifa_addr
;
148 struct sockaddr
* ifa_netmask
;
149 struct sockaddr
* ifa_broadaddr
;
150 struct sockaddr
* ifa_dstaddr
;
154 //---------------------------------------------------------------------------------------------------------------------------
155 /*! @function getifaddrs
157 @abstract Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
160 int getifaddrs( struct ifaddrs
**outAddrs
);
162 //---------------------------------------------------------------------------------------------------------------------------
163 /*! @function freeifaddrs
165 @abstract Frees a linked list of interfaces built with getifaddrs.
168 void freeifaddrs( struct ifaddrs
*inAddrs
);
170 //---------------------------------------------------------------------------------------------------------------------------
171 /*! @function sock_pton
173 @abstract Converts a 'p'resentation address string into a 'n'umeric sockaddr structure.
175 @result 0 if successful or an error code on failure.
178 int sock_pton( const char *inString
, int inFamily
, void *outAddr
, size_t inAddrSize
, size_t *outAddrSize
);
180 //---------------------------------------------------------------------------------------------------------------------------
181 /*! @function sock_ntop
183 @abstract Converts a 'n'umeric sockaddr structure into a 'p'resentation address string.
185 @result Ptr to 'p'resentation address string buffer if successful or NULL on failure.
188 char * sock_ntop( const void *inAddr
, size_t inAddrSize
, char *inBuffer
, size_t inBufferSize
);
194 #endif // __MDNS_WIN32__