Rtpcommon.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _RTPCOMMON_H_
  2. #define _RTPCOMMON_H_
  3. #include <QList>
  4. /**
  5. * @brief UDP的状态
  6. *
  7. */
  8. enum class eUDPState
  9. {
  10. eUDP_None = 0, /* 未知状态 */
  11. eUDP_Init, /* 初始化 */
  12. eUDP_Opened, /* 已打开 */
  13. eUDP_Closed, /* 已关闭 */
  14. eUDP_Error /* 错误状态 */
  15. };
  16. /**
  17. 接收到的客户端结构体
  18. 这里的sessionID应该换成对比项ID加需要数据的对比项使用的通道信息,通过对比项ID加通道编号
  19. 找到对应的声卡通道
  20. */
  21. struct RtpRecvClientInfo_t
  22. {
  23. char clientIP[32]; /* 客户端IP */
  24. int clientPort; /* 客户端接收数据的UDP端口 */
  25. int compareItemID; /* 对比项ID */
  26. int compareItemRoadNum; /* 对比项的通道号 */
  27. int type; /* 包类型,0:Login,1:Heart,2:Logout */
  28. RtpRecvClientInfo_t();
  29. RtpRecvClientInfo_t(const RtpRecvClientInfo_t& other);
  30. RtpRecvClientInfo_t& operator=(const RtpRecvClientInfo_t& other);
  31. };
  32. /**
  33. * @brief 客户端信息结构体
  34. *
  35. */
  36. struct RtpSendClientInfo_t
  37. {
  38. QString localIP; /* 本地IP */
  39. int localPort = -1; /* 本地发送数据的UDP端口 */
  40. QString clientIP; /* 客户端IP */
  41. int clientPort = -1; /* 客户端接收数据的UDP端口 */
  42. // int compareItemID; /* 对比项ID */
  43. // int compareItemRoadNum; /* 对比项通道号 */
  44. int SoundCardNum; /* 声卡编号 */
  45. int SoundCardRoadNum; /* 声卡通道编号 */
  46. RtpSendClientInfo_t();
  47. RtpSendClientInfo_t(const RtpSendClientInfo_t& other);
  48. RtpSendClientInfo_t& operator=(const RtpSendClientInfo_t& other);
  49. };
  50. /**
  51. * @brief 客户端信息结构体,充当Rtp服务中客户端列表的键
  52. *
  53. */
  54. struct RtpClientKey_t
  55. {
  56. QString clientIP; /* 客户端IP */
  57. int clientPort; /* 客户端接收数据的UDP端口 */
  58. int SoundCardNum = -1; /* 声卡编号 */
  59. int SoundCardRoadNum = -1; /* 声卡通道编号 */
  60. RtpClientKey_t() = default;
  61. bool operator==(const RtpClientKey_t& other) const;
  62. bool operator<(const RtpClientKey_t& other) const;
  63. };
  64. #endif /* _RTPCOMMON_H_ */