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.

345 lines
9.0 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997-1999 **/
  4. /**********************************************************************/
  5. /*
  6. snmppp.h
  7. snmp extension property pages
  8. FILE HISTORY:
  9. */
  10. #ifndef _SNMPPPH_
  11. #define _SNMPPPH_
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #define N_PERMISSION_BITS 5
  16. #define PERM_BIT_NONE 0
  17. #define PERM_BIT_NOTIFY 1
  18. #define PERM_BIT_READONLY 2
  19. #define PERM_BIT_READWRITE 3
  20. #define PERM_BIT_READCREATE 4
  21. const int COMBO_EDIT_LEN = 256;
  22. const int HOSTNAME_LENGTH = 64;
  23. const int DOMAINNAME_LENGTH = 255;
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CAddDialog dialog
  26. class CAddDialog : public CBaseDialog
  27. {
  28. // Construction
  29. public:
  30. CAddDialog(CWnd* pParent = NULL); // standard constructor
  31. // Dialog Data
  32. //{{AFX_DATA(CAddDialog)
  33. enum { IDD = IDD_DIALOG_ADD };
  34. CEdit m_editName;
  35. CButton m_buttonAdd;
  36. CButton m_buttonCancel;
  37. CStatic m_staticText;
  38. CStatic m_staticPermissions;
  39. CComboBox m_comboPermissions;
  40. //}}AFX_DATA
  41. // Overrides
  42. // ClassWizard generated virtual function overrides
  43. //{{AFX_VIRTUAL(CAddDialog)
  44. protected:
  45. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  46. //}}AFX_VIRTUAL
  47. // Implementation
  48. protected:
  49. // Generated message map functions
  50. //{{AFX_MSG(CAddDialog)
  51. virtual BOOL OnInitDialog();
  52. virtual void OnClickedButtonAdd();
  53. //}}AFX_MSG
  54. DECLARE_MESSAGE_MAP()
  55. virtual DWORD * GetHelpMap();
  56. public:
  57. BOOL m_bCommunity;
  58. // this contains the specified string to add
  59. CString m_strName;
  60. // this contains the specified choice name
  61. CString m_strChoice;
  62. // this contains the specified choice index
  63. int m_nChoice;
  64. };
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CEditDialog dialog
  67. class CEditDialog : public CBaseDialog
  68. {
  69. // Construction
  70. public:
  71. CEditDialog(CWnd* pParent = NULL); // standard constructor
  72. // Dialog Data
  73. //{{AFX_DATA(CEditDialog)
  74. enum { IDD = IDD_DIALOG_EDIT };
  75. CEdit m_editName;
  76. CButton m_buttonOk;
  77. CButton m_buttonCancel;
  78. CStatic m_staticText;
  79. CComboBox m_comboPermissions;
  80. CStatic m_staticPermissions;
  81. //}}AFX_DATA
  82. // Overrides
  83. // ClassWizard generated virtual function overrides
  84. //{{AFX_VIRTUAL(CEditDialog)
  85. protected:
  86. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  87. //}}AFX_VIRTUAL
  88. // Implementation
  89. protected:
  90. // Generated message map functions
  91. //{{AFX_MSG(CEditDialog)
  92. virtual BOOL OnInitDialog();
  93. virtual void OnOK();
  94. //}}AFX_MSG
  95. DECLARE_MESSAGE_MAP()
  96. virtual DWORD * GetHelpMap();
  97. public:
  98. BOOL m_bCommunity;
  99. // this contains the modified string
  100. CString m_strName;
  101. // this contains the specified choice name
  102. CString m_strChoice;
  103. // this contains the specified choice index
  104. int m_nChoice;
  105. };
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CAgentPage dialog
  108. class CAgentPage : public CPropertyPageBase
  109. {
  110. DECLARE_DYNCREATE(CAgentPage)
  111. // Construction
  112. public:
  113. CAgentPage();
  114. ~CAgentPage();
  115. // Dialog Data
  116. //{{AFX_DATA(CAgentPage)
  117. enum { IDD = IDD_AGENT_PROP_PAGE };
  118. CButton m_checkPhysical;
  119. CButton m_checkApplications;
  120. CButton m_checkDatalink;
  121. CButton m_checkInternet;
  122. CButton m_checkEndToEnd;
  123. CEdit m_editContact;
  124. CEdit m_editLocation;
  125. //}}AFX_DATA
  126. // Overrides
  127. // ClassWizard generate virtual function overrides
  128. //{{AFX_VIRTUAL(CAgentPage)
  129. public:
  130. virtual BOOL OnApply();
  131. protected:
  132. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  133. //}}AFX_VIRTUAL
  134. // Implementation
  135. public:
  136. // Context Help Support
  137. virtual DWORD * GetHelpMap() { return (DWORD *) &g_aHelpIDs_IDD_AGENT_PROP_PAGE[0]; }
  138. BOOL LoadRegistry();
  139. BOOL SaveRegistry();
  140. protected:
  141. // Generated message map functions
  142. //{{AFX_MSG(CAgentPage)
  143. virtual BOOL OnInitDialog();
  144. afx_msg void OnClickedCheckPhysical();
  145. afx_msg void OnClickedCheckApplications();
  146. afx_msg void OnClickedCheckDatalink();
  147. afx_msg void OnClickedCheckInternet();
  148. afx_msg void OnClickedCheckEndToEnd();
  149. afx_msg void OnChangeEditContact();
  150. afx_msg void OnChangeEditLocation();
  151. //}}AFX_MSG
  152. DECLARE_MESSAGE_MAP()
  153. BOOL m_bLocationChanged;
  154. BOOL m_bContactChanged;
  155. };
  156. /////////////////////////////////////////////////////////////////////////////
  157. // CTrapsPage dialog
  158. class CTrapsPage : public CPropertyPageBase
  159. {
  160. DECLARE_DYNCREATE(CTrapsPage)
  161. // Construction
  162. public:
  163. CTrapsPage();
  164. ~CTrapsPage();
  165. // Dialog Data
  166. //{{AFX_DATA(CTrapsPage)
  167. enum { IDD = IDD_TRAPS_PROP_PAGE };
  168. CComboBox m_comboCommunityName;
  169. CButton m_buttonAddName;
  170. CButton m_buttonRemoveName;
  171. CListBox m_listboxTrapDestinations;
  172. CButton m_buttonAddTrap;
  173. CButton m_buttonEditTrap;
  174. CButton m_buttonRemoveTrap;
  175. //}}AFX_DATA
  176. // Overrides
  177. // ClassWizard generate virtual function overrides
  178. //{{AFX_VIRTUAL(CTrapsPage)
  179. public:
  180. virtual BOOL OnApply();
  181. protected:
  182. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  183. //}}AFX_VIRTUAL
  184. // Implementation
  185. public:
  186. // Context Help Support
  187. virtual DWORD * GetHelpMap() { return (DWORD *) &g_aHelpIDs_IDD_TRAPS_PROP_PAGE[0]; }
  188. BOOL LoadRegistry();
  189. BOOL SaveRegistry();
  190. BOOL LoadTrapDestination(int nIndex);
  191. void UpdateCommunityAddButton();
  192. void UpdateCommunityRemoveButton();
  193. void UpdateTrapDestinationButtons();
  194. protected:
  195. // Generated message map functions
  196. //{{AFX_MSG(CTrapsPage)
  197. virtual BOOL OnInitDialog();
  198. afx_msg void OnEditChangeCommunityName();
  199. afx_msg void OnEditUpdateCommunityName();
  200. afx_msg void OnSelectionChangeCommunityName();
  201. afx_msg void OnClickedButtonAddName();
  202. afx_msg void OnClickedButtonRemoveName();
  203. afx_msg void OnClickedButtonAddTrap();
  204. afx_msg void OnClickedButtonEditTrap();
  205. afx_msg void OnClickedButtonRemoveTrap();
  206. //}}AFX_MSG
  207. DECLARE_MESSAGE_MAP()
  208. CObList * m_pCommunityList;
  209. CAddDialog m_dlgAdd;
  210. CEditDialog m_dlgEdit;
  211. BOOL m_fPolicyTrapConfig;
  212. };
  213. /////////////////////////////////////////////////////////////////////////////
  214. // CSecurityPage dialog
  215. class CSecurityPage : public CPropertyPageBase
  216. {
  217. DECLARE_DYNCREATE(CSecurityPage)
  218. // Construction
  219. public:
  220. CSecurityPage();
  221. ~CSecurityPage();
  222. // Dialog Data
  223. //{{AFX_DATA(CSecurityPage)
  224. enum { IDD = IDD_SECURITY_PROP_PAGE };
  225. CCommList m_listboxCommunity;
  226. CButton m_buttonAddCommunity;
  227. CButton m_buttonEditCommunity;
  228. CButton m_buttonRemoveCommunity;
  229. CButton m_buttonAddHost;
  230. CButton m_buttonEditHost;
  231. CButton m_buttonRemoveHost;
  232. CListBox m_listboxHost;
  233. CButton m_checkSendAuthTrap;
  234. CButton m_radioAcceptAnyHost;
  235. CButton m_radioAcceptSpecificHost;
  236. //}}AFX_DATA
  237. // Overrides
  238. // ClassWizard generate virtual function overrides
  239. //{{AFX_VIRTUAL(CSecurityPage)
  240. public:
  241. virtual BOOL OnApply();
  242. protected:
  243. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  244. //}}AFX_VIRTUAL
  245. // Implementation
  246. public:
  247. // Context Help Support
  248. virtual DWORD * GetHelpMap() { return (DWORD *) &g_aHelpIDs_IDD_SECURITY_PROP_PAGE[0]; }
  249. BOOL LoadRegistry();
  250. BOOL SaveRegistry();
  251. BOOL LoadTrapDestination(int nIndex);
  252. void UpdateNameButtons();
  253. void UpdateHostButtons();
  254. BOOL LoadSecurityInfo(CString &strRegName);
  255. BOOL SaveSecurityInfo(CString &strRegName);
  256. protected:
  257. // Generated message map functions
  258. //{{AFX_MSG(CSecurityPage)
  259. virtual BOOL OnInitDialog();
  260. afx_msg void OnClickedButtonAddCommunity();
  261. afx_msg void OnClickedButtonEditCommunity();
  262. afx_msg void OnClickedButtonRemoveCommunity();
  263. afx_msg void OnClickedButtonAddHost();
  264. afx_msg void OnClickedButtonEditHost();
  265. afx_msg void OnClickedButtonRemoveHost();
  266. afx_msg void OnClickedCheckSendAuthTrap();
  267. afx_msg void OnClickedRadioAcceptAnyHost();
  268. afx_msg void OnClickedRadioAcceptSpecificHost();
  269. afx_msg void OnDblclkCtrlistCommunity(NMHDR* pNMHDR, LRESULT* pResult);
  270. afx_msg void OnCommunityListChanged(NMHDR* pNMHDR, LRESULT* pResult);
  271. //}}AFX_MSG
  272. DECLARE_MESSAGE_MAP()
  273. // private methods to add admin acl to registry subkey
  274. PACL AllocACL();
  275. void FreeACL( PACL pAcl);
  276. BOOL SnmpAddAdminAclToKey(LPTSTR pszKey);
  277. CAddDialog m_dlgAddName;
  278. CEditDialog m_dlgEditName;
  279. CAddDialog m_dlgAddHost;
  280. CEditDialog m_dlgEditHost;
  281. BOOL m_fPolicyValidCommunities;
  282. BOOL m_fPolicyPermittedManagers;
  283. };
  284. BOOL IsValidString(CString & strName);
  285. BOOL ValidateDomain(CString & strdomain);
  286. #endif