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.

174 lines
4.5 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. AgentHand.h
  5. Abstract:
  6. Declaration of the CAgentHandler Class
  7. Author:
  8. noela 02-06-98
  9. Notes:
  10. Revision History:
  11. --*/
  12. #ifndef __AGENTHANDLER_H
  13. #define __AGENTHANDLER_H
  14. #include "resource.h" // main symbols
  15. class CAgent;
  16. class CTAPI;
  17. class CAgentSession;
  18. class CQueue;
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CAgentHandler
  21. class ATL_NO_VTABLE CAgentHandler :
  22. public CTAPIComObjectRoot<CAgentHandler>,
  23. public IDispatchImpl<ITAgentHandler, &IID_ITAgentHandler, &LIBID_TAPI3Lib>,
  24. public CObjectSafeImpl
  25. {
  26. private:
  27. PWSTR m_szName;
  28. GUID m_GUID;
  29. AddressLineStruct * m_pAddressLine; // Where we find our hLine
  30. CTAPI * m_tapiObj; // Tapi obj this AH belongs to
  31. GroupArray m_GroupArray;
  32. AgentArray m_AgentArray;
  33. AddressArray m_AddressArray;
  34. CHashTable m_AgentSessionHashtable;
  35. CHashTable m_QueueHashtable;
  36. public:
  37. CAgentHandler(){}
  38. GUID getHandle() {return m_GUID;}
  39. HRESULT InternalCreateAgent(BSTR pID, BSTR pPIN, CAgent ** ppAgent);
  40. void AddAddress(CAddress *pAddress);
  41. HLINE getHLine();
  42. CTAPI * GetTapi() { return m_tapiObj; }
  43. HRESULT UpdateGroupArray();
  44. void FinalRelease();
  45. void AddAgentSessionToHash(HAGENTSESSION hSession, CAgentSession *pSession)
  46. {
  47. m_AgentSessionHashtable.Lock();
  48. m_AgentSessionHashtable.Insert( (ULONG_PTR)(hSession), (ULONG_PTR)pSession );
  49. m_AgentSessionHashtable.Unlock();
  50. }
  51. void RemoveAgentSessionFromHash(HAGENTSESSION hSession)
  52. {
  53. m_AgentSessionHashtable.Lock();
  54. m_AgentSessionHashtable.Remove( (ULONG_PTR)(hSession) );
  55. m_AgentSessionHashtable.Unlock();
  56. }
  57. BOOL FindSessionObject(HAGENTSESSION hAgentSession, CAgentSession ** ppAgentSession);
  58. void AddQueueToHash(DWORD dwQueueID, CQueue *pQueue)
  59. {
  60. m_QueueHashtable.Lock();
  61. m_QueueHashtable.Insert( (ULONG_PTR)(dwQueueID), (ULONG_PTR)pQueue );
  62. m_QueueHashtable.Unlock();
  63. }
  64. void RemoveQueueFromHash(DWORD dwQueueID)
  65. {
  66. m_QueueHashtable.Lock();
  67. m_QueueHashtable.Remove( (ULONG_PTR)(dwQueueID) );
  68. m_QueueHashtable.Unlock();
  69. }
  70. BOOL FindQueueObject(DWORD dwQueueID,CQueue ** ppQueue);
  71. BOOL FindAgentObject( HAGENT hAgent, CAgent ** ppAgent);
  72. DECLARE_MARSHALQI(CAgentHandler)
  73. DECLARE_QI()
  74. DECLARE_TRACELOG_CLASS(CAgentHandler)
  75. BEGIN_COM_MAP(CAgentHandler)
  76. COM_INTERFACE_ENTRY(ITAgentHandler)
  77. COM_INTERFACE_ENTRY(IDispatch)
  78. COM_INTERFACE_ENTRY(IObjectSafety)
  79. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  80. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  81. END_COM_MAP()
  82. // ITAgentHandler
  83. public:
  84. STDMETHOD(get_Name)(BSTR * ppName);
  85. STDMETHOD(CreateAgent)(ITAgent **ppAgent);
  86. STDMETHOD(CreateAgentWithID)(BSTR pID, BSTR pPIN, ITAgent **ppAgent);
  87. STDMETHOD(EnumerateACDGroups)(IEnumACDGroup ** ppEnumGroup);
  88. STDMETHOD(get_ACDGroups)(VARIANT * pVariant);
  89. STDMETHOD(EnumerateUsableAddresses)(IEnumAddress ** ppEnumAddress);
  90. STDMETHOD(get_UsableAddresses)(VARIANT * pVariant);
  91. STDMETHOD(Initialize) (PWSTR proxyName, GUID proxyGUID, CTAPI *tapiObj);
  92. };
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CAgentHandlerEvent
  95. class ATL_NO_VTABLE CAgentHandlerEvent :
  96. public CTAPIComObjectRoot<CAgentHandlerEvent>,
  97. public IDispatchImpl<ITAgentHandlerEvent, &IID_ITAgentHandlerEvent, &LIBID_TAPI3Lib>,
  98. public CObjectSafeImpl
  99. {
  100. protected:
  101. AGENTHANDLER_EVENT m_AgentHandlerEvent;
  102. ITAgentHandler * m_pAgentHandler;
  103. public:
  104. CAgentHandlerEvent()
  105. {
  106. }
  107. static HRESULT FireEvent(
  108. CAgentHandler * pAgentHandler,
  109. AGENTHANDLER_EVENT Event
  110. );
  111. void FinalRelease();
  112. DECLARE_MARSHALQI(CAgentHandlerEvent)
  113. DECLARE_TRACELOG_CLASS(CAgentHandlerEvent)
  114. BEGIN_COM_MAP(CAgentHandlerEvent)
  115. COM_INTERFACE_ENTRY(ITAgentHandlerEvent)
  116. COM_INTERFACE_ENTRY(IDispatch)
  117. COM_INTERFACE_ENTRY(IObjectSafety)
  118. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  119. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  120. END_COM_MAP()
  121. // CAgentHandlerEvent
  122. public:
  123. STDMETHOD(get_Event)(AGENTHANDLER_EVENT * pEvent);
  124. STDMETHOD(get_AgentHandler)(ITAgentHandler ** ppAgentHandler);
  125. };
  126. #endif //__AGENTHANDLER_H