Msp.Idl
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:8k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. cpp_quote("/* Copyright (c) Microsoft Corporation. All rights reserved.*/")
  4. ///////////////////////////////////////////////////////////////////////////
  5. // msp.idl : IDL source for Media Service Provider interface
  6. /////////////////////////////////////////////////////////////////////////////
  7. #ifndef __MEDIA_STREAM_PROVIDER_IDL__
  8. #define __MEDIA_STREAM_PROVIDER_IDL__
  9. import "tapi3if.idl";
  10. /////////////////////////////////////////////////////////////////////////////
  11. // Forward declarations
  12. /////////////////////////////////////////////////////////////////////////////
  13. /////////////////////////////////////////////////////////////////////////////
  14. // Type definitions
  15. /////////////////////////////////////////////////////////////////////////////
  16. typedef long * MSP_HANDLE;
  17. typedef enum
  18. {
  19.     ADDRESS_TERMINAL_AVAILABLE,   // new terminal arrived via PNP
  20.     //    ITTerminal *
  21.     ADDRESS_TERMINAL_UNAVAILABLE, // terminal gone via PNP
  22.     //    ITTerminal *
  23. } MSP_ADDRESS_EVENT;
  24. typedef enum
  25. {
  26.     // In each case the MSP fills in as much as much info as it can. Terminals
  27.     // or error codes may not be available, in which case the MSP fills in zero.
  28.     // The bare-bones info needed is indicated here.
  29.     CALL_NEW_STREAM, // - a new stream is created by the call. The app can
  30.     // choose to select a terminal or delete the stream from the call.
  31.     //    ITStream * 
  32.     CALL_STREAM_FAIL, // - setup of the stream failed or the stream fails to start.
  33.     //    ITStream * 
  34.     //    Error code
  35.     CALL_TERMINAL_FAIL, // - The terminal failed to connect.    
  36.     //    ITTerminal *
  37.     //    Error code
  38.     CALL_STREAM_NOT_USED, // - The stream is not used in the call (the remote
  39.     // party rejected it).
  40.     //    ITStream *
  41.     CALL_STREAM_ACTIVE, // - The app needs this event to decide when a
  42.     // stream can be used to send and receive data. 
  43.     // It is fired when the streams enter running state 
  44.     // (the timing of which is determined by the TSP).
  45.     //    ITStream *
  46.     CALL_STREAM_INACTIVE // - No more data can be sent to or received from
  47.     // this stream. This happens when a send stream
  48.     // has sent all its data, or when a receive stream
  49.     // stops receiving data.
  50.     //    ITStream *
  51. } MSP_CALL_EVENT;
  52. typedef enum
  53. {
  54.     CALL_CAUSE_UNKNOWN,
  55.     CALL_CAUSE_BAD_DEVICE,
  56.     // a bad device caused failure, for either STREAM_FAIL or TERMINAL_FAIL.
  57.     CALL_CAUSE_CONNECT_FAIL,
  58.     // either connecting the stream failed or connecting the terminal failed.
  59.     // Note, if a terminal can not be connected to a stream, the app will get
  60.     // a TERMINAL_FAIL event with CMC_CONNECT_FAIL. If this stream failed
  61.     // because the terminal is the only one to use, the app will also get a
  62.     // STREAM_FAIL event with CMC_CONNECT_FAIL.
  63.     CALL_CAUSE_LOCAL_REQUEST,
  64.     // the event is the result of the app抯 calling a method on the stream.
  65.     CALL_CAUSE_REMOTE_REQUEST,
  66.     // the event is the result of the remote endpoint抯 request.
  67.     CALL_CAUSE_MEDIA_TIMEOUT,
  68.     // the media that carries the stream is temporarily not available.
  69.     CALL_CAUSE_MEDIA_RECOVERED,
  70.     // the media goes back to normal from a temporary deny of service.
  71. CALL_CAUSE_QUALITY_OF_SERVICE
  72. // the event is because qos does/doesn't allow the media to send.
  73. } MSP_CALL_EVENT_CAUSE;
  74. typedef enum
  75. {
  76.     ME_ADDRESS_EVENT,
  77.     ME_CALL_EVENT,
  78.     ME_TSP_DATA,
  79.     ME_PRIVATE_EVENT,
  80.     ME_ASR_TERMINAL_EVENT,
  81.     ME_TTS_TERMINAL_EVENT,
  82.     ME_FILE_TERMINAL_EVENT,
  83.     ME_TONE_TERMINAL_EVENT
  84. } MSP_EVENT;
  85. typedef struct
  86. {
  87.     DWORD               dwSize;         // total size
  88.     MSP_EVENT           Event;          // event type
  89.     MSP_HANDLE          hCall;          // may be NULL
  90.     [switch_type(MSP_EVENT), switch_is((MSP_EVENT)Event)]
  91.     union
  92.     {
  93.         [case(ME_ADDRESS_EVENT)] 
  94.         struct
  95.         {
  96.             MSP_ADDRESS_EVENT   Type;
  97.             ITTerminal        * pTerminal;
  98.         } MSP_ADDRESS_EVENT_INFO;
  99.         [case(ME_CALL_EVENT)] 
  100.         struct 
  101.         {
  102.             MSP_CALL_EVENT         Type;
  103.             MSP_CALL_EVENT_CAUSE   Cause;
  104.             ITStream             * pStream;
  105.             ITTerminal           * pTerminal;
  106.             HRESULT                hrError;
  107.         } MSP_CALL_EVENT_INFO;
  108.         [case(ME_TSP_DATA)] 
  109.         struct
  110.         {
  111.             DWORD               dwBufferSize;
  112.             BYTE                pBuffer[1];
  113.         } MSP_TSP_DATA;
  114.         [case(ME_PRIVATE_EVENT)]
  115.         struct
  116.         {
  117.             IDispatch         * pEvent;
  118.             long                lEventCode;
  119.         } MSP_PRIVATE_EVENT_INFO;
  120.         [case(ME_FILE_TERMINAL_EVENT)]
  121.         struct
  122.         {
  123.             ITTerminal                      * pParentFileTerminal;
  124.             ITFileTrack                     * pFileTrack;
  125.             TERMINAL_MEDIA_STATE              TerminalMediaState;
  126.             FT_STATE_EVENT_CAUSE              ftecEventCause;
  127.             HRESULT                           hrErrorCode;
  128.         } MSP_FILE_TERMINAL_EVENT_INFO;
  129.         [case(ME_ASR_TERMINAL_EVENT)]
  130.         struct
  131.         {
  132.             ITTerminal                      * pASRTerminal;
  133.             HRESULT                           hrErrorCode;
  134.         } MSP_ASR_TERMINAL_EVENT_INFO;
  135.         [case(ME_TTS_TERMINAL_EVENT)]
  136.         struct
  137.         {
  138.             ITTerminal                      * pTTSTerminal;
  139.             HRESULT                           hrErrorCode;
  140.         } MSP_TTS_TERMINAL_EVENT_INFO;
  141.         [case(ME_TONE_TERMINAL_EVENT)]
  142.         struct
  143.         {
  144.             ITTerminal                      * pToneTerminal;
  145.             HRESULT                           hrErrorCode;
  146.         } MSP_TONE_TERMINAL_EVENT_INFO;
  147.     };
  148. } MSP_EVENT_INFO;
  149. /////////////////////////////////////////////////////////////////////////////
  150. // Interface definitions
  151. /////////////////////////////////////////////////////////////////////////////
  152. [
  153.     uuid(6E0887BE-BA1A-492e-BD10-4020EC5E33E0),
  154.     helpstring("ITPluggableTerminalEventSink"),
  155.     pointer_default(unique)
  156. ]
  157. interface ITPluggableTerminalEventSink : IUnknown
  158. {
  159.     HRESULT FireEvent(
  160.         [in] const MSP_EVENT_INFO *pMspEventInfo
  161.         );
  162. }
  163. [
  164.     uuid(F7115709-A216-4957-A759-060AB32A90D1),
  165.     helpstring("ITPluggableTerminalEventSinkRegistration"),
  166.     pointer_default(unique)
  167. ]
  168. interface ITPluggableTerminalEventSinkRegistration : IUnknown
  169. {
  170.     HRESULT RegisterSink(
  171.         [in] ITPluggableTerminalEventSink* pEventSink
  172.         );
  173.     HRESULT UnregisterSink(
  174.         );
  175. }
  176. [
  177.     uuid(EE3BD600-3868-11D2-A045-00C04FB6809F),
  178.     helpstring("ITMSPAddress Interface"),
  179.     pointer_default(unique)
  180. ]
  181. interface ITMSPAddress : IUnknown
  182. {
  183.     HRESULT Initialize(
  184.         [in] MSP_HANDLE hEvent
  185.         );
  186.     HRESULT Shutdown();
  187.     HRESULT CreateMSPCall(
  188.         [in] MSP_HANDLE hCall,
  189.         [in] DWORD dwReserved,
  190.         [in] DWORD dwMediaType,
  191.         [in] IUnknown * pOuterUnknown,
  192.         [out] IUnknown ** ppStreamControl
  193.         );
  194.     HRESULT ShutdownMSPCall(
  195.         [in] IUnknown * pStreamControl
  196.         );
  197.     HRESULT ReceiveTSPData(
  198.         [in] IUnknown * pMSPCall,
  199.         [in, size_is(dwSize)] BYTE * pBuffer,
  200.         [in] DWORD dwSize
  201.         );
  202.     HRESULT GetEvent(
  203.         [in,out] DWORD * pdwSize,
  204.         [in, out, size_is(*pdwSize)] byte * pEventBuffer
  205.         );
  206. }
  207. #endif // __MEDIA_STREAM_PROVIDER_IDL__