| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #ifndef P2P_BASE_PORT_H_ |
| 12 | #define P2P_BASE_PORT_H_ |
| 13 |
| 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
| 16 |
| 17 | #include <functional> |
| 18 | #include <map> |
| 19 | #include <memory> |
| 20 | #include <set> |
| 21 | #include <string> |
| 22 | #include <type_traits> |
| 23 | #include <utility> |
| 24 | #include <vector> |
| 25 |
| 26 | #include "absl/base/attributes.h" |
| 27 | #include "absl/strings/string_view.h" |
| 28 | #include "absl/types/optional.h" |
| 29 | #include "api/candidate.h" |
| 30 | #include "api/field_trials_view.h" |
| 31 | #include "api/packet_socket_factory.h" |
| 32 | #include "api/rtc_error.h" |
| 33 | #include "api/sequence_checker.h" |
| 34 | #include "api/task_queue/task_queue_base.h" |
| 35 | #include "api/transport/field_trial_based_config.h" |
| 36 | #include "api/transport/stun.h" |
| 37 | #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h" |
| 38 | #include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h" |
| 39 | #include "logging/rtc_event_log/ice_logger.h" |
| 40 | #include "p2p/base/candidate_pair_interface.h" |
| 41 | #include "p2p/base/connection.h" |
| 42 | #include "p2p/base/connection_info.h" |
| 43 | #include "p2p/base/p2p_constants.h" |
| 44 | #include "p2p/base/port_interface.h" |
| 45 | #include "p2p/base/stun_request.h" |
| 46 | #include "p2p/base/transport_description.h" |
| 47 | #include "rtc_base/async_packet_socket.h" |
| 48 | #include "rtc_base/callback_list.h" |
| 49 | #include "rtc_base/checks.h" |
| 50 | #include "rtc_base/dscp.h" |
| 51 | #include "rtc_base/memory/always_valid_pointer.h" |
| 52 | #include "rtc_base/net_helper.h" |
| 53 | #include "rtc_base/network.h" |
| 54 | #include "rtc_base/network/received_packet.h" |
| 55 | #include "rtc_base/network/sent_packet.h" |
| 56 | #include "rtc_base/proxy_info.h" |
| 57 | #include "rtc_base/rate_tracker.h" |
| 58 | #include "rtc_base/socket_address.h" |
| 59 | #include "rtc_base/system/rtc_export.h" |
| 60 | #include "rtc_base/third_party/sigslot/sigslot.h" |
| 61 | #include "rtc_base/thread_annotations.h" |
| 62 | #include "rtc_base/weak_ptr.h" |
| 63 |
| 64 | namespace cricket { |
| 65 |
| 66 | // RFC 6544, TCP candidate encoding rules. |
| 67 | extern const int DISCARD_PORT; |
| 68 | extern const char TCPTYPE_ACTIVE_STR[]; |
| 69 | extern const char TCPTYPE_PASSIVE_STR[]; |
| 70 | extern const char TCPTYPE_SIMOPEN_STR[]; |
| 71 |
| 72 | enum class MdnsNameRegistrationStatus { |
| 73 | // IP concealment with mDNS is not enabled or the name registration process is |
| 74 | // not started yet. |
| 75 | kNotStarted, |
| 76 | // A request to create and register an mDNS name for a local IP address of a |
| 77 | // host candidate is sent to the mDNS responder. |
| 78 | kInProgress, |
| 79 | // The name registration is complete and the created name is returned by the |
| 80 | // mDNS responder. |
| 81 | kCompleted, |
| 82 | }; |
| 83 |
| 84 | // Stats that we can return about the port of a STUN candidate. |
| 85 | class StunStats { |
| 86 | public: |
| 87 | StunStats() = default; |
| 88 | StunStats(const StunStats&) = default; |
| 89 | ~StunStats() = default; |
| 90 |
| 91 | StunStats& operator=(const StunStats& other) = default; |
| 92 |
| 93 | int stun_binding_requests_sent = 0; |
| 94 | int stun_binding_responses_received = 0; |
| 95 | double stun_binding_rtt_ms_total = 0; |
| 96 | double stun_binding_rtt_ms_squared_total = 0; |
| 97 | }; |
| 98 |
| 99 | // Stats that we can return about a candidate. |
| 100 | class CandidateStats { |
| 101 | public: |
| 102 | CandidateStats() = default; |
| 103 | CandidateStats(const CandidateStats&) = default; |
| 104 | CandidateStats(CandidateStats&&) = default; |
| 105 | CandidateStats(Candidate candidate, |
| 106 | absl::optional<StunStats> stats = absl::nullopt) |
| 107 | : candidate_(std::move(candidate)), stun_stats_(std::move(stats)) {} |
| 108 | ~CandidateStats() = default; |
| 109 |
| 110 | CandidateStats& operator=(const CandidateStats& other) = default; |
| 111 |
| 112 | const Candidate& candidate() const { return candidate_; } |
| 113 |
| 114 | const absl::optional<StunStats>& stun_stats() const { return stun_stats_; } |
| 115 |
| 116 | private: |
| 117 | Candidate candidate_; |
| 118 | // STUN port stats if this candidate is a STUN candidate. |
| 119 | absl::optional<StunStats> stun_stats_; |
| 120 | }; |
| 121 |
| 122 | typedef std::vector<CandidateStats> CandidateStatsList; |
| 123 |
| 124 | const char* ProtoToString(ProtocolType proto); |
| 125 | absl::optional<ProtocolType> StringToProto(absl::string_view proto_name); |
| 126 |
| 127 | struct ProtocolAddress { |
| 128 | rtc::SocketAddress address; |
| 129 | ProtocolType proto; |
| 130 |
| 131 | ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) |
| 132 | : address(a), proto(p) {} |
| 133 |
| 134 | bool operator==(const ProtocolAddress& o) const { |
| 135 | return address == o.address && proto == o.proto; |
| 136 | } |
| 137 | bool operator!=(const ProtocolAddress& o) const { return !(*this == o); } |
| 138 | }; |
| 139 |
| 140 | struct IceCandidateErrorEvent { |
| 141 | IceCandidateErrorEvent() = default; |
| 142 | IceCandidateErrorEvent(absl::string_view address, |
| 143 | int port, |
| 144 | absl::string_view url, |
| 145 | int error_code, |
| 146 | absl::string_view error_text) |
| 147 | : address(std::move(address)), |
| 148 | port(port), |
| 149 | url(std::move(url)), |
| 150 | error_code(error_code), |
| 151 | error_text(std::move(error_text)) {} |
| 152 |
| 153 | std::string address; |
| 154 | int port = 0; |
| 155 | std::string url; |
| 156 | int error_code = 0; |
| 157 | std::string error_text; |
| 158 | }; |
| 159 |
| 160 | struct CandidatePairChangeEvent { |
| 161 | CandidatePair selected_candidate_pair; |
| 162 | int64_t last_data_received_ms; |
| 163 | std::string reason; |
| 164 | // How long do we estimate that we've been disconnected. |
| 165 | int64_t estimated_disconnected_time_ms; |
| 166 | }; |
| 167 |
| 168 | typedef std::set<rtc::SocketAddress> ServerAddresses; |
| 169 |
| 170 | // Represents a local communication mechanism that can be used to create |
| 171 | // connections to similar mechanisms of the other client. Subclasses of this |
| 172 | // one add support for specific mechanisms like local UDP ports. |
| 173 | class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> { |
| 174 | public: |
| 175 | // INIT: The state when a port is just created. |
| 176 | // KEEP_ALIVE_UNTIL_PRUNED: A port should not be destroyed even if no |
| 177 | // connection is using it. |
| 178 | // PRUNED: It will be destroyed if no connection is using it for a period of |
| 179 | // 30 seconds. |
| 180 | enum class State { INIT, KEEP_ALIVE_UNTIL_PRUNED, PRUNED }; |
| 181 | Port(webrtc::TaskQueueBase* thread, |
| 182 | absl::string_view type ABSL_ATTRIBUTE_LIFETIME_BOUND, |
| 183 | rtc::PacketSocketFactory* factory, |
| 184 | const rtc::Network* network, |
| 185 | absl::string_view username_fragment, |
| 186 | absl::string_view password, |
| 187 | const webrtc::FieldTrialsView* field_trials = nullptr); |
| 188 | Port(webrtc::TaskQueueBase* thread, |
| 189 | absl::string_view type ABSL_ATTRIBUTE_LIFETIME_BOUND, |
| 190 | rtc::PacketSocketFactory* factory, |
| 191 | const rtc::Network* network, |
| 192 | uint16_t min_port, |
| 193 | uint16_t max_port, |
| 194 | absl::string_view username_fragment, |
| 195 | absl::string_view password, |
| 196 | const webrtc::FieldTrialsView* field_trials = nullptr); |
| 197 | ~Port() override; |
| 198 |
| 199 | // Note that the port type does NOT uniquely identify different subclasses of |
| 200 | // Port. Use the 2-tuple of the port type AND the protocol (GetProtocol()) to |
| 201 | // uniquely identify subclasses. Whenever a new subclass of Port introduces a |
| 202 | // conflict in the value of the 2-tuple, make sure that the implementation |
| 203 | // that relies on this 2-tuple for RTTI is properly changed. |
| 204 | const absl::string_view Type() const override; |
| 205 | const rtc::Network* Network() const override; |
| 206 |
| 207 | // Methods to set/get ICE role and tiebreaker values. |
| 208 | IceRole GetIceRole() const override; |
| 209 | void SetIceRole(IceRole role) override; |
| 210 |
| 211 | void SetIceTiebreaker(uint64_t tiebreaker) override; |
| 212 | uint64_t IceTiebreaker() const override; |
| 213 |
| 214 | bool SharedSocket() const override; |
| 215 | void ResetSharedSocket() { shared_socket_ = false; } |
| 216 |
| 217 | // Should not destroy the port even if no connection is using it. Called when |
| 218 | // a port is ready to use. |
| 219 | void KeepAliveUntilPruned(); |
| 220 | // Allows a port to be destroyed if no connection is using it. |
| 221 | void Prune(); |
| 222 |
| 223 | // Call to stop any currently pending operations from running. |
| 224 | void CancelPendingTasks(); |
| 225 |
| 226 | // The thread on which this port performs its I/O. |
| 227 | webrtc::TaskQueueBase* thread() override { return thread_; } |
| 228 |
| 229 | // The factory used to create the sockets of this port. |
| 230 | rtc::PacketSocketFactory* socket_factory() const override { return factory_; } |
| 231 |
| 232 | // For debugging purposes. |
| 233 | const std::string& content_name() const override { return content_name_; } |
| 234 | void set_content_name(absl::string_view content_name) { |
| 235 | content_name_ = std::string(content_name); |
| 236 | } |
| 237 |
| 238 | int component() const { return component_; } |
| 239 | void set_component(int component) { component_ = component; } |
| 240 |
| 241 | bool send_retransmit_count_attribute() const override { |
| 242 | return send_retransmit_count_attribute_; |
| 243 | } |
| 244 | void set_send_retransmit_count_attribute(bool enable) { |
| 245 | send_retransmit_count_attribute_ = enable; |
| 246 | } |
| 247 |
| 248 | // Identifies the generation that this port was created in. |
| 249 | uint32_t generation() const override { return generation_; } |
| 250 | void set_generation(uint32_t generation) override { |
| 251 | generation_ = generation; |
| 252 | } |
| 253 |
| 254 | const std::string& username_fragment() const; |
| 255 | const std::string& password() const { return password_; } |
| 256 |
| 257 | // May be called when this port was initially created by a pooled |
| 258 | // PortAllocatorSession, and is now being assigned to an ICE transport. |
| 259 | // Updates the information for candidates as well. |
| 260 | void SetIceParameters(int component, |
| 261 | absl::string_view username_fragment, |
| 262 | absl::string_view password); |
| 263 |
| 264 | // Fired when candidates are discovered by the port. When all candidates |
| 265 | // are discovered that belong to port SignalAddressReady is fired. |
| 266 | sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; |
| 267 | // Provides all of the above information in one handy object. |
| 268 | const std::vector<Candidate>& Candidates() const override; |
| 269 | // Fired when candidate discovery failed using certain server. |
| 270 | sigslot::signal2<Port*, const IceCandidateErrorEvent&> SignalCandidateError; |
| 271 |
| 272 | // SignalPortComplete is sent when port completes the task of candidates |
| 273 | // allocation. |
| 274 | sigslot::signal1<Port*> SignalPortComplete; |
| 275 | // This signal sent when port fails to allocate candidates and this port |
| 276 | // can't be used in establishing the connections. When port is in shared mode |
| 277 | // and port fails to allocate one of the candidates, port shouldn't send |
| 278 | // this signal as other candidates might be usefull in establishing the |
| 279 | // connection. |
| 280 | sigslot::signal1<Port*> SignalPortError; |
| 281 |
| 282 | void SubscribePortDestroyed( |
| 283 | std::function<void(PortInterface*)> callback) override; |
| 284 | void SendPortDestroyed(Port* port); |
| 285 | // Returns a map containing all of the connections of this port, keyed by the |
| 286 | // remote address. |
| 287 | typedef std::map<rtc::SocketAddress, Connection*> AddressMap; |
| 288 | const AddressMap& connections() { return connections_; } |
| 289 |
| 290 | // Returns the connection to the given address or NULL if none exists. |
| 291 | Connection* GetConnection(const rtc::SocketAddress& remote_addr) override; |
| 292 |
| 293 | // Removes and deletes a connection object. `DestroyConnection` will |
| 294 | // delete the connection object directly whereas `DestroyConnectionAsync` |
| 295 | // defers the `delete` operation to when the call stack has been unwound. |
| 296 | // Async may be needed when deleting a connection object from within a |
| 297 | // callback. |
| 298 | void DestroyConnection(Connection* conn) override { |
| 299 | DestroyConnectionInternal(conn, false); |
| 300 | } |
| 301 |
| 302 | void DestroyConnectionAsync(Connection* conn) override { |
| 303 | DestroyConnectionInternal(conn, true); |
| 304 | } |
| 305 |
| 306 | // In a shared socket mode each port which shares the socket will decide |
| 307 | // to accept the packet based on the `remote_addr`. Currently only UDP |
| 308 | // port implemented this method. |
| 309 | // TODO(mallinath) - Make it pure virtual. |
| 310 | virtual bool HandleIncomingPacket(rtc::AsyncPacketSocket* socket, |
| 311 | const rtc::ReceivedPacket& packet); |
| 312 |
| 313 | // Shall the port handle packet from this `remote_addr`. |
| 314 | // This method is overridden by TurnPort. |
| 315 | virtual bool CanHandleIncomingPacketsFrom( |
| 316 | const rtc::SocketAddress& remote_addr) const; |
| 317 |
| 318 | // Sends a response error to the given request. |
| 319 | void SendBindingErrorResponse(StunMessage* message, |
| 320 | const rtc::SocketAddress& addr, |
| 321 | int error_code, |
| 322 | absl::string_view reason) override; |
| 323 | void SendUnknownAttributesErrorResponse( |
| 324 | StunMessage* message, |
| 325 | const rtc::SocketAddress& addr, |
| 326 | const std::vector<uint16_t>& unknown_types); |
| 327 |
| 328 | void set_proxy(absl::string_view user_agent, const rtc::ProxyInfo& proxy) { |
| 329 | user_agent_ = std::string(user_agent); |
| 330 | proxy_ = proxy; |
| 331 | } |
| 332 | const std::string& user_agent() override { return user_agent_; } |
| 333 | const rtc::ProxyInfo& proxy() override { return proxy_; } |
| 334 |
| 335 | void EnablePortPackets() override; |
| 336 |
| 337 | // Called if the port has no connections and is no longer useful. |
| 338 | void Destroy(); |
| 339 |
| 340 | // Debugging description of this port |
| 341 | std::string ToString() const override; |
| 342 | uint16_t min_port() { return min_port_; } |
| 343 | uint16_t max_port() { return max_port_; } |
| 344 |
| 345 | // Timeout shortening function to speed up unit tests. |
| 346 | void set_timeout_delay(int delay); |
| 347 |
| 348 | // This method will return local and remote username fragements from the |
| 349 | // stun username attribute if present. |
| 350 | bool ParseStunUsername(const StunMessage* stun_msg, |
| 351 | std::string* local_username, |
| 352 | std::string* remote_username) const override; |
| 353 | std::string CreateStunUsername( |
| 354 | absl::string_view remote_username) const override; |
| 355 |
| 356 | bool MaybeIceRoleConflict(const rtc::SocketAddress& addr, |
| 357 | IceMessage* stun_msg, |
| 358 | absl::string_view remote_ufrag) override; |
| 359 |
| 360 | // Called when a packet has been sent to the socket. |
| 361 | // This is made pure virtual to notify subclasses of Port that they MUST |
| 362 | // listen to AsyncPacketSocket::SignalSentPacket and then call |
| 363 | // PortInterface::OnSentPacket. |
| 364 | virtual void OnSentPacket(rtc::AsyncPacketSocket* socket, |
| 365 | const rtc::SentPacket& sent_packet) = 0; |
| 366 |
| 367 | // Called when the socket is currently able to send. |
| 368 | void OnReadyToSend(); |
| 369 |
| 370 | // Called when the Connection discovers a local peer reflexive candidate. |
| 371 | void AddPrflxCandidate(const Candidate& local) override; |
| 372 |
| 373 | int16_t network_cost() const override { return network_cost_; } |
| 374 |
| 375 | void GetStunStats(absl::optional<StunStats>* stats) override {} |
| 376 |
| 377 | // Foundation: An arbitrary string that is the same for two candidates |
| 378 | // that have the same type, base IP address, protocol (UDP, TCP, |
| 379 | // etc.), and STUN or TURN server. If any of these are different, |
| 380 | // then the foundation will be different. Two candidate pairs with |
| 381 | // the same foundation pairs are likely to have similar network |
| 382 | // characteristics. Foundations are used in the frozen algorithm. |
| 383 | std::string ComputeFoundation( |
| 384 | absl::string_view type, |
| 385 | absl::string_view protocol, |
| 386 | absl::string_view relay_protocol, |
| 387 | const rtc::SocketAddress& base_address) override; |
| 388 |
| 389 | protected: |
| 390 | void UpdateNetworkCost() override; |
| 391 |
| 392 | rtc::WeakPtr<Port> NewWeakPtr() { return weak_factory_.GetWeakPtr(); } |
| 393 |
| 394 | void AddAddress(const rtc::SocketAddress& address, |
| 395 | const rtc::SocketAddress& base_address, |
| 396 | const rtc::SocketAddress& related_address, |
| 397 | absl::string_view protocol, |
| 398 | absl::string_view relay_protocol, |
| 399 | absl::string_view tcptype, |
| 400 | absl::string_view type, |
| 401 | uint32_t type_preference, |
| 402 | uint32_t relay_preference, |
| 403 | absl::string_view url, |
| 404 | bool is_final); |
| 405 |
| 406 | void FinishAddingAddress(const Candidate& c, bool is_final) |
| 407 | RTC_RUN_ON(thread_); |
| 408 |
| 409 | virtual void PostAddAddress(bool is_final); |
| 410 |
| 411 | // Adds the given connection to the map keyed by the remote candidate address. |
| 412 | // If an existing connection has the same address, the existing one will be |
| 413 | // replaced and destroyed. |
| 414 | void AddOrReplaceConnection(Connection* conn); |
| 415 |
| 416 | // Called when a packet is received from an unknown address that is not |
| 417 | // currently a connection. If this is an authenticated STUN binding request, |
| 418 | // then we will signal the client. |
| 419 | void OnReadPacket(const rtc::ReceivedPacket& packet, ProtocolType proto); |
| 420 |
| 421 | [[deprecated( |
| 422 | "Use OnReadPacket(const rtc::ReceivedPacket& packet, ProtocolType " |
| 423 | "proto)")]] void |
| 424 | OnReadPacket(const char* data, |
| 425 | size_t size, |
| 426 | const rtc::SocketAddress& addr, |
| 427 | ProtocolType proto) { |
| 428 | OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy( |
| 429 | data, size, /*packet_time_us = */ -1, addr), |
| 430 | proto); |
| 431 | } |
| 432 |
| 433 | // If the given data comprises a complete and correct STUN message then the |
| 434 | // return value is true, otherwise false. If the message username corresponds |
| 435 | // with this port's username fragment, msg will contain the parsed STUN |
| 436 | // message. Otherwise, the function may send a STUN response internally. |
| 437 | // remote_username contains the remote fragment of the STUN username. |
| 438 | bool GetStunMessage(const char* data, |
| 439 | size_t size, |
| 440 | const rtc::SocketAddress& addr, |
| 441 | std::unique_ptr<IceMessage>* out_msg, |
| 442 | std::string* out_username) override; |
| 443 |
| 444 | // Checks if the address in addr is compatible with the port's ip. |
| 445 | bool IsCompatibleAddress(const rtc::SocketAddress& addr); |
| 446 |
| 447 | // Returns DSCP value packets generated by the port itself should use. |
| 448 | rtc::DiffServCodePoint StunDscpValue() const override; |
| 449 |
| 450 | // Extra work to be done in subclasses when a connection is destroyed. |
| 451 | virtual void HandleConnectionDestroyed(Connection* conn) {} |
| 452 |
| 453 | void DestroyAllConnections(); |
| 454 |
| 455 | void CopyPortInformationToPacketInfo(rtc::PacketInfo* info) const; |
| 456 |
| 457 | MdnsNameRegistrationStatus mdns_name_registration_status() const { |
| 458 | return mdns_name_registration_status_; |
| 459 | } |
| 460 | void set_mdns_name_registration_status(MdnsNameRegistrationStatus status) { |
| 461 | mdns_name_registration_status_ = status; |
| 462 | } |
| 463 |
| 464 | const webrtc::FieldTrialsView& field_trials() const { return *field_trials_; } |
| 465 |
| 466 | private: |
| 467 | void Construct(); |
| 468 |
| 469 | void PostDestroyIfDead(bool delayed); |
| 470 | void DestroyIfDead(); |
| 471 |
| 472 | // Called internally when deleting a connection object. |
| 473 | // Returns true if the connection object was removed from the `connections_` |
| 474 | // list and the state updated accordingly. If the connection was not found |
| 475 | // in the list, the return value is false. Note that this may indicate |
| 476 | // incorrect behavior of external code that might be attempting to delete |
| 477 | // connection objects from within a 'on destroyed' callback notification |
| 478 | // for the connection object itself. |
| 479 | bool OnConnectionDestroyed(Connection* conn); |
| 480 |
| 481 | // Private implementation of DestroyConnection to keep the async usage |
| 482 | // distinct. |
| 483 | void DestroyConnectionInternal(Connection* conn, bool async); |
| 484 |
| 485 | void OnNetworkTypeChanged(const rtc::Network* network); |
| 486 |
| 487 | webrtc::TaskQueueBase* const thread_; |
| 488 | rtc::PacketSocketFactory* const factory_; |
| 489 | const absl::string_view type_; |
| 490 | bool send_retransmit_count_attribute_; |
| 491 | const rtc::Network* network_; |
| 492 | uint16_t min_port_; |
| 493 | uint16_t max_port_; |
| 494 | std::string content_name_; |
| 495 | int component_; |
| 496 | uint32_t generation_; |
| 497 | // In order to establish a connection to this Port (so that real data can be |
| 498 | // sent through), the other side must send us a STUN binding request that is |
| 499 | // authenticated with this username_fragment and password. |
| 500 | // PortAllocatorSession will provide these username_fragment and password. |
| 501 | std::string ice_username_fragment_ RTC_GUARDED_BY(thread_); |
| 502 | std::string password_ RTC_GUARDED_BY(thread_); |
| 503 | std::vector<Candidate> candidates_ RTC_GUARDED_BY(thread_); |
| 504 | AddressMap connections_; |
| 505 | int timeout_delay_; |
| 506 | bool enable_port_packets_; |
| 507 | IceRole ice_role_; |
| 508 | uint64_t tiebreaker_; |
| 509 | bool shared_socket_; |
| 510 | // Information to use when going through a proxy. |
| 511 | std::string user_agent_; |
| 512 | rtc::ProxyInfo proxy_; |
| 513 |
| 514 | // A virtual cost perceived by the user, usually based on the network type |
| 515 | // (WiFi. vs. Cellular). It takes precedence over the priority when |
| 516 | // comparing two connections. |
| 517 | int16_t network_cost_; |
| 518 | State state_ = State::INIT; |
| 519 | int64_t last_time_all_connections_removed_ = 0; |
| 520 | MdnsNameRegistrationStatus mdns_name_registration_status_ = |
| 521 | MdnsNameRegistrationStatus::kNotStarted; |
| 522 |
| 523 | rtc::WeakPtrFactory<Port> weak_factory_; |
| 524 | webrtc::AlwaysValidPointer<const webrtc::FieldTrialsView, |
| 525 | webrtc::FieldTrialBasedConfig> |
| 526 | field_trials_; |
| 527 |
| 528 | bool MaybeObfuscateAddress(const Candidate& c, bool is_final) |
| 529 | RTC_RUN_ON(thread_); |
| 530 |
| 531 | webrtc::CallbackList<PortInterface*> port_destroyed_callback_list_; |
| 532 | }; |
| 533 |
| 534 | } // namespace cricket |
| 535 |
| 536 | #endif // P2P_BASE_PORT_H_ |
| 537 |