common.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * Copyright (c) 2019 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_COMMON_H
  19. #define RTC_COMMON_H
  20. #ifdef RTC_STATIC
  21. #define RTC_CPP_EXPORT
  22. #else // dynamic library
  23. #ifdef _WIN32
  24. #ifdef RTC_EXPORTS
  25. #define RTC_CPP_EXPORT __declspec(dllexport) // building the library
  26. #else
  27. #define RTC_CPP_EXPORT __declspec(dllimport) // using the library
  28. #endif
  29. #else // not WIN32
  30. #define RTC_CPP_EXPORT
  31. #endif
  32. #endif
  33. #ifdef _WIN32
  34. #ifndef _WIN32_WINNT
  35. #define _WIN32_WINNT 0x0602 // Windows 8
  36. #endif
  37. #ifdef _MSC_VER
  38. #pragma warning(disable : 4251) // disable "X needs to have dll-interface..."
  39. #endif
  40. #endif
  41. #ifndef RTC_ENABLE_WEBSOCKET
  42. #define RTC_ENABLE_WEBSOCKET 1
  43. #endif
  44. #ifndef RTC_ENABLE_MEDIA
  45. #define RTC_ENABLE_MEDIA 1
  46. #endif
  47. #include "rtc.h" // for C API defines
  48. #include "utils.hpp"
  49. #include <cstddef>
  50. #include <functional>
  51. #include <memory>
  52. #include <mutex>
  53. #include <optional>
  54. #include <string>
  55. #include <string_view>
  56. #include <variant>
  57. #include <vector>
  58. namespace rtc {
  59. using std::byte;
  60. using std::nullopt;
  61. using std::optional;
  62. using std::shared_ptr;
  63. using std::string;
  64. using std::string_view;
  65. using std::unique_ptr;
  66. using std::variant;
  67. using std::weak_ptr;
  68. using binary = std::vector<byte>;
  69. using binary_ptr = shared_ptr<binary>;
  70. using message_variant = variant<binary, string>;
  71. using std::int16_t;
  72. using std::int32_t;
  73. using std::int64_t;
  74. using std::int8_t;
  75. using std::ptrdiff_t;
  76. using std::size_t;
  77. using std::uint16_t;
  78. using std::uint32_t;
  79. using std::uint64_t;
  80. using std::uint8_t;
  81. } // namespace rtc
  82. #endif