diff options
Diffstat (limited to '')
-rw-r--r-- | third_party/libwebrtc/p2p/base/port_interface.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/third_party/libwebrtc/p2p/base/port_interface.h b/third_party/libwebrtc/p2p/base/port_interface.h index fe4b204c95..fb8023b5dd 100644 --- a/third_party/libwebrtc/p2p/base/port_interface.h +++ b/third_party/libwebrtc/p2p/base/port_interface.h @@ -11,6 +11,7 @@ #ifndef P2P_BASE_PORT_INTERFACE_H_ #define P2P_BASE_PORT_INTERFACE_H_ +#include <memory> #include <string> #include <utility> #include <vector> @@ -18,9 +19,11 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/candidate.h" +#include "api/packet_socket_factory.h" #include "p2p/base/transport_description.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/callback_list.h" +#include "rtc_base/proxy_info.h" #include "rtc_base/socket_address.h" namespace rtc { @@ -137,8 +140,80 @@ class PortInterface { virtual void GetStunStats(absl::optional<StunStats>* stats) = 0; + // Removes and deletes a connection object. `DestroyConnection` will + // delete the connection object directly whereas `DestroyConnectionAsync` + // defers the `delete` operation to when the call stack has been unwound. + // Async may be needed when deleting a connection object from within a + // callback. + virtual void DestroyConnection(Connection* conn) = 0; + + virtual void DestroyConnectionAsync(Connection* conn) = 0; + + // The thread on which this port performs its I/O. + virtual webrtc::TaskQueueBase* thread() = 0; + + // The factory used to create the sockets of this port. + virtual rtc::PacketSocketFactory* socket_factory() const = 0; + virtual const std::string& user_agent() = 0; + virtual const rtc::ProxyInfo& proxy() = 0; + + // Identifies the generation that this port was created in. + virtual uint32_t generation() const = 0; + virtual void set_generation(uint32_t generation) = 0; + virtual bool send_retransmit_count_attribute() const = 0; + // For debugging purposes. + virtual const std::string& content_name() const = 0; + + // Called when the Connection discovers a local peer reflexive candidate. + virtual void AddPrflxCandidate(const Candidate& local) = 0; + + // Foundation: An arbitrary string that is the same for two candidates + // that have the same type, base IP address, protocol (UDP, TCP, + // etc.), and STUN or TURN server. If any of these are different, + // then the foundation will be different. Two candidate pairs with + // the same foundation pairs are likely to have similar network + // characteristics. Foundations are used in the frozen algorithm. + virtual std::string ComputeFoundation( + absl::string_view type, + absl::string_view protocol, + absl::string_view relay_protocol, + const rtc::SocketAddress& base_address) = 0; + protected: PortInterface(); + virtual void UpdateNetworkCost() = 0; + + // Returns DSCP value packets generated by the port itself should use. + virtual rtc::DiffServCodePoint StunDscpValue() const = 0; + + // If the given data comprises a complete and correct STUN message then the + // return value is true, otherwise false. If the message username corresponds + // with this port's username fragment, msg will contain the parsed STUN + // message. Otherwise, the function may send a STUN response internally. + // remote_username contains the remote fragment of the STUN username. + virtual bool GetStunMessage(const char* data, + size_t size, + const rtc::SocketAddress& addr, + std::unique_ptr<IceMessage>* out_msg, + std::string* out_username) = 0; + + // This method will return local and remote username fragements from the + // stun username attribute if present. + virtual bool ParseStunUsername(const StunMessage* stun_msg, + std::string* local_username, + std::string* remote_username) const = 0; + virtual std::string CreateStunUsername( + absl::string_view remote_username) const = 0; + + virtual bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, + IceMessage* stun_msg, + absl::string_view remote_ufrag) = 0; + + virtual int16_t network_cost() const = 0; + + // Connection and Port are entangled; functions exposed to Port only + // should not be public. + friend class Connection; }; } // namespace cricket |