webrtc/p2p/client/relay_port_factory_interface.h
Jonas Oreland 3e7e15d240 Reland "move relay server priority assignment to port_allocator"
This is a reland of commit b395f5bd5c
Downstream project has been fixed.

Original change's description:
> move relay server priority assignment to port_allocator
>
> which knows more about the internals of ICE.
> Remove the relay server config priority field which was used to
> specify the relative priority of TURN servers. This is now handled
> internally by CreateRelayPortArgs without being exposed.
>
> Also rename BasicPortAllocator::AddTurnServer to
> BasicPortAllocator::AddTurnServerForTesting since it is a test-only
> method.
>
> BUG=webrtc:13195,webrtc:14539
>
> Change-Id: Id36cbf0187b7a84d1a9b53860f31994f3c7589f0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280224
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#38520}

Bug: webrtc:13195,webrtc:14539
Change-Id: I617b611de97e4013c7286e3345073ca7589065c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281662
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38543}
2022-11-03 12:16:08 +00:00

72 lines
2.2 KiB
C++

/*
* Copyright 2017 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 P2P_CLIENT_RELAY_PORT_FACTORY_INTERFACE_H_
#define P2P_CLIENT_RELAY_PORT_FACTORY_INTERFACE_H_
#include <memory>
#include <string>
#include "p2p/base/port_interface.h"
#include "rtc_base/ref_count.h"
namespace rtc {
class AsyncPacketSocket;
class Network;
class PacketSocketFactory;
class Thread;
} // namespace rtc
namespace webrtc {
class TurnCustomizer;
class FieldTrialsView;
} // namespace webrtc
namespace cricket {
class Port;
struct ProtocolAddress;
struct RelayServerConfig;
// A struct containing arguments to RelayPortFactory::Create()
struct CreateRelayPortArgs {
rtc::Thread* network_thread;
rtc::PacketSocketFactory* socket_factory;
const rtc::Network* network;
const ProtocolAddress* server_address;
const RelayServerConfig* config;
std::string username;
std::string password;
webrtc::TurnCustomizer* turn_customizer = nullptr;
const webrtc::FieldTrialsView* field_trials = nullptr;
// Relative priority of candidates from this TURN server in relation
// to the candidates from other servers. Required because ICE priorities
// need to be unique.
int relative_priority = 0;
};
// A factory for creating RelayPort's.
class RelayPortFactoryInterface {
public:
virtual ~RelayPortFactoryInterface() {}
// This variant is used for UDP connection to the relay server
// using a already existing shared socket.
virtual std::unique_ptr<Port> Create(const CreateRelayPortArgs& args,
rtc::AsyncPacketSocket* udp_socket) = 0;
// This variant is used for the other cases.
virtual std::unique_ptr<Port> Create(const CreateRelayPortArgs& args,
int min_port,
int max_port) = 0;
};
} // namespace cricket
#endif // P2P_CLIENT_RELAY_PORT_FACTORY_INTERFACE_H_