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.

834 lines
25 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: server.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _SERVER_H
  11. #define _SERVER_H
  12. #include "dnsutil.h"
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // GLOBAL FUNCTIONS
  15. DNS_STATUS ServerHasCache(LPCWSTR lpszServerName, BOOL* pbRes);
  16. DNS_STATUS ServerHasRootZone(LPCWSTR lpszServerName, BOOL* pbRes);
  17. extern LPCWSTR DNS_EVT_COMMAND_LINE;
  18. extern LPCWSTR MMC_APP;
  19. ///////////////////////////////////////////////////////////////////////////////
  20. // FORWARD DECLARATIONS
  21. class CDNSMTContainerNode;
  22. class CDNSServerNode;
  23. class CDNSZoneNode;
  24. class CDNSDomainNode;
  25. class CCathegoryFolderNode;
  26. class CDNSRootHintsNode;
  27. class CDNSServer_TestPropertyPage;
  28. class CDNSQueryFilter;
  29. ///////////////////////////////////////////////////////////////////////////////
  30. // defines for server test intervals
  31. #define MIN_SERVER_TEST_INTERVAL 30 // seconds
  32. #define MAX_SERVER_TEST_INTERVAL 3600 // seconds in 1 hour
  33. #define DEFAULT_SERVER_TEST_INTERVAL 60 // seconds
  34. ///////////////////////////////////////////////////////////////////////////////
  35. // defines for server sheet messages
  36. #define SHEET_MSG_SERVER_TEST_DATA (1)
  37. #define SHEET_MSG_SELECT_PAGE (2)
  38. ///////////////////////////////////////////////////////////////////////////////
  39. // CZoneInfoHolder : simple memory manager for arrays of zone info handles
  40. class CZoneInfoHolder
  41. {
  42. public:
  43. CZoneInfoHolder();
  44. ~CZoneInfoHolder();
  45. BOOL Grow();
  46. PDNS_ZONE_INFO* m_zoneInfoArray;
  47. DWORD m_dwArrSize;
  48. DWORD m_dwZoneCount;
  49. private:
  50. void AllocateMemory(DWORD dwArrSize);
  51. void FreeMemory();
  52. };
  53. ///////////////////////////////////////////////////////////////////////////////
  54. // CDNSMTContainerNode
  55. // base class from which all the MT nodes derive from
  56. class CDNSMTContainerNode : public CMTContainerNode
  57. {
  58. public:
  59. // enumeration for node states, to handle icon changes
  60. typedef enum
  61. {
  62. notLoaded = 0, // initial state, valid only if server never contacted
  63. loading,
  64. loaded,
  65. unableToLoad,
  66. accessDenied
  67. } nodeStateType;
  68. CDNSMTContainerNode();
  69. void SetServerNode(CDNSServerNode* pServerNode)
  70. { ASSERT(pServerNode != NULL); m_pServerNode = pServerNode; }
  71. CDNSServerNode* GetServerNode()
  72. { ASSERT( m_pServerNode != NULL); return m_pServerNode; }
  73. virtual HRESULT OnSetToolbarVerbState(IToolbar* pToolbar, CNodeList* pNodeList);
  74. virtual int GetImageIndex(BOOL bOpenImage);
  75. virtual CColumnSet* GetColumnSet()
  76. {
  77. if (m_pColumnSet == NULL)
  78. {
  79. CDNSRootData* pRoot = (CDNSRootData*)GetRootContainer();
  80. m_pColumnSet = ((CDNSComponentDataObjectBase*)pRoot->GetComponentDataObject())->GetColumnSet(L"---Default Column Set---");
  81. }
  82. return m_pColumnSet;
  83. }
  84. virtual LPCWSTR GetColumnID() { return GetColumnSet()->GetColumnID(); }
  85. virtual LPWSTR GetDescriptionBarText();
  86. protected:
  87. virtual BOOL CanCloseSheets();
  88. virtual void OnChangeState(CComponentDataObject* pComponentDataObject);
  89. virtual void OnHaveData(CObjBase* pObj, CComponentDataObject* pComponentDataObject);
  90. virtual void OnError(DWORD dwErr);
  91. CColumnSet* m_pColumnSet;
  92. CString m_szDescriptionBar;
  93. private:
  94. CDNSServerNode* m_pServerNode;
  95. };
  96. ///////////////////////////////////////////////////////////////////////////////
  97. // CDNSQueryObj : general purpose base class
  98. class CDNSQueryObj : public CQueryObj
  99. {
  100. public:
  101. CDNSQueryObj(BOOL bAdvancedView, DWORD dwServerVersion)
  102. {
  103. m_dwServerVersion = dwServerVersion;
  104. m_bAdvancedView = bAdvancedView;
  105. // internal state variables
  106. m_nObjectCount = 0;
  107. m_nMaxObjectCount = DNS_QUERY_OBJ_COUNT_MAX;
  108. m_bGetAll = TRUE;
  109. m_nFilterOption = DNS_QUERY_FILTER_DISABLED;
  110. }
  111. CString m_szServerName;
  112. DWORD m_dwServerVersion;
  113. BOOL m_bAdvancedView;
  114. public:
  115. virtual BOOL AddQueryResult(CObjBase* pObj)
  116. {
  117. BOOL bRet = CQueryObj::AddQueryResult(pObj);
  118. if (bRet)
  119. m_nObjectCount++;
  120. return bRet;
  121. }
  122. void SetFilterOptions(CDNSQueryFilter* pFilter);
  123. BOOL TooMuchData();
  124. protected:
  125. ULONG m_nMaxObjectCount; // max number of objects in a query
  126. BOOL m_bGetAll;
  127. ULONG m_nObjectCount; // number of objects queried so far
  128. UINT m_nFilterOption;
  129. CString m_szFilterString1;
  130. int m_nFilterStringLen1; // cached value
  131. CString m_szFilterString2;
  132. int m_nFilterStringLen2; // cached value
  133. protected:
  134. BOOL MatchName(LPCWSTR lpszName);
  135. };
  136. /////////////////////////////////////////////////////////////////////////
  137. // CCathegoryFolderNode
  138. class CCathegoryFolderQueryObj : public CDNSQueryObj
  139. {
  140. public:
  141. CCathegoryFolderQueryObj(BOOL bAdvancedView, DWORD dwServerVersion)
  142. : CDNSQueryObj(bAdvancedView, dwServerVersion)
  143. {
  144. }
  145. virtual BOOL Enumerate();
  146. typedef enum { unk, cache, fwdAuthoritated, revAuthoritated, domainForwarders } queryType;
  147. void SetType(queryType type) { m_type = type;}
  148. protected:
  149. queryType m_type;
  150. BOOL CanAddZone(PDNS_RPC_ZONE pZoneInfo);
  151. };
  152. class CCathegoryFolderNode : public CDNSMTContainerNode
  153. {
  154. public:
  155. CCathegoryFolderNode()
  156. {
  157. m_type = CCathegoryFolderQueryObj::unk;
  158. }
  159. virtual HRESULT OnCommand(long nCommandID,
  160. DATA_OBJECT_TYPES type,
  161. CComponentDataObject* pComponentData,
  162. CNodeList* pNodeList);
  163. virtual void OnDelete(CComponentDataObject*,
  164. CNodeList*)
  165. { ASSERT(FALSE);}
  166. virtual BOOL OnSetRefreshVerbState(DATA_OBJECT_TYPES type,
  167. BOOL* pbHide,
  168. CNodeList* pNodeList);
  169. virtual LPCWSTR GetString(int nCol)
  170. {
  171. return (nCol == 0) ? GetDisplayName() : g_lpszNullString;
  172. }
  173. CCathegoryFolderQueryObj::queryType GetType() { return m_type;}
  174. virtual LPWSTR GetDescriptionBarText();
  175. virtual CColumnSet* GetColumnSet()
  176. {
  177. if (m_pColumnSet == NULL)
  178. {
  179. CDNSRootData* pRoot = (CDNSRootData*)GetRootContainer();
  180. m_pColumnSet = ((CDNSComponentDataObjectBase*)pRoot->GetComponentDataObject())->GetColumnSet(L"---Zone Column Set---");
  181. }
  182. return m_pColumnSet;
  183. }
  184. virtual BOOL CanExpandSync() { return TRUE; }
  185. protected:
  186. virtual LPCONTEXTMENUITEM2 OnGetContextMenuItemTable()
  187. { return CDNSCathegoryFolderHolder::GetContextMenuItem(); }
  188. virtual BOOL OnAddMenuItem(LPCONTEXTMENUITEM2 pContextMenuItem2,
  189. long *pInsertionAllowed);
  190. virtual CQueryObj* OnCreateQuery();
  191. CCathegoryFolderQueryObj::queryType m_type;
  192. };
  193. /////////////////////////////////////////////////////////////////////////
  194. // CDNSCacheNode
  195. //
  196. // * contains the root domain "."
  197. // * can delete items underneath, but cannot add or modify
  198. class CDNSCacheNode : public CCathegoryFolderNode
  199. {
  200. public:
  201. CDNSCacheNode();
  202. virtual HRESULT OnCommand(long nCommandID,
  203. DATA_OBJECT_TYPES type,
  204. CComponentDataObject* pComponentData,
  205. CNodeList* pNodeList);
  206. void OnClearCache(CComponentDataObject* pComponentData);
  207. virtual BOOL CanExpandSync() { return TRUE; }
  208. protected:
  209. virtual LPCONTEXTMENUITEM2 OnGetContextMenuItemTable()
  210. { return CDNSCacheMenuHolder::GetContextMenuItem(); }
  211. virtual BOOL OnAddMenuItem(LPCONTEXTMENUITEM2 pContextMenuItem2,
  212. long *pInsertionAllowed);
  213. };
  214. /////////////////////////////////////////////////////////////////////////
  215. // CDNSDomainForwardersNode
  216. //
  217. // * contains the domain forwarders as zones
  218. // * this node will always be hidden
  219. //
  220. class CDNSDomainForwardersNode : public CCathegoryFolderNode
  221. {
  222. public:
  223. CDNSDomainForwardersNode();
  224. virtual BOOL OnEnumerate(CComponentDataObject* pComponentData, BOOL bAsync = TRUE);
  225. };
  226. /////////////////////////////////////////////////////////////////////////
  227. // CDNSAuthoritatedZonesNode
  228. //
  229. // * contains autoritated zones, both primary and secondary
  230. // * have one for FWD and one for REVERSE
  231. class CDNSAuthoritatedZonesNode : public CCathegoryFolderNode
  232. {
  233. public:
  234. CDNSAuthoritatedZonesNode(BOOL bReverse, UINT nStringID);
  235. BOOL IsReverse() { return m_bReverse;}
  236. virtual HRESULT OnCommand(long nCommandID,
  237. DATA_OBJECT_TYPES type,
  238. CComponentDataObject* pComponentData,
  239. CNodeList* pNodeList);
  240. virtual BOOL OnSetRefreshVerbState(DATA_OBJECT_TYPES type,
  241. BOOL* pbHide,
  242. CNodeList* pNodeList);
  243. virtual HRESULT OnSetToolbarVerbState(IToolbar* pToolbar,
  244. CNodeList* pNodeList);
  245. virtual BOOL CanExpandSync() { return TRUE; }
  246. protected:
  247. virtual LPCONTEXTMENUITEM2 OnGetContextMenuItemTable()
  248. { return CDNSAuthoritatedZonesMenuHolder::GetContextMenuItem(); }
  249. virtual BOOL OnAddMenuItem(LPCONTEXTMENUITEM2 pContextMenuItem2,
  250. long *pInsertionAllowed);
  251. private:
  252. // command handlers
  253. HRESULT OnNewZone(CComponentDataObject* pComponentData, CNodeList* pNodeList);
  254. // data
  255. BOOL m_bReverse;
  256. DECLARE_TOOLBAR_MAP()
  257. };
  258. /////////////////////////////////////////////////////////////////////////
  259. // CDNSForwardZonesNode
  260. class CDNSForwardZonesNode : public CDNSAuthoritatedZonesNode
  261. {
  262. public:
  263. CDNSForwardZonesNode();
  264. virtual HRESULT OnShow(LPCONSOLE lpConsole);
  265. virtual HRESULT GetResultViewType(CComponentDataObject* pComponentData,
  266. LPOLESTR *ppViewType,
  267. long *pViewOptions);
  268. };
  269. /////////////////////////////////////////////////////////////////////////
  270. // CDNSReverseZonesNode
  271. class CDNSReverseZonesNode : public CDNSAuthoritatedZonesNode
  272. {
  273. public:
  274. CDNSReverseZonesNode();
  275. virtual BOOL OnRefresh(CComponentDataObject* pComponentData,
  276. CNodeList* pNodeList);
  277. protected:
  278. virtual void OnHaveData(CObjBase* pObj, CComponentDataObject* pComponentDataObject);
  279. void ChangeViewOption(BOOL bAdvanced, CComponentDataObject* pComponentDataObject);
  280. virtual HRESULT OnShow(LPCONSOLE lpConsole);
  281. virtual HRESULT GetResultViewType(CComponentDataObject* pComponentData,
  282. LPOLESTR *ppViewType,
  283. long *pViewOptions);
  284. private:
  285. // cached pointers to autocreated zones
  286. CDNSZoneNode* m_p0ZoneNode;
  287. CDNSZoneNode* m_p127ZoneNode;
  288. CDNSZoneNode* m_p255ZoneNode;
  289. friend class CDNSServerNode;
  290. };
  291. /////////////////////////////////////////////////////////////////////////
  292. // CDNSServerTestOptions
  293. class CDNSServerTestOptions
  294. {
  295. public:
  296. CDNSServerTestOptions();
  297. HRESULT Save(IStream* pStm);
  298. HRESULT Load(IStream* pStm);
  299. const CDNSServerTestOptions& operator=(const CDNSServerTestOptions& x);
  300. BOOL operator==(const CDNSServerTestOptions& x) const;
  301. BOOL m_bEnabled; // polling enabled
  302. DWORD m_dwInterval; // seconds
  303. // query types
  304. BOOL m_bSimpleQuery;
  305. BOOL m_bRecursiveQuery;
  306. };
  307. ////////////////////////////////////////////////////////////////////////
  308. // CDNSServerTestQueryResult
  309. class CDNSServerTestQueryResult
  310. {
  311. public:
  312. CDNSServerTestQueryResult()
  313. { memset(this, 0x0, sizeof(CDNSServerTestQueryResult));}
  314. const CDNSServerTestQueryResult& operator=(const CDNSServerTestQueryResult& x)
  315. {
  316. memcpy(this, &x, sizeof(CDNSServerTestQueryResult));
  317. return *this;
  318. }
  319. BOOL operator==(const CDNSServerTestQueryResult& x)
  320. {
  321. ASSERT(m_serverCookie == x.m_serverCookie); // always compare the same server
  322. // we do not compare the time
  323. // we do not compare the force logging flag
  324. // we want just to compare the query flags and the results
  325. return (m_dwQueryFlags == x.m_dwQueryFlags) &&
  326. (m_dwAddressResolutionResult == x.m_dwAddressResolutionResult) &&
  327. (m_dwPlainQueryResult == x.m_dwPlainQueryResult) &&
  328. (m_dwRecursiveQueryResult == x.m_dwRecursiveQueryResult);
  329. }
  330. BOOL Succeded()
  331. {
  332. return (m_dwAddressResolutionResult == 0) &&
  333. (m_dwPlainQueryResult == 0) &&
  334. (m_dwRecursiveQueryResult == 0);
  335. }
  336. static DWORD Pack(BOOL bPlainQuery, BOOL bRecursiveQuery)
  337. {
  338. DWORD dw = 0;
  339. if (bPlainQuery)
  340. dw |= 0x1;
  341. if (bRecursiveQuery)
  342. dw |= 0x2;
  343. return dw;
  344. }
  345. static void Unpack(DWORD dwQueryFlags, BOOL* pbPlainQuery, BOOL* pbRecursiveQuery)
  346. {
  347. *pbPlainQuery = (dwQueryFlags & 0x1);
  348. *pbRecursiveQuery = (dwQueryFlags & 0x2);
  349. }
  350. // Data
  351. MMC_COOKIE m_serverCookie;
  352. BOOL m_bAsyncQuery;
  353. SYSTEMTIME m_queryTime;
  354. DWORD m_dwQueryFlags;
  355. DWORD m_dwAddressResolutionResult;
  356. DWORD m_dwPlainQueryResult;
  357. DWORD m_dwRecursiveQueryResult;
  358. };
  359. ////////////////////////////////////////////////////////////////////////
  360. // CDNSServerTestQueryResultList
  361. class CDNSServerTestQueryResultList : public
  362. CList< CDNSServerTestQueryResult*, CDNSServerTestQueryResult* >
  363. {
  364. public:
  365. typedef enum addAction { none = 0, changed, added, addedAndRemoved};
  366. CDNSServerTestQueryResultList()
  367. {
  368. m_nMaxCount = 50;
  369. ExceptionPropagatingInitializeCriticalSection(&m_cs);
  370. }
  371. ~CDNSServerTestQueryResultList()
  372. {
  373. while (!IsEmpty())
  374. delete RemoveHead();
  375. ::DeleteCriticalSection(&m_cs);
  376. }
  377. public:
  378. void Lock() { ::EnterCriticalSection(&m_cs); }
  379. void Unlock() { ::LeaveCriticalSection(&m_cs); }
  380. addAction AddTestQueryResult(CDNSServerTestQueryResult* pTestResult)
  381. {
  382. addAction action = none;
  383. Lock();
  384. // determine if we have to add
  385. INT_PTR nCount = GetCount();
  386. CDNSServerTestQueryResult* pLastQueryResult = NULL;
  387. if (nCount > 0)
  388. pLastQueryResult = GetHead();
  389. if ((pTestResult->m_bAsyncQuery) ||
  390. (pLastQueryResult == NULL) ||
  391. !(*pLastQueryResult == *pTestResult))
  392. {
  393. // make sure we do not have too many items
  394. BOOL bRemoveLast = nCount > m_nMaxCount;
  395. if (bRemoveLast)
  396. {
  397. delete RemoveTail();
  398. }
  399. // add the item
  400. AddHead(pTestResult);
  401. action = bRemoveLast ? addedAndRemoved : added;
  402. }
  403. else
  404. {
  405. // just just update the time stamp in the last message we have
  406. ASSERT(pLastQueryResult != NULL);
  407. memcpy(&(pLastQueryResult->m_queryTime), &(pTestResult->m_queryTime),
  408. sizeof(SYSTEMTIME));
  409. action = changed;
  410. delete pTestResult; // not added
  411. }
  412. Unlock();
  413. return action;
  414. }
  415. BOOL LastQuerySuceeded()
  416. {
  417. BOOL bRes = TRUE;
  418. Lock();
  419. if (GetCount() > 0)
  420. bRes = GetHead()->Succeded();
  421. Unlock();
  422. return bRes;
  423. }
  424. int GetMaxCount()
  425. {
  426. return m_nMaxCount;
  427. }
  428. private:
  429. CRITICAL_SECTION m_cs;
  430. int m_nMaxCount;
  431. };
  432. /////////////////////////////////////////////////////////////////////////
  433. // CDNSServerNode
  434. class CDNSServerQueryObj : public CDNSQueryObj
  435. {
  436. public:
  437. CDNSServerQueryObj(BOOL bAdvancedView, DWORD dwServerVersion)
  438. : CDNSQueryObj(bAdvancedView, dwServerVersion){}
  439. virtual BOOL Enumerate();
  440. private:
  441. };
  442. class CDNSServerNode : public CDNSMTContainerNode
  443. {
  444. public:
  445. CDNSServerNode(LPCTSTR lpszName, BOOL bIsLocalServer = FALSE);
  446. virtual ~CDNSServerNode();
  447. virtual void SetDisplayName(LPCWSTR lpszDisplayName);
  448. void SetLocalServer(BOOL bLocalServer) { m_bLocalServer = bLocalServer; }
  449. BOOL IsLocalServer() { return m_bLocalServer; }
  450. // node info
  451. DECLARE_NODE_GUID()
  452. virtual HRESULT GetDataHere(CLIPFORMAT cf, LPSTGMEDIUM lpMedium,
  453. CDataObject* pDataObject);
  454. virtual HRESULT GetData(CLIPFORMAT cf, LPSTGMEDIUM lpMedium,
  455. CDataObject* pDataObject);
  456. HRESULT RetrieveEventViewerLogs(LPSTGMEDIUM lpMedium, CDataObject* pDataObject);
  457. virtual CColumnSet* GetColumnSet()
  458. {
  459. if (m_pColumnSet == NULL)
  460. {
  461. CDNSRootData* pRoot = (CDNSRootData*)GetRootContainer();
  462. m_pColumnSet = ((CDNSComponentDataObjectBase*)pRoot->GetComponentDataObject())->GetColumnSet(L"---Server Column Set---");
  463. }
  464. return m_pColumnSet;
  465. }
  466. virtual HRESULT OnCommand(long nCommandID,
  467. DATA_OBJECT_TYPES type,
  468. CComponentDataObject* pComponentData,
  469. CNodeList* pNodeList);
  470. virtual void OnDelete(CComponentDataObject* pComponentData,
  471. CNodeList* pNodeList);
  472. virtual BOOL OnRefresh(CComponentDataObject* pComponentData,
  473. CNodeList* pNodeList);
  474. virtual LPCWSTR GetString(int nCol)
  475. {
  476. return (nCol == 0) ? GetDisplayName() : g_lpszNullString;
  477. }
  478. virtual int GetImageIndex(BOOL bOpenImage);
  479. virtual BOOL HasPropertyPages(DATA_OBJECT_TYPES type,
  480. BOOL* pbHideVerb,
  481. CNodeList* pNodeList);
  482. virtual HRESULT CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,
  483. LONG_PTR handle,
  484. CNodeList* pNodeList);
  485. virtual void DecrementSheetLockCount();
  486. virtual BOOL CanExpandSync() { return FALSE; }
  487. protected:
  488. virtual LPCONTEXTMENUITEM2 OnGetContextMenuItemTable()
  489. { return CDNSServerMenuHolder::GetContextMenuItem(); }
  490. virtual BOOL OnAddMenuItem(LPCONTEXTMENUITEM2 pContextMenuItem2,
  491. long *pInsertionAllowed);
  492. virtual BOOL OnSetDeleteVerbState(DATA_OBJECT_TYPES type,
  493. BOOL* pbHide,
  494. CNodeList* pNodeList);
  495. virtual BOOL OnSetRefreshVerbState(DATA_OBJECT_TYPES type,
  496. BOOL* pbHide,
  497. CNodeList* pNodeList);
  498. virtual HRESULT OnSetToolbarVerbState(IToolbar* pToolbar,
  499. CNodeList* pNodeList);
  500. virtual HRESULT GetResultViewType(CComponentDataObject* pComponentData,
  501. LPOLESTR *ppViewType,
  502. long *pViewOptions);
  503. virtual HRESULT OnShow(LPCONSOLE lpConsole);
  504. virtual CQueryObj* OnCreateQuery();
  505. virtual void OnHaveData(CObjBase* pObj, CComponentDataObject* pComponentDataObject);
  506. #ifdef USE_NDNC
  507. BOOL ContainsDefaultNDNCs();
  508. #endif
  509. virtual void SetRecordAging();
  510. virtual void ScavengeRecords();
  511. private:
  512. // folders mainipulation
  513. //CCathegoryFolderNode* GetCathegoryFolder(CCathegoryFolderQueryObj::queryType type);
  514. CDNSAuthoritatedZonesNode* GetAuthoritatedZoneFolder(BOOL bFwd);
  515. // command handlers
  516. HRESULT OnNewZone(CComponentDataObject* pComponentData, CNodeList* pNodeList);
  517. void OnUpdateDataFiles(CComponentDataObject* pComponentData);
  518. void OnClearCache(CComponentDataObject* pComponentData);
  519. void OnConfigureServer(CComponentDataObject* pComponentData);
  520. #ifdef USE_NDNC
  521. void OnCreateNDNC();
  522. #endif
  523. public:
  524. void ChangeViewOption(BOOL bAdvanced, CComponentDataObject* pComponentData);
  525. // serialization from/to stream
  526. static HRESULT CreateFromStream(IStream* pStm, CDNSServerNode** ppServerNode);
  527. HRESULT SaveToStream(IStream* pStm);
  528. // DNS specific helpers
  529. #ifdef USE_NDNC
  530. DNS_STATUS CreatePrimaryZone(LPCTSTR lpszName,
  531. LPCTSTR lpszFileName,
  532. BOOL bLoadExisting,
  533. BOOL bFwd,
  534. BOOL bDSIntegrated,
  535. UINT nDynamicUpdate,
  536. CComponentDataObject* pComponentData,
  537. ReplicationType replType,
  538. PCWSTR pszPartitionName);
  539. DNS_STATUS CreateStubZone(LPCTSTR lpszName,
  540. LPCTSTR lpszFileName,
  541. BOOL bLoadExisting,
  542. BOOL bDSIntegrated,
  543. BOOL bFwd,
  544. DWORD* ipMastersArray,
  545. int nIPMastersCount,
  546. BOOL bLocalListOfMasters,
  547. CComponentDataObject* pComponentData,
  548. ReplicationType replType,
  549. PCWSTR pszPartitionName);
  550. #else
  551. DNS_STATUS CreatePrimaryZone(LPCTSTR lpszName, LPCTSTR lpszFileName, BOOL bLoadExisting,
  552. BOOL bFwd, BOOL bDSIntegrated, UINT nDynamicUpdate,
  553. CComponentDataObject* pComponentData);
  554. DNS_STATUS CreateStubZone(LPCTSTR lpszName, LPCTSTR lpszFileName,
  555. BOOL bLoadExisting, BOOL bDSIntegrated, BOOL bFwd,
  556. DWORD* ipMastersArray, int nIPMastersCount,
  557. BOOL bLocalListOfMasters,
  558. CComponentDataObject* pComponentData);
  559. #endif // USE_NDNC
  560. DNS_STATUS CreateSecondaryZone(LPCTSTR lpszName, LPCTSTR lpszFileName,
  561. BOOL bLoadExisting, BOOL bFwd,
  562. DWORD* ipMastersArray, int nIPMastersCount,
  563. CComponentDataObject* pComponentData);
  564. DNS_STATUS CreateForwarderZone(LPCTSTR lpszName,
  565. DWORD* ipMastersArray,
  566. int nIPMastersCount,
  567. DWORD dwTimeout,
  568. DWORD fSlave,
  569. CComponentDataObject* pComponentData);
  570. DNS_STATUS EnumZoneInfo(CZoneInfoHolder* pZoneInfoHolder);
  571. static DNS_STATUS EnumZoneInfo(LPCTSTR lpszServerName, CZoneInfoHolder* pZoneInfoHolder);
  572. DNS_STATUS ClearCache();
  573. // name used for RPC calls
  574. LPCWSTR GetRPCName();
  575. // server info access functions
  576. BOOL HasServerInfo() { ASSERT(m_pServInfoEx != NULL); return m_pServInfoEx->HasData();}
  577. void AttachServerInfo(CDNSServerInfoEx* pNewInfo);
  578. BOOL CanUseADS();
  579. DWORD GetVersion();
  580. BYTE GetMajorVersion(){ return DNS_SRV_MAJOR_VERSION(GetVersion());}
  581. BYTE GetMinorVersion(){ return DNS_SRV_MINOR_VERSION(GetVersion());}
  582. WORD GetBuildNumber() { return DNS_SRV_BUILD_NUMBER(GetVersion());}
  583. void CreateDsServerLdapPath(CString& sz);
  584. void CreateDsZoneLdapPath(CDNSZoneNode* pZoneNode, CString& sz);
  585. void CreateDsZoneName(CDNSZoneNode* pZoneNode, CString& sz);
  586. void CreateDsNodeLdapPath(CDNSZoneNode* pZoneNode, CDNSDomainNode* pDomainNode, CString& sz);
  587. void CreateLdapPathFromX500Name(LPCWSTR lpszX500Name, CString& szLdapPath);
  588. //
  589. // Server property accessors
  590. //
  591. DWORD GetNameCheckFlag();
  592. DNS_STATUS ResetNameCheckFlag(DWORD dwNameCheckFlag);
  593. DWORD GetLogLevelFlag();
  594. DNS_STATUS ResetLogLevelFlag(DWORD dwLogLevel);
  595. DWORD GetEventLogLevelFlag();
  596. DNS_STATUS ResetEventLogLevelFlag(DWORD dwEventLogLevel);
  597. PIP_ARRAY GetDebugLogFilterList();
  598. DNS_STATUS ResetDebugLogFilterList(PIP_ARRAY pIPArray);
  599. PCWSTR GetDebugLogFileName();
  600. DNS_STATUS ResetDebugLogFileName(PCWSTR pszLogFileName);
  601. DWORD GetDebugLogFileMaxSize();
  602. DNS_STATUS ResetDebugLogFileMaxSize(DWORD dwMaxSize);
  603. BOOL DoesRecursion();
  604. void GetAdvancedOptions(BOOL* bOptionsArray);
  605. DNS_STATUS ResetAdvancedOptions(BOOL* bOptionsArray, DNS_STATUS* dwRegKeyOptionsErrorArr);
  606. UCHAR GetBootMethod();
  607. DNS_STATUS ResetBootMethod(UCHAR fBootMethod);
  608. BOOL IsServerConfigured();
  609. DNS_STATUS SetServerConfigured();
  610. BOOL GetScavengingState();
  611. DWORD GetScavengingInterval();
  612. DNS_STATUS ResetScavengingInterval(DWORD dwScavengingInterval);
  613. DWORD GetDefaultRefreshInterval();
  614. DNS_STATUS ResetDefaultRefreshInterval(DWORD dwRefreshInterval);
  615. DWORD GetDefaultNoRefreshInterval();
  616. DNS_STATUS ResetDefaultNoRefreshInterval(DWORD dwNoRefreshInterval);
  617. DWORD GetDefaultScavengingState();
  618. DNS_STATUS ResetDefaultScavengingState(DWORD bScavengingState);
  619. #ifdef USE_NDNC
  620. PCSTR GetDomainName();
  621. PCSTR GetForestName();
  622. #endif
  623. DNS_STATUS ResetListenAddresses(DWORD cAddrCount, PIP_ADDRESS pipAddrs);
  624. void GetListenAddressesInfo(DWORD* pcAddrCount, PIP_ADDRESS* ppipAddrs);
  625. void GetServerAddressesInfo(DWORD* pcAddrCount, PIP_ADDRESS* ppipAddrs);
  626. DNS_STATUS ResetForwarders(DWORD cForwardersCount, PIP_ADDRESS pipForwarders, DWORD dwForwardTimeout, DWORD fSlave);
  627. void GetForwardersInfo(DWORD* pcForwardersCount, PIP_ADDRESS* ppipForwarders, DWORD* pdwForwardTimeout, DWORD* pfSlave);
  628. // Root Hints management API's
  629. BOOL HasRootHints() { return m_pRootHintsNode != NULL;}
  630. CDNSRootHintsNode* GetRootHints();
  631. void AttachRootHints(CDNSRootHintsNode* pNewRootHints);
  632. // testing options
  633. void GetTestOptions(CDNSServerTestOptions* pOptions);
  634. void ResetTestOptions(CDNSServerTestOptions* pOptions);
  635. BOOL IsTestEnabled() { return m_testOptions.m_bEnabled;}
  636. DWORD GetTestInterval() { return m_testOptions.m_dwInterval;}
  637. BOOL IsTestSimpleQueryEnabled() { return m_testOptions.m_bSimpleQuery;}
  638. BOOL IsRecursiveQueryEnabled() { return m_testOptions.m_bRecursiveQuery;}
  639. // test result manipulation
  640. void AddTestQueryResult(CDNSServerTestQueryResult* pTestResult,
  641. CComponentDataObject* pComponentData);
  642. void SetProppageStart(int nStartPage) { m_nStartProppage = nStartPage; }
  643. CDNSDomainForwardersNode* GetDomainForwardersNode() { return m_pDomainForwardersFolderNode; }
  644. private:
  645. DNS_STATUS WriteDirtyZones();
  646. CDNSZoneNode* GetNewZoneNode();
  647. // server info manipulation
  648. CDNSServerInfoEx* m_pServInfoEx;
  649. void FreeServInfo(); // free memory
  650. DNS_STATUS GetServInfo(); // read info from server
  651. // root hints info
  652. CDNSRootHintsNode* m_pRootHintsNode;
  653. void FreeRootHints();
  654. // server test query info
  655. CDNSServerTestOptions m_testOptions;
  656. DWORD m_dwTestTime;
  657. CDNSServerTestQueryResultList m_testResultList;
  658. BOOL m_bTestQueryPending;
  659. BOOL m_bShowMessages;
  660. BOOL m_bPrevQuerySuccess;
  661. int m_nStartProppage;
  662. BOOL m_bLocalServer;
  663. // cached pointer to cache folder
  664. CDNSCacheNode* m_pCacheFolderNode;
  665. CDNSForwardZonesNode* m_pFwdZonesFolderNode;
  666. CDNSReverseZonesNode* m_pRevZonesFolderNode;
  667. CDNSDomainForwardersNode* m_pDomainForwardersFolderNode;
  668. friend class CDNSRootData;
  669. friend class CDNSServer_TestPropertyPage;
  670. DECLARE_TOOLBAR_MAP()
  671. };
  672. #endif // _SERVER_H