group_common.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * SRT - Secure, Reliable, Transport
  3. * Copyright (c) 2021 Haivision Systems Inc.
  4. *
  5. * This Source Code Form is subject to the terms of the Mozilla Public
  6. * License, v. 2.0. If a copy of the MPL was not distributed with this
  7. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  8. *
  9. */
  10. /*****************************************************************************
  11. Written by
  12. Haivision Systems Inc.
  13. *****************************************************************************/
  14. #ifndef INC_SRT_GROUP_COMMON_H
  15. #define INC_SRT_GROUP_COMMON_H
  16. #include "srt.h"
  17. #include "common.h"
  18. #include "core.h"
  19. #include <list>
  20. namespace srt
  21. {
  22. namespace groups
  23. {
  24. typedef SRT_MEMBERSTATUS GroupState;
  25. struct SocketData
  26. {
  27. SRTSOCKET id; // same as ps->m_SocketID
  28. CUDTSocket* ps;
  29. int token;
  30. SRT_SOCKSTATUS laststatus;
  31. GroupState sndstate;
  32. GroupState rcvstate;
  33. int sndresult;
  34. int rcvresult;
  35. sockaddr_any agent;
  36. sockaddr_any peer;
  37. bool ready_read;
  38. bool ready_write;
  39. bool ready_error;
  40. // Configuration
  41. uint16_t weight;
  42. // Stats
  43. int64_t pktSndDropTotal;
  44. };
  45. SocketData prepareSocketData(CUDTSocket* s);
  46. typedef std::list<SocketData> group_t;
  47. typedef group_t::iterator gli_t;
  48. } // namespace groups
  49. } // namespace srt
  50. #endif // INC_SRT_GROUP_COMMON_H