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.

762 lines
20 KiB

  1. /*
  2. * sap.h
  3. *
  4. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * This is the interface file for the class CBaseSap. This class is an abstract
  8. * base class for objects that act as Service Access Points (SAPs) to
  9. * external applications or the node controller.
  10. *
  11. * This class has two main responsibilities. First, it handles many of the
  12. * administrative tasks that are common to all types of SAPs. These
  13. * include handling command target registration responsibilities and
  14. * managing the message queue. It also handles all of the primitives that
  15. * are common between the Control SAP (CControlSAP class) and Application
  16. * SAPs (CAppSap class). Since this class inherits from CommandTarget, it
  17. * has the ability to communicate directly with other command targets. A
  18. * CommandTarget object wishing to communicate with a CBaseSap object must
  19. * register itself by passing it a CommandTarget pointer and a handle
  20. * (typically a ConferenceID). This process is identical for both of the
  21. * derived CBaseSap classes. Note that the CBaseSap object can handle multiple
  22. * registered command targets at the same time.
  23. *
  24. * Caveats:
  25. * None.
  26. *
  27. * Author:
  28. * blp
  29. */
  30. #ifndef _SAP_
  31. #define _SAP_
  32. /*
  33. * include files
  34. */
  35. // #include "gcmdtar.h"
  36. #include "password.h"
  37. #include "crost.h"
  38. #include "arost.h"
  39. #include "conflist.h"
  40. #include "sesskey.h"
  41. #include "regkey.h"
  42. #include "regitem.h"
  43. #include "invoklst.h"
  44. #include "arostmsg.h"
  45. #include "crostmsg.h"
  46. #include "privlist.h"
  47. #include "clists.h"
  48. #define MSG_RANGE 0x0100
  49. enum
  50. {
  51. // GCCController
  52. GCTRLMSG_BASE = 0x2100,
  53. // CConf
  54. CONFMSG_BASE = 0x2200,
  55. // CControlSAP
  56. CSAPMSG_BASE = 0x2300,
  57. // CControlSAP asyn direct confirm message
  58. CSAPCONFIRM_BASE = 0x2400,
  59. // CAppSap
  60. ASAPMSG_BASE = 0x2500,
  61. // NCUI
  62. NCMSG_BASE = 0x2600,
  63. // MCS (Node) Controller
  64. MCTRLMSG_BASE = 0x2700,
  65. };
  66. LRESULT CALLBACK SapNotifyWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  67. typedef struct GCCAppSapMsgEx
  68. {
  69. GCCAppSapMsgEx(GCCMessageType);
  70. ~GCCAppSapMsgEx(void);
  71. GCCAppSapMsg Msg;
  72. }
  73. GCCAppSapMsgEx, *PGCCAppSapMsgEx;
  74. /*
  75. * This macro defines the minimum user ID value allowed by MCS.
  76. */
  77. #define MINIMUM_USER_ID_VALUE 1001
  78. /*
  79. * Structures and enumerations used by the CBaseSap class.
  80. */
  81. //
  82. // Class definition.
  83. //
  84. class CConf;
  85. class CBaseSap : public CRefCount
  86. {
  87. public:
  88. #ifdef SHIP_BUILD
  89. CBaseSap();
  90. #else
  91. CBaseSap(DWORD dwStampID);
  92. #endif
  93. virtual ~CBaseSap(void) = 0;
  94. GCCError ConfRosterInquire(GCCConfID, GCCAppSapMsgEx **);
  95. GCCError AppRosterInquire(GCCConfID, GCCSessionKey *, GCCAppSapMsgEx **);
  96. GCCError ConductorInquire(GCCConfID);
  97. GCCError AppInvoke(GCCConfID, GCCAppProtEntityList *, GCCSimpleNodeList *, GCCRequestTag *);
  98. BOOL IsThisNodeTopProvider(GCCConfID);
  99. GCCNodeID GetTopProvider(GCCConfID);
  100. virtual GCCError ConfRosterInquireConfirm(
  101. GCCConfID,
  102. PGCCConferenceName,
  103. LPSTR conference_modifier,
  104. LPWSTR pwszConfDescriptor,
  105. CConfRoster *,
  106. GCCResult,
  107. GCCAppSapMsgEx **) = 0;
  108. virtual GCCError AppRosterInquireConfirm(
  109. GCCConfID,
  110. CAppRosterMsg *,
  111. GCCResult,
  112. GCCAppSapMsgEx **) = 0;
  113. virtual GCCError AppInvokeConfirm(
  114. GCCConfID,
  115. CInvokeSpecifierListContainer *,
  116. GCCResult,
  117. GCCRequestTag) = 0;
  118. virtual GCCError AppInvokeIndication(
  119. GCCConfID,
  120. CInvokeSpecifierListContainer *,
  121. GCCNodeID nidInvoker) = 0;
  122. virtual GCCError AppRosterReportIndication(GCCConfID, CAppRosterMsg *) = 0;
  123. virtual GCCError ConductorInquireConfirm(
  124. GCCNodeID nidConductor,
  125. GCCResult,
  126. BOOL permission_flag,
  127. BOOL conducted_mode,
  128. GCCConfID) = 0;
  129. virtual GCCError ConductorPermitGrantIndication(
  130. GCCConfID nConfID,
  131. UINT cGranted,
  132. GCCNodeID *aGranted,
  133. UINT cWaiting,
  134. GCCNodeID *aWaiting,
  135. BOOL fThisNodeIsGranted) = 0;
  136. virtual GCCError ConductorAssignIndication(
  137. GCCNodeID nidConductor,
  138. GCCConfID conference_id) = 0;
  139. virtual GCCError ConductorReleaseIndication(
  140. GCCConfID conference_id) = 0;
  141. protected:
  142. GCCRequestTag GenerateRequestTag(void);
  143. GCCRequestTag m_nReqTag;
  144. HWND m_hwndNotify;
  145. };
  146. /*
  147. * Comments explaining the public and protected class member functions
  148. */
  149. /*
  150. * CBaseSap();
  151. *
  152. * Public member function of CBaseSap.
  153. *
  154. * Function Description:
  155. * This is the CBaseSap constructor. The hash list used to hold command
  156. * target objects is initialized by this constructor.
  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. * ~Sap ();
  172. *
  173. * Public member function of CBaseSap.
  174. *
  175. * Function Description:
  176. * This is the CBaseSap destructor. All message flushing and queue clearing
  177. * is performed by the classes which inherit from CBaseSap. No work is actually
  178. * done by this constructor.
  179. *
  180. * Formal Parameters:
  181. * None.
  182. *
  183. * Return Value:
  184. * None.
  185. *
  186. * Side Effects:
  187. * None.
  188. *
  189. * Caveats:
  190. * None.
  191. */
  192. /*
  193. * GCCError RegisterConf(CConf *, GCCConfID)
  194. *
  195. * Public member function of CBaseSap.
  196. *
  197. * Function Description:
  198. * This routine is used by command target objects (such as Conferences) in
  199. * order to register themselves with the CBaseSap object. This is done in order
  200. * to allow the command target object to communicate directly with the CBaseSap.
  201. *
  202. * Formal Parameters:
  203. * cmdtar_object (i) Pointer to the command target object
  204. * wishing to be registered with the CBaseSap.
  205. * handle (i) Integer value used to index the registering
  206. * command target in the list of command
  207. * targets (the conference ID for confs).
  208. *
  209. * Return Value:
  210. * SAP_NO_ERROR - Command target object has been
  211. * successfully registered.
  212. * SAP_CONFERENCE_ALREADY_REGISTERED - A command target object was
  213. * already registered with the
  214. * handle passed in.
  215. *
  216. * Side Effects:
  217. * None.
  218. *
  219. * Caveats:
  220. * None.
  221. */
  222. /*
  223. * GCCError UnRegisterConf (
  224. * UINT handle);
  225. *
  226. * Public member function of CBaseSap.
  227. *
  228. * Function Description:
  229. * This routine is used by command target objects (such as Conferences) in
  230. * order to un-register themselves with the CBaseSap object. This is done when
  231. * the command target object is through communicating with the CBaseSap.
  232. *
  233. * Formal Parameters:
  234. * handle (i) Integer value used to index the registering
  235. * command target in the list of command
  236. * targets (the conference ID for confs).
  237. *
  238. * Return Value:
  239. * SAP_NO_ERROR - Command target object has been
  240. * successfully un-registered.
  241. * SAP_NO_SUCH_CONFERENCE - No command target object was found
  242. * registered with the handle passed in
  243. *
  244. * Side Effects:
  245. * None.
  246. *
  247. * Caveats:
  248. * None.
  249. */
  250. /*
  251. * GCCError ConfRosterInquire(
  252. * GCCConfID conference_id);
  253. *
  254. * Public member function of CBaseSap.
  255. *
  256. * Function Description:
  257. * This routine is used to retrieve the conference roster. This function
  258. * just passes this request to the controller via an owner callback. The
  259. * conference roster is delivered to the requesting command target object
  260. * in a Conference Roster inquire confirm.
  261. *
  262. * Formal Parameters:
  263. * conference_id - ID of conference for desired roster.
  264. *
  265. * Return Value:
  266. * GCC_NO_ERROR - Function completed successfully.
  267. * GCC_ALLOCATION_FAILURE - A resource allocation error occurred.
  268. * GCC_INVALID_CONFERENCE - Conference ID is invalid.
  269. * GCC_CONFERENCE_NOT_ESTABLISHED - Conference object has not completed
  270. * its establishment process.
  271. *
  272. *
  273. * Side Effects:
  274. * None.
  275. *
  276. * Caveats:
  277. * None.
  278. */
  279. /*
  280. * GCCError AppRosterInquire (
  281. * GCCConfID conference_id,
  282. * PGCCSessionKey session_key );
  283. *
  284. * Public member function of CBaseSap.
  285. *
  286. * Function Description:
  287. * This routine is used to retrieve a list of application rosters. This
  288. * function just passes this request to the controller via an owner
  289. * callback. This list is delivered to the requesting SAP through an
  290. * Application Roster inquire confirm message.
  291. *
  292. * Formal Parameters:
  293. * handle (i) Integer value used to index the registering
  294. * command target in the list of command
  295. * targets (the conference ID for confs).
  296. *
  297. * Return Value:
  298. * GCC_NO_ERROR - Function completed successfully.
  299. * GCC_ALLOCATION_FAILURE - A resource allocation error occurred.
  300. * GCC_INVALID_CONFERENCE - Conference ID is invalid.
  301. * GCC_BAD_SESSION_KEY - Session key pointer is invalid.
  302. *
  303. * Side Effects:
  304. * None.
  305. *
  306. * Caveats:
  307. * None.
  308. */
  309. /*
  310. * GCCError ConductorInquire (
  311. * GCCConfID conference_id);
  312. *
  313. * Public member function of CBaseSap.
  314. *
  315. * Function Description:
  316. * This routine is called in order to retrieve conductorship information.
  317. * The conductorship information is returned in the confirm.
  318. *
  319. * Formal Parameters:
  320. * conference_id (i) ID of conference.
  321. *
  322. * Return Value:
  323. * GCC_NO_ERROR - Function completed successfully.
  324. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  325. * GCC_INVALID_CONFERENCE - Conference ID is invalid.
  326. *
  327. * Side Effects:
  328. * None.
  329. *
  330. * Caveats:
  331. * None.
  332. */
  333. /*
  334. * GCCError AppInvoke(
  335. * GCCConfID conference_id,
  336. * UINT number_of_apes,
  337. * PGCCAppProtocolEntity * ape_list,
  338. * UINT number_of_destination_nodes,
  339. * UserID * list_of_destination_nodes);
  340. *
  341. * Public member function of CBaseSap.
  342. *
  343. * Function Description:
  344. * This routine is called in order to invoke other applications at remote
  345. * nodes. The request is passed on to the appropriate Conference objects.
  346. *
  347. * Formal Parameters:
  348. * conference_id (i) ID of conference.
  349. * number_of_apes (i) Number of Application Protocol Entities
  350. * to be invoked.
  351. * ape_list (i) List of "APE"s to be invoked.
  352. * number_of_destination_nodes (i) Number of nodes where applications are
  353. * to be invoked.
  354. * list_of_destination_nodes (i) List of nodes where applications are to
  355. * be invoked.
  356. *
  357. * Return Value:
  358. * GCC_NO_ERROR - No error.
  359. * GCC_ALLOCATION_FAILURE - Error creating an object using the
  360. * "new" operator.
  361. * GCC_BAD_SESSION_KEY - An invalid session key exists in
  362. * an APE passed in.
  363. * GCC_BAD_NUMBER_OF_APES - Number of APEs passed in as zero.
  364. * GCC_INVALID_CONFERENCE - Conference ID is invalid.
  365. * GCC_CONFERENCE_NOT_ESTABLISHED - Conference object has not completed
  366. * its establishment process.
  367. *
  368. * Side Effects:
  369. * None.
  370. *
  371. * Caveats:
  372. * None.
  373. */
  374. /*
  375. * GCCError ConductorPermitAskRequest(
  376. * GCCConfID conference_id,
  377. * BOOL grant_permission);
  378. *
  379. * Public member function of CBaseSap.
  380. *
  381. * Function Description:
  382. * This routine is called in order to ask for certain permissions to be
  383. * granted (or not granted) by the conductor.
  384. *
  385. * Formal Parameters:
  386. * conference_id (i) ID of conference.
  387. * grant_permission (i) Flag indicating whether asking for a certain
  388. * permission or giving up that permission.
  389. *
  390. * Return Value:
  391. * GCC_NO_ERROR - Function completed successfully.
  392. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  393. * GCC_INVALID_CONFERENCE - Conference ID is invalid.
  394. *
  395. * Side Effects:
  396. * None.
  397. *
  398. * Caveats:
  399. * None.
  400. */
  401. /*
  402. * GCCError AppRosterInquireConfirm(
  403. * GCCConfID conference_id,
  404. * CAppRosterMsg *roster_message,
  405. * GCCResult result );
  406. *
  407. * Public member function of CBaseSap.
  408. *
  409. * Function Description:
  410. * This routine is called in order to return a requested list of
  411. * application rosters to an application or the node controller.
  412. *
  413. * Formal Parameters:
  414. * conference_id (i) ID of conference.
  415. * roster_message (i) Roster message object containing the roster data
  416. * result (i) Result code indicating if call is successful.
  417. *
  418. * Return Value:
  419. * GCC_NO_ERROR - Function completed successfully.
  420. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  421. *
  422. * Side Effects:
  423. * None.
  424. *
  425. * Caveats:
  426. * None.
  427. */
  428. /*
  429. * GCCError ConfRosterInquireConfirm (
  430. * GCCConfID conference_id,
  431. * PGCCConferenceName conference_name,
  432. * LPSTR conference_modifier,
  433. * LPWSTR pwszConfDescriptor,
  434. * CConfRoster *conference_roster,
  435. * GCCResult result );
  436. *
  437. * Public member function of CBaseSap.
  438. *
  439. * Function Description:
  440. * This routine is called in order to return a requested conference
  441. * roster to an application or the node controller.
  442. *
  443. * Formal Parameters:
  444. * conference_id (i) ID of conference.
  445. * conference_name (i) Name of conference.
  446. * conference_modifier (i) Name modifier for conference.
  447. * pwszConfDescriptor (i) Desciptor string for conference.
  448. * conference_roster (i) The conference roster being returned.
  449. * result (i) Result code indicating result of call.
  450. *
  451. * Return Value:
  452. * GCC_NO_ERROR - Function completed successfully.
  453. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  454. *
  455. * Side Effects:
  456. * None.
  457. *
  458. * Caveats:
  459. * None.
  460. */
  461. /*
  462. * GCCError AppInvokeConfirm(
  463. * GCCConfID conference_id,
  464. * CInvokeSpecifierListContainer *invoke_list,
  465. * GCCResult result);
  466. *
  467. * Public member function of CBaseSap.
  468. *
  469. * Function Description:
  470. * This routine is called in order to confirm a call requesting application
  471. * invocation.
  472. *
  473. * Formal Parameters:
  474. * conference_id (i) ID of conference.
  475. * invoke_list (i) List of APE attempted to be invoked.
  476. * result (i) Result code indicating result of call.
  477. *
  478. * Return Value:
  479. * GCC_NO_ERROR - Function completed successfully.
  480. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  481. *
  482. * Side Effects:
  483. * None.
  484. *
  485. * Caveats:
  486. * None.
  487. */
  488. /*
  489. * GCCError AppInvokeIndication (
  490. * GCCConfID conference_id,
  491. * CInvokeSpecifierListContainer *invoke_list,
  492. * UserID invoking_node_id);
  493. *
  494. * Public member function of CBaseSap.
  495. *
  496. * Function Description:
  497. * This routine is called in order to send an indication to an application
  498. * or node controller that a request for application invocation has been
  499. * made.
  500. *
  501. * Formal Parameters:
  502. * conference_id (i) ID of conference.
  503. * invoke_list (i) List of APE's to be invoked.
  504. * invoking_node_id (i) ID of node requesting the invoke.
  505. *
  506. * Return Value:
  507. * GCC_NO_ERROR - Function completed successfully.
  508. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  509. *
  510. * Side Effects:
  511. * None.
  512. *
  513. * Caveats:
  514. * None.
  515. */
  516. /*
  517. * GCCError ConductorInquireConfirm (
  518. * UserID conductor_node_id,
  519. * GCCResult result,
  520. * BOOL permission_flag,
  521. * BOOL conducted_mode,
  522. * GCCConfID conference_id);
  523. *
  524. * Public member function of CBaseSap.
  525. *
  526. * Function Description:
  527. * This routine is called in order to return conductorship information
  528. * which has been requested.
  529. *
  530. * Formal Parameters:
  531. * conductor_node_id (i) Node ID of conducting node.
  532. * result (i) Result of call.
  533. * permission_flag (i) Flag indicating whether or not local
  534. * node has conductorship permission.
  535. * conducted_mode (i) Flag indicating whether or not
  536. * conference is in conducted mode.
  537. * conference_id (i) ID of conference.
  538. *
  539. * Return Value:
  540. * GCC_NO_ERROR - Function completed successfully.
  541. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  542. *
  543. * Side Effects:
  544. * None.
  545. *
  546. * Caveats:
  547. * None.
  548. */
  549. /*
  550. * GCCError ConductorAssignIndication (
  551. * UserID conductor_user_id,
  552. * GCCConfID conference_id);
  553. *
  554. * Public member function of CBaseSap.
  555. *
  556. * Function Description:
  557. * This routine is called in order to send an indication to an application
  558. * or node controller that a request has been made to assign conductorship.
  559. *
  560. * Formal Parameters:
  561. * conductor_user_id (i) Node ID of conductor.
  562. * conference_id (i) ID of conference.
  563. *
  564. * Return Value:
  565. * GCC_NO_ERROR - Function completed successfully.
  566. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  567. *
  568. * Side Effects:
  569. * None.
  570. *
  571. * Caveats:
  572. * None.
  573. */
  574. /*
  575. * GCCError ConductorReleaseIndication (
  576. * GCCConfID conference_id);
  577. *
  578. * Public member function of CBaseSap.
  579. *
  580. * Function Description:
  581. * This routine is called in order to send an indication to an application
  582. * or node controller that a request for releasing conductorship has been
  583. * made.
  584. *
  585. * Formal Parameters:
  586. * conference_id (i) ID of conference.
  587. *
  588. * Return Value:
  589. * GCC_NO_ERROR - Function completed successfully.
  590. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  591. *
  592. * Side Effects:
  593. * None.
  594. *
  595. * Caveats:
  596. * None.
  597. */
  598. /*
  599. * GCCError ConductorPermitGrantIndication (
  600. * GCCConfID conference_id,
  601. * UINT number_granted,
  602. * PUserID granted_node_list,
  603. * UINT number_waiting,
  604. * PUserID waiting_node_list,
  605. * BOOL permission_is_granted);
  606. *
  607. * Public member function of CBaseSap.
  608. *
  609. * Function Description:
  610. * This routine is called in order to send an indication to an application
  611. * or node controller that a request for permission from the conductor
  612. * has been made.
  613. *
  614. * Formal Parameters:
  615. * conference_id (i) ID of conference.
  616. * number_granted (i) Number of nodes permission is requested
  617. * for.
  618. * granted_node_list (i) List of node ID's for nodes to be
  619. * granted permission.
  620. * number_waiting (i) Number of nodes waiting for permission.
  621. * waiting_node_list (i) List of nodes waiting for permission.
  622. * permission_is_granted (i) Flag indicating whether permission is
  623. * granted.
  624. *
  625. * Return Value:
  626. * GCC_NO_ERROR - Function completed successfully.
  627. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  628. *
  629. * Side Effects:
  630. * None.
  631. *
  632. * Caveats:
  633. * None.
  634. */
  635. /*
  636. * GCCError ConfRosterReportIndication (
  637. * GCCConfID conference_id,
  638. * CConfRosterMsg *roster_message);
  639. *
  640. * Public member function of CBaseSap.
  641. *
  642. * Function Description:
  643. * This routine is called in order to indicate to applications and the
  644. * node controller that the conference roster has been updated.
  645. *
  646. * Formal Parameters:
  647. * conference_id (i) ID of conference.
  648. * roster_message (i) Roster message object holding the updated
  649. * roster information.
  650. *
  651. * Return Value:
  652. * GCC_NO_ERROR - Function completed successfully.
  653. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  654. *
  655. * Side Effects:
  656. * None.
  657. *
  658. * Caveats:
  659. * None.
  660. */
  661. /*
  662. * GCCError ApplicationRosterReportIndication (
  663. * GCCConfID conference_id,
  664. * CAppRosterMsg *roster_message);
  665. *
  666. * Public member function of CBaseSap.
  667. *
  668. * Function Description:
  669. * This routine is called in order to indicate to applications and the
  670. * node controller that the list of application rosters has been updated.
  671. *
  672. * Formal Parameters:
  673. * conference_id (i) ID of conference.
  674. * roster_message (i) Roster message object holding the updated
  675. * roster information.
  676. *
  677. * Return Value:
  678. * GCC_NO_ERROR - Function completed successfully.
  679. * GCC_ALLOCATION_FAILURE - A resource error occurred.
  680. *
  681. * Side Effects:
  682. * None.
  683. *
  684. * Caveats:
  685. * None.
  686. */
  687. #endif