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.

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