多数据源中间件标准版1.0

Session.h 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*************************************************************************
  2. 【文件名】 Session.h
  3. 【功能模块和目的】 会话管理类头文件
  4. 【开发者及日期】 郑石诺 2016/07/28
  5. 【版本】 V1.0.0
  6. 【版权信息】 Copyright (C)2016 河南华谊网络科技有限公司
  7. 【更改记录】
  8. *************************************************************************/
  9. #pragma once
  10. #include <mutex>
  11. class CFsProxy;
  12. class CVirtualChan;
  13. /*************************************************************************
  14. 【类名】 CSession
  15. 【功能】
  16. 【接口说明】 会话管理类
  17. 【开发者及日期】 郑石诺 2016/07/28
  18. 【版本】 V1.0.0
  19. 【版权信息】 Copyright (C)2016 河南华谊网络科技有限公司
  20. 【更改记录】
  21. *************************************************************************/
  22. class CSession
  23. {
  24. public:
  25. CSession(CFsProxy* pParent, LPCTSTR Id);
  26. ~CSession(void);
  27. // 属性接口
  28. LPCTSTR id(void) const { return m_Id; }
  29. bool isVoid(void) const { return m_ListChan.GetCount() == 0; }
  30. // 操作接口
  31. void prepare(PCHAN_EVENT_NOTIFY pNotify);
  32. void onChanEvent(PCHAN_EVENT_NOTIFY pNotify);
  33. void onChanDtmf(PDTMF_NOTIFY pNotify);
  34. void onChanHold(PHOLD_NOTIFY pNotify);
  35. CVirtualChan* getAssoChan(CVirtualChan* pChan);
  36. private:
  37. CVirtualChan* __getChan(LPCTSTR ChanId);
  38. CVirtualChan* __findChan(PCHAN_EVENT_NOTIFY pNotify);
  39. void __addChan(CVirtualChan* pChan);
  40. void __delChan(CVirtualChan* pChan);
  41. void __clearChan(void);
  42. void __notifySessionChanEvent(CVirtualChan* pChanHost, PCHAN_EVENT_NOTIFY pNotify);
  43. void __onChanFree(CVirtualChan* pChan, PCHAN_EVENT_NOTIFY pNotify);
  44. private:
  45. CFsProxy* m_pParent;
  46. CString m_Id;
  47. CList<CVirtualChan*, CVirtualChan*> m_ListChan;
  48. std::mutex m_LockChan; // 2020-03-02
  49. };