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.

649 lines
21 KiB

  1. /*
  2. * arostmgr.h
  3. *
  4. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * A single instance of this class represents the owner of all the
  8. * Application Roster objects for a single "Application Protocol Key". The
  9. * CAppRosterMgr takes care of both the "Local" and "Global"
  10. * rosters for all the Sessions that exists which use the same Application
  11. * Protocol Key (peer applications). Organizing ApplicationRosters this
  12. * way enables GCC to meet some of the requirements specified by the T.GAT
  13. * recommendation. Specifically, it enables GCC to deliver multiple
  14. * application rosters that a particular application might be interested in
  15. * a single application roster update indication. It also hides much of
  16. * the complexity required to manage application rosters from the
  17. * CConf object.
  18. *
  19. * To understand the responsibilities of the CAppRosterMgr it is
  20. * important to understand the meaning of a "Session" within the context
  21. * of GCC. A "Session" is a logical entity that is used by a set of peer
  22. * Application Protocol Entities (APEs see T.GAT) to communicate. When an
  23. * application enrolls with GCC it must specify the session it wishes to
  24. * enroll with by specifying a GCCSessionKey. This session key includes an
  25. * Application Protocol Key and a session ID. The enrolling application
  26. * must include an Application Protocol Key that is unique for that
  27. * particular APE (Application Protocol Entity see T.GAT). When other APEs
  28. * in the conference enroll with the same GCCSessionKey, they all show up
  29. * in the same Application Roster. This makes it possible for all the APEs
  30. * enrolled in the same session to determine who it is talking to who.
  31. *
  32. * Note that it is possible for the same APE to be enrolled in multiple
  33. * sessions at the same time. Typically the session that does not include
  34. * a session ID is considered the "Default" session for a particular APE.
  35. * The industry seems to be leaning toward using this default session to do
  36. * administrative task like announcing your capabilities to other APEs or
  37. * as a place to enroll inactively until you have time to join the channels
  38. * associated with the real session you want to enroll with.
  39. *
  40. * An obvious requirement of the CAppRosterMgr is that it must
  41. * have the ability to deliver all the related rosters (the rosters
  42. * associated with all the sessions in existence for a particular APE) to
  43. * the enrolled User Application SAPs and to the Control SAP. It must also
  44. * be able to manage the flow of PDU traffic to and from the application
  45. * rosters it manages. Below is a more detailed description of the
  46. * responsibilities of the CAppRosterMgr.
  47. *
  48. * The rules for when an CAppRosterMgr exist in a CConf object are
  49. * quite a bit more complex than with the CConfRosterMgr. In the
  50. * later case, every node is explicitly required to maintain either a
  51. * single "Global" CConfRoster Manager (if it is a Top Provider node)
  52. * or both a "Local" and "Global" CConfRoster Manager (if it is a
  53. * subordinate node). The existence of an CAppRosterMgr depends
  54. * entirely on an application being enrolled with the conference. If no
  55. * applications are enrolled there are no ApplicationRosterManagers. It
  56. * gets much more complicated if some nodes are servicing enrolled
  57. * applications while others are not. This is often the case when a
  58. * dedicated MCU is in use. Since an Application Roster's information base
  59. * is distributed throughout the CConf, this sometimes requires that
  60. * CAppRosterMgr objects exist at nodes that contain no enrolled
  61. * applications.
  62. *
  63. * An CAppRosterMgr maintains both "Global" and "Local" rosters.
  64. * A "Local" CAppRoster consist of all the Application Roster
  65. * Records at its local node and below it in the connection hierarchy.
  66. * The CAppRosterMgr does not communicate any changes made to
  67. * "Local" ApplicationRosters to the CAppSap objects. Its only input is
  68. * from either primitive calls at the local node or from Roster Update PDUs
  69. * received from subordinate nodes. A "Local" CAppRoster can only
  70. * exist at nodes that are not the Top Provider.
  71. *
  72. * A "Global" CAppRoster has a dual set of responsibilities
  73. * depending on whether or not it is at a Top Provider. A "Global" roster
  74. * at a Top Provider is responsible for maintaining an Application Roster
  75. * that includes a record entry for every application in the CConf
  76. * that is enrolled with the same Application Protocol Key. It is also
  77. * responsible for sending full application roster refreshes to all of its
  78. * subordinate nodes when changes to the roster occur. All
  79. * ApplicationRosterManagers managing "Global" rosters (regardless of
  80. * location within the connection hierarchy) have the ability to send
  81. * Roster Update indications to their local enrolled CAppSap objects.
  82. * Pointers to CAppSap objects that have enrolled with the conference are
  83. * maintained in a list of enrolled ApplicationSaps. These pointers are
  84. * passed in to this object whenever a new APE enrolls with an Application
  85. * Roster through a GCC primitive at the local node. Application Rosters
  86. * are propagated up to the enrolled applications through Command Target
  87. * calls to the ApplicationSap object. The CAppRosterMgr also
  88. * maintains a pointer to the CControlSAP object. Remember all roster
  89. * updates are directed to both the appropriate application SAPs and to the
  90. * Control SAP.
  91. *
  92. * ApplicationRosterManagers are also responsible for receiving full
  93. * refreshes of the Application Roster from the Top Provider and passing
  94. * them on to the appropriate "Global" CAppRoster object it
  95. * maintains. It also sends (as mentioned above) Roster Update indications
  96. * to the enrolled Application SAP objects and the Control SAP via
  97. * CAppRosterMsg objects.
  98. *
  99. * All PDUs and messages are delivered when the CAppRosterMgr is
  100. * flushed. This is a very important concept in that it allows an
  101. * CAppRosterMgr to process a number of request and PDUs before
  102. * actually being flushed. The CAppRoster itself will queue up
  103. * changes to a PDU that can consist of either multiple updates or a single
  104. * refresh and will not free it until after it is flushed. Therefore, when
  105. * processing a roster update PDU that consists of changes to the
  106. * conference roster as well as multiple application rosters, a roster
  107. * refresh PDU can be held back until all the roster managers have had a
  108. * chance to process their portion of the roster update. Once complete, a
  109. * single PDU can be built by flushing the CConfRosterMgr and all
  110. * the affected ApplicationRosterManagers.
  111. *
  112. * Caveats:
  113. * None.
  114. *
  115. * Author:
  116. * blp
  117. */
  118. #ifndef _APPLICATION_ROSTER_MANAGER_
  119. #define _APPLICATION_ROSTER_MANAGER_
  120. #include "gccpdu.h"
  121. #include "mcsuser.h"
  122. // #include "gcmdtar.h"
  123. #include "arost.h"
  124. #include "sesskey.h"
  125. #include "clists.h"
  126. class CAppRosterMgr : public CRefCount
  127. {
  128. public:
  129. CAppRosterMgr(PGCCSessionKey,
  130. PSessionKey, // PDU
  131. GCCConfID,
  132. PMCSUser,
  133. CConf *,
  134. PGCCError);
  135. ~CAppRosterMgr(void);
  136. GCCError EnrollRequest(GCCEnrollRequest *, GCCEntityID, GCCNodeID, CAppSap *);
  137. GCCError UnEnrollRequest(PGCCSessionKey, GCCEntityID);
  138. GCCError ProcessRosterUpdateIndicationPDU(PSetOfApplicationInformation, UserID uidSender);
  139. PSetOfApplicationInformation FlushRosterUpdateIndication(PSetOfApplicationInformation *, PGCCError);
  140. PSetOfApplicationInformation GetFullRosterRefreshPDU(PSetOfApplicationInformation *, PGCCError);
  141. BOOL IsThisYourSessionKey(PGCCSessionKey pSessKey) { return IsThisSessionKeyValid(pSessKey); }
  142. BOOL IsThisYourSessionKeyPDU(PSessionKey pSessKey) { return IsThisSessionKeyPDUValid(pSessKey); }
  143. GCCError RemoveEntityReference(GCCEntityID);
  144. GCCError RemoveUserReference(UserID uidDetached);
  145. GCCError ApplicationRosterInquire(PGCCSessionKey, CAppRosterMsg *);
  146. BOOL IsEntityEnrolled(GCCEntityID);
  147. BOOL IsAPEEnrolled(GCCNodeID, GCCEntityID);
  148. BOOL IsAPEEnrolled(CSessKeyContainer *, GCCNodeID, GCCEntityID);
  149. BOOL IsEmpty(void);
  150. void DeleteRosterRecord(GCCNodeID, GCCEntityID);
  151. private:
  152. GCCError SendRosterReportMessage(void);
  153. CAppRoster *GetApplicationRoster(PGCCSessionKey, CAppRosterList *);
  154. CAppRoster *GetApplicationRosterFromPDU(PSessionKey, CAppRosterList *);
  155. BOOL IsThisSessionKeyValid(PGCCSessionKey pSessKey)
  156. { return m_pSessionKey->IsThisYourApplicationKey(&pSessKey->application_protocol_key); }
  157. BOOL IsThisSessionKeyPDUValid(PSessionKey pSessKey)
  158. { return m_pSessionKey->IsThisYourApplicationKeyPDU(&pSessKey->application_protocol_key); }
  159. void CleanupApplicationRosterLists(void);
  160. private:
  161. GCCConfID m_nConfID;
  162. BOOL m_fTopProvider;
  163. PMCSUser m_pMcsUserObject;
  164. CAppSapEidList2 m_AppSapEidList2;
  165. CConf *m_pConf;
  166. CAppRosterList m_GlobalRosterList;
  167. CAppRosterList m_LocalRosterList;
  168. CAppRosterList m_RosterDeleteList;
  169. CSessKeyContainer *m_pSessionKey;
  170. };
  171. #endif // _APPLICATION_ROSTER_MANAGER_
  172. /*
  173. * CAppRosterMgr (
  174. * PGCCSessionKey session_key,
  175. * GCCConfID conference_id,
  176. * PMCSUser user_object,
  177. * UINT owner_message_base,
  178. * CControlSAP *pControlSap,
  179. * PGCCError return_value)
  180. *
  181. * Public Function Description
  182. * This is the application roster manager constructor. It is responsible
  183. * for initializing all the instance variables used by this class.
  184. * This constructor is used when the initial roster data that is
  185. * availble comes from local API data.
  186. *
  187. * Formal Parameters:
  188. * session_key - (i) "API" Session Key used to establish the
  189. * application protocol key for this session.
  190. * conference_id - (i) Conference ID associated with this roster
  191. * maanger.
  192. * user_object - (i) Pointer to the user attachment object used
  193. * by this class.
  194. * owner_object - (i) Pointer to the owner object.
  195. * owner_message_base - (i) Message base to add to all the owner
  196. * callbacks.
  197. * control_sap - (i) Pointer to the node controller SAP object.
  198. * return_value - (o) Pointer to error value to be returned.
  199. *
  200. *
  201. * Return Value
  202. * GCC_NO_ERROR - No resource error occured.
  203. * GCC_ALLOCATION_FAILURE - A resource error occured.
  204. *
  205. * Side Effects
  206. * None.
  207. *
  208. * Caveats
  209. * None.
  210. */
  211. /*
  212. * CAppRosterMgr (
  213. * PSessionKey session_key,
  214. * GCCConfID conference_id,
  215. * PMCSUser user_object,
  216. * UINT owner_message_base,
  217. * CControlSAP *pControlSap,
  218. * PGCCError return_value)
  219. *
  220. * Public Function Description
  221. * This is the application roster manager constructor. It is responsible
  222. * for initializing all the instance variables used by this class.
  223. * This constructor is used when the initial roster data that is
  224. * availble comes from remote PDU data.
  225. *
  226. * This constructor handles a number of different possiblities:
  227. * For Non Top Providers:
  228. * 1) A refresh received from the top provider.
  229. * 2) An update from a node below this one.
  230. *
  231. * For the Top Provider:
  232. * 1) An Update from a lower node
  233. *
  234. * Formal Parameters:
  235. * session_key - (i) "PDU" Session Key used to establish the
  236. * application protocol key for this session.
  237. * conference_id - (i) Conference ID associated with this roster
  238. * maanger.
  239. * user_object - (i) Pointer to the user attachment object used
  240. * by this class.
  241. * owner_object - (i) Pointer to the owner object.
  242. * owner_message_base - (i) Message base to add to all the owner
  243. * callbacks.
  244. * control_sap - (i) Pointer to the node controller SAP object.
  245. * return_value - (o) Pointer to error value to be returned.
  246. *
  247. *
  248. * Return Value
  249. * GCC_NO_ERROR - No resource error occured.
  250. * GCC_ALLOCATION_FAILURE - A resource error occured.
  251. *
  252. * Side Effects
  253. * None.
  254. *
  255. * Caveats
  256. * None.
  257. */
  258. /*
  259. * ~ApplicationRosterManager ()
  260. *
  261. * Public Function Description
  262. * This is the application roster manager destructor. It is used to
  263. * free up all memory associated with this class.
  264. *
  265. * Formal Parameters:
  266. * None.
  267. *
  268. * Return Value
  269. * None.
  270. *
  271. * Side Effects
  272. * None.
  273. *
  274. * Caveats
  275. * None.
  276. */
  277. /*
  278. * GCCError EnrollRequest (
  279. * PGCCSessionKey session_key,
  280. * PGCCApplicationRecord application_record,
  281. * EntityID entity_id,
  282. * UINT number_of_capabilities,
  283. * PGCCApplicationCapability * capabilities_list)
  284. *
  285. * Public Function Description
  286. * This routine is called whenever an APE wishes to enroll with the
  287. * conference in a specific session. This routine can be used to
  288. * either add a new record or replace a currently existing record.
  289. *
  290. * Formal Parameters:
  291. * session_key - (i) Session to enroll with.
  292. * application_record - (i) Application record to enroll with.
  293. * entity_id - (i) Entity ID of enrolling APE.
  294. * number_of_capabilities - (i) Number of capabilities in caps list.
  295. * capabilities_list - (i) list of capabilities that the APE is
  296. * enrolling with.
  297. * command_target - (i) Pointer to APE SAP that is enrolling.
  298. *
  299. * Return Value
  300. * GCC_NO_ERROR - No error occured.
  301. * GCC_BAD_SESSION_KEY - Session key passed in is invalid.
  302. * GCC_ALLOCATION_FAILURE - A resource error occured.
  303. * GCC_INVALID_NON_COLLAPSED_CAP - Bad non-collapsed capabilities.
  304. * GCC_INVALID_PARAMETER - Invalid parameter passed in.
  305. *
  306. * Side Effects
  307. * None.
  308. *
  309. * Caveats
  310. * None.
  311. */
  312. /*
  313. * GCCError UnEnrollRequest (
  314. * PGCCSessionKey session_key,
  315. * EntityID entity_id)
  316. *
  317. * Public Function Description
  318. * This routine is called whenever an APE wishes to unenroll from the
  319. * conference (or a specific session).
  320. *
  321. * Formal Parameters:
  322. * session_key - (i) Session to unenroll from.
  323. * entity_id - (i) Entity ID of unenrolling APE.
  324. *
  325. * Return Value
  326. * GCC_NO_ERROR - No error occured.
  327. * GCC_BAD_SESSION_KEY - Session key passed in is invalid.
  328. * GCC_APP_NOT_ENROLLED - APE is not enrolled with this
  329. * session..
  330. * GCC_INVALID_PARAMETER - Invalid parameter passed in.
  331. *
  332. * Side Effects
  333. * None.
  334. *
  335. * Caveats
  336. * None.
  337. */
  338. /*
  339. * GCCError ProcessRosterUpdateIndicationPDU(
  340. * PSetOfApplicationInformation set_of_application_info,
  341. * UserID sender_id)
  342. *
  343. * Public Function Description
  344. * This routine processes an incomming roster update PDU. It is
  345. * responsible for passing the PDU on to the right application roster.
  346. *
  347. * Formal Parameters:
  348. * set_of_application_info - (i) PDU data to process
  349. * sender_id - (i) Node ID that sent the update.
  350. *
  351. * Return Value
  352. * GCC_NO_ERROR - No error occured.
  353. * GCC_BAD_SESSION_KEY - Session key passed in is invalid.
  354. * GCC_ALLOCATION_FAILURE - A resource error occured.
  355. * GCC_INVALID_PARAMETER - Invalid parameter passed in.
  356. *
  357. * Side Effects
  358. * None.
  359. *
  360. * Caveats
  361. * None.
  362. */
  363. /*
  364. * PSetOfApplicationInformation FlushRosterUpdateIndication (
  365. * PSetOfApplicationInformation * set_of_information,
  366. * PGCCError return_value)
  367. *
  368. * Public Function Description
  369. * This routine is used to access any PDU data that might currently be
  370. * queued inside the application rosters managed by this application
  371. * roster manager. It also is responsible for flushing any queued
  372. * roster update messages if necessary.
  373. *
  374. * Formal Parameters:
  375. * set_of_information - (o) Pointer PDU to fill in.
  376. * return_value - (o) Error return here.
  377. *
  378. * Return Value
  379. * Pointer to the new set of application information.
  380. *
  381. * Side Effects
  382. * None.
  383. *
  384. * Caveats
  385. * None.
  386. */
  387. /*
  388. * PSetOfApplicationInformation GetFullRosterRefreshPDU (
  389. * PSetOfApplicationInformation * set_of_information,
  390. * PGCCError return_value)
  391. *
  392. * Public Function Description
  393. * This routine is used to obtain a complete roster refresh of all the
  394. * rosters maintained by this roster manger.
  395. *
  396. * Formal Parameters:
  397. * set_of_information - (o) Pointer PDU to fill in.
  398. * return_value - (o) Error return here.
  399. *
  400. * Return Value
  401. * Pointer to the new set of application information.
  402. *
  403. * Side Effects
  404. * None.
  405. *
  406. * Caveats
  407. * None.
  408. */
  409. /*
  410. * BOOL IsThisYourSessionKey(
  411. * PGCCSessionKey session_key)
  412. *
  413. * Public Function Description
  414. * This routine is used to determine if the specified "API" session key is
  415. * associated with this application roster manager.
  416. *
  417. * Formal Parameters:
  418. * session_key - (i) "API" session key to test.
  419. *
  420. * Return Value
  421. * TRUE - If session key is associated with this manager.
  422. * FALSE - If session key is NOT associated with this manager.
  423. *
  424. * Side Effects
  425. * None.
  426. *
  427. * Caveats
  428. * None.
  429. */
  430. /*
  431. * BOOL IsThisYourSessionKeyPDU(
  432. * PSessionKey session_key);
  433. *
  434. * Public Function Description
  435. * This routine is used to determine if the specified "PDU" session key is
  436. * associated with this application roster manager.
  437. *
  438. * Formal Parameters:
  439. * session_key - (i) "PDU" session key to test.
  440. *
  441. * Return Value
  442. * TRUE - If session key is associated with this manager.
  443. * FALSE - If session key is NOT associated with this manager.
  444. *
  445. * Side Effects
  446. * None.
  447. *
  448. * Caveats
  449. * None.
  450. */
  451. /*
  452. * GCCError RemoveEntityReference(
  453. * EntityID application_entity)
  454. *
  455. * Public Function Description
  456. * This routine is used to remove the specified APE entity from the
  457. * session it is enrolled with. Note that this routine is only used
  458. * to remove local entity references.
  459. *
  460. * Formal Parameters:
  461. * application_entity - (i) Entity reference to remove.
  462. *
  463. * Return Value
  464. * GCC_NO_ERROR - Entity was removed.
  465. * GCC_INVALID_PARAMETER - Entity does not exist here.
  466. *
  467. * Side Effects
  468. * None.
  469. *
  470. * Caveats
  471. * None.
  472. */
  473. /*
  474. * GCCError RemoveUserReference(
  475. * UserID detached_user)
  476. *
  477. * Public Function Description
  478. * This routine is used to remove all references associated with the
  479. * node defined by the detached user.
  480. *
  481. * Formal Parameters:
  482. * detached_user - (i) User reference to remove.
  483. *
  484. * Return Value
  485. * GCC_NO_ERROR - User reference was removed.
  486. * GCC_INVALID_PARAMETER - No records associated with this node.
  487. *
  488. * Side Effects
  489. * None.
  490. *
  491. * Caveats
  492. * None.
  493. */
  494. /*
  495. * BOOL IsEntityEnrolled(
  496. * EntityID entity_id)
  497. *
  498. * Public Function Description
  499. * This routine informs the caller if the specified entity is enrolled
  500. * with any sessions managed by this application roster manager.
  501. *
  502. * Formal Parameters:
  503. * entity_id - (i) Entity to test.
  504. *
  505. * Return Value
  506. * TRUE - Entity is enrolled.
  507. * FALSE - Entity is not enrolled.
  508. *
  509. * Side Effects
  510. * None.
  511. *
  512. * Caveats
  513. * None.
  514. */
  515. /*
  516. * GCCError ApplicationRosterInquire (
  517. * PGCCSessionKey session_key,
  518. * CAppRosterMsg *roster_message)
  519. *
  520. * Public Function Description
  521. * This routine inserts the appropriate application rosters into the
  522. * roster message that is passed in. If the specified session key is set
  523. * to NULL or a session ID of zero is passed in, all the global rosters
  524. * managed by this object will be returned. Otherwise, only the
  525. * specified session roster will be returned.
  526. *
  527. * Formal Parameters:
  528. * session_key - (i) Session key defining roster being inquired about.
  529. * roster_message - (o) Roster message to fill in.
  530. *
  531. * Return Value
  532. * GCC_NO_ERROR - No error occured.
  533. * GCC_ALLOCATION_FAILURE - A resource error occured.
  534. *
  535. * Side Effects
  536. * None.
  537. *
  538. * Caveats
  539. * None.
  540. */
  541. /*
  542. * BOOL IsAPEEnrolled(
  543. * UserID node_id,
  544. * EntityID entity_id)
  545. *
  546. * Public Function Description
  547. * This routine determines if the specified APE is enrolled with one
  548. * of the sessions managed by this application roster manager.
  549. *
  550. * Formal Parameters:
  551. * node_id - (i) Node ID of APE to test.
  552. * entity_id - (i) Entity ID of APE to test.
  553. *
  554. * Return Value
  555. * TRUE - APE is enrolled here.
  556. * FALSE - APE is not enrolled here.
  557. *
  558. * Side Effects
  559. * None.
  560. *
  561. * Caveats
  562. * None.
  563. */
  564. /*
  565. * BOOL IsAPEEnrolled(
  566. * CSessKeyContainer *session_key_data,
  567. * UserID node_id,
  568. * EntityID entity_id)
  569. *
  570. * Public Function Description
  571. * This routine determines if the specified APE is enrolled with the
  572. * specified session.
  573. *
  574. * Formal Parameters:
  575. * session_key_data - (i) Session Key of roster to check.
  576. * node_id - (i) Node ID of APE to test.
  577. * entity_id - (i) Entity ID of APE to test.
  578. *
  579. * Return Value
  580. * TRUE - APE is enrolled with this session.
  581. * FALSE - APE is not enrolled with this session.
  582. *
  583. * Side Effects
  584. * None.
  585. *
  586. * Caveats
  587. * None.
  588. */
  589. /*
  590. * BOOL IsEmpty(void)
  591. *
  592. * Public Function Description
  593. * This routine determines if this application roster managfer contains
  594. * any application rosters.
  595. *
  596. * Formal Parameters:
  597. * None.
  598. *
  599. * Return Value
  600. * TRUE - Application Roster Manager is empty.
  601. * FALSE - Application Roster Manager is NOT empty.
  602. *
  603. * Side Effects
  604. * None.
  605. *
  606. * Caveats
  607. * None.
  608. */