global.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Copyright (c) 2020-2021 Paul-Louis Ageneau
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef RTC_GLOBAL_H
  19. #define RTC_GLOBAL_H
  20. #include "common.hpp"
  21. #include <chrono>
  22. #include <iostream>
  23. namespace rtc {
  24. enum class LogLevel { // Don't change, it must match plog severity
  25. None = 0,
  26. Fatal = 1,
  27. Error = 2,
  28. Warning = 3,
  29. Info = 4,
  30. Debug = 5,
  31. Verbose = 6
  32. };
  33. typedef std::function<void(LogLevel level, string message)> LogCallback;
  34. RTC_CPP_EXPORT void InitLogger(LogLevel level, LogCallback callback = nullptr);
  35. #ifdef PLOG_DEFAULT_INSTANCE_ID
  36. RTC_CPP_EXPORT void InitLogger(plog::Severity severity, plog::IAppender *appender = nullptr);
  37. #endif
  38. RTC_CPP_EXPORT void Preload();
  39. RTC_CPP_EXPORT void Cleanup();
  40. struct SctpSettings {
  41. // For the following settings, not set means optimized default
  42. optional<size_t> recvBufferSize; // in bytes
  43. optional<size_t> sendBufferSize; // in bytes
  44. optional<size_t> maxChunksOnQueue; // in chunks
  45. optional<size_t> initialCongestionWindow; // in MTUs
  46. optional<size_t> maxBurst; // in MTUs
  47. optional<unsigned int> congestionControlModule; // 0: RFC2581, 1: HSTCP, 2: H-TCP, 3: RTCC
  48. optional<std::chrono::milliseconds> delayedSackTime;
  49. optional<std::chrono::milliseconds> minRetransmitTimeout;
  50. optional<std::chrono::milliseconds> maxRetransmitTimeout;
  51. optional<std::chrono::milliseconds> initialRetransmitTimeout;
  52. optional<unsigned int> maxRetransmitAttempts;
  53. optional<std::chrono::milliseconds> heartbeatInterval;
  54. };
  55. RTC_CPP_EXPORT void SetSctpSettings(SctpSettings s);
  56. } // namespace rtc
  57. RTC_CPP_EXPORT std::ostream &operator<<(std::ostream &out, rtc::LogLevel level);
  58. #endif