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.

207 lines
7.2 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: D L G A T M . H
  7. //
  8. // Contents: CTcpArpcPage and CATMAddressDialog declaration
  9. //
  10. // Notes: The "ATM ARP Client" page and dialog
  11. //
  12. // Author: tongl 1 July 1997 Created
  13. //
  14. //-----------------------------------------------------------------------
  15. #pragma once
  16. #include <ncxbase.h>
  17. #include <ncatlps.h>
  18. // maximum number of characters in the ARPS and MARS edit control
  19. const int MAX_MTU_LENGTH = 5;
  20. const int MAX_TITLE_LENGTH = 12;
  21. const int NUM_ATMSERVER_LIMIT = 12;
  22. const int MAX_MTU = 65527;
  23. const int MIN_MTU = 9180;
  24. class CAtmArpcPage : public CPropSheetPage
  25. {
  26. public:
  27. // Declare the message map
  28. BEGIN_MSG_MAP(CAtmArpcPage)
  29. // Initialize dialog
  30. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  31. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  32. MESSAGE_HANDLER(WM_HELP, OnHelp)
  33. // Property page notification message handlers
  34. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  35. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  36. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  37. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  38. NOTIFY_CODE_HANDLER(PSN_QUERYCANCEL, OnQueryCancel)
  39. // Control message handlers
  40. COMMAND_ID_HANDLER(IDC_CHK_ATM_PVCONLY, OnPVCOnly)
  41. COMMAND_ID_HANDLER(IDC_LBX_ATM_ArpsAddrs, OnArpServer)
  42. COMMAND_ID_HANDLER(IDC_PSB_ATM_ArpsAdd, OnAddArps)
  43. COMMAND_ID_HANDLER(IDC_PSB_ATM_ArpsEdt, OnEditArps)
  44. COMMAND_ID_HANDLER(IDC_PSB_ATM_ArpsRmv, OnRemoveArps)
  45. COMMAND_ID_HANDLER(IDC_PSB_ATM_ArpsUp, OnArpsUp)
  46. COMMAND_ID_HANDLER(IDC_PSB_ATM_ArpsDown, OnArpsDown)
  47. COMMAND_ID_HANDLER(IDC_LBX_ATM_MarsAddrs, OnMarServer)
  48. COMMAND_ID_HANDLER(IDC_PSB_ATM_MarsAdd, OnAddMars)
  49. COMMAND_ID_HANDLER(IDC_PSB_ATM_MarsEdt, OnEditMars)
  50. COMMAND_ID_HANDLER(IDC_PSB_ATM_MarsRmv, OnRemoveMars)
  51. COMMAND_ID_HANDLER(IDC_PSB_ATM_MarsUp, OnMarsUp)
  52. COMMAND_ID_HANDLER(IDC_PSB_ATM_MarsDown, OnMarsDown)
  53. COMMAND_ID_HANDLER(IDC_EDT_ATM_MaxTU, OnMaxTU)
  54. END_MSG_MAP()
  55. // Constructors/Destructors
  56. public:
  57. CAtmArpcPage(CTcpAddrPage * pTcpAddrPage,
  58. ADAPTER_INFO * pAdapterDlg,
  59. const DWORD * adwHelpIDs = NULL)
  60. {
  61. AssertH(pTcpAddrPage);
  62. AssertH(pAdapterDlg);
  63. m_pParentDlg = pTcpAddrPage;
  64. m_pAdapterInfo = pAdapterDlg;
  65. m_adwHelpIDs = adwHelpIDs;
  66. m_fModified = FALSE;
  67. }
  68. ~CAtmArpcPage(){};
  69. // Interface
  70. public:
  71. // message map functions
  72. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  73. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  74. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  75. // notify handlers for the property page
  76. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  77. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  78. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  79. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  80. LRESULT OnQueryCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  81. // Control message handlers
  82. LRESULT OnPVCOnly(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  83. LRESULT OnArpServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  84. LRESULT OnAddArps(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  85. LRESULT OnEditArps(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  86. LRESULT OnRemoveArps(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  87. LRESULT OnArpsUp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  88. LRESULT OnArpsDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  89. LRESULT OnMarServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  90. LRESULT OnAddMars(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  91. LRESULT OnEditMars(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  92. LRESULT OnRemoveMars(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  93. LRESULT OnMarsUp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  94. LRESULT OnMarsDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  95. LRESULT OnMaxTU(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  96. friend class CAtmAddressDialog;
  97. private:
  98. // Inlines
  99. BOOL IsModified() {return m_fModified;}
  100. void SetModifiedTo(BOOL bState) {m_fModified = bState;}
  101. void PageModified() { m_fModified = TRUE;
  102. PropSheet_Changed(GetParent(), m_hWnd);
  103. }
  104. // Update the server addresses and MTU of the deselected card
  105. void UpdateInfo();
  106. void SetInfo();
  107. void EnableGroup(BOOL fEnable);
  108. void OnServerAdd(HANDLES hwndGroup, PCWSTR szTitle);
  109. void OnServerEdit(HANDLES hwndGroup, PCWSTR szTitle);
  110. void OnServerRemove(HANDLES hwndGroup, BOOL fRemoveArps);
  111. void OnServerUp(HANDLES hwndGroup);
  112. void OnServerDown(HANDLES hwndGroup);
  113. // data members
  114. CTcpAddrPage * m_pParentDlg;
  115. ADAPTER_INFO * m_pAdapterInfo;
  116. const DWORD * m_adwHelpIDs;
  117. BOOL m_fModified;
  118. BOOL m_fEditState;
  119. HWND m_hAddressList;
  120. tstring m_strNewArpsAddress; // either the one added, or edited
  121. tstring m_strNewMarsAddress;
  122. tstring m_strMovingEntry;
  123. HWND m_hMTUEditBox;
  124. HANDLES m_hArps;
  125. HANDLES m_hMars;
  126. };
  127. class CAtmAddressDialog : public CDialogImpl<CAtmAddressDialog>
  128. {
  129. public:
  130. enum { IDD = IDD_ATM_ADDR };
  131. BEGIN_MSG_MAP(CServerDialog)
  132. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog);
  133. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu);
  134. MESSAGE_HANDLER(WM_HELP, OnHelp);
  135. COMMAND_ID_HANDLER(IDOK, OnOk);
  136. COMMAND_ID_HANDLER(IDCANCEL, OnCancel);
  137. COMMAND_ID_HANDLER(IDC_EDT_ATM_Address, OnChange);
  138. END_MSG_MAP()
  139. public:
  140. CAtmAddressDialog(CAtmArpcPage * pAtmArpcPage, const DWORD* pamhidsHelp = NULL);
  141. ~CAtmAddressDialog();
  142. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  143. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  144. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  145. LRESULT OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  146. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  147. LRESULT OnChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  148. void SetTitle(PCWSTR szTitle);
  149. private:
  150. HWND m_hOkButton; // this is the IDOK button, the text of the button changes
  151. // with the context.
  152. HWND m_hEditBox; // this is the edit box for the ATM address
  153. CAtmArpcPage * m_pParentDlg;
  154. WCHAR m_szTitle[MAX_TITLE_LENGTH];
  155. const DWORD * m_adwHelpIDs;
  156. };