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.

367 lines
11 KiB

  1. /*++
  2. Module Name:
  3. RepSet.h
  4. Abstract:
  5. --*/
  6. #ifndef __REPSET_H_
  7. #define __REPSET_H_
  8. #include "resource.h" // main symbols
  9. #include "dfsenums.h"
  10. #include "netutils.h"
  11. #include "ldaputils.h"
  12. #include <list>
  13. using namespace std;
  14. class CFrsMember;
  15. class CDfsAlternate
  16. {
  17. public:
  18. CComBSTR m_bstrServer;
  19. CComBSTR m_bstrShare;
  20. CFrsMember* m_pFrsMember;
  21. };
  22. class CFrsMember
  23. {
  24. public:
  25. CComBSTR m_bstrServer;
  26. CComBSTR m_bstrSite;
  27. CComBSTR m_bstrDomain;
  28. CComBSTR m_bstrServerGuid;
  29. CComBSTR m_bstrRootPath;
  30. CComBSTR m_bstrStagingPath;
  31. CComBSTR m_bstrMemberDN;
  32. CComBSTR m_bstrComputerDN;
  33. CComBSTR m_bstrSubscriberDN;
  34. public:
  35. //
  36. // InitEx does query DS to retrieve related info
  37. //
  38. HRESULT InitEx(
  39. PLDAP i_pldap, // points to the i_bstrMemberDN's DS
  40. BSTR i_bstrDC, // domain controller pointed by i_pldap
  41. BSTR i_bstrMemberDN, // FQDN of nTFRSMember object
  42. BSTR i_bstrComputerDN = NULL // FQDN of computer object
  43. );
  44. //
  45. // Init does NOT query DS
  46. //
  47. HRESULT Init(
  48. IN BSTR i_bstrDnsHostName,
  49. IN BSTR i_bstrComputerDomain,
  50. IN BSTR i_bstrComputerGuid,
  51. IN BSTR i_bstrRootPath,
  52. IN BSTR i_bstrStagingPath,
  53. IN BSTR i_bstrMemberDN,
  54. IN BSTR i_bstrComputerDN,
  55. IN BSTR i_bstrSubscriberDN
  56. );
  57. CFrsMember* Copy();
  58. private:
  59. void _ReSet();
  60. HRESULT _GetMemberInfo(
  61. PLDAP i_pldap, // points to the i_bstrMemberDN's DS
  62. BSTR i_bstrDC, // domain controller pointed by i_pldap
  63. BSTR i_bstrMemberDN, // FQDN of nTFRSMember object
  64. BSTR i_bstrComputerDN = NULL // FQDN of computer object
  65. );
  66. HRESULT _GetSubscriberInfo
  67. (
  68. PLDAP i_pldap, // points to the i_bstrComputerDN's DS
  69. BSTR i_bstrComputerDN, // FQDN of the computer object
  70. BSTR i_bstrMemberDN // FQDN of the corresponding nTFRSMember object
  71. );
  72. HRESULT _GetComputerInfo
  73. (
  74. PLDAP i_pldap, // points to the i_bstrComputerDN's DS
  75. BSTR i_bstrComputerDN // FQDN of the computer object
  76. );
  77. };
  78. class CFrsConnection
  79. {
  80. public:
  81. CComBSTR m_bstrConnectionDN;
  82. CComBSTR m_bstrFromMemberDN;
  83. CComBSTR m_bstrToMemberDN;
  84. BOOL m_bEnable;
  85. DWORD m_dwOptions;
  86. //
  87. // Init Does NOT query DS
  88. //
  89. HRESULT Init(
  90. BSTR i_bstrConnectionDN,
  91. BSTR i_bstrFromMemberDN,
  92. BOOL i_bEnable,
  93. DWORD i_dwOptions
  94. );
  95. CFrsConnection* Copy();
  96. protected:
  97. void _ReSet();
  98. };
  99. typedef list<CDfsAlternate *> CDfsAlternateList;
  100. typedef list<CFrsMember *> CFrsMemberList;
  101. typedef list<CFrsConnection *> CFrsConnectionList;
  102. void FreeDfsAlternates(CDfsAlternateList* pList);
  103. void FreeFrsMembers(CFrsMemberList* pList);
  104. void FreeFrsConnections(CFrsConnectionList* pList);
  105. class ATL_NO_VTABLE CReplicaSet :
  106. public CComObjectRootEx<CComSingleThreadModel>,
  107. public CComCoClass<CReplicaSet, &CLSID_ReplicaSet>,
  108. public IDispatchImpl<IReplicaSet, &IID_IReplicaSet, &LIBID_DFSCORELib>
  109. {
  110. public:
  111. CReplicaSet();
  112. ~CReplicaSet();
  113. DECLARE_REGISTRY_RESOURCEID(IDR_REPLICASET)
  114. DECLARE_PROTECT_FINAL_CONSTRUCT()
  115. BEGIN_COM_MAP(CReplicaSet)
  116. COM_INTERFACE_ENTRY(IReplicaSet)
  117. COM_INTERFACE_ENTRY(IDispatch)
  118. END_COM_MAP()
  119. // IReplicaSet
  120. STDMETHOD(get_Type)(
  121. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  122. STDMETHOD(put_Type)(
  123. /* [in] */ BSTR newVal);
  124. STDMETHOD(get_TopologyPref)(
  125. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  126. STDMETHOD(put_TopologyPref)(
  127. /* [in] */ BSTR newVal);
  128. STDMETHOD(get_HubMemberDN)(
  129. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  130. STDMETHOD(put_HubMemberDN)(
  131. /* [in] */ BSTR newVal);
  132. STDMETHOD(get_PrimaryMemberDN)(
  133. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  134. STDMETHOD(put_PrimaryMemberDN)(
  135. /* [in] */ BSTR newVal);
  136. STDMETHOD(get_FileFilter)(
  137. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  138. STDMETHOD(put_FileFilter)(
  139. /* [in] */ BSTR newVal);
  140. STDMETHOD(get_DirFilter)(
  141. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  142. STDMETHOD(put_DirFilter)(
  143. /* [in] */ BSTR newVal);
  144. STDMETHOD(get_DfsEntryPath)(
  145. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  146. STDMETHOD(get_Domain)(
  147. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  148. STDMETHOD(get_ReplicaSetDN)(
  149. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  150. STDMETHOD(get_NumOfMembers)(
  151. /* [retval][out] */ long __RPC_FAR *pVal);
  152. STDMETHOD(get_NumOfConnections)(
  153. /* [retval][out] */ long __RPC_FAR *pVal);
  154. STDMETHOD(get_TargetedDC)(
  155. /* [retval][out] */ BSTR __RPC_FAR *pVal);
  156. STDMETHOD(Create)(
  157. /* [in] */ BSTR i_bstrDomain,
  158. /* [in] */ BSTR i_bstrReplicaSetDN,
  159. /* [in] */ BSTR i_bstrType,
  160. /* [in] */ BSTR i_bstrTopologyPref,
  161. /* [in] */ BSTR i_bstrHubMemberDN,
  162. /* [in] */ BSTR i_bstrPrimaryMemberDN,
  163. /* [in] */ BSTR i_bstrFileFilter,
  164. /* [in] */ BSTR i_bstrDirFilter
  165. );
  166. STDMETHOD(Initialize)(
  167. /* [in] */ BSTR i_bstrDomain,
  168. /* [in] */ BSTR i_bstrReplicaSetDN);
  169. STDMETHOD(GetMemberList)(
  170. /* [retval][out] */ VARIANT __RPC_FAR *o_pvarMemberDNs);
  171. STDMETHOD(GetMemberListEx)(
  172. /* [retval][out] */ VARIANT __RPC_FAR *o_pVal);
  173. STDMETHOD(GetMemberInfo)(
  174. /* [in] */ BSTR i_bstrMemberDN,
  175. /* [retval][out] */ VARIANT __RPC_FAR *o_pvarMember);
  176. STDMETHOD(IsFRSMember)(
  177. /* [in] */ BSTR i_bstrDnsHostName,
  178. /* [in] */ BSTR i_bstrRootPath);
  179. STDMETHOD(IsHubMember)(
  180. /* [in] */ BSTR i_bstrDnsHostName,
  181. /* [in] */ BSTR i_bstrRootPath);
  182. STDMETHOD(AddMember)(
  183. /* [in] */ BSTR i_bstrServer,
  184. /* [in] */ BSTR i_bstrRootPath,
  185. /* [in] */ BSTR i_bstrStagingPath,
  186. /* [in] */ BOOL i_bAddConnectionNow,
  187. /* [retval][out] */ BSTR __RPC_FAR *o_pbstrMemberDN);
  188. STDMETHOD(RemoveMember)(
  189. /* [in] */ BSTR i_bstrMemberDN);
  190. STDMETHOD(RemoveMemberEx)(
  191. /* [in] */ BSTR i_bstrDnsHostName,
  192. /* [in] */ BSTR i_bstrRootPath);
  193. STDMETHOD(RemoveAllMembers)();
  194. STDMETHOD(GetConnectionList)(
  195. /* [retval][out] */ VARIANT __RPC_FAR *o_pvarConnectionDNs);
  196. STDMETHOD(GetConnectionListEx)(
  197. /* [retval][out] */ VARIANT __RPC_FAR *o_pVal);
  198. STDMETHOD(GetConnectionInfo)(
  199. /* [in] */ BSTR i_bstrConnectionDN,
  200. /* [retval][out] */ VARIANT __RPC_FAR *o_pvarConnection);
  201. STDMETHOD(AddConnection)(
  202. /* [in] */ BSTR i_bstrFromMemberDN,
  203. /* [in] */ BSTR i_bstrToMemberDN,
  204. /* [in] */ BOOL i_bEnable,
  205. /* [in] */ BOOL i_bSyncImmediately,
  206. /* [in] */ long i_nPriority,
  207. /* [retval][out] */ BSTR __RPC_FAR *o_pbstrConnectionDN);
  208. STDMETHOD(RemoveConnection)(
  209. /* [in] */ BSTR i_bstrConnectionDN);
  210. STDMETHOD(RemoveConnectionEx)(
  211. /* [in] */ BSTR i_bstrFromMemberDN,
  212. /* [in] */ BSTR i_bstrToMemberDN);
  213. STDMETHOD(RemoveAllConnections)();
  214. STDMETHOD(EnableConnection)(
  215. /* [in] */ BSTR i_bstrConnectionDN,
  216. /* [in] */ BOOL i_bEnable);
  217. STDMETHOD(EnableConnectionEx)(
  218. /* [in] */ BSTR i_bstrFromMemberDN,
  219. /* [in] */ BSTR i_bstrToMemberDN,
  220. /* [in] */ BOOL i_bEnable);
  221. STDMETHOD(GetConnectionSchedule)(
  222. /* [in] */ BSTR i_bstrConnectionDN,
  223. /* [retval][out] */ VARIANT* o_pVar);
  224. STDMETHOD(GetConnectionScheduleEx)(
  225. /* [in] */ BSTR i_bstrFromMemberDN,
  226. /* [in] */ BSTR i_bstrToMemberDN,
  227. /* [retval][out] */ VARIANT* o_pVar);
  228. STDMETHOD(SetConnectionSchedule)(
  229. /* [in] */ BSTR i_bstrConnectionDN,
  230. /* [in] */ VARIANT* i_pVar);
  231. STDMETHOD(SetConnectionScheduleEx)(
  232. /* [in] */ BSTR i_bstrFromMemberDN,
  233. /* [in] */ BSTR i_bstrToMemberDN,
  234. /* [in] */ VARIANT* i_pVar);
  235. STDMETHOD(SetScheduleOnAllConnections)(
  236. /* [in] */ VARIANT* i_pVar);
  237. STDMETHOD(SetConnectionOptions)(
  238. /* [in] */ BSTR i_bstrConnectionDN,
  239. /* [in] */ BOOL i_bSyncImmediately,
  240. /* [in] */ long i_nPriority);
  241. STDMETHOD(SetConnectionOptionsEx)(
  242. /* [in] */ BSTR i_bstrFromMemberDN,
  243. /* [in] */ BSTR i_bstrToMemberDN,
  244. /* [in] */ BOOL i_bSyncImmediately,
  245. /* [in] */ long i_nPriority);
  246. STDMETHOD(CreateConnections)();
  247. STDMETHOD(Delete)();
  248. STDMETHOD(GetBadMemberInfo)(
  249. /* [in] */ BSTR i_bstrServerName,
  250. /* [retval][out] */ VARIANT __RPC_FAR *o_pvarMember);
  251. protected:
  252. void _FreeMemberVariables();
  253. HRESULT _PopulateMemberList();
  254. HRESULT _PopulateConnectionList();
  255. HRESULT _DeleteMember(CFrsMember* pFrsMember);
  256. HRESULT _DeleteConnection(CFrsConnection* pFrsConnection);
  257. HRESULT _GetMemberInfo(CFrsMember* i_pFrsMember, VARIANT* o_pvarMember);
  258. HRESULT _GetConnectionInfo(CFrsConnection* i_pFrsConnection, VARIANT* o_pvarConnection);
  259. HRESULT _SetCustomTopologyPref();
  260. HRESULT _AdjustConnectionsAdd(BSTR i_bstrNewMemberDN, BSTR i_bstrSite);
  261. HRESULT _RemoveConnectionsFromAndTo(CFrsMember* pFrsMember);
  262. HRESULT _GetConnectionSchedule(BSTR i_bstrConnectionDN, VARIANT* o_pVar);
  263. protected:
  264. CComBSTR m_bstrType;
  265. CComBSTR m_bstrTopologyPref;
  266. CComBSTR m_bstrHubMemberDN;
  267. CComBSTR m_bstrPrimaryMemberDN;
  268. CComBSTR m_bstrFileFilter;
  269. CComBSTR m_bstrDirFilter;
  270. CComBSTR m_bstrDfsEntryPath;
  271. CComBSTR m_bstrReplicaSetDN;
  272. CDfsAlternateList m_dfsAlternateList;
  273. CFrsMemberList m_frsMemberList;
  274. CFrsConnectionList m_frsConnectionList;
  275. PLDAP m_pldap;
  276. CComBSTR m_bstrDomain;
  277. CComBSTR m_bstrDomainGuid;
  278. CComBSTR m_bstrDC;
  279. BOOL m_bNewSchema;
  280. };
  281. #endif //__REPSET_H_