Introduce dynamic endpoints
Bug: webrtc:10138 Change-Id: I7f6922adb93680cada6bea014539fc3089735834 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128480 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27336}
This commit is contained in:
@ -46,6 +46,19 @@ struct EmulatedEndpointConfig {
|
||||
// If specified will be used as IP address for endpoint node. Must be unique
|
||||
// among all created nodes.
|
||||
absl::optional<rtc::IPAddress> ip;
|
||||
// Should endpoint be enabled or not, when it will be created.
|
||||
// Enabled endpoints will be available for webrtc to send packets.
|
||||
bool start_as_enabled = true;
|
||||
};
|
||||
|
||||
// Provide interface to obtain all required objects to inject network emulation
|
||||
// layer into PeerConnection.
|
||||
class EmulatedNetworkManagerInterface {
|
||||
public:
|
||||
virtual ~EmulatedNetworkManagerInterface() = default;
|
||||
|
||||
virtual rtc::Thread* network_thread() = 0;
|
||||
virtual rtc::NetworkManager* network_manager() = 0;
|
||||
};
|
||||
|
||||
// Provides an API for creating and configuring emulated network layer.
|
||||
@ -63,6 +76,12 @@ class NetworkEmulationManager {
|
||||
// Creates an emulated endpoint, which represents single network interface on
|
||||
// the peer's device.
|
||||
virtual EmulatedEndpoint* CreateEndpoint(EmulatedEndpointConfig config) = 0;
|
||||
// Enable emulated endpoint to make it available for webrtc.
|
||||
// Caller mustn't enable currently enabled endpoint.
|
||||
virtual void EnableEndpoint(EmulatedEndpoint* endpoint) = 0;
|
||||
// Disable emulated endpoint to make it unavailable for webrtc.
|
||||
// Caller mustn't disable currently disabled endpoint.
|
||||
virtual void DisableEndpoint(EmulatedEndpoint* endpoint) = 0;
|
||||
|
||||
// Creates a route between endpoints going through specified network nodes.
|
||||
// This route is single direction only and describe how traffic that was
|
||||
@ -88,16 +107,13 @@ class NetworkEmulationManager {
|
||||
// removed earlier.
|
||||
virtual void ClearRoute(EmulatedRoute* route) = 0;
|
||||
|
||||
// Creates rtc::Thread that should be used as network thread for peer
|
||||
// connection. Created thread contains special rtc::SocketServer inside it
|
||||
// to enable correct integration between peer connection and emulated network
|
||||
// layer.
|
||||
virtual rtc::Thread* CreateNetworkThread(
|
||||
const std::vector<EmulatedEndpoint*>& endpoints) = 0;
|
||||
// Creates rtc::NetworkManager that should be used inside
|
||||
// cricket::PortAllocator for peer connection to provide correct list of
|
||||
// network interfaces, that exists in emulated network later.
|
||||
virtual rtc::NetworkManager* CreateNetworkManager(
|
||||
// Creates EmulatedNetworkManagerInterface which can be used then to inject
|
||||
// network emulation layer into PeerConnection. |endpoints| - are available
|
||||
// network interfaces for PeerConnection. If endpoint is enabled, it will be
|
||||
// immediately available for PeerConnection, otherwise user will be able to
|
||||
// enable endpoint later to make it available for PeerConnection.
|
||||
virtual EmulatedNetworkManagerInterface*
|
||||
CreateEmulatedNetworkManagerInterface(
|
||||
const std::vector<EmulatedEndpoint*>& endpoints) = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user