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.

633 lines
19 KiB

  1. /*
  2. * privchnl.h
  3. *
  4. * Copyright (c) 1993 - 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * This is the interface file for the PrivateChannel class. Objects of
  8. * this class represent private channels in the MCS environment. This
  9. * class inherits much of its behavior from class Channel. However,
  10. * objects of this class maintain a list of authorized users, and do not
  11. * allow any other users to use the channel. Users that are not part
  12. * of the authorized user list may not join the channel, nor may they
  13. * even send data on the channel.
  14. *
  15. * Private channels are created as the result of a user issuing a
  16. * channel convene request. This user is known as the channel manager.
  17. * Only the channel manager may modify the authorized user list, and
  18. * only the channel manager may destroy (disband) the private channel.
  19. *
  20. * The channel adds users to the authorized user list by issuing a
  21. * channel admit request. Users are removed from this list when the
  22. * channel manager issues a channel expel request.
  23. *
  24. * Private channel objects will exist in the information base of all
  25. * providers who contain either an admitted user or the channel
  26. * manager in their sub-tree. Requests pass upward to the Top Provider
  27. * who issues the appropriate indications downward to manage the
  28. * information base synchronization process.
  29. *
  30. * Private channel objects restrict the joining of channel by overriding
  31. * the join commands. They restrict the transmission of data by
  32. * overriding the send data commands.
  33. *
  34. * Caveats:
  35. * None.
  36. *
  37. * Author:
  38. * James P. Galvin, Jr.
  39. */
  40. #ifndef _PRIVATECHANNEL_
  41. #define _PRIVATECHANNEL_
  42. /*
  43. * This is the class definition for the PrivateChannel class.
  44. */
  45. class PrivateChannel : public Channel
  46. {
  47. public:
  48. PrivateChannel (
  49. ChannelID channel_id,
  50. UserID channel_manager,
  51. PDomain local_provider,
  52. PConnection top_provider,
  53. CChannelList2 *channel_list,
  54. CAttachmentList *attachment_list);
  55. PrivateChannel (
  56. ChannelID channel_id,
  57. UserID channel_manager,
  58. PDomain local_provider,
  59. PConnection top_provider,
  60. CChannelList2 *channel_list,
  61. CAttachmentList *attachment_list,
  62. CUidList *admitted_list,
  63. PConnection pConn);
  64. virtual ~PrivateChannel ();
  65. virtual Channel_Type GetChannelType ();
  66. virtual BOOL IsValid ();
  67. virtual CAttachment *GetAttachment(void);
  68. virtual Void IssueMergeRequest ();
  69. virtual Void ChannelJoinRequest (
  70. CAttachment *originator,
  71. UserID uidInitiator,
  72. ChannelID channel_id);
  73. Void ChannelDisbandRequest (
  74. CAttachment *originator,
  75. UserID uidInitiator,
  76. ChannelID channel_id);
  77. Void ChannelDisbandIndication (
  78. ChannelID channel_id);
  79. Void ChannelAdmitRequest (
  80. CAttachment *originator,
  81. UserID uidInitiator,
  82. ChannelID channel_id,
  83. CUidList *user_id_list);
  84. Void ChannelAdmitIndication (
  85. PConnection originator,
  86. UserID uidInitiator,
  87. ChannelID channel_id,
  88. CUidList *user_id_list);
  89. Void ChannelExpelRequest (
  90. CAttachment *originator,
  91. UserID uidInitiator,
  92. ChannelID channel_id,
  93. CUidList *user_id_list);
  94. Void ChannelExpelIndication (
  95. PConnection originator,
  96. ChannelID channel_id,
  97. CUidList *user_id_list);
  98. virtual Void SendDataRequest (
  99. CAttachment *originator,
  100. UINT type,
  101. PDataPacket data_packet);
  102. private:
  103. BOOL ValidateUserID (
  104. UserID user_id);
  105. Void BuildAttachmentLists (
  106. CUidList *user_id_list,
  107. CAttachmentList *local_attachment_list,
  108. CAttachmentList *remote_attachment_list);
  109. Void BuildUserIDList (
  110. CUidList *user_id_list,
  111. CAttachment *attachment,
  112. CUidList *user_id_subset);
  113. private:
  114. UserID m_uidChannelManager;
  115. CUidList m_AuthorizedUserList;
  116. BOOL m_fDisbandRequestPending;
  117. };
  118. /*
  119. * PrivateChannel (
  120. * ChannelID channel_id,
  121. * UserID channel_manager,
  122. * PDomain local_provider,
  123. * PConnection top_provider,
  124. * PChannelList channel_list,
  125. * PAttachmentList attachment_list)
  126. *
  127. * Functional Description:
  128. * This is the normal constructor for the PrivateChannel class. It simply
  129. * initializes the instance variables that identify the channel, the local
  130. * provider, the top provider, and the channel manager. The attachment
  131. * list is empty by default (meaning that no users have joined the
  132. * channel). The authorized user list is also empty by default.
  133. *
  134. * Upon successful construction of this object, a channel convene confirm
  135. * is automatically issued to the channel manager, if it is in the
  136. * sub-tree of this provider.
  137. *
  138. * Formal Parameters:
  139. * channel_id (i)
  140. * This is the ID of the channel object. By keeping track of this
  141. * internally, it doesn't have to be passed in for every operation.
  142. * channel_manager (i)
  143. * This is the user ID of the channel manager. Only this user is
  144. * permitted to expand or reduce the size of the authorized user list.
  145. * local_provider (i)
  146. * This is the identity of the local provider. A PrivateChannel object
  147. * needs this since it issues MCS commands on behalf of the local
  148. * provider.
  149. * top_provider (i)
  150. * This is a pointer to the top provider. This is used by the
  151. * PrivateChannel object when it needs to issue a request to the Top
  152. * Provider.
  153. * channel_list (i)
  154. * This is a pointer to the domain's channel list, which identifies
  155. * all valid channels in the domain. This is used by channel objects
  156. * to validate user IDs.
  157. * attachment_list (i)
  158. * This is a pointer to the domain's attachment list, which identifies
  159. * all valid attachments in the domain. This is used by channel
  160. * objects to validate joined attachments.
  161. *
  162. * Return Value:
  163. * None.
  164. *
  165. * Side Effects:
  166. * None.
  167. *
  168. * Caveats:
  169. * None.
  170. */
  171. /*
  172. * PrivateChannel (
  173. * ChannelID channel_id,
  174. * UserID channel_manager,
  175. * PDomain local_provider,
  176. * PConnection top_provider,
  177. * PChannelList channel_list,
  178. * PAttachmentList attachment_list,
  179. * CUidList *admitted_list,
  180. * PCommandTarget attachment)
  181. *
  182. * Functional Description:
  183. * This is a secondary version of the constructor that is used only during
  184. * merge operations. The only difference between this one and the one
  185. * above is that this one allows the specification of an initial
  186. * attachment. This allows a PrivateChannel object to be constructed with
  187. * an attachment already joined to the channel.
  188. *
  189. * This version of the constructor will not issue a channel convene confirm
  190. * or a channel join confirm to the user.
  191. *
  192. * Formal Parameters:
  193. * channel_id (i)
  194. * This is the ID of the channel object. By keeping track of this
  195. * internally, it doesn't have to be passed in for every operation.
  196. * channel_manager (i)
  197. * This is the user ID of the channel manager. Only this user is
  198. * permitted to expand or reduce the size of the authorized user list.
  199. * local_provider (i)
  200. * This is the identity of the local provider. A PrivateChannel object
  201. * needs this since it issues MCS commands on behalf of the local
  202. * provider.
  203. * top_provider (i)
  204. * This is a pointer to the top provider. This is used by the
  205. * PrivateChannel object when it needs to issue a request to the Top
  206. * Provider.
  207. * channel_list (i)
  208. * This is a pointer to the domain's channel list, which identifies
  209. * all valid channels in the domain. This is used by channel objects
  210. * to validate user IDs.
  211. * attachment_list (i)
  212. * This is a pointer to the domain's attachment list, which identifies
  213. * all valid attachments in the domain. This is used by channel
  214. * objects to validate joined attachments.
  215. * admitted_list (i)
  216. * This is a list of users that are admitted to the channel at the
  217. * time of the merge.
  218. * attachment (i)
  219. * This is the initial attachment for the channel. A channel join
  220. * confirm is NOT issued to the attachment.
  221. *
  222. * Return Value:
  223. * None.
  224. *
  225. * Side Effects:
  226. * None.
  227. *
  228. * Caveats:
  229. * None.
  230. */
  231. /*
  232. * ~PrivateChannel ()
  233. *
  234. * Functional Description:
  235. * This is the PrivateChannel class destructor. It does nothing at this
  236. * time. The base class constructor takes care of clearing the attachment
  237. * list.
  238. *
  239. * Formal Parameters:
  240. * None.
  241. *
  242. * Return Value:
  243. * None.
  244. *
  245. * Side Effects:
  246. * None.
  247. *
  248. * Caveats:
  249. * None.
  250. */
  251. /*
  252. * Channel_Type GetChannelType ()
  253. *
  254. * Functional Description:
  255. * This virtual member function returns the type of the channel. For this
  256. * class it will always be PRIVATE_CHANNEL.
  257. *
  258. * Formal Parameters:
  259. * None.
  260. *
  261. * Return Value:
  262. * PRIVATE_CHANNEL
  263. *
  264. * Side Effects:
  265. * None.
  266. *
  267. * Caveats:
  268. * None.
  269. */
  270. /*
  271. * BOOL IsValid ()
  272. *
  273. * Functional Description:
  274. * This function will return TRUE until the channel is disbanded. Then
  275. * it will return FALSE to indicate that the channel object can be deleted
  276. * from the domain infirmation base.
  277. *
  278. * Formal Parameters:
  279. * None.
  280. *
  281. * Return Value:
  282. * TRUE if channel still valid.
  283. * FALSE if the channel has been disbanded.
  284. *
  285. * Side Effects:
  286. * None.
  287. *
  288. * Caveats:
  289. * None.
  290. */
  291. /*
  292. * CAttachment *GetAttachment ()
  293. *
  294. * Functional Description:
  295. * This function returns the attachment which leads to the private channel
  296. * manager. If the channel manager is not in the sub-tree of this
  297. * provider, it returns NULL.
  298. *
  299. * Formal Parameters:
  300. * None.
  301. *
  302. * Return Value:
  303. * Attachment that leads to channel manager, or NULL if channel manager is
  304. * not in the sub-tree of this provider.
  305. *
  306. * Side Effects:
  307. * None.
  308. *
  309. * Caveats:
  310. * None.
  311. */
  312. /*
  313. * Void IssueMergeRequest ()
  314. *
  315. * Functional Description:
  316. * This member function causes the PrivateChannel object to issue a merge
  317. * request to the top provider. It will pack the appropriate local
  318. * information into the command.
  319. *
  320. * Formal Parameters:
  321. * None.
  322. *
  323. * Return Value:
  324. * None.
  325. *
  326. * Side Effects:
  327. * None.
  328. *
  329. * Caveats:
  330. * None.
  331. */
  332. /*
  333. * Void ChannelJoinRequest (
  334. * PCommandTarget originator,
  335. * UserID uidInitiator,
  336. * ChannelID channel_id)
  337. *
  338. * Functional Description:
  339. * This function is invoked when a user tries to join the private channel
  340. * associated with a PrivateChannel object. The originator of the request
  341. * will only be permitted to join if their user ID is contained in the
  342. * authorized user list, If it does, then the originator will be permitted
  343. * to join.
  344. *
  345. * If this provider is not the Top Provider, then the request will be
  346. * forwarded upward to the Top Provider. If this is the Top Provider,
  347. * the a channel join confirm will be issued back to the requesting
  348. * user.
  349. *
  350. * Formal Parameters:
  351. * originator (i)
  352. * This is the attachment from which this command originated.
  353. * uidInitiator (i)
  354. * This is the user ID of the user joining the channel. This must
  355. * be contained in the authorized user list maintained by the object,
  356. * or the request will automatically be rejected.
  357. * channel_id (i)
  358. * This is the channel being acted upon.
  359. *
  360. * Return Value:
  361. * None.
  362. *
  363. * Side Effects:
  364. * None.
  365. *
  366. * Caveats:
  367. * None.
  368. */
  369. /*
  370. * Void ChannelDisbandRequest (
  371. * PCommandTarget originator,
  372. * UserID uidInitiator,
  373. * ChannelID channel_id)
  374. *
  375. * Functional Description:
  376. * This function is invoked when a user tries to destroy an existing
  377. * private channel. This is only permitted if the operation is invoked
  378. * by the manager of the specified private channel.
  379. *
  380. * If this provider is not the Top Provider, then the request will be
  381. * forwarded upward to the Top Provider.
  382. *
  383. * Formal Parameters:
  384. * originator (i)
  385. * This is the attachment from which this command originated.
  386. * uidInitiator (i)
  387. * This is the user ID of the user disbanding the channel. This must
  388. * be the same as the user ID of the private channel manager, or the
  389. * request will automatically be rejected.
  390. * channel_id (i)
  391. * This is the channel being acted upon.
  392. *
  393. * Return Value:
  394. * None.
  395. *
  396. * Side Effects:
  397. * None.
  398. *
  399. * Caveats:
  400. * None.
  401. */
  402. /*
  403. * Void ChannelDisbandIndication (
  404. * PCommandTarget originator,
  405. * ChannelID channel_id)
  406. *
  407. * Functional Description:
  408. * This function is invoked when the Top Provider determines the need to
  409. * destroy a private channel. This may be done in response to a
  410. * disband request from the channel manager, or it may be done for
  411. * other reasons (such as the channel manager detaching from the domain).
  412. *
  413. * Formal Parameters:
  414. * originator (i)
  415. * This is the attachment from which this command originated.
  416. * channel_id (i)
  417. * This is the channel being acted upon.
  418. *
  419. * Return Value:
  420. * None.
  421. *
  422. * Side Effects:
  423. * None.
  424. *
  425. * Caveats:
  426. * None.
  427. */
  428. /*
  429. * Void ChannelAdmitRequest (
  430. * PCommandTarget originator,
  431. * UserID uidInitiator,
  432. * ChannelID channel_id,
  433. * CUidList *user_id_list)
  434. *
  435. * Functional Description:
  436. * This function is invoked when a user tries to expand the authorized
  437. * user list of a private channel. This operation will only be permitted
  438. * if the uidInitiator is the same as the user ID of the private channel
  439. * manager.
  440. *
  441. * If this is the Top Provider, this request will be serviced locally,
  442. * resulting in the transmission of a channel admit indication to all
  443. * downward attachments that contain an admitted user in their sub-tree.
  444. * If this is not the Top Provider, ths request will forwarded toward
  445. * the Top Provider once the request has been validated.
  446. *
  447. * Formal Parameters:
  448. * originator (i)
  449. * This is the attachment from which this command originated.
  450. * uidInitiator (i)
  451. * This is the user ID of the user who is attempting to add users to
  452. * the authorized user list. This must be the same as the user ID
  453. * represented by the object, or the request will automatically be
  454. * rejected.
  455. * channel_id (i)
  456. * This is the channel being acted upon.
  457. * user_id_list (i)
  458. * This is a list containing the IDs of the users to added to the
  459. * user list.
  460. *
  461. * Return Value:
  462. * None.
  463. *
  464. * Side Effects:
  465. * None.
  466. *
  467. * Caveats:
  468. * None.
  469. */
  470. /*
  471. * Void ChannelAdmitIndication (
  472. * PCommandTarget originator,
  473. * UserID uidInitiator,
  474. * ChannelID channel_id,
  475. * CUidList *user_id_list)
  476. *
  477. * Functional Description:
  478. * This function is invoked by the Top Provider upon reception of a
  479. * channel admit request from the legitimate manager of a private channel.
  480. * It travels downward toward any providers that contain an admitted user
  481. * in their sub-tree.
  482. *
  483. * Formal Parameters:
  484. * originator (i)
  485. * This is the attachment from which this command originated.
  486. * uidInitiator (i)
  487. * This is the user ID of the user who is attempting to add users to
  488. * the authorized user list. This must be the same as the user ID
  489. * represented by the object, or the request will automatically be
  490. * rejected.
  491. * channel_id (i)
  492. * This is the channel being acted upon.
  493. * user_id_list (i)
  494. * This is a list containing the IDs of the users to added to the
  495. * user list.
  496. *
  497. * Return Value:
  498. * None.
  499. *
  500. * Side Effects:
  501. * None.
  502. *
  503. * Caveats:
  504. * None.
  505. */
  506. /*
  507. * Void ChannelExpelRequest (
  508. * PCommandTarget originator,
  509. * UserID uidInitiator,
  510. * ChannelID channel_id,
  511. * CUidList *user_id_list)
  512. *
  513. * Functional Description:
  514. * This function is invoked when a user tries to shrink the authorized
  515. * user list of a private channel. This operation will only be permitted
  516. * if the uidInitiator is the same as the user ID of the private channel
  517. * manager.
  518. *
  519. * If this is the Top Provider, this request will be serviced locally,
  520. * resulting in the transmission of a channel admit indication to all
  521. * downward attachments that contain an admitted user in their sub-tree.
  522. * If this is not the Top Provider, ths request will forwarded toward
  523. * the Top Provider once the request has been validated.
  524. *
  525. * Formal Parameters:
  526. * originator (i)
  527. * This is the attachment from which this command originated.
  528. * uidInitiator (i)
  529. * This is the user ID of the user who is attempting to remove users
  530. * from the authorized user list. This must be the same as the user ID
  531. * represented by the object, or the request will automatically be
  532. * rejected.
  533. * channel_id (i)
  534. * This is the channel being acted upon.
  535. * user_id_list (i)
  536. * This is a list containing the IDs of the users to removed from the
  537. * user list.
  538. *
  539. * Return Value:
  540. * None.
  541. *
  542. * Side Effects:
  543. * None.
  544. *
  545. * Caveats:
  546. * None.
  547. */
  548. /*
  549. * Void ChannelExpelIndication (
  550. * PCommandTarget originator,
  551. * ChannelID channel_id,
  552. * CUidList *user_id_list)
  553. *
  554. * Functional Description:
  555. * This function is invoked by the Top Provider upon reception of a
  556. * channel expel request from the legitimate manager of a private channel.
  557. * It travels downward toward any providers that contain (or used to
  558. * contain) an admitted user in their sub-tree.
  559. *
  560. * Formal Parameters:
  561. * originator (i)
  562. * This is the attachment from which this command originated.
  563. * uidInitiator (i)
  564. * This is the user ID of the user who is attempting to remove users
  565. * from the authorized user list. This must be the same as the user ID
  566. * represented by the object, or the request will automatically be
  567. * rejected.
  568. * channel_id (i)
  569. * This is the channel being acted upon.
  570. * user_id_list (i)
  571. * This is a list containing the IDs of the users to removed from the
  572. * user list.
  573. *
  574. * Return Value:
  575. * None.
  576. *
  577. * Side Effects:
  578. * None.
  579. *
  580. * Caveats:
  581. * None.
  582. */
  583. /*
  584. * Void SendDataRequest (
  585. * PCommandTarget originator,
  586. * UINT type,
  587. * PDataPacket data_packet)
  588. *
  589. * Functional Description:
  590. * This function is called when it is necessary to send data through the
  591. * channel that this PrivateChannel object represents. The identity of
  592. * the requesting user will be validated to make sure the user is allowed
  593. * to send data on the private channel. If so, then the request is
  594. * passed to the Channel class SendDataRequest to be processed.
  595. *
  596. * Formal Parameters:
  597. * originator (i)
  598. * This is the attachment from which the data came.
  599. * type (i)
  600. * Normal or uniform send data request.
  601. * data_packet (i)
  602. * This is a pointer to a DataPacket object containing the channel
  603. * ID, the User ID of the data sender, segmentation flags, priority of
  604. * the data packet and a pointer to the packet to be sent.
  605. *
  606. * Return Value:
  607. * None.
  608. *
  609. * Side Effects:
  610. * None.
  611. *
  612. * Caveats:
  613. * None.
  614. */
  615. #endif