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.

240 lines
5.4 KiB

  1. #ifndef PORTSPAGE_H
  2. #define PORTSPAGE_H
  3. #include "stdafx.h"
  4. #include "resource.h"
  5. #include "MNLBUIData.h"
  6. class PortsPage : public CPropertyPage
  7. {
  8. public:
  9. struct PortData
  10. {
  11. PortData();
  12. DWORD key;
  13. _bstr_t virtual_ip_addr;
  14. _bstr_t start_port;
  15. _bstr_t end_port;
  16. _bstr_t protocol;
  17. _bstr_t mode;
  18. _bstr_t priority;
  19. _bstr_t load;
  20. bool equal;
  21. _bstr_t affinity;
  22. };
  23. enum
  24. {
  25. IDD = IDD_DIALOG_PORTS,
  26. };
  27. PortsPage(
  28. CPropertySheet *psh,
  29. NLB_EXTENDED_CLUSTER_CONFIGURATION *pNlbCfg,
  30. bool fIsClusterLevel,
  31. ENGINEHANDLE ehCluster OPTIONAL
  32. // ENGINEHANDLE ehInterface OPTIONAL
  33. );
  34. ~PortsPage();
  35. // overrides of CPropertyPage
  36. virtual void OnOK();
  37. virtual BOOL OnSetActive();
  38. virtual BOOL OnKillActive();
  39. virtual BOOL OnInitDialog();
  40. virtual BOOL OnWizardFinish();
  41. virtual void DoDataExchange( CDataExchange* pDX );
  42. afx_msg void OnButtonAdd();
  43. afx_msg void OnButtonDel();
  44. afx_msg void OnButtonModify();
  45. afx_msg void OnDoubleClick( NMHDR * pNotifyStruct, LRESULT * result );
  46. afx_msg void OnColumnClick( NMHDR * pNotifyStruct, LRESULT * result );
  47. afx_msg void OnSelchanged( NMHDR * pNotifyStruct, LRESULT * result );
  48. afx_msg BOOL OnHelpInfo (HELPINFO* helpInfo );
  49. afx_msg void OnContextMenu( CWnd* pWnd, CPoint point );
  50. void FillPortRuleDescription ();
  51. // data members
  52. CListCtrl m_portList;
  53. CButton buttonAdd;
  54. CButton buttonModify;
  55. CButton buttonDel;
  56. map< long, PortDataX> m_mapPortX;
  57. bool m_isClusterLevel;
  58. _bstr_t machine;
  59. private:
  60. CPropertySheet *m_pshOwner;
  61. bool m_sort_ascending;
  62. int m_sort_column;
  63. ENGINEHANDLE m_ehCluster; // engine handle to cluster (could be NULL)
  64. // ENGINEHANDLE m_ehInterface; // engine handle to inteface (could be NULL)
  65. // The (New) place to get/save config.
  66. //
  67. NLB_EXTENDED_CLUSTER_CONFIGURATION *m_pNlbCfg;
  68. void
  69. mfn_SaveToNlbCfg(void);
  70. DECLARE_MESSAGE_MAP()
  71. };
  72. class PortListUtils
  73. {
  74. public:
  75. static void getPresentPorts(CListCtrl &portList,
  76. vector<PortsPage::PortData>* ports );
  77. static void LoadFromNlbCfg(NLB_EXTENDED_CLUSTER_CONFIGURATION * pNlbCfg,
  78. CListCtrl & portList,
  79. bool isClusterLevel,
  80. bool isDetailsView
  81. );
  82. static void OnColumnClick(LPNMLISTVIEW lv,
  83. CListCtrl & portList,
  84. bool isClusterLevel,
  85. bool & sort_ascending,
  86. int & sort_column);
  87. };
  88. static DWORD g_aHelpIDs_IDD_DIALOG_PORTS [] = {
  89. IDC_TEXT_PORT_RULE, IDC_LIST_PORT_RULE,
  90. IDC_LIST_PORT_RULE, IDC_LIST_PORT_RULE,
  91. IDC_BUTTON_ADD, IDC_BUTTON_ADD,
  92. IDC_BUTTON_MODIFY, IDC_BUTTON_MODIFY,
  93. IDC_BUTTON_DEL, IDC_BUTTON_DEL,
  94. IDC_GROUP_PORT_RULE_DESCR, IDC_GROUP_PORT_RULE_DESCR,
  95. IDC_TEXT_PORT_RULE_DESCR, IDC_GROUP_PORT_RULE_DESCR,
  96. 0, 0
  97. };
  98. class comp_vip
  99. {
  100. public:
  101. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  102. {
  103. return ( x.virtual_ip_addr < y.virtual_ip_addr );
  104. }
  105. };
  106. class comp_start_port
  107. {
  108. public:
  109. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  110. {
  111. return ( _wtoi( x.start_port ) < _wtoi( y.start_port ) );
  112. }
  113. };
  114. class comp_end_port
  115. {
  116. public:
  117. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  118. {
  119. return ( _wtoi( x.end_port ) < _wtoi( y.end_port ) );
  120. }
  121. };
  122. class comp_protocol
  123. {
  124. public:
  125. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  126. {
  127. return ( x.protocol < y.protocol );
  128. }
  129. };
  130. class comp_mode
  131. {
  132. public:
  133. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  134. {
  135. return ( x.mode < y.mode );
  136. }
  137. };
  138. class comp_priority_string
  139. {
  140. public:
  141. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  142. {
  143. return ( x.priority < y.priority );
  144. }
  145. };
  146. class comp_priority_int
  147. {
  148. public:
  149. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  150. {
  151. return ( _wtoi( x.priority ) < _wtoi( y.priority ) );
  152. }
  153. };
  154. class comp_load_string
  155. {
  156. public:
  157. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  158. {
  159. return ( x.load < y.load );
  160. }
  161. };
  162. class comp_load_int
  163. {
  164. public:
  165. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  166. {
  167. return ( _wtoi( x.load ) < _wtoi( y.load ) );
  168. }
  169. };
  170. class comp_affinity
  171. {
  172. public:
  173. bool operator()( PortsPage::PortData x, PortsPage::PortData y )
  174. {
  175. return ( x.affinity < y.affinity );
  176. }
  177. };
  178. #endif