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.8 2006/08/14 23:24:00 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
23 Revision 1.7 2005/02/25 19:57:30 shersche
24 <rdar://problem/4023323> Remove FTP browsing from plugin
26 Revision 1.6 2005/01/27 22:27:03 shersche
27 Add m_about member for "About ..." tree item
29 Revision 1.5 2004/07/26 05:47:31 shersche
30 use TXTRecord APIs, fix bug in locating service to be removed
32 Revision 1.4 2004/07/20 06:49:18 shersche
33 clean up socket handling code
35 Revision 1.3 2004/07/13 21:24:21 rpantos
36 Fix for <rdar://problem/3701120>.
38 Revision 1.2 2004/06/27 14:59:59 shersche
39 reference count service info to handle multi-homed hosts
41 Revision 1.1 2004/06/18 04:34:59 rpantos
42 Move to Clients from mDNSWindows
44 Revision 1.3 2004/04/15 01:00:05 bradley
45 Removed support for automatically querying for A/AAAA records when resolving names. Platforms
46 without .local name resolving support will need to manually query for A/AAAA records as needed.
48 Revision 1.2 2004/04/08 09:43:43 bradley
49 Changed callback calling conventions to __stdcall so they can be used with C# delegates.
51 Revision 1.1 2004/01/30 03:01:56 bradley
52 Explorer Plugin to browse for DNS-SD advertised Web and FTP servers from within Internet Explorer.
56 #ifndef __EXPLORER_BAR_WINDOW__
57 #define __EXPLORER_BAR_WINDOW__
66 //===========================================================================================================================
68 //===========================================================================================================================
70 // Forward Declarations
72 struct ServiceHandlerEntry
;
73 class ExplorerBarWindow
;
85 ServiceHandlerEntry
* handler
;
113 typedef CArray
< ServiceInfo
*, ServiceInfo
* > ServiceInfoArray
;
136 void GetData( void *outData
, uint16_t *outSize
)
140 *( (void **) outData
) = mData
;
148 OSStatus
SetData( const void *inData
, uint16_t inSize
)
153 newData
= (uint8_t *) malloc( inSize
);
154 require_action( newData
, exit
, err
= kNoMemoryErr
);
155 memcpy( newData
, inData
, inSize
);
178 ServiceHandlerEntry
* handler
;
181 // ServiceHandlerEntry
183 struct ServiceHandlerEntry
186 const char * urlScheme
;
188 ServiceInfoArray array
;
189 ExplorerBarWindow
* obj
;
192 ServiceHandlerEntry( void )
201 ~ServiceHandlerEntry( void )
206 n
= (int) array
.GetSize();
207 for( i
= 0; i
< n
; ++i
)
214 typedef CArray
< ServiceHandlerEntry
*, ServiceHandlerEntry
* > ServiceHandlerArray
;
216 //===========================================================================================================================
218 //===========================================================================================================================
220 class ExplorerBar
; // Forward Declaration
222 class ExplorerBarWindow
: public CWnd
226 ExplorerBar
* mOwner
;
229 ServiceHandlerArray mServiceHandlers
;
230 DNSServiceRef mResolveServiceRef
;
234 ExplorerBarWindow( void );
235 virtual ~ExplorerBarWindow( void );
241 afx_msg
int OnCreate( LPCREATESTRUCT inCreateStruct
);
242 afx_msg
void OnDestroy( void );
243 afx_msg
void OnSize( UINT inType
, int inX
, int inY
);
244 afx_msg
void OnDoubleClick( NMHDR
*inNMHDR
, LRESULT
*outResult
);
245 afx_msg LONG
OnServiceEvent( WPARAM inWParam
, LPARAM inLParam
);
249 static void DNSSD_API
252 DNSServiceFlags inFlags
,
253 uint32_t inInterfaceIndex
,
254 DNSServiceErrorType inErrorCode
,
257 const char * inDomain
,
259 LONG
OnServiceAdd( ServiceInfo
* service
);
260 LONG
OnServiceRemove( ServiceInfo
* service
);
264 OSStatus
StartResolve( ServiceInfo
*inService
);
265 void StopResolve( void );
268 void Stop( DNSServiceRef ref
);
271 static void DNSSD_API
274 DNSServiceFlags inFlags
,
275 uint32_t inInterfaceIndex
,
276 DNSServiceErrorType inErrorCode
,
277 const char * inFullName
,
278 const char * inHostName
,
283 LONG
OnResolve( ResolveInfo
* resolve
);
289 ExplorerBar
* GetOwner( void ) const { return( mOwner
); }
290 void SetOwner( ExplorerBar
*inOwner
) { mOwner
= inOwner
; }
292 DECLARE_MESSAGE_MAP()
295 typedef std::list
< DNSServiceRef
> ServiceRefList
;
298 ServiceRefList m_serviceRefs
;
299 CImageList m_imageList
;
302 #endif // __EXPLORER_BAR_WINDOW__