reliability.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Copyright (c) 2019 Paul-Louis Ageneau
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  7. */
  8. #ifndef RTC_RELIABILITY_H
  9. #define RTC_RELIABILITY_H
  10. #include "common.hpp"
  11. #include <chrono>
  12. namespace rtc {
  13. struct Reliability {
  14. // It true, the channel does not enforce message ordering and out-of-order delivery is allowed
  15. bool unordered = false;
  16. // If both maxPacketLifeTime or maxRetransmits are unset, the channel is reliable.
  17. // If either maxPacketLifeTime or maxRetransmits is set, the channel is unreliable.
  18. // (The settings are exclusive so both maxPacketLifetime and maxRetransmits must not be set.)
  19. // Time window during which transmissions and retransmissions may occur
  20. optional<std::chrono::milliseconds> maxPacketLifeTime;
  21. // Maximum number of retransmissions that are attempted
  22. optional<unsigned int> maxRetransmits;
  23. // For backward compatibility, do not use
  24. enum class Type { Reliable = 0, Rexmit, Timed };
  25. union {
  26. Type typeDeprecated = Type::Reliable;
  27. [[deprecated("Use maxPacketLifeTime or maxRetransmits")]] Type type;
  28. };
  29. variant<int, std::chrono::milliseconds> rexmit = 0;
  30. };
  31. } // namespace rtc
  32. #endif