global.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. namespace rtc {
  23. enum class LogLevel { // Don't change, it must match plog severity
  24. None = 0,
  25. Fatal = 1,
  26. Error = 2,
  27. Warning = 3,
  28. Info = 4,
  29. Debug = 5,
  30. Verbose = 6
  31. };
  32. typedef std::function<void(LogLevel level, string message)> LogCallback;
  33. RTC_CPP_EXPORT void InitLogger(LogLevel level, LogCallback callback = nullptr);
  34. #ifdef PLOG
  35. RTC_CPP_EXPORT void InitLogger(plog::Severity severity, plog::IAppender *appender = nullptr);
  36. #endif
  37. RTC_EXPORT void Preload();
  38. RTC_EXPORT void Cleanup();
  39. struct SctpSettings {
  40. optional<size_t> recvBufferSize;
  41. optional<size_t> sendBufferSize;
  42. optional<size_t> maxChunksOnQueue;
  43. optional<size_t> initialCongestionWindow;
  44. optional<unsigned int> congestionControlModule;
  45. optional<std::chrono::milliseconds> delayedSackTime;
  46. };
  47. RTC_EXPORT void SetSctpSettings(SctpSettings s);
  48. } // namespace rtc
  49. #endif