ice_config.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_PROTOCOL_ICE_CONFIG_H_
  5. #define REMOTING_PROTOCOL_ICE_CONFIG_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/time/time.h"
  9. #include "third_party/webrtc/p2p/base/port_allocator.h"
  10. #include "third_party/webrtc/rtc_base/socket_address.h"
  11. namespace base {
  12. class DictionaryValue;
  13. } // namespace base
  14. namespace remoting {
  15. namespace apis {
  16. namespace v1 {
  17. class GetIceConfigResponse;
  18. } // namespace v1
  19. } // namespace apis
  20. namespace protocol {
  21. struct IceConfig {
  22. IceConfig();
  23. IceConfig(const IceConfig& other);
  24. ~IceConfig();
  25. bool is_null() const { return expiration_time.is_null(); }
  26. // Parses JSON representation of the config. Returns null config if parsing
  27. // fails.
  28. static IceConfig Parse(const base::DictionaryValue& dictionary);
  29. static IceConfig Parse(const std::string& config_json);
  30. static IceConfig Parse(const apis::v1::GetIceConfigResponse& config);
  31. // Time when the config will stop being valid and need to be refreshed.
  32. base::Time expiration_time;
  33. std::vector<rtc::SocketAddress> stun_servers;
  34. // Standard TURN servers
  35. std::vector<cricket::RelayServerConfig> turn_servers;
  36. // If greater than 0, the max bandwidth used for relayed connections should
  37. // be set to this value.
  38. int max_bitrate_kbps = 0;
  39. };
  40. } // namespace protocol
  41. } // namespace remoting
  42. #endif // REMOTING_PROTOCOL_ICE_CONFIG_H_