1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2003-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.
17 Change History (most recent first):
19 $Log: ExplorerBarWindow.h,v $
20 Revision 1.9 2009/03/30 18:49:15 herscher
21 <rdar://problem/5925472> Current Bonjour code does not compile on Windows
22 <rdar://problem/5187308> Move build train to Visual Studio 2005
24 Revision 1.8 2006/08/14 23:24:00 cheshire
25 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
27 Revision 1.7 2005/02/25 19:57:30 shersche
28 <rdar://problem/4023323> Remove FTP browsing from plugin
30 Revision 1.6 2005/01/27 22:27:03 shersche
31 Add m_about member for "About ..." tree item
33 Revision 1.5 2004/07/26 05:47:31 shersche
34 use TXTRecord APIs, fix bug in locating service to be removed
36 Revision 1.4 2004/07/20 06:49:18 shersche
37 clean up socket handling code
39 Revision 1.3 2004/07/13 21:24:21 rpantos
40 Fix for <rdar://problem/3701120>.
42 Revision 1.2 2004/06/27 14:59:59 shersche
43 reference count service info to handle multi-homed hosts
45 Revision 1.1 2004/06/18 04:34:59 rpantos
46 Move to Clients from mDNSWindows
48 Revision 1.3 2004/04/15 01:00:05 bradley
49 Removed support for automatically querying for A/AAAA records when resolving names. Platforms
50 without .local name resolving support will need to manually query for A/AAAA records as needed.
52 Revision 1.2 2004/04/08 09:43:43 bradley
53 Changed callback calling conventions to __stdcall so they can be used with C# delegates.
55 Revision 1.1 2004/01/30 03:01:56 bradley
56 Explorer Plugin to browse for DNS-SD advertised Web and FTP servers from within Internet Explorer.
60 #ifndef __EXPLORER_BAR_WINDOW__
61 #define __EXPLORER_BAR_WINDOW__
70 //===========================================================================================================================
72 //===========================================================================================================================
74 // Forward Declarations
76 struct ServiceHandlerEntry
;
77 class ExplorerBarWindow
;
89 ServiceHandlerEntry
* handler
;
117 typedef CArray
< ServiceInfo
*, ServiceInfo
* > ServiceInfoArray
;
140 void GetData( void *outData
, uint16_t *outSize
)
144 *( (void **) outData
) = mData
;
152 OSStatus
SetData( const void *inData
, uint16_t inSize
)
157 newData
= (uint8_t *) malloc( inSize
);
158 require_action( newData
, exit
, err
= kNoMemoryErr
);
159 memcpy( newData
, inData
, inSize
);
182 ServiceHandlerEntry
* handler
;
185 // ServiceHandlerEntry
187 struct ServiceHandlerEntry
190 const char * urlScheme
;
192 ServiceInfoArray array
;
193 ExplorerBarWindow
* obj
;
196 ServiceHandlerEntry( void )
205 ~ServiceHandlerEntry( void )
210 n
= (int) array
.GetSize();
211 for( i
= 0; i
< n
; ++i
)
218 typedef CArray
< ServiceHandlerEntry
*, ServiceHandlerEntry
* > ServiceHandlerArray
;
220 //===========================================================================================================================
222 //===========================================================================================================================
224 class ExplorerBar
; // Forward Declaration
226 class ExplorerBarWindow
: public CWnd
230 ExplorerBar
* mOwner
;
233 ServiceHandlerArray mServiceHandlers
;
234 DNSServiceRef mResolveServiceRef
;
238 ExplorerBarWindow( void );
239 virtual ~ExplorerBarWindow( void );
245 afx_msg
int OnCreate( LPCREATESTRUCT inCreateStruct
);
246 afx_msg
void OnDestroy( void );
247 afx_msg
void OnSize( UINT inType
, int inX
, int inY
);
248 afx_msg
void OnDoubleClick( NMHDR
*inNMHDR
, LRESULT
*outResult
);
249 afx_msg LRESULT
OnServiceEvent( WPARAM inWParam
, LPARAM inLParam
);
253 static void DNSSD_API
256 DNSServiceFlags inFlags
,
257 uint32_t inInterfaceIndex
,
258 DNSServiceErrorType inErrorCode
,
261 const char * inDomain
,
263 LONG
OnServiceAdd( ServiceInfo
* service
);
264 LONG
OnServiceRemove( ServiceInfo
* service
);
268 OSStatus
StartResolve( ServiceInfo
*inService
);
269 void StopResolve( void );
272 void Stop( DNSServiceRef ref
);
275 static void DNSSD_API
278 DNSServiceFlags inFlags
,
279 uint32_t inInterfaceIndex
,
280 DNSServiceErrorType inErrorCode
,
281 const char * inFullName
,
282 const char * inHostName
,
287 LONG
OnResolve( ResolveInfo
* resolve
);
293 ExplorerBar
* GetOwner( void ) const { return( mOwner
); }
294 void SetOwner( ExplorerBar
*inOwner
) { mOwner
= inOwner
; }
296 DECLARE_MESSAGE_MAP()
299 typedef std::list
< DNSServiceRef
> ServiceRefList
;
302 ServiceRefList m_serviceRefs
;
303 CImageList m_imageList
;
306 #endif // __EXPLORER_BAR_WINDOW__