2 * Copyright (c) 2003-2004 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):
25 $Log: ExplorerBarWindow.h,v $
26 Revision 1.5 2004/07/26 05:47:31 shersche
27 use TXTRecord APIs, fix bug in locating service to be removed
29 Revision 1.4 2004/07/20 06:49:18 shersche
30 clean up socket handling code
32 Revision 1.3 2004/07/13 21:24:21 rpantos
33 Fix for <rdar://problem/3701120>.
35 Revision 1.2 2004/06/27 14:59:59 shersche
36 reference count service info to handle multi-homed hosts
38 Revision 1.1 2004/06/18 04:34:59 rpantos
39 Move to Clients from mDNSWindows
41 Revision 1.3 2004/04/15 01:00:05 bradley
42 Removed support for automatically querying for A/AAAA records when resolving names. Platforms
43 without .local name resolving support will need to manually query for A/AAAA records as needed.
45 Revision 1.2 2004/04/08 09:43:43 bradley
46 Changed callback calling conventions to __stdcall so they can be used with C# delegates.
48 Revision 1.1 2004/01/30 03:01:56 bradley
49 Explorer Plugin to browse for DNS-SD advertised Web and FTP servers from within Internet Explorer.
53 #ifndef __EXPLORER_BAR_WINDOW__
54 #define __EXPLORER_BAR_WINDOW__
63 //===========================================================================================================================
65 //===========================================================================================================================
67 // Forward Declarations
69 struct ServiceHandlerEntry
;
70 class ExplorerBarWindow
;
82 ServiceHandlerEntry
* handler
;
110 typedef CArray
< ServiceInfo
*, ServiceInfo
* > ServiceInfoArray
;
133 void GetData( void *outData
, uint16_t *outSize
)
137 *( (void **) outData
) = mData
;
145 OSStatus
SetData( const void *inData
, uint16_t inSize
)
150 newData
= (uint8_t *) malloc( inSize
);
151 require_action( newData
, exit
, err
= kNoMemoryErr
);
152 memcpy( newData
, inData
, inSize
);
175 ServiceHandlerEntry
* handler
;
178 // ServiceHandlerEntry
180 struct ServiceHandlerEntry
183 const char * urlScheme
;
185 ServiceInfoArray array
;
188 ExplorerBarWindow
* obj
;
191 ServiceHandlerEntry( void )
202 ~ServiceHandlerEntry( void )
207 n
= (int) array
.GetSize();
208 for( i
= 0; i
< n
; ++i
)
215 typedef CArray
< ServiceHandlerEntry
*, ServiceHandlerEntry
* > ServiceHandlerArray
;
217 //===========================================================================================================================
219 //===========================================================================================================================
221 class ExplorerBar
; // Forward Declaration
223 class ExplorerBarWindow
: public CWnd
227 ExplorerBar
* mOwner
;
230 ServiceHandlerArray mServiceHandlers
;
231 DNSServiceRef mResolveServiceRef
;
235 ExplorerBarWindow( void );
236 virtual ~ExplorerBarWindow( void );
242 afx_msg
int OnCreate( LPCREATESTRUCT inCreateStruct
);
243 afx_msg
void OnDestroy( void );
244 afx_msg
void OnSize( UINT inType
, int inX
, int inY
);
245 afx_msg
void OnDoubleClick( NMHDR
*inNMHDR
, LRESULT
*outResult
);
246 afx_msg LONG
OnServiceEvent( WPARAM inWParam
, LPARAM inLParam
);
250 static void DNSSD_API
253 DNSServiceFlags inFlags
,
254 uint32_t inInterfaceIndex
,
255 DNSServiceErrorType inErrorCode
,
258 const char * inDomain
,
260 LONG
OnServiceAdd( ServiceInfo
* service
);
261 LONG
OnServiceRemove( ServiceInfo
* service
);
265 OSStatus
StartResolve( ServiceInfo
*inService
);
266 void StopResolve( void );
269 void Stop( DNSServiceRef ref
);
272 static void DNSSD_API
275 DNSServiceFlags inFlags
,
276 uint32_t inInterfaceIndex
,
277 DNSServiceErrorType inErrorCode
,
278 const char * inFullName
,
279 const char * inHostName
,
284 LONG
OnResolve( ResolveInfo
* resolve
);
290 ExplorerBar
* GetOwner( void ) const { return( mOwner
); }
291 void SetOwner( ExplorerBar
*inOwner
) { mOwner
= inOwner
; }
293 DECLARE_MESSAGE_MAP()
296 typedef std::list
< DNSServiceRef
> ServiceRefList
;
298 ServiceRefList m_serviceRefs
;
299 CImageList m_imageList
;
302 #endif // __EXPLORER_BAR_WINDOW__