1 /* -*- Mode: C; tab-width: 4 -*- 2 * 3 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved. 4 * 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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. 16 */ 17 18 #ifndef _ConfigPropertySheet_h 19 #define _ConfigPropertySheet_h 20 21 #include "stdafx.h" 22 #include "ServicesPage.h" 23 #include "RegistrationPage.h" 24 #include "BrowsingPage.h" 25 26 #include <RegNames.h> 27 #include <dns_sd.h> 28 #include <list> 29 30 31 //--------------------------------------------------------------------------------------------------------------------------- 32 // CConfigPropertySheet 33 //--------------------------------------------------------------------------------------------------------------------------- 34 35 class CConfigPropertySheet : public CPropertySheet 36 { 37 public: 38 39 CConfigPropertySheet(); 40 virtual ~CConfigPropertySheet(); 41 42 typedef std::list<CString> StringList; 43 44 StringList m_browseDomains; 45 46 protected: 47 48 CServicesPage m_firstPage; 49 CRegistrationPage m_secondPage; 50 CBrowsingPage m_thirdPage; 51 52 //{{AFX_VIRTUAL(CConfigPropertySheet) 53 //}}AFX_VIRTUAL 54 55 DECLARE_DYNCREATE(CConfigPropertySheet) 56 57 //{{AFX_MSG(CConfigPropertySheet) 58 //}}AFX_MSG 59 DECLARE_MESSAGE_MAP() 60 61 afx_msg BOOL OnInitDialog(); 62 afx_msg BOOL OnCommand( WPARAM wParam, LPARAM lParam ); 63 afx_msg LRESULT OnDataReady( WPARAM inWParam, LPARAM inLParam ); 64 afx_msg LRESULT OnRegistryChanged( WPARAM inWParam, LPARAM inLParam ); 65 void OnEndDialog(); 66 67 private: 68 69 OSStatus 70 SetupBrowsing(); 71 72 OSStatus 73 TearDownBrowsing(); 74 75 OSStatus 76 DecodeDomainName( const char * raw, CString & decoded ); 77 78 static void DNSSD_API 79 BrowseDomainsReply 80 ( 81 DNSServiceRef sdRef, 82 DNSServiceFlags flags, 83 uint32_t interfaceIndex, 84 DNSServiceErrorType errorCode, 85 const char * replyDomain, 86 void * context 87 ); 88 89 // This thread will watch for registry changes 90 91 static unsigned WINAPI 92 WatchRegistry 93 ( 94 LPVOID inParam 95 ); 96 97 HKEY m_statusKey; 98 HANDLE m_thread; 99 HANDLE m_threadExited; 100 DNSServiceRef m_browseDomainsRef; 101 CRITICAL_SECTION m_lock; 102 }; 103 104 105 #endif 106