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.

393 lines
12 KiB

  1. /*
  2. * crostmgr.h
  3. *
  4. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * Instances of this class represent the owner of the Conference Roster
  8. * for a single Conference object at an individual node. This class will
  9. * create either a single CConfRoster object (referred to as a
  10. * "Global" roster) or two CConfRoster objects (refered to as a
  11. * "Local" and "Global" roster) in its constructor and will return a
  12. * resource error if there is not enough memory to instantiate it. The
  13. * CConfRosterMgr is mainly responsible for routing Roster
  14. * Updates to and from the CConfRoster object(s) it manages. This
  15. * includes updates sent to both the Control SAP and Application SAPs as
  16. * well as Updates sent to other nodes via PDUs. This class makes
  17. * decisions on how to route updates based on whether or not it is at a
  18. * Top Provider node. It also must make routing decisions based on whether
  19. * the change affects the Local or Global roster being maintained.
  20. *
  21. * The CConfRosterMgr object at every node except the Top Provider
  22. * will maintain two ConferenceRosters, a local one and a global one. This
  23. * is a very important distinction in that it implies two entirely
  24. * different sets of responsibilities. Conference Roster information is
  25. * distributed over the entire Conference. Nodes that lie lower in the
  26. * connection hierarchy (subordinate nodes) contain less information than
  27. * higher nodes but all play an important role in maintaining the overall
  28. * roster.
  29. *
  30. * The "Local" CConfRoster is mainly used to inform parent nodes of
  31. * changes to the Conference Roster that occur at the local node or below
  32. * it in the connection hierarchy. The Local CConfRoster consist of
  33. * all the Conference Roster Records at its local node and below it. It is
  34. * not used to deliver Conference Roster Update messages to the various
  35. * SAPs. Its only input is from either primitive calls at the local node
  36. * or from Roster Update PDUs received from subordinate nodes. A "Local"
  37. * CConfRoster is only maintained by ConferenceRosterManagers at nodes
  38. * that are not the Top Provider.
  39. *
  40. * A "Global" CConfRoster maintained by a CConfRosterMgr has
  41. * a dual set of responsibilities depending on if it is at a Top Provider
  42. * node. A CConfRoster of this type at a Top Provider is responsible
  43. * for maintaining a record entry for every node in the Conference. It is
  44. * also used to send full conference roster refreshes to all of its
  45. * subordinate nodes when changes to the roster occur. All "Global"
  46. * ConferenceRosters (regardless of location within the connection
  47. * hierarchy) are used to send Roster Update indications to all the
  48. * appropriate SAPs (Control and Application) via an Owner-Callback call to
  49. * the Conference Object that owns it. The owner object is informed of the
  50. * roster update through a CONF_ROSTER_MGR_ROSTER_REPORT message. Included
  51. * in this message is a pointer to a CConfRosterMsg object. The
  52. * CConfRosterMgr creates a CConfRosterMsg from the
  53. * "Global" CConfRoster object that it maintains. This
  54. * CConfRosterMsg object contains all the conference roster data
  55. * serialized into a single memory block which is formatted for delivery to
  56. * the appropriate SAPs. You can think of this as a snapshot in time of
  57. * the CConfRoster being delivered in the roster update message.
  58. *
  59. * A "Global" CConfRoster at a subordinate node is responsible for
  60. * storing full refreshes of the Conference Roster from the Top Provider.
  61. * It is also used to send the Conference Roster Update message to all the
  62. * appropriate SAPs through an Owner-Callback to the Conference object (as
  63. * mentioned above) after processing the full refresh PDU.
  64. *
  65. * All PDUs and messages are delivered when the CConfRosterMgr is
  66. * flushed. This is also true for ApplicationRosterManagers. This is a
  67. * very important concept in that it allows a CConfRosterMgr to
  68. * process a number of request and PDUs before actually being flushed. The
  69. * CConfRoster itself will queue up changes to a PDU that can consist
  70. * of either multiple updates or a single refresh and will not free it
  71. * until after it is flushed. Therefore, when processing a roster update
  72. * PDU that consists of changes to the conference roster as well as
  73. * multiple application rosters, a roster refresh PDU can be held back
  74. * until all the roster managers have had a chance to process their portion
  75. * of the roster update. Once complete, a single PDU can be built by
  76. * flushing the CConfRosterMgr and all the affected
  77. * ApplicationRosterManagers.
  78. *
  79. * Caveats:
  80. * None.
  81. *
  82. * Author:
  83. * blp
  84. */
  85. #ifndef _CONFERENCE_ROSTER_MANAGER_
  86. #define _CONFERENCE_ROSTER_MANAGER_
  87. #include "mcsuser.h"
  88. #include "clists.h"
  89. #include "crost.h"
  90. class CConf;
  91. class CConfRosterMgr : public CRefCount
  92. {
  93. public:
  94. CConfRosterMgr(
  95. PMCSUser user_object,
  96. CConf *pConf,
  97. BOOL top_provider,
  98. PGCCError roster_error);
  99. ~CConfRosterMgr(void);
  100. GCCError AddNodeRecord(PGCCNodeRecord node_record);
  101. GCCError UpdateNodeRecord(PGCCNodeRecord node_record);
  102. GCCError RemoveUserReference(UserID deteched_node_id);
  103. GCCError RosterUpdateIndication(
  104. PGCCPDU roster_update,
  105. UserID sender_id);
  106. GCCError FlushRosterUpdateIndication(PNodeInformation node_information);
  107. GCCError GetFullRosterRefreshPDU(PNodeInformation node_information);
  108. CConfRoster *GetConferenceRosterPointer(void) { return (m_pGlobalConfRoster); }
  109. BOOL Contains(UserID uid) { return m_pGlobalConfRoster->Contains(uid); }
  110. UINT GetNumberOfNodeRecords(void) { return m_pGlobalConfRoster->GetNumberOfNodeRecords(); }
  111. BOOL IsThisNodeParticipant ( GCCNodeID );
  112. private:
  113. BOOL m_fTopProvider;
  114. CConfRoster *m_pGlobalConfRoster;
  115. CConfRoster *m_pLocalConfRoster;
  116. MCSUser *m_pMcsUserObject;
  117. CConf *m_pConf;
  118. };
  119. #endif
  120. /*
  121. * CConfRosterMgr (
  122. * PMCSUser user_object,
  123. * UINT owner_message_base,
  124. * BOOL top_provider,
  125. * PGCCError roster_error)
  126. *
  127. * Public Function Description
  128. * This is the conference roster manager constructor. It is responsible for
  129. * initializing all the instance variables used by this class.
  130. *
  131. * Formal Parameters:
  132. * user_object - (i) Pointer to the user attachment object used
  133. * by this class.
  134. * owner_object - (i) Pointer to the owner object.
  135. * owner_message_base - (i) Message base to add to all the owner
  136. * callbacks.
  137. * top_provider - (i) Indicates if this is the top provider node.
  138. * roster_error - (o) Pointer to error value to be returned.
  139. *
  140. *
  141. * Return Value
  142. * GCC_NO_ERROR - No resource error occured.
  143. * GCC_ALLOCATION_FAILURE - A resource error occured.
  144. *
  145. * Side Effects
  146. * None.
  147. *
  148. * Caveats
  149. * None.
  150. */
  151. /*
  152. * ~CConfRosterMgr ()
  153. *
  154. * Public Function Description
  155. * This is the conference roster destructor. It is responsible for
  156. * freeing up all memory allocated by this class.
  157. *
  158. * Formal Parameters:
  159. * None.
  160. *
  161. * Return Value
  162. * None.
  163. *
  164. * Side Effects
  165. * None.
  166. *
  167. * Caveats
  168. * None.
  169. */
  170. /*
  171. * GCCError AddNodeRecord (PGCCNodeRecord node_record)
  172. *
  173. * Public Function Description
  174. * This routine is used to add a new record to the conference roster.
  175. * This class makes the decision about which roster the new record goes
  176. * into (global or local).
  177. *
  178. * Formal Parameters:
  179. * node_record - (i) Pointer to the record to add to the roster.
  180. *
  181. * Return Value
  182. * GCC_NO_ERROR - No error occured.
  183. * GCC_ALLOCATION_FAILURE - A resource error occured.
  184. * GCC_INVALID_PARAMETER - Invalid parameter passed in.
  185. * GCC_BAD_NETWORK_ADDRESS - Invalid network address passed in.
  186. * GCC_BAD_NETWORK_ADDRESS_TYPE - Bad "choice" field for address
  187. * GCC_BAD_USER_DATA - The user data passed in contained
  188. * an invalid object key.
  189. *
  190. * Side Effects
  191. * None.
  192. *
  193. * Caveats
  194. * None.
  195. */
  196. /*
  197. * GCCError UpdateNodeRecord(
  198. * PGCCNodeRecord node_record)
  199. *
  200. * Public Function Description
  201. * This routine is used to replace a record in the conference roster with
  202. * a new record. This class makes the decision about which roster the new
  203. * record affects (global or local).
  204. *
  205. * Formal Parameters:
  206. * node_record - (i) Pointer to the record to replace with.
  207. *
  208. * Return Value
  209. * GCC_NO_ERROR - No error occured.
  210. * GCC_ALLOCATION_FAILURE - A resource error occured.
  211. * GCC_INVALID_PARAMETER - Invalid parameter passed in.
  212. * GCC_BAD_NETWORK_ADDRESS - Invalid network address passed in.
  213. * GCC_BAD_NETWORK_ADDRESS_TYPE - Bad "choice" field for address
  214. * GCC_BAD_USER_DATA - The user data passed in contained
  215. *
  216. * Side Effects
  217. * None.
  218. *
  219. * Caveats
  220. * None.
  221. */
  222. /*
  223. * GCCError RemoveUserReference (
  224. * UserID deteched_node_id)
  225. *
  226. * Public Function Description
  227. * This routine removes the record associated with the specified node
  228. * id.
  229. *
  230. * Formal Parameters:
  231. * deteched_node_id (i) Node reference to remove.
  232. *
  233. * Return Value:
  234. * GCC_NO_ERROR - No error occured.
  235. * GCC_INVALID_PARAMETER - No records associated with this node
  236. *
  237. * Side Effects:
  238. * None.
  239. *
  240. * Caveats:
  241. * None.
  242. */
  243. /*
  244. * GCCError RosterUpdateIndication(
  245. * PGCCPDU roster_update,
  246. * UserID sender_id)
  247. *
  248. * Public Function Description
  249. * This routine is responsible for processing the decoded PDU data.
  250. * It essentially passes the PDU on along to the appropriate roster.
  251. *
  252. * Formal Parameters:
  253. * roster_update - (i) This is a pointer to a structure that
  254. * holds the decoded PDU data.
  255. *
  256. * Return Value
  257. * GCC_NO_ERROR - No error occured.
  258. * GCC_ALLOCATION_FAILURE - A resource error occured.
  259. *
  260. * Side Effects
  261. * None.
  262. *
  263. * Caveats
  264. * None.
  265. */
  266. /*
  267. * GCCError FlushRosterUpdateIndication(
  268. * PNodeInformation node_information)
  269. *
  270. * Public Function Description
  271. * This routine is used to access any PDU data that might currently be
  272. * queued inside the conference roster. It also is responsible for
  273. * flushing a roster update message if necessary.
  274. *
  275. * Formal Parameters:
  276. * node_information - (o) Pointer to the PDU buffer to fill in.
  277. *
  278. * Return Value
  279. * None.
  280. *
  281. * Side Effects
  282. * None.
  283. *
  284. * Caveats
  285. * None.
  286. */
  287. /*
  288. * GCCError GetFullRosterRefreshPDU(
  289. * PNodeInformation node_information)
  290. *
  291. * Public Function Description
  292. * This routine is used to access a full conference roster refresh.
  293. *
  294. * Formal Parameters:
  295. * node_information - (o) Pointer to the PDU buffer to fill in.
  296. *
  297. * Return Value
  298. * None.
  299. *
  300. * Side Effects
  301. * None.
  302. *
  303. * Caveats
  304. * None.
  305. */
  306. /*
  307. * BOOL Contains(UserID node_record_entry)
  308. *
  309. * Public Function Description
  310. * This routine is used to determine if the specified record exists in
  311. * the conference roster.
  312. *
  313. * Formal Parameters:
  314. * node_record_entry (i) Node ID of record to check for
  315. *
  316. * Return Value:
  317. * TRUE - If the record is contained in the conference roster.
  318. * FALSE - If the record is not contained in the conference roster.
  319. *
  320. * Side Effects:
  321. * None.
  322. *
  323. * Caveats:
  324. * None.
  325. */
  326. /*
  327. * CConfRoster *GetConferenceRosterPointer ()
  328. *
  329. * Public Function Description
  330. * This routine is used to access a pointer to the conference roster
  331. * managed by this conference roster manager. The global roster
  332. * is always returned by this routine.
  333. *
  334. * Formal Parameters:
  335. * None.
  336. *
  337. * Return Value:
  338. * A pointer to the Global conference roster.
  339. *
  340. * Side Effects:
  341. * None.
  342. *
  343. * Caveats:
  344. * None.
  345. */
  346. /*
  347. * USHORT GetNumberOfNodeRecords ();
  348. *
  349. * Public Function Description
  350. * This routine returns the total number of conference roster records
  351. * contained in the global conference roster record list.
  352. *
  353. * Formal Parameters:
  354. * None.
  355. *
  356. * Return Value:
  357. * The number of records in the conference roster list.
  358. *
  359. * Side Effects:
  360. * None.
  361. *
  362. * Caveats:
  363. * None.
  364. */