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.

364 lines
10 KiB

  1. /*
  2. * userchnl.h
  3. *
  4. * Copyright (c) 1993 - 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * This is the interface file for the UserChannel class. Objects of this
  8. * class represent user ID channels in the MCS environment. This class
  9. * inherits most of its behavior from class Channel. In fact, with the
  10. * exception of how user channels are joined, and how merge commands are
  11. * constructed, this class works exactly the same as class Channel.
  12. *
  13. * When a user attaches to a domain, each provider in the path from the
  14. * Top Provider to the user will create an object of this class. Unlike
  15. * static and assigned channels, it is NOT necessary for the user to
  16. * be joined to the channel for the channel to exist. It is perfectly
  17. * legal to have a user channel that no one is joined to.
  18. *
  19. * The major distinguishing characteristic of user channels is that they
  20. * know the user ID of the user they are associated with. They will
  21. * only allow that user to join the channel. Furthermore, when the user
  22. * leaves the usert channel, the LeaveRequest does not return a value
  23. * asking to be deleted. Anyone can send data on a user ID channel.
  24. *
  25. * The merge channel command is constructed slightly differently for user
  26. * channels, so that behavior is overridden here as well.
  27. *
  28. * Caveats:
  29. * None.
  30. *
  31. * Author:
  32. * James P. Galvin, Jr.
  33. */
  34. #ifndef _USERCHANNEL_
  35. #define _USERCHANNEL_
  36. /*
  37. * This is the class definition for the UserChannel class.
  38. */
  39. class UserChannel : public Channel
  40. {
  41. public:
  42. UserChannel (
  43. ChannelID channel_id,
  44. CAttachment *user_attachment,
  45. PDomain local_provider,
  46. PConnection top_provider,
  47. CChannelList2 *channel_list,
  48. CAttachmentList *attachment_list);
  49. UserChannel (
  50. ChannelID channel_id,
  51. CAttachment *user_attachment,
  52. PDomain local_provider,
  53. PConnection top_provider,
  54. CChannelList2 *channel_list,
  55. CAttachmentList *attachment_list,
  56. PConnection pConn);
  57. virtual ~UserChannel ();
  58. virtual Channel_Type GetChannelType ();
  59. virtual BOOL IsValid ();
  60. virtual CAttachment *GetAttachment(void);
  61. virtual Void IssueMergeRequest ();
  62. virtual Void ChannelJoinRequest (
  63. CAttachment *originator,
  64. UserID uidInitiator,
  65. ChannelID channel_id);
  66. virtual Void SendDataRequest (
  67. CAttachment *originator,
  68. UINT type,
  69. PDataPacket data_packet);
  70. private:
  71. CAttachment *m_pUserAttachment;
  72. };
  73. typedef UserChannel * PUserChannel;
  74. /*
  75. * UserChannel (
  76. * ChannelID channel_id,
  77. * PCommandTarget user_attachment,
  78. * PDomain local_provider,
  79. * PConnection top_provider,
  80. * PChannelList channel_list,
  81. * PAttachmentList attachment_list)
  82. *
  83. * Functional Description:
  84. * This is the normal constructor for the UserChannel class. It simply
  85. * initializes the instance variables that identify the channel, the local
  86. * provider, the top provider, and the user attachment. The attachment
  87. * list is empty by default (meaning that the user is not yet joined to
  88. * its channel).
  89. *
  90. * Upon successful construction of this object, an attach user confirm
  91. * is automatically issued to the user.
  92. *
  93. * Formal Parameters:
  94. * channel_id (i)
  95. * This is the ID of the channel object. By keeping track of this
  96. * internally, it doesn't have to be passed in for every operation.
  97. * user_attachment (i)
  98. * This is the attachment which leads to the user represented by this
  99. * UserChannel object. It does not matter if it is a local attachment
  100. * or a remote attachment. This is used to issue MCS commands (such
  101. * as attach user confirm) to the user.
  102. * local_provider (i)
  103. * This is the identity of the local provider. A UserChannel object
  104. * needs this since it issues MCS commands on behalf of the local
  105. * provider.
  106. * top_provider (i)
  107. * This is a pointer to the top provider. This is used by the
  108. * UserChannel object when it needs to issue a request to the Top
  109. * Provider.
  110. * channel_list (i)
  111. * This is a pointer to the domain's channel list, which identifies
  112. * all valid channels in the domain. This is used by channel objects
  113. * to validate user IDs.
  114. * attachment_list (i)
  115. * This is a pointer to the domain's attachment list, which identifies
  116. * all valid attachments in the domain. This is used by channel
  117. * objects to validate joined attachments.
  118. *
  119. * Return Value:
  120. * None.
  121. *
  122. * Side Effects:
  123. * None.
  124. *
  125. * Caveats:
  126. * None.
  127. */
  128. /*
  129. * UserChannel (
  130. * ChannelID channel_id,
  131. * PCommandTarget user_attachment,
  132. * PDomain local_provider,
  133. * PConnection top_provider,
  134. * PChannelList channel_list,
  135. * PAttachmentList attachment_list,
  136. * PCommandTarget attachment)
  137. *
  138. * Functional Description:
  139. * This is a secondary version of the constructor that is used only during
  140. * merge operations. The only difference between this one and the one
  141. * above is that this one allows the specification of an initial
  142. * attachment. This allows a UserChannel object to be constructed with the
  143. * user already joined to the channel. The initial attachment should be
  144. * the same as the user attachment.
  145. *
  146. * This version of the constructor will not issue an attach user confirm
  147. * or a channel join confirm to the user.
  148. *
  149. * Formal Parameters:
  150. * channel_id (i)
  151. * This is the ID of the channel object. By keeping track of this
  152. * internally, it doesn't have to be passed in for every operation.
  153. * user_attachment (i)
  154. * This is the attachment which leads to the user represented by this
  155. * UserChannel object. It does not matter if it is a local attachment
  156. * or a remote attachment. This is used to issue MCS commands (such
  157. * as attach user confirm) to the user.
  158. * local_provider (i)
  159. * This is the identity of the local provider. A UserChannel object
  160. * needs this since it issues MCS commands on behalf of the local
  161. * provider.
  162. * top_provider (i)
  163. * This is a pointer to the top provider. This is used by the
  164. * UserChannel object when it needs to issue a request to the Top
  165. * Provider.
  166. * channel_list (i)
  167. * This is a pointer to the domain's channel list, which identifies
  168. * all valid channels in the domain. This is used by channel objects
  169. * to validate user IDs.
  170. * attachment_list (i)
  171. * This is a pointer to the domain's attachment list, which identifies
  172. * all valid attachments in the domain. This is used by channel
  173. * objects to validate joined attachments.
  174. * attachment (i)
  175. * This is the initial attachment for the channel. A channel join
  176. * confirm is NOT issued to the attachment.
  177. *
  178. * Return Value:
  179. * None.
  180. *
  181. * Side Effects:
  182. * None.
  183. *
  184. * Caveats:
  185. * None.
  186. */
  187. /*
  188. * ~UserChannel ()
  189. *
  190. * Functional Description:
  191. * This is the UserChannel class destructor. It does nothing at this time.
  192. * The base class constructor takes care of clearing the attachment list.
  193. *
  194. * Formal Parameters:
  195. * None.
  196. *
  197. * Return Value:
  198. * None.
  199. *
  200. * Side Effects:
  201. * None.
  202. *
  203. * Caveats:
  204. * None.
  205. */
  206. /*
  207. * Channel_Type GetChannelType ()
  208. *
  209. * Functional Description:
  210. * This virtual member function returns the type of the channel. For this
  211. * class it will always be USER_CHANNEL.
  212. *
  213. * Formal Parameters:
  214. * None.
  215. *
  216. * Return Value:
  217. * USER_CHANNEL
  218. *
  219. * Side Effects:
  220. * None.
  221. *
  222. * Caveats:
  223. * None.
  224. */
  225. /*
  226. * BOOL IsValid ()
  227. *
  228. * Functional Description:
  229. * This function always returns TRUE since User ID channels are always
  230. * valid (as long as the user is still attached).
  231. *
  232. * Formal Parameters:
  233. * None.
  234. *
  235. * Return Value:
  236. * TRUE
  237. *
  238. * Side Effects:
  239. * None.
  240. *
  241. * Caveats:
  242. * None.
  243. */
  244. /*
  245. * CAttachment *GetAttachment ()
  246. *
  247. * Functional Description:
  248. * This function is used to retrieve the attachment associated with the
  249. * user represented by this object. This is used by Domain objects when
  250. * it is necessary to send an MCS command to a user, and it needs to know
  251. * how to get it there. That information is currently excapsulated within
  252. * this class.
  253. *
  254. * Formal Parameters:
  255. * None.
  256. *
  257. * Return Value:
  258. * A pointer to the attachment that leads to the user represented by this
  259. * object.
  260. *
  261. * Side Effects:
  262. * None.
  263. *
  264. * Caveats:
  265. * None.
  266. */
  267. /*
  268. * Void IssueMergeRequest ()
  269. *
  270. * Functional Description:
  271. * This member function causes the UserChannel object to issue a merge
  272. * request to the top provider. It will pack the appropriate local
  273. * information into the command.
  274. *
  275. * Formal Parameters:
  276. * None.
  277. *
  278. * Return Value:
  279. * None.
  280. *
  281. * Side Effects:
  282. * None.
  283. *
  284. * Caveats:
  285. * None.
  286. */
  287. /*
  288. * Void ChannelJoinRequest (
  289. * PCommandTarget originator,
  290. * UserID uidInitiator,
  291. * ChannelID channel_id)
  292. *
  293. * Functional Description:
  294. * This function is invoked when a user tries to join the channel
  295. * associated with a UserChannel object. The originator of the request
  296. * will only be permitted to join if their user ID matches that of the
  297. * user with which this UserChannel object is associated. If it does,
  298. * then the originator will be permitted to join.
  299. *
  300. * If this provider is not the Top Provider, then the request will be
  301. * forwarded upward to the Top Provider. If this is the Top Provider,
  302. * the a channel join confirm will be issued back to the requesting
  303. * user.
  304. *
  305. * Formal Parameters:
  306. * originator (i)
  307. * This is the attachment of the user wishing to join the channel.
  308. * uidInitiator (i)
  309. * This is the user ID of the user joining the channel. This must
  310. * be the same as the user ID represented by the object, or the
  311. * request will automatically be rejected.
  312. * channel_id (i)
  313. * This is the channel being acted upon.
  314. *
  315. * Return Value:
  316. * None.
  317. *
  318. * Side Effects:
  319. * None.
  320. *
  321. * Caveats:
  322. * None.
  323. */
  324. /*
  325. * Void SendDataRequest (
  326. * PCommandTarget originator,
  327. * PDataPacket data_packet)
  328. *
  329. * Functional Description:
  330. * This member function handles a send data request on the channel. It
  331. * determines where to send the data. This differs from the base class
  332. * implementation only in that it is unnecessary to send data upward
  333. * if it is known that the user is in the sub-tree of the current
  334. * provider.
  335. *
  336. * Formal Parameters:
  337. * originator (i)
  338. * This is the attachment from which the data originated.
  339. * data_packet (i)
  340. * This is a pointer to a DataPacket object containing the channel
  341. * ID, the User ID of the data sender, segmentation flags, priority of
  342. * the data packet and a pointer to the packet to be sent.
  343. *
  344. * Return Value:
  345. * None.
  346. *
  347. * Side Effects:
  348. * None.
  349. *
  350. * Caveats:
  351. * None.
  352. */
  353. #endif