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.

325 lines
7.5 KiB

  1. //+---------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993 - 1997.
  5. //
  6. // File: endpointDetails.h
  7. //
  8. // Contents: Defines the classes CEndpointDetails,
  9. //
  10. // Classes:
  11. //
  12. // Methods:
  13. //
  14. // History: 03-Dec-96 Ronans Created.
  15. //
  16. //----------------------------------------------------------------------
  17. #ifndef __ENDPOINTDETAILS_H__
  18. #define __ENDPOINTDETAILS_H__
  19. /////////////////////////////////////////////////////////////////////////////
  20. // ProtocolDesc structure
  21. struct ProtocolDesc {
  22. enum endpFormat {
  23. ef_Integer255 = 1,
  24. ef_IpPortNum = 2,
  25. ef_NamedPipe = 4,
  26. ef_Integer = 8,
  27. ef_DecNetObject = 16,
  28. ef_Char22 = 32,
  29. ef_VinesSpPort = 64,
  30. ef_sAppService = 128 };
  31. LPCTSTR pszProtseq;
  32. int nResidDesc;
  33. int nEndpFmt;
  34. int nAddrTip;
  35. int nEndpointTip;
  36. BOOL bAllowDynamic;
  37. BOOL m_bSupportedInCOM;
  38. };
  39. int FindProtocol(LPCTSTR pszProtSeq);
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CEndpointData
  42. class CEndpointData : public CObject
  43. {
  44. DECLARE_DYNAMIC(CEndpointData)
  45. public:
  46. BOOL AllowGlobalProperties();
  47. BOOL GetDescription(CString&);
  48. enum EndpointFlags { edUseStaticEP = 0, edUseInternetEP = 1, edUseIntranetEP = 2, edDisableEP = 3 };
  49. CEndpointData();
  50. CEndpointData(LPCTSTR szProtseq, EndpointFlags nDynamic = edUseStaticEP, LPCTSTR szEndpoint = NULL);
  51. CString m_szProtseq;
  52. EndpointFlags m_nDynamicFlags;
  53. CString m_szEndpoint;
  54. ProtocolDesc *m_pProtocol;
  55. };
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CEndpointDetails dialog
  58. class CEndpointDetails : public CDialog
  59. {
  60. // Construction
  61. public:
  62. void UpdateProtocolUI();
  63. void SetEndpointData(CEndpointData* pData);
  64. CEndpointData* GetEndpointData(CEndpointData *);
  65. CEndpointDetails(CWnd* pParent = NULL); // standard constructor
  66. enum operation { opAddProtocol, opUpdateProtocol };
  67. void SetOperation ( operation opTask );
  68. enum btnOrder { rbiDisable = 0, rbiDefault, rbiStatic, rbiIntranet, rbiInternet };
  69. // Dialog Data
  70. //{{AFX_DATA(CEndpointDetails)
  71. enum { IDD = IDD_RPCEP_DETAILS };
  72. CButton m_rbDisableEP;
  73. CStatic m_stProtseq;
  74. CStatic m_stInstructions;
  75. CEdit m_edtEndpoint;
  76. CButton m_rbStaticEP;
  77. CComboBox m_cbProtseq;
  78. CString m_szEndpoint;
  79. int m_nDynamic;
  80. //}}AFX_DATA
  81. CButton m_rbDynamicInternet;
  82. CButton m_rbDynamicIntranet;
  83. // Overrides
  84. // ClassWizard generated virtual function overrides
  85. //{{AFX_VIRTUAL(CEndpointDetails)
  86. protected:
  87. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  88. //}}AFX_VIRTUAL
  89. // Implementation
  90. protected:
  91. CEndpointData::EndpointFlags m_nDynamicFlags;
  92. int m_nProtocolIndex;
  93. operation m_opTask;
  94. CEndpointData *m_pCurrentEPData;
  95. // Generated message map functions
  96. //{{AFX_MSG(CEndpointDetails)
  97. virtual BOOL OnInitDialog();
  98. afx_msg void OnChooseProtocol();
  99. afx_msg void OnEndpointAssignment();
  100. afx_msg void OnEndpointAssignmentStatic();
  101. afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  102. //}}AFX_MSG
  103. DECLARE_MESSAGE_MAP()
  104. };
  105. #endif
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CAddProtocolDlg dialog
  108. const long MIN_PORT = 0;
  109. const long MAX_PORT = 0xffff;
  110. class CAddProtocolDlg : public CDialog
  111. {
  112. // Construction
  113. public:
  114. CAddProtocolDlg(CWnd* pParent = NULL); // standard constructor
  115. CEndpointData* GetEndpointData(CEndpointData *);
  116. // Dialog Data
  117. //{{AFX_DATA(CAddProtocolDlg)
  118. enum { IDD = IDD_ADDPROTOCOL };
  119. CComboBox m_cbProtseq;
  120. CStatic m_stInstructions;
  121. //}}AFX_DATA
  122. // Overrides
  123. // ClassWizard generated virtual function overrides
  124. //{{AFX_VIRTUAL(CAddProtocolDlg)
  125. protected:
  126. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  127. //}}AFX_VIRTUAL
  128. // Implementation
  129. protected:
  130. // Generated message map functions
  131. //{{AFX_MSG(CAddProtocolDlg)
  132. afx_msg void OnChooseProtocol();
  133. virtual BOOL OnInitDialog();
  134. afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  135. //}}AFX_MSG
  136. DECLARE_MESSAGE_MAP()
  137. private:
  138. int m_nProtocolIndex;
  139. CEndpointData *m_pCurrentEPData;
  140. };
  141. class CPortRange : public CObject
  142. {
  143. friend class CPortRangesDlg;
  144. friend class CAddPortDlg;
  145. public:
  146. CPortRange(long start, long finish);
  147. long Start();
  148. long Finish();
  149. BOOL operator<(CPortRange& rRange);
  150. private:
  151. long m_dwStart;
  152. long m_dwFinish;
  153. };
  154. inline CPortRange::CPortRange(long start, long finish)
  155. {
  156. m_dwStart = start;
  157. m_dwFinish = finish;
  158. }
  159. inline long CPortRange::Start()
  160. {
  161. return m_dwStart;
  162. }
  163. inline long CPortRange::Finish()
  164. {
  165. return m_dwFinish;
  166. }
  167. inline BOOL CPortRange::operator<(CPortRange& rRange)
  168. {
  169. return (m_dwStart < rRange.m_dwStart);
  170. }
  171. /////////////////////////////////////////////////////////////////////////////
  172. // CPortRangesDlg dialog
  173. class CPortRangesDlg : public CDialog
  174. {
  175. // Construction
  176. public:
  177. CPortRangesDlg(CWnd* pParent = NULL); // standard constructor
  178. ~CPortRangesDlg();
  179. void RemoveAllRanges(CObArray& rRanges);
  180. void RefreshRanges(CPortRange *pModifiedRange, BOOL bAdded);
  181. enum cprRangeAssignment { cprInternet = 0, cprIntranet = 1 };
  182. enum cprDefaultRange { cprDefaultInternet = 0, cprDefaultIntranet = 1 };
  183. // Dialog Data
  184. //{{AFX_DATA(CPortRangesDlg)
  185. enum { IDD = IDD_RPC_PORT_RANGES };
  186. CButton m_rbRangeInternet;
  187. CStatic m_stInstructions;
  188. CListBox m_lbRanges;
  189. CButton m_btnRemoveAll;
  190. CButton m_btnRemove;
  191. CButton m_btnAdd;
  192. int m_nrbDefaultAssignment;
  193. int m_nrbRangeAssignment; // 1 = intranet, 0 = internet
  194. //}}AFX_DATA
  195. CButton m_rbRangeIntranet;
  196. // Overrides
  197. // ClassWizard generated virtual function overrides
  198. //{{AFX_VIRTUAL(CPortRangesDlg)
  199. protected:
  200. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  201. //}}AFX_VIRTUAL
  202. // Implementation
  203. protected:
  204. void CondenseRangeSet(CObArray &arrSrc);
  205. void SortRangeSet(CObArray &arrSrc);
  206. void CreateInverseRangeSet(CObArray& arrSrc, CObArray& arrDest);
  207. // Generated message map functions
  208. //{{AFX_MSG(CPortRangesDlg)
  209. virtual BOOL OnInitDialog();
  210. afx_msg void OnAddPortRange();
  211. afx_msg void OnRemovePortRange();
  212. afx_msg void OnRemoveAllRanges();
  213. afx_msg void OnAssignRangeInternet();
  214. afx_msg void OnAssignRangeIntranet();
  215. afx_msg void OnSelChangeRanges();
  216. virtual void OnOK();
  217. afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  218. afx_msg void OnDefaultInternet();
  219. afx_msg void OnDefaultIntranet();
  220. //}}AFX_MSG
  221. DECLARE_MESSAGE_MAP()
  222. private:
  223. CObArray* m_pRanges;
  224. int m_nSelection;
  225. CObArray m_arrInternetRanges;
  226. CObArray m_arrIntranetRanges;
  227. int m_nInetPortsIdx;
  228. int m_nInetPortsAvailableIdx;
  229. int m_nInetDefaultPortsIdx;
  230. BOOL m_bChanged;
  231. };
  232. /////////////////////////////////////////////////////////////////////////////
  233. // CAddPortDlg dialog
  234. class CAddPortDlg : public CDialog
  235. {
  236. // Construction
  237. public:
  238. CPortRange* GetPortRange();
  239. BOOL Validate();
  240. CAddPortDlg(CWnd* pParent = NULL); // standard constructor
  241. // Dialog Data
  242. //{{AFX_DATA(CAddPortDlg)
  243. enum { IDD = IDD_ADD_PORT_RANGE };
  244. CEdit m_edtPortRange;
  245. CButton m_btnOk;
  246. CStatic m_stInstructions;
  247. CString m_sRange;
  248. //}}AFX_DATA
  249. // Overrides
  250. // ClassWizard generated virtual function overrides
  251. //{{AFX_VIRTUAL(CAddPortDlg)
  252. protected:
  253. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  254. //}}AFX_VIRTUAL
  255. // Implementation
  256. protected:
  257. // Generated message map functions
  258. //{{AFX_MSG(CAddPortDlg)
  259. virtual BOOL OnInitDialog();
  260. virtual void OnOK();
  261. afx_msg void OnChangePortrange();
  262. afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  263. //}}AFX_MSG
  264. DECLARE_MESSAGE_MAP()
  265. private:
  266. long m_dwEndPort;
  267. long m_dwStartPort;
  268. };