2 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
25 Change History (most recent first):
28 Revision 1.9 2003/08/20 06:21:25 bradley
29 Updated to latest internal version of the Rendezvous for Windows platform plugin: Added support
30 for Windows CE/PocketPC 2003; re-did interface-related code to emulate getifaddrs/freeifaddrs for
31 restricting usage to only active, multicast-capable, and non-point-to-point interfaces and to ease
32 the addition of IPv6 support in the future; Changed init code to serialize thread initialization to
33 enable ThreadID improvement to wakeup notification; Define platform support structure locally to
34 allow portable mDNS_Init usage; Removed dependence on modified mDNSCore: define interface ID<->name
35 structures/prototypes locally; Changed to use _beginthreadex()/_endthreadex() on non-Windows CE
36 platforms (re-mapped to CreateThread on Window CE) to avoid a leak in the Microsoft C runtime;
37 Added IPv4/IPv6 string<->address conversion routines; Cleaned up some code and added HeaderDoc.
39 Revision 1.8 2003/08/12 19:56:27 cheshire
42 Revision 1.7 2003/07/23 02:23:01 cheshire
43 Updated mDNSPlatformUnlock() to work correctly, now that <rdar://problem/3160248>
44 "ScheduleNextTask needs to be smarter" has refined the way m->NextScheduledEvent is set
46 Revision 1.6 2003/07/02 21:20:04 cheshire
47 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
49 Revision 1.5 2003/04/29 00:06:09 cheshire
50 <rdar://problem/3242673> mDNSWindows needs a wakeupEvent object to signal the main thread
52 Revision 1.4 2003/03/22 02:57:44 cheshire
53 Updated mDNSWindows to use new "mDNS_Execute" model (see "mDNSCore/Implementer Notes.txt")
55 Revision 1.3 2002/09/21 20:44:54 zarzycki
58 Revision 1.2 2002/09/20 05:55:16 bradley
59 Multicast DNS platform plugin for Win32
63 #ifndef __MDNS_WIN32__
64 #define __MDNS_WIN32__
66 #if( !defined( WIN32_LEAN_AND_MEAN ) )
67 #define WIN32_LEAN_AND_MEAN // Needed to avoid redefinitions by Windows interfaces.
74 #include "mDNSClientAPI.h"
80 //---------------------------------------------------------------------------------------------------------------------------
81 /*! @typedef SocketRef
83 @abstract Socket file descriptor alias for improved readability.
86 typedef SOCKET SocketRef
;
88 //---------------------------------------------------------------------------------------------------------------------------
89 /*! @struct mDNSInterfaceData
91 @abstract Structure containing interface-specific data.
94 typedef struct mDNSInterfaceData mDNSInterfaceData
;
95 struct mDNSInterfaceData
97 mDNSInterfaceData
* next
;
99 SocketRef multicastSocketRef
;
100 HANDLE multicastReadPendingEvent
;
101 SocketRef unicastSocketRef
;
102 HANDLE unicastReadPendingEvent
;
103 NetworkInterfaceInfo hostSet
;
104 mDNSBool hostRegistered
;
106 int sendMulticastCounter
;
107 int sendUnicastCounter
;
108 int sendErrorCounter
;
110 int recvMulticastCounter
;
111 int recvUnicastCounter
;
112 int recvErrorCounter
;
115 //---------------------------------------------------------------------------------------------------------------------------
116 /*! @struct mDNS_PlatformSupport_struct
118 @abstract Structure containing platform-specific data.
121 struct mDNS_PlatformSupport_struct
123 CRITICAL_SECTION lock
;
124 mDNSBool lockInitialized
;
127 HANDLE interfaceListChangedEvent
;
132 SocketRef interfaceListChangedSocketRef
;
134 mDNSInterfaceData
* interfaceList
;
138 //---------------------------------------------------------------------------------------------------------------------------
141 @abstract Interface information
146 struct ifaddrs
* ifa_next
;
149 struct sockaddr
* ifa_addr
;
150 struct sockaddr
* ifa_netmask
;
151 struct sockaddr
* ifa_broadaddr
;
152 struct sockaddr
* ifa_dstaddr
;
156 //---------------------------------------------------------------------------------------------------------------------------
157 /*! @function getifaddrs
159 @abstract Builds a linked list of interfaces. Caller must free using freeifaddrs if successful.
162 int getifaddrs( struct ifaddrs
**outAddrs
);
164 //---------------------------------------------------------------------------------------------------------------------------
165 /*! @function freeifaddrs
167 @abstract Frees a linked list of interfaces built with getifaddrs.
170 void freeifaddrs( struct ifaddrs
*inAddrs
);
172 //---------------------------------------------------------------------------------------------------------------------------
173 /*! @function sock_pton
175 @abstract Converts a 'p'resentation address string into a 'n'umeric sockaddr structure.
177 @result 0 if successful or an error code on failure.
180 int sock_pton( const char *inString
, int inFamily
, void *outAddr
, size_t inAddrSize
, size_t *outAddrSize
);
182 //---------------------------------------------------------------------------------------------------------------------------
183 /*! @function sock_ntop
185 @abstract Converts a 'n'umeric sockaddr structure into a 'p'resentation address string.
187 @result Ptr to 'p'resentation address string buffer if successful or NULL on failure.
190 char * sock_ntop( const void *inAddr
, size_t inAddrSize
, char *inBuffer
, size_t inBufferSize
);
196 #endif // __MDNS_WIN32__