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.

254 lines
5.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. ServBrow.h
  7. The server browser dialog
  8. FILE HISTORY:
  9. */
  10. #if !defined _SERVBROW_H
  11. #define _SERVBROW_H
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #ifndef _BUSYDLG_H
  16. #include "busydlg.h"
  17. #endif
  18. // defines used in the display of owner info
  19. enum _AUTH_COLUMNS
  20. {
  21. COLUMN_NAME,
  22. COLUMN_IP,
  23. COLUMN_MAX
  24. };
  25. extern BOOL g_bDhcpDsInitialized;
  26. class CServerInfo
  27. {
  28. public:
  29. CServerInfo()
  30. : m_dwIp(0) {};
  31. CServerInfo(DWORD dwIp, LPCTSTR pFQDN)
  32. : m_dwIp(dwIp), m_strName(pFQDN) {};
  33. CServerInfo(CServerInfo & ServerInfo)
  34. {
  35. *this = ServerInfo;
  36. }
  37. CServerInfo & operator = (const CServerInfo & ServerInfo)
  38. {
  39. if (this != &ServerInfo)
  40. {
  41. m_dwIp = ServerInfo.m_dwIp;
  42. m_strName = ServerInfo.m_strName;
  43. }
  44. return *this;
  45. }
  46. public:
  47. DWORD m_dwIp;
  48. CString m_strName;
  49. };
  50. typedef CList<CServerInfo, CServerInfo&> CServerInfoListBase;
  51. class CAuthServerList : public CServerInfoListBase
  52. {
  53. public:
  54. CAuthServerList();
  55. ~CAuthServerList();
  56. public:
  57. HRESULT Init();
  58. HRESULT Destroy();
  59. BOOL IsInitialized() { return m_bInitialized; }
  60. HRESULT EnumServers();
  61. BOOL IsAuthorized(DWORD dwIpAddress);
  62. HRESULT AddServer(DWORD dwIpAddress, LPCTSTR pFQDN);
  63. HRESULT RemoveServer(DWORD dwIpAddress);
  64. void Clear();
  65. void Reset();
  66. HRESULT Next(CServerInfo &ServerInfo);
  67. private:
  68. POSITION m_pos;
  69. BOOL m_bInitialized;
  70. CCriticalSection m_cs;
  71. };
  72. class CAuthServerWorker : public CDlgWorkerThread
  73. {
  74. public:
  75. CAuthServerWorker(CAuthServerList ** ppList);
  76. ~CAuthServerWorker();
  77. void OnDoAction();
  78. private:
  79. CAuthServerList * m_pAuthList;
  80. CAuthServerList ** m_ppList;
  81. };
  82. class CStandaloneAuthServerWorker : public CAuthServerWorker
  83. {
  84. public:
  85. CStandaloneAuthServerWorker();
  86. ~CStandaloneAuthServerWorker();
  87. virtual int Run();
  88. };
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CServerBrowse dialog
  91. class CServerBrowse : public CBaseDialog
  92. {
  93. // Construction
  94. public:
  95. CServerBrowse(BOOL bMultiselect = FALSE, CWnd* pParent = NULL); // standard constructor
  96. // Dialog Data
  97. //{{AFX_DATA(CServerBrowse)
  98. enum { IDD = IDD_BROWSE_SERVERS };
  99. CButton m_buttonOk;
  100. CButton m_buttonRemove;
  101. CListCtrl m_listctrlServers;
  102. //}}AFX_DATA
  103. public:
  104. void SetServerList(CAuthServerList * pServerList) { m_pServerList = pServerList; }
  105. virtual DWORD * GetHelpMap() { return DhcpGetHelpMap(CServerBrowse::IDD); }
  106. int HandleSort(LPARAM lParam1, LPARAM lParam2);
  107. void ResetSort();
  108. // Overrides
  109. // ClassWizard generated virtual function overrides
  110. //{{AFX_VIRTUAL(CServerBrowse)
  111. protected:
  112. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  113. //}}AFX_VIRTUAL
  114. // Implementation
  115. protected:
  116. void RefreshData();
  117. void UpdateButtons();
  118. void FillListCtrl();
  119. void Sort(int nCol);
  120. // Generated message map functions
  121. //{{AFX_MSG(CServerBrowse)
  122. virtual BOOL OnInitDialog();
  123. virtual void OnOK();
  124. afx_msg void OnButtonRefresh();
  125. afx_msg void OnButtonRemove();
  126. afx_msg void OnItemchangedListValidServers(NMHDR* pNMHDR, LRESULT* pResult);
  127. afx_msg void OnButtonAuthorize();
  128. afx_msg void OnColumnclickListValidServers(NMHDR* pNMHDR, LRESULT* pResult);
  129. //}}AFX_MSG
  130. DECLARE_MESSAGE_MAP()
  131. public:
  132. // these contain the name and IP of the selected item on exit
  133. CStringArray m_astrName;
  134. CStringArray m_astrIp;
  135. private:
  136. CAuthServerList * m_pServerList;
  137. BOOL m_bMultiselect;
  138. int m_nSortColumn;
  139. BOOL m_aSortOrder[COLUMN_MAX];
  140. };
  141. /////////////////////////////////////////////////////////////////////////////
  142. // CGetServer dialog
  143. class CGetServer : public CBaseDialog
  144. {
  145. // Construction
  146. public:
  147. CGetServer(CWnd* pParent = NULL); // standard constructor
  148. // Dialog Data
  149. //{{AFX_DATA(CGetServer)
  150. enum { IDD = IDD_GET_SERVER };
  151. // NOTE: the ClassWizard will add data members here
  152. //}}AFX_DATA
  153. DWORD m_dwIpAddress;
  154. CString m_strName;
  155. virtual DWORD * GetHelpMap() { return DhcpGetHelpMap(CGetServer::IDD); }
  156. // Overrides
  157. // ClassWizard generated virtual function overrides
  158. //{{AFX_VIRTUAL(CGetServer)
  159. protected:
  160. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  161. //}}AFX_VIRTUAL
  162. // Implementation
  163. protected:
  164. // Generated message map functions
  165. //{{AFX_MSG(CGetServer)
  166. virtual void OnOK();
  167. afx_msg void OnChangeEditServerNameIp();
  168. virtual BOOL OnInitDialog();
  169. //}}AFX_MSG
  170. DECLARE_MESSAGE_MAP()
  171. };
  172. /////////////////////////////////////////////////////////////////////////////
  173. // CConfirmAuthorization dialog
  174. class CConfirmAuthorization : public CBaseDialog
  175. {
  176. // Construction
  177. public:
  178. CConfirmAuthorization(CWnd* pParent = NULL); // standard constructor
  179. // Dialog Data
  180. //{{AFX_DATA(CConfirmAuthorization)
  181. enum { IDD = IDD_GET_SERVER_CONFIRM };
  182. CString m_strName;
  183. //}}AFX_DATA
  184. DWORD m_dwAuthAddress;
  185. // Overrides
  186. // ClassWizard generated virtual function overrides
  187. //{{AFX_VIRTUAL(CConfirmAuthorization)
  188. protected:
  189. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  190. //}}AFX_VIRTUAL
  191. virtual DWORD * GetHelpMap() { return DhcpGetHelpMap(CConfirmAuthorization::IDD); }
  192. // Implementation
  193. protected:
  194. CWndIpAddress m_ipaAuth;
  195. // Generated message map functions
  196. //{{AFX_MSG(CConfirmAuthorization)
  197. virtual BOOL OnInitDialog();
  198. virtual void OnOK();
  199. //}}AFX_MSG
  200. DECLARE_MESSAGE_MAP()
  201. };
  202. //{{AFX_INSERT_LOCATION}}
  203. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  204. #endif // !defined _SERVBROW_H