Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

487 lines
12 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: zoneui.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _ZONEUI_H
  11. #define _ZONEUI_H
  12. #include "ipeditor.h"
  13. #include "nspage.h"
  14. #include "aclpage.h"
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // FORWARD DECLARATIONS
  17. class CCathegoryFolderNode;
  18. class CDNSZoneNode;
  19. class CDNSZonePropertyPageHolder;
  20. ///////////////////////////////////////////////////////////////////////////////
  21. // CDNSZone_GeneralPropertyPage
  22. class CDNSZone_GeneralIPEditor : public CIPEditor
  23. {
  24. public:
  25. CDNSZone_GeneralIPEditor()
  26. {
  27. m_bNoUpdateNow = FALSE;
  28. }
  29. virtual void OnChangeData(); // override from base class
  30. void FindMastersNames();
  31. private:
  32. BOOL m_bNoUpdateNow;
  33. };
  34. class CDNSZone_GeneralPropertyPage : public CPropertyPageBase
  35. {
  36. // Construction
  37. public:
  38. CDNSZone_GeneralPropertyPage();
  39. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask);
  40. // Dialog Data
  41. protected:
  42. #ifdef USE_NDNC
  43. enum { IDD = IDD_ZONE_GENERAL_PAGE_NDNC };
  44. #else
  45. enum { IDD = IDD_ZONE_GENERAL_PAGE };
  46. #endif // USE_NDNC
  47. // Overrides
  48. public:
  49. // Implementation
  50. protected:
  51. #ifdef USE_NDNC
  52. afx_msg void OnChangeReplButton();
  53. #endif // USE_NDNC
  54. afx_msg void OnChangeTypeButton();
  55. afx_msg void OnPauseStartButton();
  56. afx_msg void OnChangePrimaryStorageRadio();
  57. afx_msg void OnChangePrimaryFileNameEdit() { SetDirty(TRUE);}
  58. //afx_msg void OnChangePrimaryStoreADSEdit() { SetDirty(TRUE);}
  59. afx_msg void OnChangePrimaryDynamicUpdateCombo() { SetDirty(TRUE);}
  60. afx_msg void OnChangeSecondaryFileNameEdit() { SetDirty(TRUE);}
  61. afx_msg void OnBrowseMasters();
  62. afx_msg void OnFindMastersNames();
  63. afx_msg void OnAging();
  64. afx_msg void OnLocalCheck();
  65. virtual void SetUIData();
  66. virtual BOOL OnInitDialog();
  67. virtual BOOL OnApply();
  68. DECLARE_MESSAGE_MAP()
  69. public:
  70. BOOL IsPrimaryZoneUI() { return m_bIsPrimary;}
  71. BOOL IsStubZoneUI() { return m_bIsStub; }
  72. BOOL ApplyChanges() { return OnApply();}
  73. private:
  74. // common controls
  75. CButton* GetPauseStartButton()
  76. { return (CButton*)GetDlgItem(IDC_PAUSE_START_BUTTON);}
  77. CDNSButtonToggleTextHelper m_pauseStartHelper;
  78. CDNSManageControlTextHelper m_typeStaticHelper;
  79. CDNSToggleTextControlHelper m_zoneStorageStaticHelper;
  80. CDNSManageControlTextHelper m_statusHelper;
  81. // common to primary and secondary
  82. CStatic* GetFileNameEdit()
  83. { return (CStatic*)GetDlgItem(IDC_FILE_NAME_EDIT);}
  84. // primary zone
  85. CStatic* GetPrimaryDynamicUpdateStatic()
  86. { return (CStatic*)GetDlgItem(IDC_PRIMARY_DYN_UPD_STATIC);}
  87. CComboBox* GetPrimaryDynamicUpdateCombo()
  88. { return (CComboBox*)GetDlgItem(IDC_PRIMARY_DYN_UPD_COMBO);}
  89. // secondary zone
  90. CDNSZone_GeneralIPEditor m_mastersEditor;
  91. CButton* GetMastersBrowseButton()
  92. { return (CButton*)GetDlgItem(IDC_BROWSE_MASTERS_BUTTON);}
  93. CButton* GetFindMastersNamesButton()
  94. { return (CButton*)GetDlgItem(IDC_FIND_MASTERS_NAMES_BUTTON);}
  95. CStatic* GetIPLabel()
  96. { return (CStatic*)GetDlgItem(IDC_STATIC_IP);}
  97. // set/get helpers
  98. void SetPrimaryDynamicUpdateComboVal(UINT nAllowsDynamicUpdate);
  99. UINT GetPrimaryDynamicUpdateComboVal();
  100. // UI manipulation and helpers
  101. void ChangeUIControls();
  102. void ChangeUIControlHelper(CWnd* pChild, BOOL bEnable);
  103. void GetStorageName(CString& szDataStorageName);
  104. void OnChangeIPEditorData();
  105. #ifdef USE_NDNC
  106. void SetTextForReplicationScope();
  107. ReplicationType m_replType;
  108. CString m_szCustomScope;
  109. #endif // USE_NDNC
  110. BOOL m_bIsPrimary;
  111. BOOL m_bIsStub;
  112. BOOL m_bIsPaused;
  113. BOOL m_bIsExpired;
  114. BOOL m_bDSIntegrated;
  115. BOOL m_bServerADSEnabled;
  116. BOOL m_bScavengingEnabled;
  117. DWORD m_dwRefreshInterval;
  118. DWORD m_dwNoRefreshInterval;
  119. DWORD m_dwScavengingStart;
  120. UINT m_nAllowsDynamicUpdate;
  121. BOOL m_bDiscardUIState;
  122. BOOL m_bDiscardUIStateShowMessage;
  123. friend class CDNSZone_GeneralIPEditor;
  124. };
  125. ///////////////////////////////////////////////////////////////////////////////
  126. // CDNSZone_ZoneTransferPropertyPage
  127. class CDNSZoneNotifyDialog; //fwd decl
  128. class CDNSZone_ZoneTransferPropertyPage : public CPropertyPageBase
  129. {
  130. // Construction
  131. public:
  132. CDNSZone_ZoneTransferPropertyPage();
  133. ~CDNSZone_ZoneTransferPropertyPage();
  134. // Implementation
  135. protected:
  136. // Generated message map functions
  137. afx_msg void OnRadioSecSecureOff() { SyncUIRadioHelper(IDC_RADIO_SECSECURE_OFF);}
  138. afx_msg void OnRadioSecSecureNone() { SyncUIRadioHelper(IDC_CHECK_ALLOW_TRANSFERS);}
  139. afx_msg void OnRadioSecSecureNS() { SyncUIRadioHelper(IDC_RADIO_SECSECURE_NS);}
  140. afx_msg void OnRadioSecSecureList() { SyncUIRadioHelper(IDC_RADIO_SECSECURE_LIST);}
  141. afx_msg void OnButtonNotify();
  142. virtual BOOL OnInitDialog();
  143. virtual BOOL OnApply();
  144. virtual BOOL OnSetActive();
  145. DECLARE_MESSAGE_MAP()
  146. private:
  147. // state for the subdialog
  148. DWORD m_fNotifyLevel;
  149. DWORD m_cNotify;
  150. PIP_ADDRESS m_aipNotify;
  151. BOOL m_bStub;
  152. void SyncUIRadioHelper(UINT nRadio);
  153. int SetRadioState(DWORD fSecureSecondaries);
  154. DWORD GetRadioState();
  155. CButton* GetNotifyButton()
  156. { return (CButton*)GetDlgItem(IDC_BUTTON_NOTIFY);}
  157. class CDNSSecondariesIPEditor : public CIPEditor
  158. {
  159. public:
  160. CDNSSecondariesIPEditor() : CIPEditor(TRUE) {} // no up/down buttons
  161. virtual void OnChangeData();
  162. };
  163. CDNSSecondariesIPEditor m_secondariesListEditor;
  164. friend class CDNSSecondariesIPEditor;
  165. friend class CDNSZoneNotifyDialog;
  166. };
  167. ////////////////////////////////////////////////////////////////////////////
  168. // CDNSZone_SOA_PropertyPage
  169. class CDNSZone_SOA_PropertyPage; // fwd decl
  170. class CDNS_SOA_SerialNumberEditGroup : public CDNSUpDownUnsignedIntEditGroup
  171. {
  172. protected:
  173. virtual void OnEditChange();
  174. private:
  175. CDNSZone_SOA_PropertyPage* m_pPage;
  176. friend class CDNSZone_SOA_PropertyPage;
  177. };
  178. //
  179. // From winnt.h
  180. //
  181. #define MAXDWORD 0xffffffff
  182. class CDNS_SOA_TimeIntervalEditGroup : public CDNSTimeIntervalEditGroup
  183. {
  184. public:
  185. CDNS_SOA_TimeIntervalEditGroup() : CDNSTimeIntervalEditGroup(0, MAXDWORD) {}
  186. virtual void OnEditChange();
  187. private:
  188. CDNSZone_SOA_PropertyPage* m_pPage;
  189. friend class CDNSZone_SOA_PropertyPage;
  190. };
  191. class CDNSZone_SOA_PropertyPage : public CDNSRecordPropertyPage
  192. {
  193. public:
  194. CDNSZone_SOA_PropertyPage(BOOL bZoneRoot = TRUE);
  195. ~CDNSZone_SOA_PropertyPage();
  196. public:
  197. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask);
  198. protected:
  199. virtual void SetUIData();
  200. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  201. virtual BOOL OnInitDialog();
  202. virtual BOOL OnApply();
  203. private:
  204. BOOL m_bZoneRoot;
  205. CDNS_SOA_Record* m_pTempSOARecord;
  206. afx_msg void OnPrimaryServerChange();
  207. afx_msg void OnResponsiblePartyChange();
  208. afx_msg void OnMinTTLChange();
  209. afx_msg void OnBrowseServer();
  210. afx_msg void OnBrowseResponsibleParty();
  211. private:
  212. CDNS_SOA_SerialNumberEditGroup m_serialNumberEditGroup;
  213. CDNS_SOA_TimeIntervalEditGroup m_refreshIntervalEditGroup;
  214. CDNS_SOA_TimeIntervalEditGroup m_retryIntervalEditGroup;
  215. CDNS_SOA_TimeIntervalEditGroup m_expireIntervalEditGroup;
  216. CDNS_SOA_TimeIntervalEditGroup m_minTTLIntervalEditGroup;
  217. CEdit* GetPrimaryServerEdit() { return (CEdit*)GetDlgItem(IDC_PRIMARY_SERV_EDIT);}
  218. CEdit* GetResponsiblePartyEdit() { return (CEdit*)GetDlgItem(IDC_RESP_PARTY_EDIT);}
  219. CStatic* GetErrorStatic() { return (CStatic*)GetDlgItem(IDC_STATIC_ERROR);}
  220. void ShowErrorUI();
  221. DECLARE_MESSAGE_MAP()
  222. friend class CDNS_SOA_SerialNumberEditGroup;
  223. friend class CDNS_SOA_TimeIntervalEditGroup;
  224. };
  225. ////////////////////////////////////////////////////////////////////////////
  226. // CDNSZone_WINSBase_PropertyPage
  227. class CDNSZone_WINSBase_PropertyPage : public CDNSRecordPropertyPage
  228. {
  229. public:
  230. enum WINS_STATE
  231. {
  232. wins_local_state = 1,
  233. wins_not_local_state,
  234. no_wins_state
  235. };
  236. CDNSZone_WINSBase_PropertyPage(UINT nIDTemplate);
  237. ~CDNSZone_WINSBase_PropertyPage();
  238. virtual BOOL OnSetActive();
  239. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask);
  240. protected:
  241. virtual void SetUIData();
  242. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  243. virtual BOOL OnInitDialog();
  244. virtual BOOL OnApply();
  245. afx_msg void OnUseWinsResolutionChange();
  246. afx_msg void OnDoNotReplicateChange();
  247. CButton* GetUseWinsCheck() { return (CButton*)GetDlgItem(IDC_USE_WINS_RES_CHECK); }
  248. CButton* GetDoNotReplicateCheck() { return (CButton*)GetDlgItem(IDC_NOT_REPL_CHECK); }
  249. CButton* GetAdvancedButton() { return (CButton*)GetDlgItem(IDC_ADVANCED_BUTTON); }
  250. // cast helpers
  251. CDNSZonePropertyPageHolder* GetZoneHolder() { return (CDNSZonePropertyPageHolder*)GetHolder(); }
  252. CDNSZoneNode* GetZoneNode();
  253. virtual void EnableUI(BOOL bEnable);
  254. virtual void EnableUI();
  255. virtual BOOL IsValidTempRecord()=0;
  256. // data
  257. CDNSRecord* m_pTempRecord;
  258. UINT m_iWINSMsg;
  259. UINT m_nReplCheckTextID;
  260. BOOL m_bPrimaryZone;
  261. BOOL m_bStub;
  262. BOOL m_bLocalRecord;
  263. WINS_STATE m_nState;
  264. DECLARE_MESSAGE_MAP()
  265. private:
  266. enum { none, add, remove, edit } m_action; // to communicate across threads when hitting Apply()
  267. };
  268. ////////////////////////////////////////////////////////////////////////////
  269. // CDNSZone_WINS_PropertyPage
  270. class CDNSZone_WINS_WinsServersIPEditor : public CIPEditor
  271. {
  272. public:
  273. virtual void OnChangeData();
  274. };
  275. class CDNSZone_WINS_PropertyPage : public CDNSZone_WINSBase_PropertyPage
  276. {
  277. public:
  278. CDNSZone_WINS_PropertyPage();
  279. protected:
  280. virtual void SetUIData();
  281. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  282. virtual BOOL OnInitDialog();
  283. virtual void EnableUI(BOOL bEnable);
  284. virtual void EnableUI();
  285. virtual BOOL IsValidTempRecord();
  286. afx_msg void OnAdvancedButton();
  287. private:
  288. CDNSZone_WINS_WinsServersIPEditor m_winsServersEditor;
  289. DECLARE_MESSAGE_MAP()
  290. friend class CDNSZone_WINS_WinsServersIPEditor;
  291. };
  292. ////////////////////////////////////////////////////////////////////////////
  293. // CDNSZone_NBSTAT_PropertyPage
  294. class CDNSZone_NBSTAT_PropertyPage : public CDNSZone_WINSBase_PropertyPage
  295. {
  296. public:
  297. CDNSZone_NBSTAT_PropertyPage();
  298. protected:
  299. virtual void SetUIData();
  300. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  301. // virtual BOOL OnInitDialog();
  302. afx_msg void OnDomainNameEditChange();
  303. CEdit* GetDomainNameEdit() { return (CEdit*)GetDlgItem(IDC_DOMAIN_NAME_EDIT); }
  304. virtual void EnableUI(BOOL bEnable);
  305. virtual void EnableUI();
  306. virtual BOOL IsValidTempRecord();
  307. afx_msg void OnAdvancedButton();
  308. private:
  309. DECLARE_MESSAGE_MAP()
  310. };
  311. ///////////////////////////////////////////////////////////////////////////////
  312. // CDNSZoneNameServersPropertyPage
  313. class CDNSZoneNameServersPropertyPage : public CDNSNameServersPropertyPage
  314. {
  315. public:
  316. virtual BOOL OnSetActive();
  317. protected:
  318. virtual void ReadRecordNodesList();
  319. virtual BOOL WriteNSRecordNodesList();
  320. };
  321. ///////////////////////////////////////////////////////////////////////////////
  322. // CDNSZonePropertyPageHolder
  323. // page holder to contain DNS Zone property pages
  324. #define ZONE_HOLDER_SOA RR_HOLDER_SOA
  325. #define ZONE_HOLDER_NS RR_HOLDER_NS
  326. #define ZONE_HOLDER_WINS RR_HOLDER_WINS
  327. #define ZONE_HOLDER_GEN (RR_HOLDER_WINS +1)
  328. class CDNSZonePropertyPageHolder : public CPropertyPageHolderBase
  329. {
  330. public:
  331. CDNSZonePropertyPageHolder(CCathegoryFolderNode* pFolderNode, CDNSZoneNode* pZoneNode,
  332. CComponentDataObject* pComponentData);
  333. virtual ~CDNSZonePropertyPageHolder();
  334. CDNSZoneNode* GetZoneNode() { return (CDNSZoneNode*)GetTreeNode();}
  335. BOOL IsPrimaryZoneUI() { return m_generalPage.IsPrimaryZoneUI();}
  336. BOOL IsStubZoneUI() { return m_generalPage.IsStubZoneUI(); }
  337. BOOL ApplyGeneralPageChanges() { return m_generalPage.ApplyChanges();}
  338. BOOL IsAdvancedView() { return m_bAdvancedView; }
  339. protected:
  340. virtual int OnSelectPageMessage(long nPageCode);
  341. virtual HRESULT OnAddPage(int nPage, CPropertyPageBase* pPage);
  342. private:
  343. CDNSZone_GeneralPropertyPage m_generalPage;
  344. CDNSZone_ZoneTransferPropertyPage m_zoneTransferPage;
  345. CDNSZoneNameServersPropertyPage m_nameServersPage;
  346. // special record property pages
  347. CDNSZone_SOA_PropertyPage m_SOARecordPage; // for all zones
  348. CDNSZone_WINS_PropertyPage m_WINSRecordPage; // fwd lookup zones only
  349. CDNSZone_NBSTAT_PropertyPage m_NBSTATRecordPage; // reverse lookup zones only
  350. // optional security page
  351. CAclEditorPage* m_pAclEditorPage;
  352. // page #'s of pages we want to select
  353. int m_nGenPage;
  354. int m_nSOAPage;
  355. int m_nWINSorWINSRPage;
  356. int m_nNSPage;
  357. BOOL m_bAdvancedView;
  358. };
  359. #endif // _ZONEUI_H