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.

178 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. bridgetm.h
  5. Abstract:
  6. Definitions for the bridge terminals.
  7. Author:
  8. Mu Han (muhan) 11/12/1998
  9. --*/
  10. #ifndef _BRIDGETERM_H_
  11. #define _BRIDGETERM_H_
  12. /////////////////////////////////////////////////////////////////////////////
  13. /////////////////////////////////////////////////////////////////////////////
  14. //
  15. // CIPConfBaseTerminal
  16. //
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. /////////////////////////////////////////////////////////////////////////////
  20. class CIPConfBaseTerminal :
  21. virtual public CComObjectRootEx<CComMultiThreadModelNoCS>, // we have our own CS implementation
  22. public IDispatchImpl<ITTerminal, &IID_ITTerminal, &LIBID_TAPI3Lib>,
  23. public ITTerminalControl
  24. {
  25. BEGIN_COM_MAP(CIPConfBaseTerminal)
  26. COM_INTERFACE_ENTRY(IDispatch)
  27. COM_INTERFACE_ENTRY(ITTerminal)
  28. COM_INTERFACE_ENTRY(ITTerminalControl)
  29. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  30. END_COM_MAP()
  31. DECLARE_GET_CONTROLLING_UNKNOWN()
  32. public:
  33. CIPConfBaseTerminal(
  34. const GUID & ClassID,
  35. TERMINAL_DIRECTION TerminalDirection,
  36. TERMINAL_TYPE TerminalType,
  37. DWORD dwMediaType
  38. );
  39. HRESULT FinalConstruct();
  40. virtual ~CIPConfBaseTerminal();
  41. public:
  42. // ITTerminal -- COM interface for use by MSP or application
  43. STDMETHOD(get_TerminalClass)(OUT BSTR *pVal);
  44. STDMETHOD(get_TerminalType) (OUT TERMINAL_TYPE *pVal);
  45. STDMETHOD(get_State) (OUT TERMINAL_STATE *pVal);
  46. STDMETHOD(get_Name) (OUT BSTR *pVal);
  47. STDMETHOD(get_MediaType) (OUT long * plMediaType);
  48. STDMETHOD(get_Direction) (OUT TERMINAL_DIRECTION *pDirection);
  49. // ITTerminalControl -- COM interface for use by MSP only
  50. STDMETHOD (get_AddressHandle) (
  51. OUT MSP_HANDLE * phtAddress
  52. );
  53. STDMETHOD (CompleteConnectTerminal) (void);
  54. STDMETHOD (RunRenderFilter) (void);
  55. STDMETHOD (StopRenderFilter) (void);
  56. public:
  57. HRESULT Initialize(
  58. IN WCHAR * strName,
  59. IN MSP_HANDLE htAddress,
  60. IN DWORD dwMediaType
  61. );
  62. protected:
  63. void Lock() { EnterCriticalSection(&m_CritSec); }
  64. void Unlock() { LeaveCriticalSection(&m_CritSec); }
  65. protected:
  66. // The lock that protects the data members.
  67. CRITICAL_SECTION m_CritSec;
  68. BOOL m_fCritSecValid;
  69. // these five members need to be set by the derived class.
  70. GUID m_TerminalClassID;
  71. TERMINAL_DIRECTION m_TerminalDirection;
  72. TERMINAL_TYPE m_TerminalType;
  73. TERMINAL_STATE m_TerminalState;
  74. DWORD m_dwMediaType;
  75. WCHAR m_szName[MAX_PATH + 1];
  76. MSP_HANDLE m_htAddress;
  77. // Pointer to the free threaded marshaler.
  78. IUnknown * m_pFTM;
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. /////////////////////////////////////////////////////////////////////////////
  82. //
  83. // CIPConfBridgeTerminal
  84. //
  85. //
  86. /////////////////////////////////////////////////////////////////////////////
  87. /////////////////////////////////////////////////////////////////////////////
  88. typedef enum
  89. {
  90. SOURCE,
  91. SINK
  92. } FILTER_TYPE;
  93. class CIPConfBridgeTerminal :
  94. public CIPConfBaseTerminal
  95. {
  96. public:
  97. CIPConfBridgeTerminal();
  98. virtual ~CIPConfBridgeTerminal();
  99. static HRESULT CreateTerminal(
  100. IN DWORD dwMediaType,
  101. IN MSP_HANDLE htAddress,
  102. OUT ITTerminal **ppTerm
  103. );
  104. HRESULT Initialize (
  105. IN DWORD dwMediaType,
  106. IN MSP_HANDLE htAddress
  107. );
  108. STDMETHOD (ConnectTerminal) (
  109. IN IGraphBuilder * pGraph,
  110. IN DWORD dwReserved,
  111. IN OUT DWORD * pdwNumPins,
  112. OUT IPin ** ppPins
  113. );
  114. STDMETHOD (DisconnectTerminal) (
  115. IN IGraphBuilder * pGraph,
  116. IN DWORD dwReserved
  117. );
  118. protected:
  119. HRESULT CreateFilters();
  120. HRESULT AddFilter(
  121. IN FILTER_TYPE FilterType,
  122. IN IGraphBuilder * pGraph,
  123. OUT IPin ** ppPins
  124. );
  125. protected:
  126. // The sink filter is the data sink for the upstream graph.
  127. IGraphBuilder * m_pUpStreamGraph;
  128. IBaseFilter * m_pSinkFilter;
  129. IPin* m_pSinkInputPin;
  130. // The source filter is the data source for the upstream graph.
  131. IGraphBuilder * m_pDownStreamGraph;
  132. IBaseFilter * m_pSourceFilter;
  133. IPin* m_pSourceOutputPin;
  134. };
  135. #endif // _IPConfTERM_H_