webrtc_m130/api/ice_transport_interface.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

155 lines
6.1 KiB
C
Raw Normal View History

/*
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_ICE_TRANSPORT_INTERFACE_H_
#define API_ICE_TRANSPORT_INTERFACE_H_
#include <string>
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
#include "api/async_dns_resolver.h"
#include "api/async_resolver_factory.h"
#include "api/rtc_error.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/scoped_refptr.h"
#include "rtc_base/ref_count.h"
namespace cricket {
class IceTransportInternal;
class PortAllocator;
class IceControllerFactoryInterface;
class ActiveIceControllerFactoryInterface;
} // namespace cricket
namespace webrtc {
class FieldTrialsView;
// An ICE transport, as represented to the outside world.
// This object is refcounted, and is therefore alive until the
// last holder has released it.
class IceTransportInterface : public rtc::RefCountInterface {
public:
// Accessor for the internal representation of an ICE transport.
// The returned object can only be safely used on the signalling thread.
// TODO(crbug.com/907849): Add API calls for the functions that have to
// be exposed to clients, and stop allowing access to the
// cricket::IceTransportInternal API.
virtual cricket::IceTransportInternal* internal() = 0;
};
struct IceTransportInit final {
public:
IceTransportInit() = default;
IceTransportInit(const IceTransportInit&) = delete;
IceTransportInit(IceTransportInit&&) = default;
IceTransportInit& operator=(const IceTransportInit&) = delete;
IceTransportInit& operator=(IceTransportInit&&) = default;
cricket::PortAllocator* port_allocator() { return port_allocator_; }
void set_port_allocator(cricket::PortAllocator* port_allocator) {
port_allocator_ = port_allocator;
}
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory() {
return async_dns_resolver_factory_;
}
void set_async_dns_resolver_factory(
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory) {
RTC_DCHECK(!async_resolver_factory_);
async_dns_resolver_factory_ = async_dns_resolver_factory;
}
[[deprecated("Use async_dns_resolver_factory")]] AsyncResolverFactory*
async_resolver_factory() {
return async_resolver_factory_;
}
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
ABSL_DEPRECATED("bugs.webrtc.org/12598")
void set_async_resolver_factory(
AsyncResolverFactory* async_resolver_factory) {
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
RTC_DCHECK(!async_dns_resolver_factory_);
async_resolver_factory_ = async_resolver_factory;
}
RtcEventLog* event_log() { return event_log_; }
void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; }
void set_ice_controller_factory(
cricket::IceControllerFactoryInterface* ice_controller_factory) {
ice_controller_factory_ = ice_controller_factory;
}
cricket::IceControllerFactoryInterface* ice_controller_factory() {
return ice_controller_factory_;
}
// An active ICE controller actively manages the connection used by an ICE
// transport, in contrast with a legacy ICE controller that only picks the
// best connection to use or ping, and lets the transport decide when and
// whether to switch.
//
// Which ICE controller is used is determined as follows:
//
// 1. If an active ICE controller factory is supplied, it is used and
// the legacy ICE controller factory is not used.
// 2. If not, a default active ICE controller is used, wrapping over the
// supplied or the default legacy ICE controller.
void set_active_ice_controller_factory(
cricket::ActiveIceControllerFactoryInterface*
active_ice_controller_factory) {
active_ice_controller_factory_ = active_ice_controller_factory;
}
cricket::ActiveIceControllerFactoryInterface*
active_ice_controller_factory() {
return active_ice_controller_factory_;
}
const FieldTrialsView* field_trials() { return field_trials_; }
void set_field_trials(const FieldTrialsView* field_trials) {
field_trials_ = field_trials;
}
private:
cricket::PortAllocator* port_allocator_ = nullptr;
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory_ = nullptr;
Reland "Deprecate all classes related to AsyncResolver" This reverts commit 08d431ec34a1c7ab52557702f2cebd9fdfacae9e. Reason for revert: Last (hopefully) Chrome blocker removed Original change's description: > Revert "Deprecate all classes related to AsyncResolver" > > This reverts commit 61a442809cc06de93a613186084d2dfa9c934d81. > > Reason for revert: Breaks roll into Chromium > > Original change's description: > > Deprecate all classes related to AsyncResolver > > > > and remove internal usage. > > > > Bug: webrtc:12598 > > Change-Id: Ie208682bfa0163f6c7a8e805151cfbda76324496 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322860 > > Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> > > Auto-Submit: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#40919} > > Bug: webrtc:12598 > Change-Id: I8aef5e062e19a51baec75873eddfca2a10467d3c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322901 > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> > Auto-Submit: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#40927} Bug: webrtc:12598 Change-Id: I3c7b07c831eb9ff808368433d9b9ae8ec4b2afb6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323720 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40944}
2023-10-17 03:34:39 +00:00
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
// For backwards compatibility. Only one resolver factory can be set.
AsyncResolverFactory* async_resolver_factory_ = nullptr;
Reland "Deprecate all classes related to AsyncResolver" This reverts commit 08d431ec34a1c7ab52557702f2cebd9fdfacae9e. Reason for revert: Last (hopefully) Chrome blocker removed Original change's description: > Revert "Deprecate all classes related to AsyncResolver" > > This reverts commit 61a442809cc06de93a613186084d2dfa9c934d81. > > Reason for revert: Breaks roll into Chromium > > Original change's description: > > Deprecate all classes related to AsyncResolver > > > > and remove internal usage. > > > > Bug: webrtc:12598 > > Change-Id: Ie208682bfa0163f6c7a8e805151cfbda76324496 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322860 > > Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> > > Auto-Submit: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#40919} > > Bug: webrtc:12598 > Change-Id: I8aef5e062e19a51baec75873eddfca2a10467d3c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322901 > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> > Auto-Submit: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#40927} Bug: webrtc:12598 Change-Id: I3c7b07c831eb9ff808368433d9b9ae8ec4b2afb6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323720 Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40944}
2023-10-17 03:34:39 +00:00
#pragma clang diagnostic pop
RtcEventLog* event_log_ = nullptr;
cricket::IceControllerFactoryInterface* ice_controller_factory_ = nullptr;
cricket::ActiveIceControllerFactoryInterface* active_ice_controller_factory_ =
nullptr;
const FieldTrialsView* field_trials_ = nullptr;
Reland "Use the new DNS resolver API in PeerConnection" This reverts commit 5a40b3710545edfd8a634341df3de26f57d79281. Reason for revert: Fixed the bug and ran layout tests. Original change's description: > Revert "Use the new DNS resolver API in PeerConnection" > > This reverts commit acf8ccb3c9f001b0ed749aca52b2d436d66f9586. > > Reason for revert: Speculative revert for https://ci.chromium.org/ui/p/chromium/builders/try/win10_chromium_x64_rel_ng/b8851745102358680592/overview. > > Original change's description: > > Use the new DNS resolver API in PeerConnection > > > > Bug: webrtc:12598 > > Change-Id: I5a14058e7f28c993ed927749df7357c715ba83fb > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212961 > > Reviewed-by: Niels Moller <nisse@webrtc.org> > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#33561} > > # Not skipping CQ checks because original CL landed > 1 day ago. > > TBR=hta@webrtc.org > > Bug: webrtc:12598 > Change-Id: Idc9853cb569849c49052f9cbd865614710fff979 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213188 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#33591} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:12598 Change-Id: Ief7867f2f23de66504877cdab1b23a11df2d5de4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214120 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33647}
2021-04-08 07:25:04 +00:00
// TODO(https://crbug.com/webrtc/12657): Redesign to have const members.
};
// TODO(qingsi): The factory interface is defined in this file instead of its
// namesake file ice_transport_factory.h to avoid the extra dependency on p2p/
// introduced there by the p2p/-dependent factory methods. Move the factory
// methods to a different file or rename it.
class IceTransportFactory {
public:
virtual ~IceTransportFactory() = default;
// As a refcounted object, the returned ICE transport may outlive the host
// construct into which its reference is given, e.g. a peer connection. As a
// result, the returned ICE transport should not hold references to any object
// that the transport does not own and that has a lifetime bound to the host
// construct. Also, assumptions on the thread safety of the returned transport
// should be clarified by implementations. For example, a peer connection
// requires the returned transport to be constructed and destroyed on the
// network thread and an ICE transport factory that intends to work with a
// peer connection should offer transports compatible with these assumptions.
virtual rtc::scoped_refptr<IceTransportInterface> CreateIceTransport(
const std::string& transport_name,
int component,
IceTransportInit init) = 0;
};
} // namespace webrtc
#endif // API_ICE_TRANSPORT_INTERFACE_H_