2
0

global.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) 2020-2021 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_GLOBAL_H
  9. #define RTC_GLOBAL_H
  10. #include "common.hpp"
  11. #include <chrono>
  12. #include <future>
  13. #include <iostream>
  14. namespace rtc {
  15. enum class LogLevel { // Don't change, it must match plog severity
  16. None = 0,
  17. Fatal = 1,
  18. Error = 2,
  19. Warning = 3,
  20. Info = 4,
  21. Debug = 5,
  22. Verbose = 6
  23. };
  24. typedef std::function<void(LogLevel level, string message)> LogCallback;
  25. RTC_CPP_EXPORT void InitLogger(LogLevel level, LogCallback callback = nullptr);
  26. RTC_CPP_EXPORT void Preload();
  27. RTC_CPP_EXPORT std::shared_future<void> Cleanup();
  28. struct SctpSettings {
  29. // For the following settings, not set means optimized default
  30. optional<size_t> recvBufferSize; // in bytes
  31. optional<size_t> sendBufferSize; // in bytes
  32. optional<size_t> maxChunksOnQueue; // in chunks
  33. optional<size_t> initialCongestionWindow; // in MTUs
  34. optional<size_t> maxBurst; // in MTUs
  35. optional<unsigned int> congestionControlModule; // 0: RFC2581, 1: HSTCP, 2: H-TCP, 3: RTCC
  36. optional<std::chrono::milliseconds> delayedSackTime;
  37. optional<std::chrono::milliseconds> minRetransmitTimeout;
  38. optional<std::chrono::milliseconds> maxRetransmitTimeout;
  39. optional<std::chrono::milliseconds> initialRetransmitTimeout;
  40. optional<unsigned int> maxRetransmitAttempts;
  41. optional<std::chrono::milliseconds> heartbeatInterval;
  42. };
  43. RTC_CPP_EXPORT void SetSctpSettings(SctpSettings s);
  44. RTC_CPP_EXPORT std::ostream &operator<<(std::ostream &out, LogLevel level);
  45. } // namespace rtc
  46. #endif