chromium/third_party/webrtc_overrides/p2p/base/bridge_ice_controller.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/webrtc_overrides/p2p/base/bridge_ice_controller.h"

#include <algorithm>
#include <iterator>
#include <memory>
#include <optional>
#include <vector>

#include "base/check.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
#include "third_party/webrtc/api/array_view.h"
#include "third_party/webrtc/api/rtc_error.h"
#include "third_party/webrtc/p2p/base/connection.h"
#include "third_party/webrtc/p2p/base/ice_agent_interface.h"
#include "third_party/webrtc/p2p/base/ice_controller_interface.h"
#include "third_party/webrtc/p2p/base/ice_switch_reason.h"
#include "third_party/webrtc/p2p/base/ice_transport_internal.h"
#include "third_party/webrtc/p2p/base/transport_description.h"
#include "third_party/webrtc_overrides/p2p/base/ice_connection.h"
#include "third_party/webrtc_overrides/p2p/base/ice_controller_observer.h"
#include "third_party/webrtc_overrides/p2p/base/ice_ping_proposal.h"
#include "third_party/webrtc_overrides/p2p/base/ice_prune_proposal.h"
#include "third_party/webrtc_overrides/p2p/base/ice_switch_proposal.h"
#include "third_party/webrtc_overrides/rtc_base/diagnostic_logging.h"
#include "third_party/webrtc_overrides/rtc_base/logging.h"

namespace {
Connection;
IceAgentInterface;
IceConfig;
IceControllerInterface;
IceMode;
IceRole;
NominationMode;
}  // unnamed namespace

namespace blink {

BridgeIceController::BridgeIceController(
    scoped_refptr<base::SequencedTaskRunner> network_task_runner,
    IceControllerObserverInterface* observer,
    IceAgentInterface* ice_agent,
    std::unique_ptr<cricket::IceControllerInterface> native_controller)
    :{}

BridgeIceController::BridgeIceController(
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    IceAgentInterface* ice_agent,
    std::unique_ptr<IceControllerInterface> native_controller)
    :{}

BridgeIceController::~BridgeIceController() = default;

void BridgeIceController::AttachObserver(
    IceControllerObserverInterface* observer) {}

void BridgeIceController::SetIceConfig(const IceConfig& config) {}

bool BridgeIceController::GetUseCandidateAttribute(
    const Connection* connection,
    NominationMode mode,
    IceMode remote_ice_mode) const {}

void BridgeIceController::OnConnectionAdded(const Connection* connection) {}

void BridgeIceController::OnConnectionPinged(const Connection* connection) {}

void BridgeIceController::OnConnectionUpdated(const Connection* connection) {}

void BridgeIceController::OnConnectionSwitched(const Connection* connection) {}

void BridgeIceController::OnConnectionDestroyed(const Connection* connection) {}

void BridgeIceController::MaybeStartPinging() {}

// TODO(crbug.com/1369096) currently, proposals are applied when accepted even
// if another proposal arrived and was applied immediately while waiting for
// another response. This needs to be fixed by maintaining an ordered queue of
// proposals and ignoring any stale proposals.

void BridgeIceController::SelectAndPingConnection() {}

void BridgeIceController::OnPingProposalAccepted(
    const IcePingProposal& proposal) {}

void BridgeIceController::OnPingProposalRejected(
    const IcePingProposal& proposal) {}

void BridgeIceController::DoPerformPing(
    const cricket::IceControllerInterface::PingResult result) {}

void BridgeIceController::DoPerformPing(const cricket::Connection* connection,
                                        std::optional<int> recheck_delay_ms) {}

// TODO(crbug.com/1369096): rechecks could be batched to avoid a spike
// of recheck activity every recheck interval. Going further, ping proposals
// could probably also be batched to optimize the JS round trip.
void BridgeIceController::DoSchedulePingRecheck(
    std::optional<int> recheck_delay_ms) {}

void BridgeIceController::OnSortAndSwitchRequest(
    cricket::IceSwitchReason reason) {}

void BridgeIceController::SortAndSwitchToBestConnection(
    cricket::IceSwitchReason reason) {}

void BridgeIceController::OnImmediateSortAndSwitchRequest(
    cricket::IceSwitchReason reason) {}

void BridgeIceController::DoSortAndSwitchToBestConnection(
    cricket::IceSwitchReason reason) {}

bool BridgeIceController::OnImmediateSwitchRequest(
    cricket::IceSwitchReason reason,
    const Connection* selected) {}

void BridgeIceController::OnSwitchProposalAccepted(
    const IceSwitchProposal& proposal) {}

void BridgeIceController::OnSwitchProposalRejected(
    const IceSwitchProposal& proposal) {}

void BridgeIceController::DoPerformSwitch(
    cricket::IceSwitchReason reason_for_switch,
    const IceControllerInterface::SwitchResult result) {}

void BridgeIceController::DoPerformSwitch(
    cricket::IceSwitchReason reason_for_switch,
    const cricket::Connection* connection,
    std::optional<cricket::IceRecheckEvent> recheck_event,
    base::span<const cricket::Connection* const>
        connections_to_forget_state_on) {}

void BridgeIceController::DoScheduleSwitchRecheck(
    std::optional<cricket::IceRecheckEvent> recheck_event) {}

void BridgeIceController::UpdateStateOnConnectionsResorted() {}

void BridgeIceController::PruneConnections() {}

void BridgeIceController::UpdateStateOnPrune() {}

void BridgeIceController::OnPruneProposalAccepted(
    const IcePruneProposal& proposal) {}

void BridgeIceController::OnPruneProposalRejected(
    const IcePruneProposal& proposal) {}

void BridgeIceController::DoPerformPrune(
    base::span<const cricket::Connection* const> connections) {}

// Only for unit tests
const Connection* BridgeIceController::FindNextPingableConnection() {}

webrtc::RTCError BridgeIceController::OnPingRequested(
    const IceConnection& ice_connection) {}

webrtc::RTCError BridgeIceController::OnSwitchRequested(
    const IceConnection& ice_connection) {}

webrtc::RTCError BridgeIceController::OnPruneRequested(
    base::span<const IceConnection> ice_connections_to_prune) {}

const cricket::Connection* BridgeIceController::FindConnection(
    uint32_t id) const {}

BridgeIceController::IceInteractionProxy::IceInteractionProxy(
    BridgeIceController* controller,
    scoped_refptr<base::SequencedTaskRunner> task_runner)
    :{}

void BridgeIceController::IceInteractionProxy::AcceptPingProposal(
    const IcePingProposal& proposal) {}

void BridgeIceController::IceInteractionProxy::RejectPingProposal(
    const IcePingProposal& proposal) {}

void BridgeIceController::IceInteractionProxy::AcceptSwitchProposal(
    const IceSwitchProposal& proposal) {}

void BridgeIceController::IceInteractionProxy::RejectSwitchProposal(
    const IceSwitchProposal& proposal) {}

void BridgeIceController::IceInteractionProxy::AcceptPruneProposal(
    const IcePruneProposal& proposal) {}

void BridgeIceController::IceInteractionProxy::RejectPruneProposal(
    const IcePruneProposal& proposal) {}

webrtc::RTCError BridgeIceController::IceInteractionProxy::PingIceConnection(
    const IceConnection& connection) {}

webrtc::RTCError
BridgeIceController::IceInteractionProxy::SwitchToIceConnection(
    const IceConnection& connection) {}

webrtc::RTCError BridgeIceController::IceInteractionProxy::PruneIceConnections(
    base::span<const IceConnection> connections_to_prune) {}

}  // namespace blink