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.

767 lines
22 KiB

  1. /*
  2. * mcsdllif.h
  3. *
  4. * Copyright (c) 1993 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * This is the interface file for the MCAT MCS DLL Interface class.
  8. *
  9. * When this class is first instantiated, it initializes MCS. After
  10. * that, the application using this object requests MCS services through
  11. * this object. This object is also responsible for receiving and
  12. * forwarding cllback messages. When this object is deleted it calls
  13. * MCSCleanupAPI to shut down the MCATMCS DLL.
  14. *
  15. * MCS interface objects represent the Service Access Point (SAP)
  16. * between GCC and MCS. Exactly how the interface works is an
  17. * implementation matter for those classes that inherit from this one.
  18. * This class defines the public member functions that GCC expects to be
  19. * able to call upon to utilize MCS.
  20. *
  21. * The public member functions defined here can be broken into two
  22. * categories: those that are part of T.122; and those that are not.
  23. * The T.122 functions include connect provider request, connect
  24. * provider response, disconnect provider request, create domain, delete
  25. * domain, send data request, etc. All other member functions are
  26. * considered a local matter from a standards point-of-view. These
  27. * functions include support for initialization and setup, as well as
  28. * functions allowing GCC to poll MCS for activity.
  29. *
  30. * Note that this class also handles the connect provider confirms by
  31. * keeping a list of all the objects with outstanding connect provider
  32. * request. These are held in the ConfirmObjectList.
  33. *
  34. * Caveats:
  35. * None.
  36. *
  37. * Author:
  38. * Christos Tsollis
  39. *
  40. */
  41. #ifndef _MCS_DLL_INTERFACE_
  42. #define _MCS_DLL_INTERFACE_
  43. #include "mcsuser.h"
  44. /*
  45. ** This dictionary keeps up with all the outstanding connect provider
  46. ** request. When a response is received, this interface class will obtain
  47. ** a pointer to the correct object from this list and will then pass on the
  48. ** response.
  49. */
  50. class CConnHdlConfList2 : public CList2
  51. {
  52. DEFINE_CLIST2_(CConnHdlConfList2, CConf*, ConnectionHandle)
  53. };
  54. extern PController g_pMCSController;
  55. /*
  56. * CONNECT_PROVIDER_INDICATION
  57. *
  58. * Parameter1:
  59. * PConnectProviderIndication
  60. * This is a pointer to a structure that contains all necessary
  61. * information about an incoming connection.
  62. * Parameter2: Unused
  63. *
  64. * Functional Description:
  65. * This indication is sent to the owner object when an incoming
  66. * connection is detected. The owner object should respond by calling
  67. * MCSConnectProviderResponse indicating whether or not the connection
  68. * is to be accepted.
  69. */
  70. /*
  71. * CONNECT_PROVIDER_CONFIRM
  72. *
  73. * Parameter1:
  74. * PConnectProviderConfirm
  75. * This is a pointer to a structure that contains all necessary
  76. * information about an outgoing connection.
  77. * Parameter2: Unused
  78. *
  79. * Functional Description:
  80. * This confirm is sent to the object that made the original connect
  81. * provider request. It informs the requesting object of when the new
  82. * connection is available for use, or that the connection could not be
  83. * established (or that it was rejected by the remote site).
  84. */
  85. /*
  86. * DISCONNECT_PROVIDER_INDICATION
  87. *
  88. * Parameter1: Unused
  89. * Parameter2:
  90. * (LOWUSHORT) ConnectionHandle
  91. * This is the handle for the connection that was lost.
  92. * (HIGHUSHORT) Reason
  93. * This is the reason for the disconnect.
  94. *
  95. * Functional Description:
  96. * This indication is sent to the owner object whenever a connection
  97. * is lost. This essentially tells the owner object that the contained
  98. * connection handle is no longer valid.
  99. */
  100. /*
  101. * GCC_ATTACH_USER_CONFIRM
  102. *
  103. * Parameter1: Unused
  104. * Parameter2:
  105. * (LOWUSHORT) UserID
  106. * If the result is success, then this is the newly assigned user ID.
  107. * If the result is failure, then this field is undefined.
  108. * (HIGHUSHORT) Result
  109. * This is the result of the attach user request.
  110. *
  111. * Functional Description:
  112. * This confirm is sent to the user object in response to a previous
  113. * call to MCS_AttachRequest. It contains the result of that service
  114. * request. If successful, it also contains the user ID that has been
  115. * assigned to that attachment.
  116. */
  117. /*
  118. * GCC_DETACH_USER_INDICATION
  119. *
  120. * Parameter1: Unused
  121. * Parameter2:
  122. * (LOWUSHORT) UserID
  123. * This is the user ID of the user that is detaching.
  124. * (HIGHUSHORT) Reason
  125. * This is the reason for the detachment.
  126. *
  127. * Functional Description:
  128. * This indication is sent to the user object whenever a user detaches
  129. * from the domain. This is sent to ALL remaining user objects in the
  130. * domain automatically. Note that if the user ID contained in this
  131. * indication is the same as that of the user object receiving it, the
  132. * user is essentially being told that it has been kicked out of the
  133. * conference. The user handle and user ID are no longer valid in this
  134. * case. It is the responsibility of the user object to recognize when
  135. * this occurs.
  136. */
  137. /*
  138. * GCC_CHANNEL_JOIN_CONFIRM
  139. *
  140. * Parameter1: Unused
  141. * Parameter2:
  142. * (LOWUSHORT) ChannelID
  143. * This is the channel that has been joined.
  144. * (HIGHUSHORT) Result
  145. * This is the result of the join request.
  146. *
  147. * Functional Description:
  148. * This confirm is sent to a user object in response to a previous
  149. * call to ChannelJoinRequest. It lets the user object know if the
  150. * join was successful for a particular channel. Furthermore, if the
  151. * join request was for channel 0 (zero), then the ID of the assigned
  152. * channel is contained in this confirm.
  153. */
  154. /*
  155. * CHANNEL_LEAVE_INDICATION
  156. *
  157. * Parameter1: Unused
  158. * Parameter2:
  159. * (LOWUSHORT) ChannelID
  160. * This is the channel that has been left or is being told to leave.
  161. * (HIGHUSHORT) Reason
  162. * This is the reason for the leave.
  163. *
  164. * Functional Description:
  165. * This indication is sent to a user object when a domain merger has
  166. * caused a channel to be purged from the lower domain. This informs the
  167. * the user that it is no longer joined to the channel.
  168. */
  169. /*
  170. * GCC_SEND_DATA_INDICATION
  171. *
  172. * Parameter1:
  173. * PSendData
  174. * This is a pointer to a SendData structure that contains all
  175. * information about the data received.
  176. * Parameter2: Unused
  177. *
  178. * Functional Description:
  179. * This indication is sent to a user object when data is received
  180. * by the local MCS provider on a channel to which the user is joined.
  181. */
  182. /*
  183. * GCC_UNIFORM_SEND_DATA_INDICATION
  184. *
  185. * Parameter1:
  186. * PSendData
  187. * This is a pointer to a SendData structure that contains all
  188. * information about the data received.
  189. * Parameter2: Unused
  190. *
  191. * Functional Description:
  192. * This indication is sent to a user object when data is received
  193. * by the local MCS provider on a channel to which the user is joined.
  194. */
  195. /*
  196. * TRANSPORT_STATUS_INDICATION
  197. *
  198. * Parameter1:
  199. * PTransportStatus
  200. * This is a pointer to a TransportStatus structure that contains
  201. * information about this indication. This structure is defined in
  202. * "transprt.h".
  203. *
  204. * Functional Description:
  205. * A transport stack will issue this indication when it detects a status
  206. * change of some sort. It fills in the TransportStatus structure to
  207. * describe the state change and the sends it to MCS. MCS fills in the
  208. * field containing the name of the stack (using the transport identifier),
  209. * and forwards it to GCC.
  210. */
  211. class CConf;
  212. class MCSUser;
  213. class CMCSUserList : public CList
  214. {
  215. DEFINE_CLIST(CMCSUserList, MCSUser*)
  216. };
  217. class MCSDLLInterface
  218. {
  219. public:
  220. MCSDLLInterface(PMCSError);
  221. ~MCSDLLInterface ();
  222. MCSError CreateDomain(GCCConfID *domain_selector)
  223. {
  224. ASSERT (g_pMCSController != NULL);
  225. return g_pMCSController->HandleAppletCreateDomain(domain_selector);
  226. };
  227. MCSError DeleteDomain(GCCConfID *domain_selector)
  228. {
  229. ASSERT (g_pMCSController != NULL);
  230. return g_pMCSController->HandleAppletDeleteDomain(domain_selector);
  231. }
  232. MCSError ConnectProviderRequest (
  233. GCCConfID *calling_domain,
  234. GCCConfID *called_domain,
  235. TransportAddress calling_address,
  236. TransportAddress called_address,
  237. BOOL fSecure,
  238. DBBoolean upward_connection,
  239. PUChar user_data,
  240. ULong user_data_length,
  241. PConnectionHandle connection_handle,
  242. PDomainParameters domain_parameters,
  243. CConf *confirm_object);
  244. MCSError ConnectProviderResponse (
  245. ConnectionHandle connection_handle,
  246. GCCConfID *domain_selector,
  247. PDomainParameters domain_parameters,
  248. Result result,
  249. PUChar user_data,
  250. ULong user_data_length);
  251. MCSError DisconnectProviderRequest (
  252. ConnectionHandle connection_handle);
  253. MCSError AttachUserRequest (
  254. GCCConfID *domain_selector,
  255. PIMCSSap *ppMCSSap,
  256. MCSUser *user_object);
  257. MCSError DetachUserRequest (
  258. PIMCSSap pMCSSap,
  259. MCSUser *pMCSUser);
  260. MCSError ChannelJoinRequest (
  261. ChannelID channel_id,
  262. PIMCSSap pMCSSap)
  263. {
  264. return pMCSSap->ChannelJoin (channel_id);
  265. };
  266. MCSError ChannelLeaveRequest (
  267. ChannelID channel_id,
  268. PIMCSSap pMCSSap)
  269. {
  270. return pMCSSap->ChannelLeave (channel_id);
  271. };
  272. MCSError SendDataRequest (
  273. ChannelID channel_id,
  274. PIMCSSap pMCSSap,
  275. Priority priority,
  276. PUChar user_data,
  277. ULong user_data_length)
  278. {
  279. return pMCSSap->SendData (NORMAL_SEND_DATA,
  280. channel_id,
  281. priority,
  282. user_data,
  283. user_data_length,
  284. APP_ALLOCATION);
  285. };
  286. MCSError UniformSendDataRequest (
  287. ChannelID channel_id,
  288. PIMCSSap pMCSSap,
  289. Priority priority,
  290. PUChar user_data,
  291. ULong user_data_length)
  292. {
  293. return pMCSSap->SendData (UNIFORM_SEND_DATA,
  294. channel_id,
  295. priority,
  296. user_data,
  297. user_data_length,
  298. APP_ALLOCATION);
  299. };
  300. MCSError TokenGrabRequest (
  301. PIMCSSap pMCSSap,
  302. TokenID token_id)
  303. {
  304. return pMCSSap->TokenGrab (token_id);
  305. };
  306. MCSError TokenGiveRequest (
  307. PIMCSSap pMCSSap,
  308. TokenID token_id,
  309. UserID receiver_id)
  310. {
  311. return pMCSSap->TokenGive (token_id,
  312. receiver_id);
  313. };
  314. MCSError TokenGiveResponse (
  315. PIMCSSap pMCSSap,
  316. TokenID token_id,
  317. Result result)
  318. {
  319. return pMCSSap->TokenGiveResponse (token_id,
  320. result);
  321. };
  322. MCSError TokenPleaseRequest (
  323. PIMCSSap pMCSSap,
  324. TokenID token_id)
  325. {
  326. return pMCSSap->TokenPlease (token_id);
  327. };
  328. MCSError TokenReleaseRequest (
  329. PIMCSSap pMCSSap,
  330. TokenID token_id)
  331. {
  332. return pMCSSap->TokenRelease (token_id);
  333. };
  334. MCSError TokenTestRequest (
  335. PIMCSSap pMCSSap,
  336. TokenID token_id)
  337. {
  338. return pMCSSap->TokenTest (token_id);
  339. };
  340. #ifdef NM_RESET_DEVICE
  341. MCSError ResetDevice (
  342. PChar device_identifier)
  343. {
  344. return MCSResetDevice (device_identifier);
  345. };
  346. #endif // NM_RESET_DEVICE
  347. GCCError TranslateMCSIFErrorToGCCError (MCSError mcs_error)
  348. {
  349. return ((mcs_error <= MCS_SECURITY_FAILED) ?
  350. (GCCError) mcs_error : GCC_UNSUPPORTED_ERROR);
  351. };
  352. void ProcessCallback (
  353. unsigned int message,
  354. LPARAM parameter,
  355. PVoid object_ptr);
  356. private:
  357. MCSError AddObjectToConfirmList (
  358. CConf *confirm_object,
  359. ConnectionHandle connection_handle);
  360. DBBoolean IsUserAttachmentVaid (
  361. MCSUser *user_object)
  362. {
  363. return (m_MCSUserList.Find(user_object));
  364. };
  365. CConnHdlConfList2 m_ConfirmConnHdlConfList2;
  366. CMCSUserList m_MCSUserList;
  367. };
  368. typedef MCSDLLInterface * PMCSDLLInterface;
  369. GCCResult TranslateMCSResultToGCCResult ( Result mcs_result );
  370. /*
  371. * MCSDLLInterface ( HANDLE instance_handle,
  372. * PMCSError error_value)
  373. *
  374. * Functional Description:
  375. * This is the constructor for the MCS Interface class. It is responsible
  376. * for initializing the MCAT MCS DLL. Any errors that occur during
  377. * initialization are returned in the error_value provided.
  378. *
  379. * Formal Parameters:
  380. * instance_handle (i)
  381. * The windows instance handle is used when creating MCS diagnostics.
  382. * error_value (i)
  383. * This pointer is used to pass back any errors that may have occured
  384. * while initializing the class. This includes any problems with
  385. * initializing the MCAT MCS DLL.
  386. *
  387. * Return Value:
  388. * None.
  389. *
  390. * Side Effects:
  391. * None.
  392. *
  393. * Caveats:
  394. * None.
  395. */
  396. /*
  397. * ~MCSDLLInterface ()
  398. *
  399. * Functional Description:
  400. * This is the destructor for the MCS Interface class. It is responsible
  401. * for cleaning up both itself and the MCAT MCS DLL.
  402. *
  403. * Formal Parameters:
  404. * None.
  405. *
  406. * Return Value:
  407. * None.
  408. *
  409. * Side Effects:
  410. * None.
  411. *
  412. * Caveats:
  413. * None.
  414. */
  415. /*
  416. * MCSError CreateDomain (
  417. * DomainSelector domain_selector_string,
  418. * UINT domain_selector_length)
  419. *
  420. * Functional Description:
  421. * This function is used to create an MCS domain.
  422. *
  423. * Formal Parameters:
  424. * domain_selector_string (i)
  425. * This is the name of the domain to be created.
  426. * domain_selector_length (i)
  427. * This is the length of the domain name in characters.
  428. *
  429. * Return Value:
  430. * MCS_NO_ERROR
  431. * On success
  432. * MCS_NOT_INITIALIZED
  433. * The mcs interface did not initialize properly
  434. * MCS_DOMAIN_ALREADY_EXISTS
  435. * A domain by this name alread exist
  436. * MCS_ALLOCATION_FAILURE
  437. * A memory failure occured
  438. *
  439. * Side Effects:
  440. * None.
  441. *
  442. * Caveats:
  443. * None.
  444. */
  445. /*
  446. * MCSError DeleteDomain (
  447. * DomainSelector domain_selector_string,
  448. * UINT domain_selector_length)
  449. *
  450. * Functional Description:
  451. * This function an MCS domain which was created using the CreateDomain
  452. * call.
  453. *
  454. * Formal Parameters:
  455. * domain_selector_string (i)
  456. * This is the name of the domain to be deleted.
  457. * domain_selector_length (i)
  458. * This is the length of the domain name in characters.
  459. *
  460. * Return Value:
  461. * MCS_NO_ERROR
  462. * On success
  463. * MCS_NOT_INITIALIZED
  464. * The mcs interface did not initialize properly
  465. * MCS_NO_SUCH_DOMAIN
  466. * The domain to be deleted does not exist
  467. *
  468. * Side Effects:
  469. * None.
  470. *
  471. * Caveats:
  472. * None.
  473. */
  474. /*
  475. * MCSError ConnectProviderRequest (
  476. * DomainSelector calling_domain,
  477. * UINT calling_domain_length,
  478. * DomainSelector called_domain,
  479. * UINT called_domain_length,
  480. * TransportAddress calling_address,
  481. * TransportAddress called_address,
  482. * DBBoolean upward_connection,
  483. * PUChar user_data,
  484. * ULong user_data_length,
  485. * PConnectionHandle connection_handle,
  486. * PDomainParameters domain_parameters,
  487. * CConf *confirm_object)
  488. *
  489. * Functional Description:
  490. * This T.122 primitive is used to connect two domains. This request
  491. * should always be followed by a connect provider confirm. The
  492. * confirm will be sent to be object specified by the confirm object
  493. * the is passed into this routine.
  494. *
  495. * Formal Parameters:
  496. * calling_domain (i)
  497. * This is a pointer to the calling domain selector string.
  498. * calling_domain_length (i)
  499. * This is the length of the calling domain selector string.
  500. * called_domain (i)
  501. * This is a pointer to the called domain selector string.
  502. * called_domain_length (i)
  503. * This is the length of the called domain selector length.
  504. * calling_address (i)
  505. * This is a pointer to the calling addres (an ASCII string).
  506. * called_address (i)
  507. * This is a pointer to the address being called (an ASCII string).
  508. * upward_connection (i)
  509. * This boolean flag denotes the hierarchical direction of the
  510. * connection to be created (TRUE means upward, FALSE means downward).
  511. * user_data (i)
  512. * This is a pointer to the user data to be transmitted during the
  513. * creation of this new connection.
  514. * user_data_length (i)
  515. * This is the length of the user data field mentioned above.
  516. * connection_handle (o)
  517. * This is set by MCS to a unique handle that can be used to access
  518. * this connection on subsequent calls.
  519. * domain_parameters (i)
  520. * This is a pointer to a structure containing the domain parameters
  521. * that the node controller wishes to use for this new connection.
  522. * confirm_object (i)
  523. * This is a pointer to the object that the connect provider response
  524. * is sent to.
  525. * object_message_base (i)
  526. * This message base is added to the connect provider response
  527. * message.
  528. *
  529. * Return Value:
  530. * MCS_NO_ERROR
  531. * On success
  532. * MCS_NOT_INITIALIZED
  533. * The mcs interface did not initialize properly
  534. * MCS_NO_SUCH_DOMAIN
  535. * The domain to connect does not exist
  536. * MCS_DOMAIN_NOT_HIERARCHICAL
  537. * An upward connection from this domain already exist
  538. * MCS_NVALID_ADDRESS_PREFIX
  539. * The transport prefix is not recognized
  540. * MCS_ALLOCATION_FAILURE
  541. * A memory failure occured
  542. * MCS_INVALID_PARAMETER
  543. * One of the parameters to the request is invalid
  544. *
  545. * Side Effects:
  546. * None.
  547. *
  548. * Caveats:
  549. * None.
  550. */
  551. /*
  552. * MCSError ConnectProviderResponse (
  553. * ConnectionHandle connection_handle,
  554. * DomainSelector domain_selector,
  555. * UINT domain_selector_length,
  556. * PDomainParameters domain_parameters,
  557. * Result result,
  558. * PUChar user_data,
  559. * ULong user_data_length)
  560. *
  561. * Functional Description:
  562. * This function is used to respond to a connect provider indication.
  563. * This call will result in a connect provider confirm at the remote
  564. * node.
  565. *
  566. * Formal Parameters:
  567. * connection_handle (i)
  568. * This is the handle of the connection that the response is for.
  569. * domain_selector (i)
  570. * This is a pointer to the domain selector identifying which domain
  571. * the inbound connection is to be bound to.
  572. * domain_selector_length (i)
  573. * This is the length of the above domain selector.
  574. * domain_parameters (i)
  575. * This is a pointer to a structure containing the domain parameters
  576. * that the node controller has agreed to use for the connection
  577. * being created.
  578. * result (i)
  579. * This is the result. This determines whether an inbound connection
  580. * is accepted or rejected. Anything but RESULT_SUCCESSFUL rejects
  581. * the connection.
  582. * user_data (i)
  583. * This is the address of user data to be sent in the connect response
  584. * PDU.
  585. * user_data_length (i)
  586. * This is the length of the user data mentioned above.
  587. *
  588. * Return Value:
  589. * MCS_NO_ERROR
  590. * On success
  591. * MCS_NOT_INITIALIZED
  592. * The mcs interface did not initialize properly
  593. * MCS_NO_SUCH_CONNECTION
  594. * The connection specified is invalid
  595. *
  596. * Side Effects:
  597. * None.
  598. *
  599. * Caveats:
  600. * None.
  601. */
  602. /*
  603. * MCSError DisconnectProviderRequest (
  604. * ConnectionHandle connection_handle)
  605. *
  606. * Functional Description:
  607. * This function is used to disconnect a node from a particular connection.
  608. * This can be either an upward or downward connection
  609. *
  610. * Formal Parameters:
  611. * connection_handle (i)
  612. * This is the handle of the connection which the node controller wants
  613. * to disconnect.
  614. *
  615. * Return Value:
  616. * MCS_NO_ERROR
  617. * On success
  618. * MCS_NOT_INITIALIZED
  619. * The mcs interface did not initialize properly
  620. * MCS_NO_SUCH_CONNECTION
  621. * The connection specified is invalid
  622. *
  623. * Side Effects:
  624. * None.
  625. *
  626. * Caveats:
  627. * None.
  628. */
  629. /*
  630. * MCSError AttachUserRequest (
  631. * DomainSelector domain_selector,
  632. * UINT domain_selector_length,
  633. * PIMCSSap *ppMCSSap,
  634. * PMCSUser user_object)
  635. *
  636. * Functional Description:
  637. * This function is used to create a user attachment to MCS. It will result
  638. * in an attach user confirm.
  639. *
  640. * Formal Parameters:
  641. * domain_selector (i)
  642. * This is the name of the domain to which the user wishes to attach.
  643. * domain_selector_length (i)
  644. * This is the length of the above domain selector.
  645. * ppMCSSap (o)
  646. * This is a pointer to a variable where the new user handle will be
  647. * stored upon successful completion of this call.
  648. * user_object (i)
  649. * This is a pointer to the MCSUser object which should receive the callbacks
  650. * for this user attachment.
  651. *
  652. * Return Value:
  653. * MCS_NO_ERROR
  654. * On success
  655. * MCS_NO_SUCH_DOMAIN
  656. * The domain to be attached to does not exist
  657. * MCS_ALLOCATION_FAILURE
  658. * A memory failure occured
  659. *
  660. * Side Effects:
  661. * None.
  662. *
  663. * Caveats:
  664. * None.
  665. */
  666. /*
  667. * void ProcessCallback ( UINT message,
  668. * ULong parameter,
  669. * PVoid object_ptr)
  670. *
  671. * Functional Description:
  672. * This routine is called whenever a callback message is received by
  673. * the "C" callback routine. It is responsible for both processing
  674. * callback messages and forwarding callback messages on to the
  675. * appropriate object.
  676. *
  677. * Formal Parameters:
  678. * message (i)
  679. * This is the mcs message to be processed
  680. * parameter (i)
  681. * Varies according to the message. See the MCAT programmers manual
  682. * object_ptr (i)
  683. * This is the user defined field that was passed to MCS on
  684. * initialization.
  685. *
  686. * Return Value:
  687. * MCS_NO_ERROR
  688. *
  689. * Side Effects:
  690. * None.
  691. *
  692. * Caveats:
  693. * None.
  694. */
  695. /*
  696. * MCSDLLInterface::TranslateMCSIFErrorToGCCError ()
  697. * MCSError mcs_error)
  698. *
  699. * Public
  700. *
  701. * Function Description
  702. * This routine translate an MCS Interface error into a GCC Error.
  703. *
  704. * Formal Parameters:
  705. * mcs_error (i)
  706. * This is the error to be translated.
  707. *
  708. * Return Value:
  709. * This is the translated GCC error.
  710. *
  711. * Side Effects:
  712. * None.
  713. *
  714. * Caveats:
  715. * None.
  716. */
  717. #endif
  718.