#include "test/network/network_emulation_manager.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <utility>
#include <vector>
#include "api/field_trials_view.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
#include "test/network/emulated_turn_server.h"
#include "test/network/simulated_network.h"
#include "test/network/traffic_route.h"
#include "test/time_controller/real_time_controller.h"
#include "test/time_controller/simulated_time_controller.h"
namespace webrtc {
namespace test {
namespace {
constexpr uint32_t kMinIPv4Address = …;
constexpr uint32_t kMaxIPv4Address = …;
std::unique_ptr<TimeController> CreateTimeController(
TimeMode mode,
const FieldTrialsView* field_trials) { … }
}
NetworkEmulationManagerImpl::NetworkEmulationManagerImpl(
NetworkEmulationManagerConfig config)
: … { … }
NetworkEmulationManagerImpl::~NetworkEmulationManagerImpl() { … }
EmulatedNetworkNode* NetworkEmulationManagerImpl::CreateEmulatedNode(
BuiltInNetworkBehaviorConfig config,
uint64_t random_seed) { … }
EmulatedNetworkNode* NetworkEmulationManagerImpl::CreateEmulatedNode(
std::unique_ptr<NetworkBehaviorInterface> network_behavior) { … }
NetworkEmulationManager::SimulatedNetworkNode::Builder
NetworkEmulationManagerImpl::NodeBuilder() { … }
EmulatedEndpointImpl* NetworkEmulationManagerImpl::CreateEndpoint(
EmulatedEndpointConfig config) { … }
void NetworkEmulationManagerImpl::EnableEndpoint(EmulatedEndpoint* endpoint) { … }
void NetworkEmulationManagerImpl::DisableEndpoint(EmulatedEndpoint* endpoint) { … }
EmulatedRoute* NetworkEmulationManagerImpl::CreateRoute(
EmulatedEndpoint* from,
const std::vector<EmulatedNetworkNode*>& via_nodes,
EmulatedEndpoint* to) { … }
EmulatedRoute* NetworkEmulationManagerImpl::CreateRoute(
const std::vector<EmulatedNetworkNode*>& via_nodes) { … }
EmulatedRoute* NetworkEmulationManagerImpl::CreateDefaultRoute(
EmulatedEndpoint* from,
const std::vector<EmulatedNetworkNode*>& via_nodes,
EmulatedEndpoint* to) { … }
void NetworkEmulationManagerImpl::ClearRoute(EmulatedRoute* route) { … }
TcpMessageRoute* NetworkEmulationManagerImpl::CreateTcpRoute(
EmulatedRoute* send_route,
EmulatedRoute* ret_route) { … }
CrossTrafficRoute* NetworkEmulationManagerImpl::CreateCrossTrafficRoute(
const std::vector<EmulatedNetworkNode*>& via_nodes) { … }
CrossTrafficGenerator* NetworkEmulationManagerImpl::StartCrossTraffic(
std::unique_ptr<CrossTrafficGenerator> generator) { … }
void NetworkEmulationManagerImpl::StopCrossTraffic(
CrossTrafficGenerator* generator) { … }
EmulatedNetworkManagerInterface*
NetworkEmulationManagerImpl::CreateEmulatedNetworkManagerInterface(
const std::vector<EmulatedEndpoint*>& endpoints) { … }
void NetworkEmulationManagerImpl::GetStats(
rtc::ArrayView<EmulatedEndpoint* const> endpoints,
std::function<void(EmulatedNetworkStats)> stats_callback) { … }
void NetworkEmulationManagerImpl::GetStats(
rtc::ArrayView<EmulatedNetworkNode* const> nodes,
std::function<void(EmulatedNetworkNodeStats)> stats_callback) { … }
absl::optional<rtc::IPAddress>
NetworkEmulationManagerImpl::GetNextIPv4Address() { … }
Timestamp NetworkEmulationManagerImpl::Now() const { … }
EmulatedTURNServerInterface* NetworkEmulationManagerImpl::CreateTURNServer(
EmulatedTURNServerConfig config) { … }
}
}