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.

187 lines
5.8 KiB

  1. /*++
  2. Copyright(c) 1998,99 Microsoft Corporation
  3. Module Name:
  4. ports.h
  5. Abstract:
  6. Windows Load Balancing Service (WLBS)
  7. Notifier object UI - port rules tab
  8. Author:
  9. kyrilf
  10. shouse
  11. --*/
  12. #pragma once
  13. #include <ncxbase.h>
  14. #include <ncatlps.h>
  15. #include "resource.h"
  16. #include "wlbsconfig.h"
  17. #include "wlbsparm.h"
  18. #include "wlbscfg.h"
  19. /* Limitations for IP address fields. */
  20. #define WLBS_FIELD_EMPTY -1
  21. #define WLBS_FIELD_LOW 0
  22. #define WLBS_FIELD_HIGH 255
  23. #define WLBS_IP_FIELD_ZERO_LOW 1
  24. #define WLBS_IP_FIELD_ZERO_HIGH 223
  25. #define WLBS_INVALID_PORT_RULE_INDEX -1
  26. #define WLBS_NUM_COLUMNS 8
  27. #define WLBS_VIP_COLUMN 0
  28. #define WLBS_PORT_START_COLUMN 1
  29. #define WLBS_PORT_END_COLUMN 2
  30. #define WLBS_PROTOCOL_COLUMN 3
  31. #define WLBS_MODE_COLUMN 4
  32. #define WLBS_PRIORITY_COLUMN 5
  33. #define WLBS_LOAD_COLUMN 6
  34. #define WLBS_AFFINITY_COLUMN 7
  35. struct VALID_PORT_RULE : public NETCFG_WLBS_PORT_RULE {
  36. BOOL valid;
  37. };
  38. class CDialogPorts : public CPropSheetPage {
  39. public:
  40. /* Declare the message map. */
  41. BEGIN_MSG_MAP (CDialogPorts)
  42. MESSAGE_HANDLER (WM_INITDIALOG, OnInitDialog)
  43. MESSAGE_HANDLER (WM_CONTEXTMENU, OnContextMenu)
  44. MESSAGE_HANDLER (WM_HELP, OnHelp)
  45. NOTIFY_CODE_HANDLER (PSN_APPLY, OnApply)
  46. NOTIFY_CODE_HANDLER (PSN_KILLACTIVE, OnKillActive)
  47. NOTIFY_CODE_HANDLER (PSN_SETACTIVE, OnActive)
  48. NOTIFY_CODE_HANDLER (PSN_RESET, OnCancel)
  49. NOTIFY_CODE_HANDLER (LVN_ITEMCHANGED, OnStateChange)
  50. NOTIFY_CODE_HANDLER (NM_DBLCLK, OnDoubleClick)
  51. NOTIFY_CODE_HANDLER (LVN_COLUMNCLICK, OnColumnClick)
  52. COMMAND_ID_HANDLER (IDC_BUTTON_ADD, OnButtonAdd)
  53. COMMAND_ID_HANDLER (IDC_BUTTON_DEL, OnButtonDel)
  54. COMMAND_ID_HANDLER (IDC_BUTTON_MODIFY, OnButtonModify)
  55. END_MSG_MAP ()
  56. /* Constructors/Destructors. */
  57. CDialogPorts (NETCFG_WLBS_CONFIG * paramp, const DWORD * phelpIDs = NULL);
  58. ~CDialogPorts ();
  59. public:
  60. /* Message map functions. */
  61. LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & fHandled);
  62. LRESULT OnContextMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & fHandled);
  63. LRESULT OnHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & fHandled);
  64. LRESULT OnApply (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  65. LRESULT OnKillActive (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  66. LRESULT OnActive (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  67. LRESULT OnCancel (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  68. LRESULT OnStateChange (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  69. LRESULT OnDoubleClick (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  70. LRESULT OnColumnClick (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  71. LRESULT OnButtonAdd (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  72. LRESULT OnButtonDel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  73. LRESULT OnButtonModify (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  74. friend class CDialogHost;
  75. friend class CDialogCluster;
  76. friend class CDialogPortRule;
  77. private:
  78. void SetInfo ();
  79. void UpdateInfo ();
  80. void CreateRule (BOOL select, VALID_PORT_RULE * rulep);
  81. void UpdateList (BOOL add, BOOL del, BOOL modify, VALID_PORT_RULE * rulep);
  82. int InsertRule (VALID_PORT_RULE * rulep);
  83. void FillPortRuleDescription ();
  84. NETCFG_WLBS_CONFIG * m_paramp;
  85. const DWORD * m_adwHelpIDs;
  86. BOOL m_rulesValid;
  87. int m_sort_column;
  88. enum { WLBS_SORT_ASCENDING = 0, WLBS_SORT_DESCENDING = 1 } m_sort_order;
  89. VALID_PORT_RULE m_rules[WLBS_MAX_RULES];
  90. };
  91. class CDialogPortRule : public CDialogImpl<CDialogPortRule> {
  92. public:
  93. enum { IDD = IDD_DIALOG_PORT_RULE_PROP };
  94. BEGIN_MSG_MAP (CDialogPortRule)
  95. MESSAGE_HANDLER (WM_INITDIALOG, OnInitDialog)
  96. MESSAGE_HANDLER (WM_CONTEXTMENU, OnContextMenu)
  97. MESSAGE_HANDLER (WM_HELP, OnHelp)
  98. NOTIFY_CODE_HANDLER (IPN_FIELDCHANGED, OnIpFieldChange)
  99. COMMAND_ID_HANDLER (IDOK, OnOk);
  100. COMMAND_ID_HANDLER (IDCANCEL, OnCancel);
  101. COMMAND_ID_HANDLER (IDC_CHECK_PORT_RULE_ALL_VIP, OnCheckPortRuleAllVip);
  102. COMMAND_ID_HANDLER (IDC_CHECK_EQUAL, OnCheckEqual)
  103. COMMAND_ID_HANDLER (IDC_RADIO_MULTIPLE, OnRadioMode)
  104. COMMAND_ID_HANDLER (IDC_RADIO_SINGLE, OnRadioMode)
  105. COMMAND_ID_HANDLER (IDC_RADIO_DISABLED, OnRadioMode)
  106. END_MSG_MAP ()
  107. CDialogPortRule (CDialogPorts * parent, const DWORD * phelpIDs, int index);
  108. ~CDialogPortRule ();
  109. public:
  110. LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & fHandled);
  111. LRESULT OnContextMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & fHandled);
  112. LRESULT OnHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & fHandled);
  113. LRESULT OnIpFieldChange (int idCtrl, LPNMHDR pnmh, BOOL & fHandled);
  114. LRESULT OnOk (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  115. LRESULT OnCancel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  116. LRESULT OnCheckPortRuleAllVip (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  117. LRESULT OnCheckEqual (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  118. LRESULT OnRadioMode (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & fHandled);
  119. friend class CDialogPorts;
  120. private:
  121. void PrintIPRangeError (unsigned int ids, int value, int low, int high);
  122. void PrintRangeError (unsigned int ids, int low, int high);
  123. void SetInfo ();
  124. void ModeSwitch ();
  125. BOOL ValidateRule (VALID_PORT_RULE * rulep, BOOL self_check);
  126. const DWORD * m_adwHelpIDs;
  127. CDialogPorts * m_parent;
  128. int m_index;
  129. VALID_PORT_RULE m_rule;
  130. struct {
  131. UINT IpControl;
  132. int Field;
  133. int Value;
  134. UINT RejectTimes;
  135. } m_IPFieldChangeState;
  136. };