1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef __MDNS_WIN32__
19 #define __MDNS_WIN32__
21 #include "CommonServices.h"
23 #if( !defined( _WIN32_WCE ) )
27 #include "mDNSEmbeddedAPI.h"
35 typedef struct Overlapped
41 DWORD bytesTransferred
;
49 typedef void ( *TCPReadEventHandler
)( TCPSocket
* sock
);
50 typedef void ( *TCPUserCallback
)();
52 struct TCPSocket_struct
54 TCPSocketFlags flags
; // MUST BE FIRST FIELD -- mDNSCore expects every TCPSocket_struct to begin with TCPSocketFlags flags
56 TCPReadEventHandler readEventHandler
;
59 TCPUserCallback userCallback
;
61 Overlapped overlapped
;
68 TCPSocket
* nextDispatchable
;
73 struct UDPSocket_struct
75 mDNSIPPort port
; // MUST BE FIRST FIELD -- mDNSCoreReceive expects every UDPSocket_struct to begin with mDNSIPPort port
76 mDNSAddr addr
; // This is initialized by our code. If we don't get the
77 // dstAddr from WSARecvMsg we use this value instead.
79 LPFN_WSARECVMSG recvMsgPtr
;
80 Overlapped overlapped
;
83 uint8_t controlBuffer
[ 128 ];
84 struct sockaddr_storage srcAddr
; // This is filled in by the WSARecv* function
85 INT srcAddrLen
; // See above
86 struct mDNSInterfaceData
* ifd
;
87 UDPSocket
* nextDispatchable
;
93 //---------------------------------------------------------------------------------------------------------------------------
94 /*! @struct mDNSInterfaceData
96 @abstract Structure containing interface-specific data.
99 typedef struct mDNSInterfaceData mDNSInterfaceData
;
100 struct mDNSInterfaceData
105 struct UDPSocket_struct sock
;
106 NetworkInterfaceInfo interfaceInfo
;
107 mDNSBool hostRegistered
;
108 mDNSInterfaceData
* next
;
112 //---------------------------------------------------------------------------------------------------------------------------
113 /*! @typedef RegisterWaitableEventHandler
115 typedef void (*RegisterWaitableEventHandler
)(mDNS
* const inMDNS
, HANDLE event
, void * context
);
117 //---------------------------------------------------------------------------------------------------------------------------
118 /*! @typedef RegisterWaitableEventFunc
120 typedef mStatus (*RegisterWaitableEventFunc
)(mDNS
* const inMDNS
, HANDLE event
, void * context
, RegisterWaitableEventHandler handler
);
122 //---------------------------------------------------------------------------------------------------------------------------
123 /*! @typedef UnregisterWaitableEventHandler
125 typedef void (*UnregisterWaitableEventFunc
)(mDNS
* const inMDNS
, HANDLE event
);
127 //---------------------------------------------------------------------------------------------------------------------------
128 /*! @typedef ReportStatusFunc
130 typedef void (*ReportStatusFunc
)(int inType
, const char *inFormat
, ...);
133 //---------------------------------------------------------------------------------------------------------------------------
134 /*! @struct mDNS_PlatformSupport_struct
136 @abstract Structure containing platform-specific data.
139 struct mDNS_PlatformSupport_struct
142 HANDLE checkFileSharesTimer
;
143 mDNSs32 checkFileSharesTimeout
;
144 RegisterWaitableEventFunc registerWaitableEventFunc
;
145 UnregisterWaitableEventFunc unregisterWaitableEventFunc
;
146 ReportStatusFunc reportStatusFunc
;
147 time_t nextDHCPLeaseExpires
;
150 mDNSBool smbFileSharing
;
151 mDNSBool smbPrintSharing
;
152 ServiceRecordSet smbSRS
;
153 AuthRecord smbSubTypes
[ 2 ];
154 mDNSBool registeredLoopback4
;
156 mDNSInterfaceData
* interfaceList
;
157 mDNSInterfaceData
* inactiveInterfaceList
;
158 struct UDPSocket_struct unicastSock4
;
159 struct UDPSocket_struct unicastSock6
;
162 //---------------------------------------------------------------------------------------------------------------------------
165 @abstract Interface information
170 struct ifaddrs
* ifa_next
;
173 struct sockaddr
* ifa_addr
;
174 struct sockaddr
* ifa_netmask
;
175 struct sockaddr
* ifa_broadaddr
;
176 struct sockaddr
* ifa_dstaddr
;
177 BYTE ifa_physaddr
[6];
178 BOOL ifa_dhcpEnabled
;
179 time_t ifa_dhcpLeaseExpires
;
191 extern void InterfaceListDidChange( mDNS
* const inMDNS
);
192 extern void ComputerDescriptionDidChange( mDNS
* const inMDNS
);
193 extern void TCPIPConfigDidChange( mDNS
* const inMDNS
);
194 extern void DynDNSConfigDidChange( mDNS
* const inMDNS
);
195 extern void FileSharingDidChange( mDNS
* const inMDNS
);
196 extern void FirewallDidChange( mDNS
* const inMDNS
);
197 extern mStatus
TCPAddSocket( mDNS
* const inMDNS
, TCPSocket
*sock
);
198 extern mStatus
SetupInterfaceList( mDNS
* const inMDNS
);
199 extern mStatus
TearDownInterfaceList( mDNS
* const inMDNS
);
200 extern BOOL
IsWOMPEnabled();
201 extern void DispatchSocketEvents( mDNS
* const inMDNS
);
208 #endif // __MDNS_WIN32__