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.

216 lines
7.1 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // Network.h
  7. //
  8. // Abstract:
  9. // Definition of the CNetwork class.
  10. //
  11. // Implementation File:
  12. // Network.cpp
  13. //
  14. // Author:
  15. // David Potter (davidp) May 28, 1997
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef _NETWORK_H_
  23. #define _NETWORK_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Forward Class Declarations
  26. /////////////////////////////////////////////////////////////////////////////
  27. class CNetwork;
  28. class CNetworkList;
  29. /////////////////////////////////////////////////////////////////////////////
  30. // External Class Declarations
  31. /////////////////////////////////////////////////////////////////////////////
  32. class CNetInterface;
  33. class CNetInterfaceList;
  34. /////////////////////////////////////////////////////////////////////////////
  35. // Type Definitions
  36. /////////////////////////////////////////////////////////////////////////////
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Include Files
  39. /////////////////////////////////////////////////////////////////////////////
  40. #ifndef _CLUSITEM_H_
  41. #include "ClusItem.h" // for CClusterItem
  42. #endif
  43. #ifndef _PROPLIST_H_
  44. #include "PropList.h" // for CObjectProperty, CClusPropList
  45. #endif
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CNetwork command target
  48. /////////////////////////////////////////////////////////////////////////////
  49. class CNetwork : public CClusterItem
  50. {
  51. DECLARE_DYNCREATE(CNetwork)
  52. // Construction
  53. public:
  54. CNetwork(void); // protected constructor used by dynamic creation
  55. void Init(IN OUT CClusterDoc * pdoc, IN LPCTSTR lpszName);
  56. protected:
  57. void CommonConstruct(void);
  58. // Attributes
  59. protected:
  60. HNETWORK m_hnetwork;
  61. CLUSTER_NETWORK_STATE m_cns;
  62. CLUSTER_NETWORK_ROLE m_cnr;
  63. CString m_strAddress;
  64. CString m_strAddressMask;
  65. DWORD m_dwCharacteristics;
  66. DWORD m_dwFlags;
  67. CNetInterfaceList * m_plpciNetInterfaces;
  68. enum
  69. {
  70. epropName = 0,
  71. epropRole,
  72. epropAddress,
  73. epropAddressMask,
  74. epropDescription,
  75. epropMAX
  76. };
  77. CObjectProperty m_rgProps[epropMAX];
  78. public:
  79. HNETWORK Hnetwork(void) const { return m_hnetwork; }
  80. CLUSTER_NETWORK_STATE Cns(void) const { return m_cns; }
  81. CLUSTER_NETWORK_ROLE Cnr(void) const { return m_cnr; }
  82. const CString & StrAddress(void) const { return m_strAddress; }
  83. const CString & StrAddressMask(void) const { return m_strAddressMask; }
  84. DWORD DwCharacteristics(void) const { return m_dwCharacteristics; }
  85. DWORD DwFlags(void) const { return m_dwFlags; }
  86. const CNetInterfaceList & LpciNetInterfaces(void) const { ASSERT(m_plpciNetInterfaces != NULL); return *m_plpciNetInterfaces; }
  87. void GetStateName(OUT CString & rstrState) const;
  88. void GetRoleName(OUT CString & rstrRole) const;
  89. // Operations
  90. public:
  91. void CollectInterfaces(IN OUT CNetInterfaceList * plpci) const;
  92. void ReadExtensions(void);
  93. void AddNetInterface(IN OUT CNetInterface * pciNetIFace);
  94. void RemoveNetInterface(IN OUT CNetInterface * pciNetIFace);
  95. void SetName(IN LPCTSTR pszName);
  96. void SetCommonProperties(
  97. IN const CString & rstrDesc,
  98. IN CLUSTER_NETWORK_ROLE cnr,
  99. IN BOOL bValidateOnly
  100. );
  101. void SetCommonProperties(
  102. IN const CString & rstrDesc,
  103. IN CLUSTER_NETWORK_ROLE cnr
  104. )
  105. {
  106. SetCommonProperties(rstrDesc, cnr, FALSE /*bValidateOnly*/);
  107. }
  108. void ValidateCommonProperties(
  109. IN const CString & rstrDesc,
  110. IN CLUSTER_NETWORK_ROLE cnr
  111. )
  112. {
  113. SetCommonProperties(rstrDesc, cnr, TRUE /*bValidateOnly*/);
  114. }
  115. // Overrides
  116. public:
  117. virtual void Cleanup(void);
  118. virtual void ReadItem(void);
  119. virtual void UpdateState(void);
  120. virtual void Rename(IN LPCTSTR pszName);
  121. virtual BOOL BGetColumnData(IN COLID colid, OUT CString & rstrText);
  122. virtual BOOL BCanBeEdited(void) const;
  123. virtual void OnBeginLabelEdit(IN OUT CEdit * pedit);
  124. virtual BOOL BDisplayProperties(IN BOOL bReadOnly = FALSE);
  125. virtual const CStringList * PlstrExtensions(void) const;
  126. #ifdef _DISPLAY_STATE_TEXT_IN_TREE
  127. virtual void GetTreeName(OUT CString & rstrName) const;
  128. #endif
  129. // ClassWizard generated virtual function overrides
  130. //{{AFX_VIRTUAL(CNetwork)
  131. //}}AFX_VIRTUAL
  132. virtual LRESULT OnClusterNotify(IN OUT CClusterNotify * pnotify);
  133. protected:
  134. virtual const CObjectProperty * Pprops(void) const { return m_rgProps; }
  135. virtual DWORD Cprops(void) const { return sizeof(m_rgProps) / sizeof(m_rgProps[0]); }
  136. virtual DWORD DwSetCommonProperties(IN const CClusPropList & rcpl, IN BOOL bValidateOnly = FALSE);
  137. // Implementation
  138. public:
  139. virtual ~CNetwork(void);
  140. public:
  141. // Generated message map functions
  142. //{{AFX_MSG(CNetwork)
  143. afx_msg void OnUpdateProperties(CCmdUI* pCmdUI);
  144. //}}AFX_MSG
  145. DECLARE_MESSAGE_MAP()
  146. }; //*** class CNetwork
  147. /////////////////////////////////////////////////////////////////////////////
  148. // CNetworkList
  149. /////////////////////////////////////////////////////////////////////////////
  150. class CNetworkList : public CClusterItemList
  151. {
  152. public:
  153. CNetwork * PciNetworkFromName(
  154. IN LPCTSTR pszName,
  155. OUT POSITION * ppos = NULL
  156. )
  157. {
  158. return (CNetwork *) PciFromName(pszName, ppos);
  159. }
  160. }; //*** class CNetworkList
  161. /////////////////////////////////////////////////////////////////////////////
  162. // Global Functions
  163. /////////////////////////////////////////////////////////////////////////////
  164. //void DeleteAllItemData(IN OUT CNetworkList & rlp);
  165. #ifdef _DEBUG
  166. class CTraceTag;
  167. extern CTraceTag g_tagNetwork;
  168. extern CTraceTag g_tagNetNotify;
  169. #endif
  170. /////////////////////////////////////////////////////////////////////////////
  171. #endif // _NETWORK_H_