/* * Copyright 2004 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_BASE_PORT_ALLOCATOR_H_ #define P2P_BASE_PORT_ALLOCATOR_H_ #include <stdint.h> #include <deque> #include <memory> #include <string> #include <vector> #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/candidate.h" #include "api/sequence_checker.h" #include "api/transport/enums.h" #include "p2p/base/port.h" #include "p2p/base/port_interface.h" #include "p2p/base/transport_description.h" #include "rtc_base/checks.h" #include "rtc_base/network.h" #include "rtc_base/socket_address.h" #include "rtc_base/ssl_certificate.h" #include "rtc_base/system/rtc_export.h" #include "rtc_base/third_party/sigslot/sigslot.h" #include "rtc_base/thread.h" namespace webrtc { class TurnCustomizer; } // namespace webrtc namespace cricket { // PortAllocator is responsible for allocating Port types for a given // P2PSocket. It also handles port freeing. // // Clients can override this class to control port allocation, including // what kinds of ports are allocated. enum { … }; // Defines various reasons that have caused ICE regathering. enum class IceRegatheringReason { … }; const uint32_t kDefaultPortAllocatorFlags = …; const uint32_t kDefaultStepDelay = …; // 1 sec step delay. // As per RFC 5245 Appendix B.1, STUN transactions need to be paced at certain // internal. Less than 20ms is not acceptable. We choose 50ms as our default. const uint32_t kMinimumStepDelay = …; // Turning on IPv6 could make many IPv6 interfaces available for connectivity // check and delay the call setup time. kDefaultMaxIPv6Networks is the default // upper limit of IPv6 networks but could be changed by // set_max_ipv6_networks(). constexpr int kDefaultMaxIPv6Networks = …; // CF = CANDIDATE FILTER enum : uint32_t { … }; // TLS certificate policy. enum class TlsCertPolicy { … }; // TODO(deadbeef): Rename to TurnCredentials (and username to ufrag). struct RelayCredentials { … }; PortList; // TODO(deadbeef): Rename to TurnServerConfig. struct RTC_EXPORT RelayServerConfig { … }; class RTC_EXPORT PortAllocatorSession : public sigslot::has_slots<> { … }; // Every method of PortAllocator (including the destructor) must be called on // the same thread after Initialize is called. // // This allows a PortAllocator subclass to be constructed and configured on one // thread, and passed into an object that uses it on a different thread. class RTC_EXPORT PortAllocator : public sigslot::has_slots<> { … }; } // namespace cricket #endif // P2P_BASE_PORT_ALLOCATOR_H_