Leaked source code of windows server 2003
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.

493 lines
13 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. CStatic* GetPrimaryDynamicWarningText()
  90. { return (CStatic*)GetDlgItem(IDC_WARNING_TEXT_STATIC); }
  91. CWnd* GetPrimaryDynamicWarningIcon()
  92. { return GetDlgItem(IDC_WARNING_ICON_STATIC); }
  93. // secondary zone
  94. CDNSZone_GeneralIPEditor m_mastersEditor;
  95. CButton* GetMastersBrowseButton()
  96. { return (CButton*)GetDlgItem(IDC_BROWSE_MASTERS_BUTTON);}
  97. CButton* GetFindMastersNamesButton()
  98. { return (CButton*)GetDlgItem(IDC_FIND_MASTERS_NAMES_BUTTON);}
  99. CStatic* GetIPLabel()
  100. { return (CStatic*)GetDlgItem(IDC_STATIC_IP);}
  101. // set/get helpers
  102. void SetPrimaryDynamicUpdateComboVal(UINT nAllowsDynamicUpdate);
  103. UINT GetPrimaryDynamicUpdateComboVal();
  104. // UI manipulation and helpers
  105. void ChangeUIControls();
  106. void ChangeUIControlHelper(CWnd* pChild, BOOL bEnable);
  107. void GetStorageName(CString& szDataStorageName);
  108. void OnChangeIPEditorData();
  109. #ifdef USE_NDNC
  110. void SetTextForReplicationScope();
  111. ReplicationType m_replType;
  112. CString m_szCustomScope;
  113. #endif // USE_NDNC
  114. BOOL m_bIsPrimary;
  115. BOOL m_bIsStub;
  116. BOOL m_bIsPaused;
  117. BOOL m_bIsExpired;
  118. BOOL m_bDSIntegrated;
  119. BOOL m_bServerADSEnabled;
  120. BOOL m_bScavengingEnabled;
  121. DWORD m_dwRefreshInterval;
  122. DWORD m_dwNoRefreshInterval;
  123. DWORD m_dwScavengingStart;
  124. UINT m_nAllowsDynamicUpdate;
  125. BOOL m_bDiscardUIState;
  126. BOOL m_bDiscardUIStateShowMessage;
  127. friend class CDNSZone_GeneralIPEditor;
  128. };
  129. ///////////////////////////////////////////////////////////////////////////////
  130. // CDNSZone_ZoneTransferPropertyPage
  131. class CDNSZoneNotifyDialog; //fwd decl
  132. class CDNSZone_ZoneTransferPropertyPage : public CPropertyPageBase
  133. {
  134. // Construction
  135. public:
  136. CDNSZone_ZoneTransferPropertyPage();
  137. ~CDNSZone_ZoneTransferPropertyPage();
  138. // Implementation
  139. protected:
  140. // Generated message map functions
  141. afx_msg void OnRadioSecSecureOff() { SyncUIRadioHelper(IDC_RADIO_SECSECURE_OFF);}
  142. afx_msg void OnRadioSecSecureNone() { SyncUIRadioHelper(IDC_CHECK_ALLOW_TRANSFERS);}
  143. afx_msg void OnRadioSecSecureNS() { SyncUIRadioHelper(IDC_RADIO_SECSECURE_NS);}
  144. afx_msg void OnRadioSecSecureList() { SyncUIRadioHelper(IDC_RADIO_SECSECURE_LIST);}
  145. afx_msg void OnButtonNotify();
  146. virtual BOOL OnInitDialog();
  147. virtual BOOL OnApply();
  148. virtual BOOL OnSetActive();
  149. DECLARE_MESSAGE_MAP()
  150. private:
  151. // state for the subdialog
  152. DWORD m_fNotifyLevel;
  153. DWORD m_cNotify;
  154. PIP_ADDRESS m_aipNotify;
  155. BOOL m_bStub;
  156. void SyncUIRadioHelper(UINT nRadio);
  157. int SetRadioState(DWORD fSecureSecondaries);
  158. DWORD GetRadioState();
  159. CButton* GetNotifyButton()
  160. { return (CButton*)GetDlgItem(IDC_BUTTON_NOTIFY);}
  161. class CDNSSecondariesIPEditor : public CIPEditor
  162. {
  163. public:
  164. CDNSSecondariesIPEditor() : CIPEditor(TRUE) {} // no up/down buttons
  165. virtual void OnChangeData();
  166. };
  167. CDNSSecondariesIPEditor m_secondariesListEditor;
  168. friend class CDNSSecondariesIPEditor;
  169. friend class CDNSZoneNotifyDialog;
  170. };
  171. ////////////////////////////////////////////////////////////////////////////
  172. // CDNSZone_SOA_PropertyPage
  173. class CDNSZone_SOA_PropertyPage; // fwd decl
  174. class CDNS_SOA_SerialNumberEditGroup : public CDNSUpDownUnsignedIntEditGroup
  175. {
  176. protected:
  177. virtual void OnEditChange();
  178. private:
  179. CDNSZone_SOA_PropertyPage* m_pPage;
  180. friend class CDNSZone_SOA_PropertyPage;
  181. };
  182. //
  183. // From winnt.h
  184. //
  185. #define MAXDWORD 0xffffffff
  186. class CDNS_SOA_TimeIntervalEditGroup : public CDNSTimeIntervalEditGroup
  187. {
  188. public:
  189. CDNS_SOA_TimeIntervalEditGroup() : CDNSTimeIntervalEditGroup(0, MAXDWORD) {}
  190. virtual void OnEditChange();
  191. private:
  192. CDNSZone_SOA_PropertyPage* m_pPage;
  193. friend class CDNSZone_SOA_PropertyPage;
  194. };
  195. class CDNSZone_SOA_PropertyPage : public CDNSRecordPropertyPage
  196. {
  197. public:
  198. CDNSZone_SOA_PropertyPage(BOOL bZoneRoot = TRUE);
  199. ~CDNSZone_SOA_PropertyPage();
  200. public:
  201. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask);
  202. protected:
  203. virtual void SetUIData();
  204. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  205. virtual BOOL OnInitDialog();
  206. virtual BOOL OnApply();
  207. private:
  208. BOOL m_bZoneRoot;
  209. CDNS_SOA_Record* m_pTempSOARecord;
  210. afx_msg void OnPrimaryServerChange();
  211. afx_msg void OnResponsiblePartyChange();
  212. afx_msg void OnMinTTLChange();
  213. afx_msg void OnBrowseServer();
  214. afx_msg void OnBrowseResponsibleParty();
  215. private:
  216. CDNS_SOA_SerialNumberEditGroup m_serialNumberEditGroup;
  217. CDNS_SOA_TimeIntervalEditGroup m_refreshIntervalEditGroup;
  218. CDNS_SOA_TimeIntervalEditGroup m_retryIntervalEditGroup;
  219. CDNS_SOA_TimeIntervalEditGroup m_expireIntervalEditGroup;
  220. CDNS_SOA_TimeIntervalEditGroup m_minTTLIntervalEditGroup;
  221. CEdit* GetPrimaryServerEdit() { return (CEdit*)GetDlgItem(IDC_PRIMARY_SERV_EDIT);}
  222. CEdit* GetResponsiblePartyEdit() { return (CEdit*)GetDlgItem(IDC_RESP_PARTY_EDIT);}
  223. CStatic* GetErrorStatic() { return (CStatic*)GetDlgItem(IDC_STATIC_ERROR);}
  224. void ShowErrorUI();
  225. DECLARE_MESSAGE_MAP()
  226. friend class CDNS_SOA_SerialNumberEditGroup;
  227. friend class CDNS_SOA_TimeIntervalEditGroup;
  228. };
  229. ////////////////////////////////////////////////////////////////////////////
  230. // CDNSZone_WINSBase_PropertyPage
  231. class CDNSZone_WINSBase_PropertyPage : public CDNSRecordPropertyPage
  232. {
  233. public:
  234. enum WINS_STATE
  235. {
  236. wins_local_state = 1,
  237. wins_not_local_state,
  238. no_wins_state
  239. };
  240. CDNSZone_WINSBase_PropertyPage(UINT nIDTemplate);
  241. ~CDNSZone_WINSBase_PropertyPage();
  242. virtual BOOL OnSetActive();
  243. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask);
  244. protected:
  245. virtual void SetUIData();
  246. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  247. virtual BOOL OnInitDialog();
  248. virtual BOOL OnApply();
  249. afx_msg void OnUseWinsResolutionChange();
  250. afx_msg void OnDoNotReplicateChange();
  251. CButton* GetUseWinsCheck() { return (CButton*)GetDlgItem(IDC_USE_WINS_RES_CHECK); }
  252. CButton* GetDoNotReplicateCheck() { return (CButton*)GetDlgItem(IDC_NOT_REPL_CHECK); }
  253. CButton* GetAdvancedButton() { return (CButton*)GetDlgItem(IDC_ADVANCED_BUTTON); }
  254. // cast helpers
  255. CDNSZonePropertyPageHolder* GetZoneHolder() { return (CDNSZonePropertyPageHolder*)GetHolder(); }
  256. CDNSZoneNode* GetZoneNode();
  257. virtual void EnableUI(BOOL bEnable);
  258. virtual void EnableUI();
  259. virtual BOOL IsValidTempRecord()=0;
  260. // data
  261. CDNSRecord* m_pTempRecord;
  262. UINT m_iWINSMsg;
  263. UINT m_nReplCheckTextID;
  264. BOOL m_bPrimaryZone;
  265. BOOL m_bStub;
  266. BOOL m_bLocalRecord;
  267. WINS_STATE m_nState;
  268. DECLARE_MESSAGE_MAP()
  269. private:
  270. enum { none, add, remove, edit } m_action; // to communicate across threads when hitting Apply()
  271. };
  272. ////////////////////////////////////////////////////////////////////////////
  273. // CDNSZone_WINS_PropertyPage
  274. class CDNSZone_WINS_WinsServersIPEditor : public CIPEditor
  275. {
  276. public:
  277. virtual void OnChangeData();
  278. };
  279. class CDNSZone_WINS_PropertyPage : public CDNSZone_WINSBase_PropertyPage
  280. {
  281. public:
  282. CDNSZone_WINS_PropertyPage();
  283. protected:
  284. virtual void SetUIData();
  285. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  286. virtual BOOL OnInitDialog();
  287. virtual void EnableUI(BOOL bEnable);
  288. virtual void EnableUI();
  289. virtual BOOL IsValidTempRecord();
  290. afx_msg void OnAdvancedButton();
  291. private:
  292. CDNSZone_WINS_WinsServersIPEditor m_winsServersEditor;
  293. DECLARE_MESSAGE_MAP()
  294. friend class CDNSZone_WINS_WinsServersIPEditor;
  295. };
  296. ////////////////////////////////////////////////////////////////////////////
  297. // CDNSZone_NBSTAT_PropertyPage
  298. class CDNSZone_NBSTAT_PropertyPage : public CDNSZone_WINSBase_PropertyPage
  299. {
  300. public:
  301. CDNSZone_NBSTAT_PropertyPage();
  302. protected:
  303. virtual void SetUIData();
  304. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  305. // virtual BOOL OnInitDialog();
  306. afx_msg void OnDomainNameEditChange();
  307. CEdit* GetDomainNameEdit() { return (CEdit*)GetDlgItem(IDC_DOMAIN_NAME_EDIT); }
  308. virtual void EnableUI(BOOL bEnable);
  309. virtual void EnableUI();
  310. virtual BOOL IsValidTempRecord();
  311. afx_msg void OnAdvancedButton();
  312. private:
  313. DECLARE_MESSAGE_MAP()
  314. };
  315. ///////////////////////////////////////////////////////////////////////////////
  316. // CDNSZoneNameServersPropertyPage
  317. class CDNSZoneNameServersPropertyPage : public CDNSNameServersPropertyPage
  318. {
  319. public:
  320. virtual BOOL OnSetActive();
  321. protected:
  322. virtual void ReadRecordNodesList();
  323. virtual BOOL WriteNSRecordNodesList();
  324. };
  325. ///////////////////////////////////////////////////////////////////////////////
  326. // CDNSZonePropertyPageHolder
  327. // page holder to contain DNS Zone property pages
  328. #define ZONE_HOLDER_SOA RR_HOLDER_SOA
  329. #define ZONE_HOLDER_NS RR_HOLDER_NS
  330. #define ZONE_HOLDER_WINS RR_HOLDER_WINS
  331. #define ZONE_HOLDER_GEN (RR_HOLDER_WINS +1)
  332. class CDNSZonePropertyPageHolder : public CPropertyPageHolderBase
  333. {
  334. public:
  335. CDNSZonePropertyPageHolder(CCathegoryFolderNode* pFolderNode, CDNSZoneNode* pZoneNode,
  336. CComponentDataObject* pComponentData);
  337. virtual ~CDNSZonePropertyPageHolder();
  338. CDNSZoneNode* GetZoneNode() { return (CDNSZoneNode*)GetTreeNode();}
  339. BOOL IsPrimaryZoneUI() { return m_generalPage.IsPrimaryZoneUI();}
  340. BOOL IsStubZoneUI() { return m_generalPage.IsStubZoneUI(); }
  341. BOOL ApplyGeneralPageChanges() { return m_generalPage.ApplyChanges();}
  342. BOOL IsAdvancedView() { return m_bAdvancedView; }
  343. protected:
  344. virtual int OnSelectPageMessage(long nPageCode);
  345. virtual HRESULT OnAddPage(int nPage, CPropertyPageBase* pPage);
  346. private:
  347. CDNSZone_GeneralPropertyPage m_generalPage;
  348. CDNSZone_ZoneTransferPropertyPage m_zoneTransferPage;
  349. CDNSZoneNameServersPropertyPage m_nameServersPage;
  350. // special record property pages
  351. CDNSZone_SOA_PropertyPage m_SOARecordPage; // for all zones
  352. CDNSZone_WINS_PropertyPage m_WINSRecordPage; // fwd lookup zones only
  353. CDNSZone_NBSTAT_PropertyPage m_NBSTATRecordPage; // reverse lookup zones only
  354. // optional security page
  355. CAclEditorPage* m_pAclEditorPage;
  356. // page #'s of pages we want to select
  357. int m_nGenPage;
  358. int m_nSOAPage;
  359. int m_nWINSorWINSRPage;
  360. int m_nNSPage;
  361. BOOL m_bAdvancedView;
  362. };
  363. #endif // _ZONEUI_H