Move port_interface.h to webrtc namespace

Bug: webrtc:42232595
Change-Id: I05a51a53d5a1147f27d847ff2563225ce14921b4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/380760
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44096}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 8876d55..6000e13 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -205,7 +205,10 @@
 rtc_source_set("turn_customizer") {
   visibility = [ "*" ]
   sources = [ "turn_customizer.h" ]
-  deps = [ "transport:stun_types" ]
+  deps = [
+    "../p2p:port_interface",
+    "transport:stun_types",
+  ]
 }
 
 rtc_source_set("ice_transport_interface") {
diff --git a/api/DEPS b/api/DEPS
index 69b9f97..4eedc5f 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -105,6 +105,10 @@
     "+rtc_base/socket_address.h",
   ],
 
+  "turn_customizer\.h": [
+    "+p2p/base/port_interface.h",
+  ],
+
   "peer_connection_interface\.h": [
     "+call/rtp_transport_controller_send_factory_interface.h",
     "+media/base/media_config.h",
diff --git a/api/turn_customizer.h b/api/turn_customizer.h
index 8d569b3..cc19d60 100644
--- a/api/turn_customizer.h
+++ b/api/turn_customizer.h
@@ -14,10 +14,7 @@
 #include <stdlib.h>
 
 #include "api/transport/stun.h"
-
-namespace cricket {
-class PortInterface;
-}  // namespace cricket
+#include "p2p/base/port_interface.h"
 
 namespace webrtc {
 
@@ -26,14 +23,14 @@
   // This is called before a TURN message is sent.
   // This could be used to add implementation specific attributes to a request.
   virtual void MaybeModifyOutgoingStunMessage(
-      cricket::PortInterface* port,
+      PortInterface* port,
       cricket::StunMessage* message) = 0;
 
   // TURN can send data using channel data messages or Send indication.
   // This method should return false if `data` should be sent using
   // a Send indication instead of a ChannelData message, even if a
   // channel is bound.
-  virtual bool AllowChannelData(cricket::PortInterface* port,
+  virtual bool AllowChannelData(PortInterface* port,
                                 const void* data,
                                 size_t size,
                                 bool payload) = 0;
diff --git a/p2p/base/connection.cc b/p2p/base/connection.cc
index aa77c44..e05b017 100644
--- a/p2p/base/connection.cc
+++ b/p2p/base/connection.cc
@@ -231,7 +231,7 @@
   return CONNECTION_RESPONSE_TIMEOUT;
 }
 
-Connection::Connection(rtc::WeakPtr<PortInterface> port,
+Connection::Connection(rtc::WeakPtr<webrtc::PortInterface> port,
                        size_t index,
                        const Candidate& remote_candidate)
     : network_thread_(port->thread()),
@@ -1859,7 +1859,7 @@
   pings_since_last_response_.clear();
 }
 
-ProxyConnection::ProxyConnection(rtc::WeakPtr<PortInterface> port,
+ProxyConnection::ProxyConnection(rtc::WeakPtr<webrtc::PortInterface> port,
                                  size_t index,
                                  const Candidate& remote_candidate)
     : Connection(std::move(port), index, remote_candidate) {}
diff --git a/p2p/base/connection.h b/p2p/base/connection.h
index d07acda..2c76500 100644
--- a/p2p/base/connection.h
+++ b/p2p/base/connection.h
@@ -104,7 +104,7 @@
   bool writable() const;
   bool receiving() const;
 
-  const PortInterface* port() const {
+  const webrtc::PortInterface* port() const {
     RTC_DCHECK_RUN_ON(network_thread_);
     return port_.get();
   }
@@ -328,8 +328,8 @@
   void SendResponseMessage(const StunMessage& response);
 
   // An accessor for unit tests.
-  PortInterface* PortForTest() { return port_.get(); }
-  const PortInterface* PortForTest() const { return port_.get(); }
+  webrtc::PortInterface* PortForTest() { return port_.get(); }
+  const webrtc::PortInterface* PortForTest() const { return port_.get(); }
 
   std::unique_ptr<IceMessage> BuildPingRequestForTest() {
     RTC_DCHECK_RUN_ON(network_thread_);
@@ -372,7 +372,7 @@
   class ConnectionRequest;
 
   // Constructs a new connection to the given remote port.
-  Connection(rtc::WeakPtr<PortInterface> port,
+  Connection(rtc::WeakPtr<webrtc::PortInterface> port,
              size_t index,
              const Candidate& candidate);
 
@@ -403,7 +403,7 @@
   void set_connected(bool value);
 
   // The local port where this connection sends and receives packets.
-  PortInterface* port() { return port_.get(); }
+  webrtc::PortInterface* port() { return port_.get(); }
 
   // NOTE: A pointer to the network thread is held by `port_` so in theory we
   // shouldn't need to hold on to this pointer here, but rather defer to
@@ -412,7 +412,7 @@
   // TODO(tommi): This ^^^ should be fixed.
   webrtc::TaskQueueBase* const network_thread_;
   const uint32_t id_;
-  rtc::WeakPtr<PortInterface> port_;
+  rtc::WeakPtr<webrtc::PortInterface> port_;
   Candidate local_candidate_ RTC_GUARDED_BY(network_thread_);
   Candidate remote_candidate_;
 
@@ -527,7 +527,7 @@
 // ProxyConnection defers all the interesting work to the port.
 class ProxyConnection : public Connection {
  public:
-  ProxyConnection(rtc::WeakPtr<PortInterface> port,
+  ProxyConnection(rtc::WeakPtr<webrtc::PortInterface> port,
                   size_t index,
                   const Candidate& remote_candidate);
 
diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc
index 55e68b9..5dbab6c 100644
--- a/p2p/base/p2p_transport_channel.cc
+++ b/p2p/base/p2p_transport_channel.cc
@@ -84,15 +84,15 @@
 using ::webrtc::SafeTask;
 using ::webrtc::TimeDelta;
 
-cricket::PortInterface::CandidateOrigin GetOrigin(
-    cricket::PortInterface* port,
-    cricket::PortInterface* origin_port) {
+webrtc::PortInterface::CandidateOrigin GetOrigin(
+    webrtc::PortInterface* port,
+    webrtc::PortInterface* origin_port) {
   if (!origin_port)
-    return cricket::PortInterface::ORIGIN_MESSAGE;
+    return webrtc::PortInterface::ORIGIN_MESSAGE;
   else if (port == origin_port)
-    return cricket::PortInterface::ORIGIN_THIS_PORT;
+    return webrtc::PortInterface::ORIGIN_THIS_PORT;
   else
-    return cricket::PortInterface::ORIGIN_OTHER_PORT;
+    return webrtc::PortInterface::ORIGIN_OTHER_PORT;
 }
 
 uint32_t GetWeakPingIntervalInFieldTrial(
@@ -901,7 +901,7 @@
 
 // A new port is available, attempt to make connections for it
 void P2PTransportChannel::OnPortReady(PortAllocatorSession* /* session */,
-                                      PortInterface* port) {
+                                      webrtc::PortInterface* port) {
   RTC_DCHECK_RUN_ON(network_thread_);
 
   // Set in-effect options on the new port
@@ -980,9 +980,9 @@
 }
 
 // Handle stun packets
-void P2PTransportChannel::OnUnknownAddress(PortInterface* port,
+void P2PTransportChannel::OnUnknownAddress(webrtc::PortInterface* port,
                                            const rtc::SocketAddress& address,
-                                           ProtocolType proto,
+                                           webrtc::ProtocolType proto,
                                            IceMessage* stun_msg,
                                            const std::string& remote_username,
                                            bool port_muxed) {
@@ -1069,7 +1069,7 @@
         component(), ProtoToString(proto), address, remote_candidate_priority,
         remote_username, remote_password, IceCandidateType::kPrflx,
         remote_generation, "", network_id, network_cost);
-    if (proto == PROTO_TCP) {
+    if (proto == webrtc::PROTO_TCP) {
       remote_candidate.set_tcptype(TCPTYPE_ACTIVE_STR);
     }
 
@@ -1102,8 +1102,8 @@
     }
   }
 
-  Connection* connection =
-      port->CreateConnection(remote_candidate, PortInterface::ORIGIN_THIS_PORT);
+  Connection* connection = port->CreateConnection(
+      remote_candidate, webrtc::PortInterface::ORIGIN_THIS_PORT);
   if (!connection) {
     // This could happen in some scenarios. For example, a TurnPort may have
     // had a refresh request timeout, so it won't create connections.
@@ -1137,7 +1137,7 @@
   }
 }
 
-void P2PTransportChannel::OnRoleConflict(PortInterface* /* port */) {
+void P2PTransportChannel::OnRoleConflict(webrtc::PortInterface* /* port */) {
   SignalRoleConflict(this);  // STUN ping will be sent when SetRole is called
                              // from Transport.
 }
@@ -1353,8 +1353,9 @@
 // Creates connections from all of the ports that we care about to the given
 // remote candidate.  The return value is true if we created a connection from
 // the origin port.
-bool P2PTransportChannel::CreateConnections(const Candidate& remote_candidate,
-                                            PortInterface* origin_port) {
+bool P2PTransportChannel::CreateConnections(
+    const Candidate& remote_candidate,
+    webrtc::PortInterface* origin_port) {
   RTC_DCHECK_RUN_ON(network_thread_);
 
   // If we've already seen the new remote candidate (in the current candidate
@@ -1376,7 +1377,7 @@
   // to make sure that the origin port is included, even if it was pruned,
   // since that may be the only port that can create this connection.
   bool created = false;
-  std::vector<PortInterface*>::reverse_iterator it;
+  std::vector<webrtc::PortInterface*>::reverse_iterator it;
   for (it = ports_.rbegin(); it != ports_.rend(); ++it) {
     if (CreateConnection(*it, remote_candidate, origin_port)) {
       if (*it == origin_port)
@@ -1397,9 +1398,9 @@
 
 // Setup a connection object for the local and remote candidate combination.
 // And then listen to connection object for changes.
-bool P2PTransportChannel::CreateConnection(PortInterface* port,
+bool P2PTransportChannel::CreateConnection(webrtc::PortInterface* port,
                                            const Candidate& remote_candidate,
-                                           PortInterface* origin_port) {
+                                           webrtc::PortInterface* origin_port) {
   RTC_DCHECK_RUN_ON(network_thread_);
   if (!port->SupportsProtocol(remote_candidate.protocol())) {
     return false;
@@ -1425,8 +1426,9 @@
                                    remote_candidate.generation()) {
     // Don't create a connection if this is a candidate we received in a
     // message and we are not allowed to make outgoing connections.
-    PortInterface::CandidateOrigin origin = GetOrigin(port, origin_port);
-    if (origin == PortInterface::ORIGIN_MESSAGE && incoming_only_) {
+    webrtc::PortInterface::CandidateOrigin origin =
+        GetOrigin(port, origin_port);
+    if (origin == webrtc::PortInterface::ORIGIN_MESSAGE && incoming_only_) {
       return false;
     }
     Connection* connection = port->CreateConnection(remote_candidate, origin);
@@ -1493,7 +1495,7 @@
 // Maintain our remote candidate list, adding this new remote one.
 void P2PTransportChannel::RememberRemoteCandidate(
     const Candidate& remote_candidate,
-    PortInterface* origin_port) {
+    webrtc::PortInterface* origin_port) {
   RTC_DCHECK_RUN_ON(network_thread_);
   // Remove any candidates whose generation is older than this one.  The
   // presence of a new generation indicates that the old ones are not useful.
@@ -1688,7 +1690,8 @@
   regathering_controller_->Start();
 }
 
-bool P2PTransportChannel::IsPortPruned(const PortInterface* port) const {
+bool P2PTransportChannel::IsPortPruned(
+    const webrtc::PortInterface* port) const {
   RTC_DCHECK_RUN_ON(network_thread_);
   return !absl::c_linear_search(ports_, port);
 }
@@ -2129,7 +2132,7 @@
 
 // When a port is destroyed, remove it from our list of ports to use for
 // connection attempts.
-void P2PTransportChannel::OnPortDestroyed(PortInterface* port) {
+void P2PTransportChannel::OnPortDestroyed(webrtc::PortInterface* port) {
   RTC_DCHECK_RUN_ON(network_thread_);
 
   ports_.erase(std::remove(ports_.begin(), ports_.end(), port), ports_.end());
@@ -2142,7 +2145,7 @@
 
 void P2PTransportChannel::OnPortsPruned(
     PortAllocatorSession* /* session */,
-    const std::vector<PortInterface*>& ports) {
+    const std::vector<webrtc::PortInterface*>& ports) {
   RTC_DCHECK_RUN_ON(network_thread_);
   for (PortInterface* port : ports) {
     if (PrunePort(port)) {
@@ -2179,7 +2182,7 @@
   ports_.clear();
 }
 
-bool P2PTransportChannel::PrunePort(PortInterface* port) {
+bool P2PTransportChannel::PrunePort(webrtc::PortInterface* port) {
   RTC_DCHECK_RUN_ON(network_thread_);
   auto it = absl::c_find(ports_, port);
   // Don't need to do anything if the port has been deleted from the port
diff --git a/p2p/base/p2p_transport_channel.h b/p2p/base/p2p_transport_channel.h
index 8be7770..f1b3c0a 100644
--- a/p2p/base/p2p_transport_channel.h
+++ b/p2p/base/p2p_transport_channel.h
@@ -86,13 +86,13 @@
 // Adds the port on which the candidate originated.
 class RemoteCandidate : public Candidate {
  public:
-  RemoteCandidate(const Candidate& c, PortInterface* origin_port)
+  RemoteCandidate(const Candidate& c, webrtc::PortInterface* origin_port)
       : Candidate(c), origin_port_(origin_port) {}
 
-  PortInterface* origin_port() { return origin_port_; }
+  webrtc::PortInterface* origin_port() { return origin_port_; }
 
  private:
-  PortInterface* origin_port_;
+  webrtc::PortInterface* origin_port_;
 };
 
 // P2PTransportChannel manages the candidates and connection process to keep
@@ -187,11 +187,11 @@
 
   // Note: These are only for testing purpose.
   // `ports_` and `pruned_ports` should not be changed from outside.
-  const std::vector<PortInterface*>& ports() {
+  const std::vector<webrtc::PortInterface*>& ports() {
     RTC_DCHECK_RUN_ON(network_thread_);
     return ports_;
   }
-  const std::vector<PortInterface*>& pruned_ports() {
+  const std::vector<webrtc::PortInterface*>& pruned_ports() {
     RTC_DCHECK_RUN_ON(network_thread_);
     return pruned_ports_;
   }
@@ -298,23 +298,23 @@
   webrtc::IceTransportState ComputeIceTransportState() const;
 
   bool CreateConnections(const Candidate& remote_candidate,
-                         PortInterface* origin_port);
-  bool CreateConnection(PortInterface* port,
+                         webrtc::PortInterface* origin_port);
+  bool CreateConnection(webrtc::PortInterface* port,
                         const Candidate& remote_candidate,
-                        PortInterface* origin_port);
+                        webrtc::PortInterface* origin_port);
   bool FindConnection(const Connection* connection) const;
 
   uint32_t GetRemoteCandidateGeneration(const Candidate& candidate);
   bool IsDuplicateRemoteCandidate(const Candidate& candidate);
   void RememberRemoteCandidate(const Candidate& remote_candidate,
-                               PortInterface* origin_port);
+                               webrtc::PortInterface* origin_port);
   void PingConnection(Connection* conn);
   void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session);
   void AddConnection(Connection* connection);
 
-  void OnPortReady(PortAllocatorSession* session, PortInterface* port);
+  void OnPortReady(PortAllocatorSession* session, webrtc::PortInterface* port);
   void OnPortsPruned(PortAllocatorSession* session,
-                     const std::vector<PortInterface*>& ports);
+                     const std::vector<webrtc::PortInterface*>& ports);
   void OnCandidatesReady(PortAllocatorSession* session,
                          const std::vector<Candidate>& candidates);
   void OnCandidateError(PortAllocatorSession* session,
@@ -322,9 +322,9 @@
   void OnCandidatesRemoved(PortAllocatorSession* session,
                            const std::vector<Candidate>& candidates);
   void OnCandidatesAllocationDone(PortAllocatorSession* session);
-  void OnUnknownAddress(PortInterface* port,
+  void OnUnknownAddress(webrtc::PortInterface* port,
                         const rtc::SocketAddress& addr,
-                        ProtocolType proto,
+                        webrtc::ProtocolType proto,
                         IceMessage* stun_msg,
                         const std::string& remote_username,
                         bool port_muxed);
@@ -332,11 +332,11 @@
 
   // When a port is destroyed, remove it from both lists `ports_`
   // and `pruned_ports_`.
-  void OnPortDestroyed(PortInterface* port);
+  void OnPortDestroyed(webrtc::PortInterface* port);
   // When pruning a port, move it from `ports_` to `pruned_ports_`.
   // Returns true if the port is found and removed from `ports_`.
-  bool PrunePort(PortInterface* port);
-  void OnRoleConflict(PortInterface* port);
+  bool PrunePort(webrtc::PortInterface* port);
+  void OnRoleConflict(webrtc::PortInterface* port);
 
   void OnConnectionStateChange(Connection* connection);
   void OnReadPacket(Connection* connection, const rtc::ReceivedPacket& packet);
@@ -375,7 +375,7 @@
   }
 
   // Indicates if the given local port has been pruned.
-  bool IsPortPruned(const PortInterface* port) const;
+  bool IsPortPruned(const webrtc::PortInterface* port) const;
 
   // Indicates if the given remote candidate has been pruned.
   bool IsRemoteCandidatePruned(const Candidate& cand) const;
@@ -423,12 +423,13 @@
       RTC_GUARDED_BY(network_thread_);
   // `ports_` contains ports that are used to form new connections when
   // new remote candidates are added.
-  std::vector<PortInterface*> ports_ RTC_GUARDED_BY(network_thread_);
+  std::vector<webrtc::PortInterface*> ports_ RTC_GUARDED_BY(network_thread_);
   // `pruned_ports_` contains ports that have been removed from `ports_` and
   // are not being used to form new connections, but that aren't yet destroyed.
   // They may have existing connections, and they still fire signals such as
   // SignalUnknownAddress.
-  std::vector<PortInterface*> pruned_ports_ RTC_GUARDED_BY(network_thread_);
+  std::vector<webrtc::PortInterface*> pruned_ports_
+      RTC_GUARDED_BY(network_thread_);
 
   Connection* selected_connection_ RTC_GUARDED_BY(network_thread_) = nullptr;
   std::vector<Connection*> connections_ RTC_GUARDED_BY(network_thread_);
diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc
index cc5fa18..3e23099 100644
--- a/p2p/base/p2p_transport_channel_unittest.cc
+++ b/p2p/base/p2p_transport_channel_unittest.cc
@@ -216,11 +216,11 @@
   turn_server.credentials = kRelayCredentials;
   if (!turn_server_udp.IsNil()) {
     turn_server.ports.push_back(
-        cricket::ProtocolAddress(turn_server_udp, cricket::PROTO_UDP));
+        cricket::ProtocolAddress(turn_server_udp, webrtc::PROTO_UDP));
   }
   if (!turn_server_tcp.IsNil()) {
     turn_server.ports.push_back(
-        cricket::ProtocolAddress(turn_server_tcp, cricket::PROTO_TCP));
+        cricket::ProtocolAddress(turn_server_tcp, webrtc::PROTO_TCP));
   }
   std::vector<cricket::RelayServerConfig> turn_servers(1, turn_server);
 
@@ -2069,14 +2069,14 @@
                          .clock = &clock}),
       webrtc::IsRtcOk());
 
-  const std::vector<PortInterface*> ports_before = ep1_ch1()->ports();
+  const std::vector<webrtc::PortInterface*> ports_before = ep1_ch1()->ports();
   for (size_t i = 0; i < ports_before.size(); ++i) {
     EXPECT_EQ(ICEROLE_CONTROLLING, ports_before[i]->GetIceRole());
   }
 
   ep1_ch1()->SetIceRole(ICEROLE_CONTROLLED);
 
-  const std::vector<PortInterface*> ports_after = ep1_ch1()->ports();
+  const std::vector<webrtc::PortInterface*> ports_after = ep1_ch1()->ports();
   for (size_t i = 0; i < ports_after.size(); ++i) {
     EXPECT_EQ(ICEROLE_CONTROLLED, ports_before[i]->GetIceRole());
   }
@@ -2868,10 +2868,11 @@
   rtc::ScopedFakeClock clock;
   const Environment env = CreateEnvironment();
   CreatePortAllocators(env);
-  test_turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  test_turn_server()->AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   RelayServerConfig turn_server;
   turn_server.credentials = kRelayCredentials;
-  turn_server.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP));
+  turn_server.ports.push_back(
+      ProtocolAddress(kTurnTcpIntAddr, webrtc::PROTO_TCP));
   GetAllocator(0)->AddTurnServerForTesting(turn_server);
   GetAllocator(1)->AddTurnServerForTesting(turn_server);
   // Enable IPv6
@@ -4320,8 +4321,8 @@
                                                              prflx_priority));
   Port* port = GetPort(&ch);
   ASSERT_NE(nullptr, port);
-  port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   Connection* conn = GetConnectionTo(&ch, "1.1.1.1", 1);
   ASSERT_NE(nullptr, conn);
 
@@ -4522,15 +4523,15 @@
 
   Port* port = GetPort(&ch);
   // conn1 should be resurrected with original priority.
-  port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
   ASSERT_TRUE(conn1 != nullptr);
   EXPECT_EQ(conn1->remote_candidate().priority(), remote_priority);
 
   // conn3, a real prflx connection, should have prflx priority.
-  port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 1), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 1),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 1);
   ASSERT_TRUE(conn3 != nullptr);
   EXPECT_EQ(conn3->remote_candidate().priority(), prflx_priority);
@@ -4827,8 +4828,8 @@
   request.AddAttribute(std::make_unique<StunUInt32Attribute>(STUN_ATTR_PRIORITY,
                                                              prflx_priority));
   TestUDPPort* port = static_cast<TestUDPPort*>(GetPort(&ch));
-  port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
   ASSERT_TRUE(conn1 != nullptr);
   EXPECT_EQ(conn1->stats().sent_ping_responses, 1u);
@@ -4855,8 +4856,8 @@
   // Another request with unknown address, it will not be set as the selected
   // connection because the selected connection was nominated by the controlling
   // side.
-  port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3);
   ASSERT_TRUE(conn3 != nullptr);
   EXPECT_EQ(conn3->stats().sent_ping_responses, 1u);
@@ -4867,8 +4868,8 @@
   // selected as the selected connection.
   request.AddAttribute(
       std::make_unique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
-  port->SignalUnknownAddress(port, rtc::SocketAddress("4.4.4.4", 4), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("4.4.4.4", 4),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   Connection* conn4 = WaitForConnectionTo(&ch, "4.4.4.4", 4);
   ASSERT_TRUE(conn4 != nullptr);
   EXPECT_EQ(conn4->stats().sent_ping_responses, 1u);
@@ -4885,8 +4886,8 @@
   // port->set_sent_binding_response(false);
   ch.SetRemoteIceParameters(kIceParams[2]);
   ch.SetRemoteIceParameters(kIceParams[3]);
-  port->SignalUnknownAddress(port, rtc::SocketAddress("5.5.5.5", 5), PROTO_UDP,
-                             &request, kIceUfrag[2], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("5.5.5.5", 5),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[2], false);
   Connection* conn5 = WaitForConnectionTo(&ch, "5.5.5.5", 5);
   ASSERT_TRUE(conn5 != nullptr);
   EXPECT_EQ(conn5->stats().sent_ping_responses, 1u);
@@ -4939,8 +4940,8 @@
   request.AddAttribute(
       std::make_unique<StunByteStringAttribute>(STUN_ATTR_USE_CANDIDATE));
   Port* port = GetPort(&ch);
-  port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3), PROTO_UDP,
-                             &request, kIceUfrag[1], false);
+  port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3),
+                             webrtc::PROTO_UDP, &request, kIceUfrag[1], false);
   Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3);
   ASSERT_TRUE(conn3 != nullptr);
   EXPECT_NE(conn3, ch.selected_connection());  // Not writable yet.
@@ -5611,7 +5612,7 @@
 
   // Make a fake signal to remove the ports in the p2ptransportchannel. then
   // change the ICE role and expect it to be updated.
-  std::vector<PortInterface*> ports(1, conn->PortForTest());
+  std::vector<webrtc::PortInterface*> ports(1, conn->PortForTest());
   ch.allocator_session()->SignalPortsPruned(ch.allocator_session(), ports);
   ch.SetIceRole(ICEROLE_CONTROLLED);
   EXPECT_EQ(ICEROLE_CONTROLLED, conn->PortForTest()->GetIceRole());
@@ -5671,7 +5672,7 @@
   }
   EXPECT_EQ(nullptr, GetConnectionTo(&ch, "1.1.1.1", 1));
   // Port will not be removed because it is not pruned yet.
-  PortInterface* port = GetPort(&ch);
+  webrtc::PortInterface* port = GetPort(&ch);
   ASSERT_NE(nullptr, port);
 
   // If the session prunes all ports, the port will be destroyed.
@@ -5988,10 +5989,10 @@
 TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest, TestTcpTurn) {
   const Environment env = CreateEnvironment();
   // Add a Tcp Turn server.
-  turn_server()->AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server()->AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   RelayServerConfig config;
   config.credentials = kRelayCredentials;
-  config.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, PROTO_TCP));
+  config.ports.push_back(ProtocolAddress(kTurnTcpIntAddr, webrtc::PROTO_TCP));
   CreatePortAllocator(env).AddTurnServerForTesting(config);
 
   P2PTransportChannel& ch = StartTransportChannel(env, true, 500);
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index f30c9cb..9866226 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -51,15 +51,15 @@
 using ::webrtc::TimeDelta;
 
 rtc::PacketInfoProtocolType ConvertProtocolTypeToPacketInfoProtocolType(
-    cricket::ProtocolType type) {
+    webrtc::ProtocolType type) {
   switch (type) {
-    case cricket::ProtocolType::PROTO_UDP:
+    case webrtc::ProtocolType::PROTO_UDP:
       return rtc::PacketInfoProtocolType::kUdp;
-    case cricket::ProtocolType::PROTO_TCP:
+    case webrtc::ProtocolType::PROTO_TCP:
       return rtc::PacketInfoProtocolType::kTcp;
-    case cricket::ProtocolType::PROTO_SSLTCP:
+    case webrtc::ProtocolType::PROTO_SSLTCP:
       return rtc::PacketInfoProtocolType::kSsltcp;
-    case cricket::ProtocolType::PROTO_TLS:
+    case webrtc::ProtocolType::PROTO_TLS:
       return rtc::PacketInfoProtocolType::kTls;
     default:
       return rtc::PacketInfoProtocolType::kUnknown;
@@ -76,14 +76,15 @@
                                           SSLTCP_PROTOCOL_NAME,
                                           TLS_PROTOCOL_NAME};
 
-const char* ProtoToString(ProtocolType proto) {
+const char* ProtoToString(webrtc::ProtocolType proto) {
   return PROTO_NAMES[proto];
 }
 
-std::optional<ProtocolType> StringToProto(absl::string_view proto_name) {
-  for (size_t i = 0; i <= PROTO_LAST; ++i) {
+std::optional<webrtc::ProtocolType> StringToProto(
+    absl::string_view proto_name) {
+  for (size_t i = 0; i <= webrtc::PROTO_LAST; ++i) {
     if (absl::EqualsIgnoreCase(PROTO_NAMES[i], proto_name)) {
-      return static_cast<ProtocolType>(i);
+      return static_cast<webrtc::ProtocolType>(i);
     }
   }
   return std::nullopt;
@@ -317,7 +318,8 @@
   }
 }
 
-void Port::OnReadPacket(const rtc::ReceivedPacket& packet, ProtocolType proto) {
+void Port::OnReadPacket(const rtc::ReceivedPacket& packet,
+                        webrtc::ProtocolType proto) {
   const char* data = reinterpret_cast<const char*>(packet.payload().data());
   size_t size = packet.payload().size();
   const rtc::SocketAddress& addr = packet.source_address();
@@ -826,7 +828,7 @@
 }
 
 void Port::SubscribePortDestroyed(
-    std::function<void(PortInterface*)> callback) {
+    std::function<void(webrtc::PortInterface*)> callback) {
   port_destroyed_callback_list_.AddReceiver(callback);
 }
 
diff --git a/p2p/base/port.h b/p2p/base/port.h
index 5b1a7bd..528a1eb 100644
--- a/p2p/base/port.h
+++ b/p2p/base/port.h
@@ -120,14 +120,14 @@
 
 typedef std::vector<CandidateStats> CandidateStatsList;
 
-const char* ProtoToString(ProtocolType proto);
-std::optional<ProtocolType> StringToProto(absl::string_view proto_name);
+const char* ProtoToString(webrtc::ProtocolType proto);
+std::optional<webrtc::ProtocolType> StringToProto(absl::string_view proto_name);
 
 struct ProtocolAddress {
   rtc::SocketAddress address;
-  ProtocolType proto;
+  webrtc::ProtocolType proto;
 
-  ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p)
+  ProtocolAddress(const rtc::SocketAddress& a, webrtc::ProtocolType p)
       : address(a), proto(p) {}
 
   bool operator==(const ProtocolAddress& o) const {
@@ -169,7 +169,8 @@
 // Represents a local communication mechanism that can be used to create
 // connections to similar mechanisms of the other client.  Subclasses of this
 // one add support for specific mechanisms like local UDP ports.
-class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
+class RTC_EXPORT Port : public webrtc::PortInterface,
+                        public sigslot::has_slots<> {
  public:
   // A struct containing common arguments to creating a port. See also
   // CreateRelayPortArgs.
@@ -278,7 +279,7 @@
   sigslot::signal1<Port*> SignalPortError;
 
   void SubscribePortDestroyed(
-      std::function<void(PortInterface*)> callback) override;
+      std::function<void(webrtc::PortInterface*)> callback) override;
   void SendPortDestroyed(Port* port);
   // Returns a map containing all of the connections of this port, keyed by the
   // remote address.
@@ -395,7 +396,8 @@
   // Called when a packet is received from an unknown address that is not
   // currently a connection.  If this is an authenticated STUN binding request,
   // then we will signal the client.
-  void OnReadPacket(const rtc::ReceivedPacket& packet, ProtocolType proto);
+  void OnReadPacket(const rtc::ReceivedPacket& packet,
+                    webrtc::ProtocolType proto);
 
   [[deprecated(
       "Use OnReadPacket(const rtc::ReceivedPacket& packet, ProtocolType "
@@ -403,7 +405,7 @@
   OnReadPacket(const char* data,
                size_t size,
                const rtc::SocketAddress& addr,
-               ProtocolType proto) {
+               webrtc::ProtocolType proto) {
     OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
                      data, size, /*packet_time_us = */ -1, addr),
                  proto);
@@ -508,7 +510,7 @@
   MdnsNameRegistrationStatus mdns_name_registration_status_ =
       MdnsNameRegistrationStatus::kNotStarted;
 
-  webrtc::CallbackList<PortInterface*> port_destroyed_callback_list_;
+  webrtc::CallbackList<webrtc::PortInterface*> port_destroyed_callback_list_;
 
   // Keep as the last member variable.
   rtc::WeakPtrFactory<Port> weak_factory_;
diff --git a/p2p/base/port_allocator.cc b/p2p/base/port_allocator.cc
index a9b177f..fc28c7e 100644
--- a/p2p/base/port_allocator.cc
+++ b/p2p/base/port_allocator.cc
@@ -36,7 +36,7 @@
 RelayServerConfig::RelayServerConfig(const rtc::SocketAddress& address,
                                      absl::string_view username,
                                      absl::string_view password,
-                                     ProtocolType proto)
+                                     webrtc::ProtocolType proto)
     : credentials(username, password) {
   ports.push_back(ProtocolAddress(address, proto));
 }
@@ -45,7 +45,7 @@
                                      int port,
                                      absl::string_view username,
                                      absl::string_view password,
-                                     ProtocolType proto)
+                                     webrtc::ProtocolType proto)
     : RelayServerConfig(rtc::SocketAddress(address, port),
                         username,
                         password,
@@ -56,13 +56,14 @@
                                      int port,
                                      absl::string_view username,
                                      absl::string_view password,
-                                     ProtocolType proto,
+                                     webrtc::ProtocolType proto,
                                      bool secure)
-    : RelayServerConfig(address,
-                        port,
-                        username,
-                        password,
-                        (proto == PROTO_TCP && secure ? PROTO_TLS : proto)) {}
+    : RelayServerConfig(
+          address,
+          port,
+          username,
+          password,
+          (proto == webrtc::PROTO_TCP && secure ? webrtc::PROTO_TLS : proto)) {}
 
 RelayServerConfig::RelayServerConfig(const RelayServerConfig&) = default;
 
diff --git a/p2p/base/port_allocator.h b/p2p/base/port_allocator.h
index 0d0e4d3..a09f307 100644
--- a/p2p/base/port_allocator.h
+++ b/p2p/base/port_allocator.h
@@ -160,18 +160,18 @@
   RelayServerConfig(const rtc::SocketAddress& address,
                     absl::string_view username,
                     absl::string_view password,
-                    ProtocolType proto);
+                    webrtc::ProtocolType proto);
   RelayServerConfig(absl::string_view address,
                     int port,
                     absl::string_view username,
                     absl::string_view password,
-                    ProtocolType proto);
+                    webrtc::ProtocolType proto);
   // Legacy constructor where "secure" and PROTO_TCP implies PROTO_TLS.
   RelayServerConfig(absl::string_view address,
                     int port,
                     absl::string_view username,
                     absl::string_view password,
-                    ProtocolType proto,
+                    webrtc::ProtocolType proto,
                     bool secure);
   RelayServerConfig(const RelayServerConfig&);
   ~RelayServerConfig();
@@ -259,19 +259,21 @@
   //
   // Ports and candidates are not guaranteed to be in the same order as the
   // signals were emitted in.
-  virtual std::vector<PortInterface*> ReadyPorts() const = 0;
+  virtual std::vector<webrtc::PortInterface*> ReadyPorts() const = 0;
   virtual std::vector<Candidate> ReadyCandidates() const = 0;
   virtual bool CandidatesAllocationDone() const = 0;
   // Marks all ports in the current session as "pruned" so that they may be
   // destroyed if no connection is using them.
   virtual void PruneAllPorts() {}
 
-  sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady;
+  sigslot::signal2<PortAllocatorSession*, webrtc::PortInterface*>
+      SignalPortReady;
   // Fires this signal when the network of the ports failed (either because the
   // interface is down, or because there is no connection on the interface),
   // or when TURN ports are pruned because a higher-priority TURN port becomes
   // ready(pairable).
-  sigslot::signal2<PortAllocatorSession*, const std::vector<PortInterface*>&>
+  sigslot::signal2<PortAllocatorSession*,
+                   const std::vector<webrtc::PortInterface*>&>
       SignalPortsPruned;
   sigslot::signal2<PortAllocatorSession*, const std::vector<Candidate>&>
       SignalCandidatesReady;
diff --git a/p2p/base/port_interface.cc b/p2p/base/port_interface.cc
index b07cdf9..233b4e9 100644
--- a/p2p/base/port_interface.cc
+++ b/p2p/base/port_interface.cc
@@ -14,10 +14,10 @@
 
 #include "absl/strings/string_view.h"
 
-namespace cricket {
+namespace webrtc {
 
 PortInterface::PortInterface() = default;
 
 PortInterface::~PortInterface() = default;
 
-}  // namespace cricket
+}  // namespace webrtc
diff --git a/p2p/base/port_interface.h b/p2p/base/port_interface.h
index 0d89a9e..1090672 100644
--- a/p2p/base/port_interface.h
+++ b/p2p/base/port_interface.h
@@ -31,12 +31,14 @@
 class Network;
 struct PacketOptions;
 }  // namespace rtc
-
 namespace cricket {
 class Connection;
 class IceMessage;
 class StunMessage;
 class StunStats;
+}  // namespace cricket
+
+namespace webrtc {
 
 enum ProtocolType {
   PROTO_UDP,
@@ -53,12 +55,12 @@
  public:
   virtual ~PortInterface();
 
-  virtual webrtc::IceCandidateType Type() const = 0;
+  virtual IceCandidateType Type() const = 0;
   virtual const rtc::Network* Network() const = 0;
 
   // Methods to set/get ICE role and tiebreaker values.
-  virtual void SetIceRole(IceRole role) = 0;
-  virtual IceRole GetIceRole() const = 0;
+  virtual void SetIceRole(cricket::IceRole role) = 0;
+  virtual cricket::IceRole GetIceRole() const = 0;
 
   virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0;
   virtual uint64_t IceTiebreaker() const = 0;
@@ -75,12 +77,14 @@
   virtual void PrepareAddress() = 0;
 
   // Returns the connection to the given address or NULL if none exists.
-  virtual Connection* GetConnection(const rtc::SocketAddress& remote_addr) = 0;
+  virtual cricket::Connection* GetConnection(
+      const rtc::SocketAddress& remote_addr) = 0;
 
   // Creates a new connection to the given address.
   enum CandidateOrigin { ORIGIN_THIS_PORT, ORIGIN_OTHER_PORT, ORIGIN_MESSAGE };
-  virtual Connection* CreateConnection(const Candidate& remote_candidate,
-                                       CandidateOrigin origin) = 0;
+  virtual cricket::Connection* CreateConnection(
+      const cricket::Candidate& remote_candidate,
+      CandidateOrigin origin) = 0;
 
   // Functions on the underlying socket(s).
   virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
@@ -89,7 +93,7 @@
 
   virtual ProtocolType GetProtocol() const = 0;
 
-  virtual const std::vector<Candidate>& Candidates() const = 0;
+  virtual const std::vector<cricket::Candidate>& Candidates() const = 0;
 
   // Sends the given packet to the given address, provided that the address is
   // that of a connection or an address that has sent to us already.
@@ -105,14 +109,14 @@
   sigslot::signal6<PortInterface*,
                    const rtc::SocketAddress&,
                    ProtocolType,
-                   IceMessage*,
+                   cricket::IceMessage*,
                    const std::string&,
                    bool>
       SignalUnknownAddress;
 
   // Sends a response message (normal or error) to the given request.  One of
   // these methods should be called as a response to SignalUnknownAddress.
-  virtual void SendBindingErrorResponse(StunMessage* message,
+  virtual void SendBindingErrorResponse(cricket::StunMessage* message,
                                         const rtc::SocketAddress& addr,
                                         int error_code,
                                         absl::string_view reason) = 0;
@@ -120,7 +124,7 @@
   // Signaled when this port decides to delete itself because it no longer has
   // any usefulness.
   virtual void SubscribePortDestroyed(
-      std::function<void(PortInterface*)> callback) = 0;
+      std::function<void(webrtc::PortInterface*)> callback) = 0;
 
   // Signaled when Port discovers ice role conflict with the peer.
   sigslot::signal1<PortInterface*> SignalRoleConflict;
@@ -139,19 +143,19 @@
 
   virtual std::string ToString() const = 0;
 
-  virtual void GetStunStats(std::optional<StunStats>* stats) = 0;
+  virtual void GetStunStats(std::optional<cricket::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 DestroyConnection(cricket::Connection* conn) = 0;
 
-  virtual void DestroyConnectionAsync(Connection* conn) = 0;
+  virtual void DestroyConnectionAsync(cricket::Connection* conn) = 0;
 
   // The thread on which this port performs its I/O.
-  virtual webrtc::TaskQueueBase* thread() = 0;
+  virtual TaskQueueBase* thread() = 0;
 
   // The factory used to create the sockets of this port.
   virtual rtc::PacketSocketFactory* socket_factory() const = 0;
@@ -164,7 +168,7 @@
   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;
+  virtual void AddPrflxCandidate(const cricket::Candidate& local) = 0;
 
  protected:
   PortInterface();
@@ -181,28 +185,40 @@
   virtual bool GetStunMessage(const char* data,
                               size_t size,
                               const rtc::SocketAddress& addr,
-                              std::unique_ptr<IceMessage>* out_msg,
+                              std::unique_ptr<cricket::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,
+  virtual bool ParseStunUsername(const cricket::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,
+                                    cricket::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;
+  friend class cricket::Connection;
 };
 
+}  //  namespace webrtc
+
+// Re-export symbols from the webrtc namespace for backwards compatibility.
+// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
+namespace cricket {
+using ::webrtc::PortInterface;
+using ::webrtc::PROTO_LAST;
+using ::webrtc::PROTO_SSLTCP;
+using ::webrtc::PROTO_TCP;
+using ::webrtc::PROTO_TLS;
+using ::webrtc::PROTO_UDP;
+using ::webrtc::ProtocolType;
 }  // namespace cricket
 
 #endif  // P2P_BASE_PORT_INTERFACE_H_
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index 183ba45..2456316 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -189,7 +189,7 @@
     return true;
   }
 
-  virtual ProtocolType GetProtocol() const { return PROTO_UDP; }
+  virtual webrtc::ProtocolType GetProtocol() const { return webrtc::PROTO_UDP; }
 
   // Exposed for testing candidate building.
   void AddCandidateAddress(const rtc::SocketAddress& addr) {
@@ -248,7 +248,7 @@
  private:
   void OnSentPacket(rtc::AsyncPacketSocket* socket,
                     const rtc::SentPacket& sent_packet) {
-    PortInterface::SignalSentPacket(sent_packet);
+    webrtc::PortInterface::SignalSentPacket(sent_packet);
   }
   std::unique_ptr<rtc::BufferT<uint8_t>> last_stun_buf_;
   std::unique_ptr<IceMessage> last_stun_msg_;
@@ -357,9 +357,9 @@
     return conn_->Send(data, len, options);
   }
 
-  void OnUnknownAddress(PortInterface* port,
+  void OnUnknownAddress(webrtc::PortInterface* port,
                         const SocketAddress& addr,
-                        ProtocolType proto,
+                        webrtc::ProtocolType proto,
                         IceMessage* msg,
                         const std::string& rf,
                         bool /*port_muxed*/) {
@@ -391,7 +391,7 @@
     remote_address_.Clear();
   }
 
-  void OnSrcPortDestroyed(PortInterface* port) {
+  void OnSrcPortDestroyed(webrtc::PortInterface* port) {
     Port* destroyed_src = port_.release();
     ASSERT_EQ(destroyed_src, port);
   }
@@ -469,10 +469,10 @@
                      ntype == NAT_OPEN_CONE, true, ntype != NAT_SYMMETRIC,
                      true);
   }
-  void TestLocalToRelay(ProtocolType proto) {
+  void TestLocalToRelay(webrtc::ProtocolType proto) {
     auto port1 = CreateUdpPort(kLocalAddr1);
     port1->SetIceRole(cricket::ICEROLE_CONTROLLING);
-    auto port2 = CreateRelayPort(kLocalAddr2, proto, PROTO_UDP);
+    auto port2 = CreateRelayPort(kLocalAddr2, proto, webrtc::PROTO_UDP);
     port2->SetIceRole(cricket::ICEROLE_CONTROLLED);
     TestConnectivity("udp", std::move(port1), RelayName(proto),
                      std::move(port2), false, true, true, true);
@@ -498,11 +498,11 @@
                      ntype1 != NAT_SYMMETRIC, ntype2 != NAT_SYMMETRIC,
                      ntype1 + ntype2 < (NAT_PORT_RESTRICTED + NAT_SYMMETRIC));
   }
-  void TestStunToRelay(NATType ntype, ProtocolType proto) {
+  void TestStunToRelay(NATType ntype, webrtc::ProtocolType proto) {
     nat_server1_ = CreateNatServer(kNatAddr1, ntype);
     auto port1 = CreateStunPort(kLocalAddr1, &nat_socket_factory1_);
     port1->SetIceRole(cricket::ICEROLE_CONTROLLING);
-    auto port2 = CreateRelayPort(kLocalAddr2, proto, PROTO_UDP);
+    auto port2 = CreateRelayPort(kLocalAddr2, proto, webrtc::PROTO_UDP);
     port2->SetIceRole(cricket::ICEROLE_CONTROLLED);
     TestConnectivity(StunName(ntype), std::move(port1), RelayName(proto),
                      std::move(port2), false, ntype != NAT_SYMMETRIC, true,
@@ -516,18 +516,18 @@
     TestConnectivity("tcp", std::move(port1), "tcp", std::move(port2), true,
                      false, true, true);
   }
-  void TestTcpToRelay(ProtocolType proto) {
+  void TestTcpToRelay(webrtc::ProtocolType proto) {
     auto port1 = CreateTcpPort(kLocalAddr1);
     port1->SetIceRole(cricket::ICEROLE_CONTROLLING);
-    auto port2 = CreateRelayPort(kLocalAddr2, proto, PROTO_TCP);
+    auto port2 = CreateRelayPort(kLocalAddr2, proto, webrtc::PROTO_TCP);
     port2->SetIceRole(cricket::ICEROLE_CONTROLLED);
     TestConnectivity("tcp", std::move(port1), RelayName(proto),
                      std::move(port2), false, false, true, true);
   }
-  void TestSslTcpToRelay(ProtocolType proto) {
+  void TestSslTcpToRelay(webrtc::ProtocolType proto) {
     auto port1 = CreateTcpPort(kLocalAddr1);
     port1->SetIceRole(cricket::ICEROLE_CONTROLLING);
-    auto port2 = CreateRelayPort(kLocalAddr2, proto, PROTO_SSLTCP);
+    auto port2 = CreateRelayPort(kLocalAddr2, proto, webrtc::PROTO_SSLTCP);
     port2->SetIceRole(cricket::ICEROLE_CONTROLLED);
     TestConnectivity("ssltcp", std::move(port1), RelayName(proto),
                      std::move(port2), false, false, true, true);
@@ -612,24 +612,24 @@
     return port;
   }
   std::unique_ptr<Port> CreateRelayPort(const SocketAddress& addr,
-                                        ProtocolType int_proto,
-                                        ProtocolType ext_proto) {
+                                        webrtc::ProtocolType int_proto,
+                                        webrtc::ProtocolType ext_proto) {
     return CreateTurnPort(addr, &socket_factory_, int_proto, ext_proto);
   }
   std::unique_ptr<TurnPort> CreateTurnPort(const SocketAddress& addr,
                                            PacketSocketFactory* socket_factory,
-                                           ProtocolType int_proto,
-                                           ProtocolType ext_proto) {
+                                           webrtc::ProtocolType int_proto,
+                                           webrtc::ProtocolType ext_proto) {
     SocketAddress server_addr =
-        int_proto == PROTO_TCP ? kTurnTcpIntAddr : kTurnUdpIntAddr;
+        int_proto == webrtc::PROTO_TCP ? kTurnTcpIntAddr : kTurnUdpIntAddr;
     return CreateTurnPort(addr, socket_factory, int_proto, ext_proto,
                           server_addr);
   }
   std::unique_ptr<TurnPort> CreateTurnPort(
       const SocketAddress& addr,
       PacketSocketFactory* socket_factory,
-      ProtocolType int_proto,
-      ProtocolType ext_proto,
+      webrtc::ProtocolType int_proto,
+      webrtc::ProtocolType ext_proto,
       const rtc::SocketAddress& server_addr) {
     RelayServerConfig config;
     config.credentials = kRelayCredentials;
@@ -668,15 +668,15 @@
         return "stun(?)";
     }
   }
-  static const char* RelayName(ProtocolType proto) {
+  static const char* RelayName(webrtc::ProtocolType proto) {
     switch (proto) {
-      case PROTO_UDP:
+      case webrtc::PROTO_UDP:
         return "turn(udp)";
-      case PROTO_TCP:
+      case webrtc::PROTO_TCP:
         return "turn(tcp)";
-      case PROTO_SSLTCP:
+      case webrtc::PROTO_SSLTCP:
         return "turn(ssltcp)";
-      case PROTO_TLS:
+      case webrtc::PROTO_TLS:
         return "turn(tls)";
       default:
         return "turn(?)";
@@ -919,15 +919,15 @@
     return port;
   }
 
-  void OnRoleConflict(PortInterface* port) { role_conflict_ = true; }
+  void OnRoleConflict(webrtc::PortInterface* port) { role_conflict_ = true; }
   bool role_conflict() const { return role_conflict_; }
 
-  void ConnectToSignalDestroyed(PortInterface* port) {
+  void ConnectToSignalDestroyed(webrtc::PortInterface* port) {
     port->SubscribePortDestroyed(
         [this](PortInterface* port) { OnDestroyed(port); });
   }
 
-  void OnDestroyed(PortInterface* port) { ++ports_destroyed_; }
+  void OnDestroyed(webrtc::PortInterface* port) { ++ports_destroyed_; }
   int ports_destroyed() const { return ports_destroyed_; }
 
   rtc::BasicPacketSocketFactory* nat_socket_factory1() {
@@ -1280,7 +1280,7 @@
 
 // Flaky: https://code.google.com/p/webrtc/issues/detail?id=3316.
 TEST_F(PortTest, DISABLED_TestLocalToTurn) {
-  TestLocalToRelay(PROTO_UDP);
+  TestLocalToRelay(webrtc::PROTO_UDP);
 }
 
 // Cone NAT -> XXXX
@@ -1305,7 +1305,7 @@
 }
 
 TEST_F(PortTest, TestConeNatToTurn) {
-  TestStunToRelay(NAT_OPEN_CONE, PROTO_UDP);
+  TestStunToRelay(NAT_OPEN_CONE, webrtc::PROTO_UDP);
 }
 
 // Address-restricted NAT -> XXXX
@@ -1330,7 +1330,7 @@
 }
 
 TEST_F(PortTest, TestARNatToTurn) {
-  TestStunToRelay(NAT_ADDR_RESTRICTED, PROTO_UDP);
+  TestStunToRelay(NAT_ADDR_RESTRICTED, webrtc::PROTO_UDP);
 }
 
 // Port-restricted NAT -> XXXX
@@ -1356,7 +1356,7 @@
 }
 
 TEST_F(PortTest, TestPRNatToTurn) {
-  TestStunToRelay(NAT_PORT_RESTRICTED, PROTO_UDP);
+  TestStunToRelay(NAT_PORT_RESTRICTED, webrtc::PROTO_UDP);
 }
 
 // Symmetric NAT -> XXXX
@@ -1383,7 +1383,7 @@
 }
 
 TEST_F(PortTest, TestSymNatToTurn) {
-  TestStunToRelay(NAT_SYMMETRIC, PROTO_UDP);
+  TestStunToRelay(NAT_SYMMETRIC, webrtc::PROTO_UDP);
 }
 
 // Outbound TCP -> XXXX
@@ -2004,16 +2004,16 @@
   EXPECT_EQ(0, stunport->SetOption(rtc::Socket::OPT_DSCP, rtc::DSCP_AF41));
   EXPECT_EQ(0, stunport->GetOption(rtc::Socket::OPT_DSCP, &dscp));
   EXPECT_EQ(rtc::DSCP_AF41, dscp);
-  auto turnport1 =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP);
+  auto turnport1 = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                  webrtc::PROTO_UDP, webrtc::PROTO_UDP);
   // Socket is created in PrepareAddress.
   turnport1->PrepareAddress();
   EXPECT_EQ(0, turnport1->SetOption(rtc::Socket::OPT_DSCP, rtc::DSCP_CS7));
   EXPECT_EQ(0, turnport1->GetOption(rtc::Socket::OPT_DSCP, &dscp));
   EXPECT_EQ(rtc::DSCP_CS7, dscp);
   // This will verify correct value returned without the socket.
-  auto turnport2 =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP);
+  auto turnport2 = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                  webrtc::PROTO_UDP, webrtc::PROTO_UDP);
   EXPECT_EQ(0, turnport2->SetOption(rtc::Socket::OPT_DSCP, rtc::DSCP_CS6));
   EXPECT_EQ(0, turnport2->GetOption(rtc::Socket::OPT_DSCP, &dscp));
   EXPECT_EQ(rtc::DSCP_CS6, dscp);
@@ -2949,8 +2949,8 @@
   EXPECT_NE(udpport2->Candidates()[0].foundation(),
             stunport->Candidates()[0].foundation());
   // Verifying TURN candidate foundation.
-  auto turnport1 =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP);
+  auto turnport1 = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                  webrtc::PROTO_UDP, webrtc::PROTO_UDP);
   turnport1->PrepareAddress();
   ASSERT_THAT(webrtc::WaitUntil(
                   [&] { return turnport1->Candidates().size(); }, Eq(1U),
@@ -2962,8 +2962,8 @@
             turnport1->Candidates()[0].foundation());
   EXPECT_NE(stunport->Candidates()[0].foundation(),
             turnport1->Candidates()[0].foundation());
-  auto turnport2 =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP);
+  auto turnport2 = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                  webrtc::PROTO_UDP, webrtc::PROTO_UDP);
   turnport2->PrepareAddress();
   ASSERT_THAT(webrtc::WaitUntil(
                   [&] { return turnport2->Candidates().size(); }, Eq(1U),
@@ -2977,8 +2977,9 @@
   SocketAddress kTurnUdpExtAddr2("99.99.98.5", 0);
   TestTurnServer turn_server2(rtc::Thread::Current(), vss(), kTurnUdpIntAddr2,
                               kTurnUdpExtAddr2);
-  auto turnport3 = CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP,
-                                  PROTO_UDP, kTurnUdpIntAddr2);
+  auto turnport3 =
+      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), webrtc::PROTO_UDP,
+                     webrtc::PROTO_UDP, kTurnUdpIntAddr2);
   turnport3->PrepareAddress();
   ASSERT_THAT(webrtc::WaitUntil(
                   [&] { return turnport3->Candidates().size(); }, Eq(1U),
@@ -2990,9 +2991,9 @@
   // Start a TCP turn server, and check that two turn candidates have
   // different foundations if their relay protocols are different.
   TestTurnServer turn_server3(rtc::Thread::Current(), vss(), kTurnTcpIntAddr,
-                              kTurnUdpExtAddr, PROTO_TCP);
-  auto turnport4 =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_TCP, PROTO_UDP);
+                              kTurnUdpExtAddr, webrtc::PROTO_TCP);
+  auto turnport4 = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                  webrtc::PROTO_TCP, webrtc::PROTO_UDP);
   turnport4->PrepareAddress();
   ASSERT_THAT(webrtc::WaitUntil(
                   [&] { return turnport4->Candidates().size(); }, Eq(1U),
@@ -3026,8 +3027,8 @@
             stunport->GetLocalAddress());
   // Verifying the related address for TURN candidate.
   // For TURN related address must be equal to the mapped address.
-  auto turnport =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP);
+  auto turnport = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                 webrtc::PROTO_UDP, webrtc::PROTO_UDP);
   turnport->PrepareAddress();
   ASSERT_THAT(webrtc::WaitUntil(
                   [&] { return turnport->Candidates().size(); }, Eq(1U),
@@ -4074,8 +4075,8 @@
   EXPECT_TRUE(tcp_port->SupportsProtocol(SSLTCP_PROTOCOL_NAME));
   EXPECT_FALSE(tcp_port->SupportsProtocol(UDP_PROTOCOL_NAME));
 
-  auto turn_port =
-      CreateTurnPort(kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP);
+  auto turn_port = CreateTurnPort(kLocalAddr1, nat_socket_factory1(),
+                                  webrtc::PROTO_UDP, webrtc::PROTO_UDP);
   EXPECT_TRUE(turn_port->SupportsProtocol(UDP_PROTOCOL_NAME));
   EXPECT_FALSE(turn_port->SupportsProtocol(TCP_PROTOCOL_NAME));
 }
diff --git a/p2p/base/stun_port.cc b/p2p/base/stun_port.cc
index a13761c..1de9ffd 100644
--- a/p2p/base/stun_port.cc
+++ b/p2p/base/stun_port.cc
@@ -338,8 +338,8 @@
   return protocol == UDP_PROTOCOL_NAME;
 }
 
-ProtocolType UDPPort::GetProtocol() const {
-  return PROTO_UDP;
+webrtc::ProtocolType UDPPort::GetProtocol() const {
+  return webrtc::PROTO_UDP;
 }
 
 void UDPPort::GetStunStats(std::optional<StunStats>* stats) {
@@ -392,13 +392,13 @@
   if (Connection* conn = GetConnection(packet.source_address())) {
     conn->OnReadPacket(packet);
   } else {
-    Port::OnReadPacket(packet, PROTO_UDP);
+    Port::OnReadPacket(packet, webrtc::PROTO_UDP);
   }
 }
 
 void UDPPort::OnSentPacket(rtc::AsyncPacketSocket* /* socket */,
                            const rtc::SentPacket& sent_packet) {
-  PortInterface::SignalSentPacket(sent_packet);
+  webrtc::PortInterface::SignalSentPacket(sent_packet);
 }
 
 void UDPPort::OnReadyToSend(rtc::AsyncPacketSocket* /* socket */) {
diff --git a/p2p/base/stun_port.h b/p2p/base/stun_port.h
index 89617f0..3c7dbaf 100644
--- a/p2p/base/stun_port.h
+++ b/p2p/base/stun_port.h
@@ -131,7 +131,7 @@
                             const rtc::ReceivedPacket& packet) override;
 
   bool SupportsProtocol(absl::string_view protocol) const override;
-  ProtocolType GetProtocol() const override;
+  webrtc::ProtocolType GetProtocol() const override;
 
   void GetStunStats(std::optional<StunStats>* stats) override;
 
diff --git a/p2p/base/tcp_port.cc b/p2p/base/tcp_port.cc
index 1cc2327..c7281b0 100644
--- a/p2p/base/tcp_port.cc
+++ b/p2p/base/tcp_port.cc
@@ -260,8 +260,8 @@
   return protocol == TCP_PROTOCOL_NAME || protocol == SSLTCP_PROTOCOL_NAME;
 }
 
-ProtocolType TCPPort::GetProtocol() const {
-  return PROTO_TCP;
+webrtc::ProtocolType TCPPort::GetProtocol() const {
+  return webrtc::PROTO_TCP;
 }
 
 void TCPPort::OnNewConnection(rtc::AsyncListenSocket* socket,
@@ -316,12 +316,12 @@
 
 void TCPPort::OnReadPacket(rtc::AsyncPacketSocket* socket,
                            const rtc::ReceivedPacket& packet) {
-  Port::OnReadPacket(packet, PROTO_TCP);
+  Port::OnReadPacket(packet, webrtc::PROTO_TCP);
 }
 
 void TCPPort::OnSentPacket(rtc::AsyncPacketSocket* socket,
                            const rtc::SentPacket& sent_packet) {
-  PortInterface::SignalSentPacket(sent_packet);
+  webrtc::PortInterface::SignalSentPacket(sent_packet);
 }
 
 void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
@@ -343,7 +343,8 @@
       pretending_to_be_writable_(false),
       reconnection_timeout_(cricket::CONNECTION_WRITE_CONNECT_TIMEOUT) {
   RTC_DCHECK_RUN_ON(network_thread_);
-  RTC_DCHECK_EQ(port()->GetProtocol(), PROTO_TCP);  // Needs to be TCPPort.
+  RTC_DCHECK_EQ(port()->GetProtocol(),
+                webrtc::PROTO_TCP);  // Needs to be TCPPort.
 
   SignalDestroyed.connect(this, &TCPConnection::OnDestroyed);
 
diff --git a/p2p/base/tcp_port.h b/p2p/base/tcp_port.h
index 206fb34..13551b5 100644
--- a/p2p/base/tcp_port.h
+++ b/p2p/base/tcp_port.h
@@ -77,7 +77,7 @@
   int SetOption(rtc::Socket::Option opt, int value) override;
   int GetError() override;
   bool SupportsProtocol(absl::string_view protocol) const override;
-  ProtocolType GetProtocol() const override;
+  webrtc::ProtocolType GetProtocol() const override;
 
  protected:
   TCPPort(const PortParametersRef& args,
@@ -182,7 +182,7 @@
   void OnDestroyed(Connection* c);
 
   TCPPort* tcp_port() {
-    RTC_DCHECK_EQ(port()->GetProtocol(), PROTO_TCP);
+    RTC_DCHECK_EQ(port()->GetProtocol(), webrtc::PROTO_TCP);
     return static_cast<TCPPort*>(port());
   }
 
diff --git a/p2p/base/turn_port.cc b/p2p/base/turn_port.cc
index d98c5e9..0dc26a5 100644
--- a/p2p/base/turn_port.cc
+++ b/p2p/base/turn_port.cc
@@ -68,14 +68,14 @@
   return ((msg_type & 0xC000) == 0x4000);  // MSB are 0b01
 }
 
-static int GetRelayPreference(cricket::ProtocolType proto) {
+static int GetRelayPreference(webrtc::ProtocolType proto) {
   switch (proto) {
-    case cricket::PROTO_TCP:
+    case webrtc::PROTO_TCP:
       return ICE_TYPE_PREFERENCE_RELAY_TCP;
-    case cricket::PROTO_TLS:
+    case webrtc::PROTO_TLS:
       return ICE_TYPE_PREFERENCE_RELAY_TLS;
     default:
-      RTC_DCHECK(proto == PROTO_UDP);
+      RTC_DCHECK(proto == webrtc::PROTO_UDP);
       return ICE_TYPE_PREFERENCE_RELAY_UDP;
   }
 }
@@ -363,7 +363,7 @@
   return socket_ ? socket_->GetLocalAddress() : rtc::SocketAddress();
 }
 
-ProtocolType TurnPort::GetProtocol() const {
+webrtc::ProtocolType TurnPort::GetProtocol() const {
   return server_address_.proto;
 }
 
@@ -440,7 +440,7 @@
                       "Failed to create TURN client socket.");
       return;
     }
-    if (server_address_.proto == PROTO_UDP) {
+    if (server_address_.proto == webrtc::PROTO_UDP) {
       // If its UDP, send AllocateRequest now.
       // For TCP and TLS AllcateRequest will be sent by OnSocketConnect.
       SendRequest(new TurnAllocateRequest(this), 0);
@@ -451,16 +451,16 @@
 bool TurnPort::CreateTurnClientSocket() {
   RTC_DCHECK(!socket_ || SharedSocket());
 
-  if (server_address_.proto == PROTO_UDP && !SharedSocket()) {
+  if (server_address_.proto == webrtc::PROTO_UDP && !SharedSocket()) {
     socket_ = socket_factory()->CreateUdpSocket(
         rtc::SocketAddress(Network()->GetBestIP(), 0), min_port(), max_port());
-  } else if (server_address_.proto == PROTO_TCP ||
-             server_address_.proto == PROTO_TLS) {
+  } else if (server_address_.proto == webrtc::PROTO_TCP ||
+             server_address_.proto == webrtc::PROTO_TLS) {
     RTC_DCHECK(!SharedSocket());
     int opts = rtc::PacketSocketFactory::OPT_STUN;
 
     // Apply server address TLS and insecure bits to options.
-    if (server_address_.proto == PROTO_TLS) {
+    if (server_address_.proto == webrtc::PROTO_TLS) {
       if (tls_cert_policy_ ==
           TlsCertPolicy::TLS_CERT_POLICY_INSECURE_NO_CHECK) {
         opts |= rtc::PacketSocketFactory::OPT_TLS_INSECURE;
@@ -504,8 +504,8 @@
 
   // TCP port is ready to send stun requests after the socket is connected,
   // while UDP port is ready to do so once the socket is created.
-  if (server_address_.proto == PROTO_TCP ||
-      server_address_.proto == PROTO_TLS) {
+  if (server_address_.proto == webrtc::PROTO_TCP ||
+      server_address_.proto == webrtc::PROTO_TLS) {
     socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect);
     socket_->SubscribeCloseEvent(
         this,
@@ -519,8 +519,8 @@
 void TurnPort::OnSocketConnect(rtc::AsyncPacketSocket* socket) {
   // This slot should only be invoked if we're using a connection-oriented
   // protocol.
-  RTC_DCHECK(server_address_.proto == PROTO_TCP ||
-             server_address_.proto == PROTO_TLS);
+  RTC_DCHECK(server_address_.proto == webrtc::PROTO_TCP ||
+             server_address_.proto == webrtc::PROTO_TLS);
 
   // Do not use this port if the socket bound to an address not associated with
   // the desired network interface. This is seen in Chrome, where TCP sockets
@@ -810,7 +810,7 @@
 
 void TurnPort::OnSentPacket(rtc::AsyncPacketSocket* socket,
                             const rtc::SentPacket& sent_packet) {
-  PortInterface::SignalSentPacket(sent_packet);
+  webrtc::PortInterface::SignalSentPacket(sent_packet);
 }
 
 void TurnPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
@@ -876,8 +876,9 @@
     // assuming socket layer will resolve the hostname through a HTTP proxy (if
     // any).
     auto& result = resolver_->result();
-    if (result.GetError() != 0 && (server_address_.proto == PROTO_TCP ||
-                                   server_address_.proto == PROTO_TLS)) {
+    if (result.GetError() != 0 &&
+        (server_address_.proto == webrtc::PROTO_TCP ||
+         server_address_.proto == webrtc::PROTO_TLS)) {
       if (!CreateTurnClientSocket()) {
         OnAllocateError(STUN_ERROR_SERVER_NOT_REACHABLE,
                         "TURN host lookup received error.");
@@ -953,7 +954,7 @@
       SafeTask(task_safety_.flag(), [this] { SignalPortError(this); }));
   std::string address = GetLocalAddress().HostAsSensitiveURIString();
   int port = GetLocalAddress().port();
-  if (server_address_.proto == PROTO_TCP &&
+  if (server_address_.proto == webrtc::PROTO_TCP &&
       server_address_.address.IsPrivateIP()) {
     address.clear();
     port = 0;
@@ -995,9 +996,10 @@
 
 void TurnPort::Close() {
   if (!ready()) {
-    OnAllocateError(
-        STUN_ERROR_SERVER_NOT_REACHABLE,
-        GetProtocol() != PROTO_UDP ? "Failed to establish connection" : "");
+    OnAllocateError(STUN_ERROR_SERVER_NOT_REACHABLE,
+                    GetProtocol() != webrtc::PROTO_UDP
+                        ? "Failed to establish connection"
+                        : "");
   }
   request_manager_.Clear();
   // Stop the port from creating new connections.
@@ -1025,7 +1027,7 @@
 }
 
 void TurnPort::TryAlternateServer() {
-  if (server_address().proto == PROTO_UDP) {
+  if (server_address().proto == webrtc::PROTO_UDP) {
     // Send another allocate request to alternate server, with the received
     // realm and nonce values.
     SendRequest(new TurnAllocateRequest(this), 0);
@@ -1033,8 +1035,8 @@
     // Since it's TCP, we have to delete the connected socket and reconnect
     // with the alternate server. PrepareAddress will send stun binding once
     // the new socket is connected.
-    RTC_DCHECK(server_address().proto == PROTO_TCP ||
-               server_address().proto == PROTO_TLS);
+    RTC_DCHECK(server_address().proto == webrtc::PROTO_TCP ||
+               server_address().proto == webrtc::PROTO_TLS);
     RTC_DCHECK(!SharedSocket());
     delete socket_;
     socket_ = nullptr;
@@ -1090,7 +1092,8 @@
   // TODO(bugs.webrtc.org/14870): rebuild DispatchPacket to take an
   // ArrayView<uint8_t>
   DispatchPacket(reinterpret_cast<const char*>(data_attr->array_view().data()),
-                 data_attr->length(), ext_addr, PROTO_UDP, packet_time_us);
+                 data_attr->length(), ext_addr, webrtc::PROTO_UDP,
+                 packet_time_us);
 }
 
 void TurnPort::HandleChannelData(uint16_t channel_id,
@@ -1132,13 +1135,13 @@
   }
 
   DispatchPacket(data + TURN_CHANNEL_HEADER_SIZE, len, entry->address(),
-                 PROTO_UDP, packet_time_us);
+                 webrtc::PROTO_UDP, packet_time_us);
 }
 
 void TurnPort::DispatchPacket(const char* data,
                               size_t size,
                               const rtc::SocketAddress& remote_addr,
-                              ProtocolType proto,
+                              webrtc::ProtocolType proto,
                               int64_t packet_time_us) {
   rtc::ReceivedPacket packet = rtc::ReceivedPacket::CreateFromLegacy(
       data, size, packet_time_us, remote_addr);
@@ -1317,14 +1320,14 @@
   std::string scheme = "turn";
   std::string transport = "tcp";
   switch (server_address_.proto) {
-    case PROTO_SSLTCP:
-    case PROTO_TLS:
+    case webrtc::PROTO_SSLTCP:
+    case webrtc::PROTO_TLS:
       scheme = "turns";
       break;
-    case PROTO_UDP:
+    case webrtc::PROTO_UDP:
       transport = "udp";
       break;
-    case PROTO_TCP:
+    case webrtc::PROTO_TCP:
       break;
   }
   rtc::StringBuilder url;
diff --git a/p2p/base/turn_port.h b/p2p/base/turn_port.h
index dec9d6c..32d0b0e 100644
--- a/p2p/base/turn_port.h
+++ b/p2p/base/turn_port.h
@@ -127,7 +127,7 @@
   }
   const RelayCredentials& credentials() const { return credentials_; }
 
-  ProtocolType GetProtocol() const override;
+  webrtc::ProtocolType GetProtocol() const override;
 
   virtual TlsCertPolicy GetTlsCertPolicy() const;
   virtual void SetTlsCertPolicy(TlsCertPolicy tls_cert_policy);
@@ -142,8 +142,9 @@
   void Release();
 
   void PrepareAddress() override;
-  Connection* CreateConnection(const Candidate& c,
-                               PortInterface::CandidateOrigin origin) override;
+  Connection* CreateConnection(
+      const Candidate& c,
+      webrtc::PortInterface::CandidateOrigin origin) override;
   int SendTo(const void* data,
              size_t size,
              const rtc::SocketAddress& addr,
@@ -308,7 +309,7 @@
   void DispatchPacket(const char* data,
                       size_t size,
                       const rtc::SocketAddress& remote_addr,
-                      ProtocolType proto,
+                      webrtc::ProtocolType proto,
                       int64_t packet_time_us);
 
   bool ScheduleRefresh(uint32_t lifetime);
diff --git a/p2p/base/turn_port_unittest.cc b/p2p/base/turn_port_unittest.cc
index 0873da9..88711cf 100644
--- a/p2p/base/turn_port_unittest.cc
+++ b/p2p/base/turn_port_unittest.cc
@@ -134,28 +134,28 @@
 constexpr uint64_t kTiebreakerDefault = 44444;
 
 static const cricket::ProtocolAddress kTurnUdpProtoAddr(kTurnUdpIntAddr,
-                                                        cricket::PROTO_UDP);
+                                                        webrtc::PROTO_UDP);
 static const cricket::ProtocolAddress kTurnTcpProtoAddr(kTurnTcpIntAddr,
-                                                        cricket::PROTO_TCP);
+                                                        webrtc::PROTO_TCP);
 static const cricket::ProtocolAddress kTurnTlsProtoAddr(kTurnTcpIntAddr,
-                                                        cricket::PROTO_TLS);
+                                                        webrtc::PROTO_TLS);
 static const cricket::ProtocolAddress kTurnUdpIPv6ProtoAddr(kTurnUdpIPv6IntAddr,
-                                                            cricket::PROTO_UDP);
+                                                            webrtc::PROTO_UDP);
 static const cricket::ProtocolAddress kTurnDangerousProtoAddr(
     kTurnDangerousAddr,
-    cricket::PROTO_TCP);
+    webrtc::PROTO_TCP);
 static const cricket::ProtocolAddress kTurnPort53ProtoAddr(kTurnPort53Addr,
-                                                           cricket::PROTO_TCP);
+                                                           webrtc::PROTO_TCP);
 static const cricket::ProtocolAddress kTurnPort80ProtoAddr(kTurnPort80Addr,
-                                                           cricket::PROTO_TCP);
+                                                           webrtc::PROTO_TCP);
 static const cricket::ProtocolAddress kTurnPort443ProtoAddr(kTurnPort443Addr,
-                                                            cricket::PROTO_TCP);
+                                                            webrtc::PROTO_TCP);
 static const cricket::ProtocolAddress kTurnPortInvalidHostnameProtoAddr(
     kTurnInvalidAddr,
-    cricket::PROTO_UDP);
+    webrtc::PROTO_UDP);
 static const cricket::ProtocolAddress kTurnPortValidHostnameProtoAddr(
     kTurnValidAddr,
-    cricket::PROTO_UDP);
+    webrtc::PROTO_UDP);
 
 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
 static int GetFDCount() {
@@ -235,9 +235,9 @@
                         const cricket::IceCandidateErrorEvent& event) {
     error_event_ = event;
   }
-  void OnTurnUnknownAddress(PortInterface* port,
+  void OnTurnUnknownAddress(webrtc::PortInterface* port,
                             const SocketAddress& addr,
-                            ProtocolType proto,
+                            webrtc::ProtocolType proto,
                             IceMessage* msg,
                             const std::string& rf,
                             bool /*port_muxed*/) {
@@ -248,7 +248,9 @@
                           const rtc::ReceivedPacket& packet) {
     turn_port_->HandleIncomingPacket(socket, packet);
   }
-  void OnTurnPortDestroyed(PortInterface* port) { turn_port_destroyed_ = true; }
+  void OnTurnPortDestroyed(webrtc::PortInterface* port) {
+    turn_port_destroyed_ = true;
+  }
 
   // TurnPort::TestCallbacks
   void OnTurnCreatePermissionResult(int code) override {
@@ -327,7 +329,7 @@
     turn_port_->SetIceTiebreaker(kTiebreakerDefault);
     ConnectSignals();
 
-    if (server_address.proto == cricket::PROTO_TLS) {
+    if (server_address.proto == webrtc::PROTO_TLS) {
       // The test TURN server has a self-signed certificate so will not pass
       // the normal client validation. Instruct the client to ignore certificate
       // errors for testing only.
@@ -340,7 +342,7 @@
   void CreateSharedTurnPort(absl::string_view username,
                             absl::string_view password,
                             const ProtocolAddress& server_address) {
-    RTC_CHECK(server_address.proto == PROTO_UDP);
+    RTC_CHECK(server_address.proto == webrtc::PROTO_UDP);
 
     if (!socket_) {
       socket_.reset(socket_factory()->CreateUdpSocket(
@@ -402,7 +404,7 @@
                                           &TurnPortTest::OnUdpPortComplete);
   }
 
-  void PrepareTurnAndUdpPorts(ProtocolType protocol_type) {
+  void PrepareTurnAndUdpPorts(webrtc::ProtocolType protocol_type) {
     // turn_port_ should have been created.
     ASSERT_TRUE(turn_port_ != nullptr);
     turn_port_->PrepareAddress();
@@ -423,17 +425,17 @@
 
   // Returns the fake clock time to establish a connection over the given
   // protocol.
-  int TimeToConnect(ProtocolType protocol_type) {
+  int TimeToConnect(webrtc::ProtocolType protocol_type) {
     switch (protocol_type) {
-      case PROTO_TCP:
+      case webrtc::PROTO_TCP:
         // The virtual socket server will delay by a fixed half a round trip
         // for a TCP connection.
         return kSimulatedRtt / 2;
-      case PROTO_TLS:
+      case webrtc::PROTO_TLS:
         // TLS operates over TCP and additionally has a round of HELLO for
         // negotiating ciphers and a round for exchanging certificates.
-        return 2 * kSimulatedRtt + TimeToConnect(PROTO_TCP);
-      case PROTO_UDP:
+        return 2 * kSimulatedRtt + TimeToConnect(webrtc::PROTO_TCP);
+      case webrtc::PROTO_UDP:
       default:
         // UDP requires no round trips to set up the connection.
         return 0;
@@ -442,7 +444,7 @@
 
   // Returns the total fake clock time to establish a connection with a TURN
   // server over the given protocol and to allocate a TURN candidate.
-  int TimeToGetTurnCandidate(ProtocolType protocol_type) {
+  int TimeToGetTurnCandidate(webrtc::ProtocolType protocol_type) {
     // For a simple allocation, the first Allocate message will return with an
     // error asking for credentials and will succeed after the second Allocate
     // message.
@@ -455,7 +457,7 @@
   // 3. Connect to alternate TURN server
   // 4. Send Allocate and receive a request for credentials
   // 5. Send Allocate with credentials and receive allocation
-  int TimeToGetAlternateTurnCandidate(ProtocolType protocol_type) {
+  int TimeToGetAlternateTurnCandidate(webrtc::ProtocolType protocol_type) {
     return 3 * kSimulatedRtt + 2 * TimeToConnect(protocol_type);
   }
 
@@ -493,7 +495,7 @@
     EXPECT_NE(0, turn_port_->Candidates()[0].address().port());
   }
 
-  void TestReconstructedServerUrl(ProtocolType protocol_type,
+  void TestReconstructedServerUrl(webrtc::ProtocolType protocol_type,
                                   absl::string_view expected_url) {
     ASSERT_TRUE(turn_port_);
     turn_port_->PrepareAddress();
@@ -506,7 +508,7 @@
     EXPECT_EQ(turn_port_->Candidates()[0].url(), expected_url);
   }
 
-  void TestTurnAlternateServer(ProtocolType protocol_type) {
+  void TestTurnAlternateServer(webrtc::ProtocolType protocol_type) {
     std::vector<rtc::SocketAddress> redirect_addresses;
     redirect_addresses.push_back(kTurnAlternateIntAddr);
 
@@ -538,7 +540,7 @@
     EXPECT_NE(0, turn_port_->Candidates()[0].address().port());
   }
 
-  void TestTurnAlternateServerV4toV6(ProtocolType protocol_type) {
+  void TestTurnAlternateServerV4toV6(webrtc::ProtocolType protocol_type) {
     std::vector<rtc::SocketAddress> redirect_addresses;
     redirect_addresses.push_back(kTurnIPv6IntAddr);
 
@@ -558,7 +560,7 @@
         webrtc::IsRtcOk());
   }
 
-  void TestTurnAlternateServerPingPong(ProtocolType protocol_type) {
+  void TestTurnAlternateServerPingPong(webrtc::ProtocolType protocol_type) {
     std::vector<rtc::SocketAddress> redirect_addresses;
     redirect_addresses.push_back(kTurnAlternateIntAddr);
     redirect_addresses.push_back(kTurnIntAddr);
@@ -585,7 +587,8 @@
     EXPECT_FALSE(redirector.ShouldRedirect(address, &address));
   }
 
-  void TestTurnAlternateServerDetectRepetition(ProtocolType protocol_type) {
+  void TestTurnAlternateServerDetectRepetition(
+      webrtc::ProtocolType protocol_type) {
     std::vector<rtc::SocketAddress> redirect_addresses;
     redirect_addresses.push_back(kTurnAlternateIntAddr);
     redirect_addresses.push_back(kTurnAlternateIntAddr);
@@ -612,7 +615,8 @@
   // which doesn't ever actually make sense. So redirects to loopback should
   // be treated as errors.
   // See: https://bugs.chromium.org/p/chromium/issues/detail?id=649118
-  void TestTurnAlternateServerLoopback(ProtocolType protocol_type, bool ipv6) {
+  void TestTurnAlternateServerLoopback(webrtc::ProtocolType protocol_type,
+                                       bool ipv6) {
     const SocketAddress& local_address = ipv6 ? kLocalIPv6Addr : kLocalAddr1;
     const SocketAddress& server_address =
         ipv6 ? kTurnIPv6IntAddr : kTurnIntAddr;
@@ -627,10 +631,11 @@
     // Make a socket and bind it to the local port, to make extra sure no
     // packet is sent to this address.
     std::unique_ptr<rtc::Socket> loopback_socket(ss_->CreateSocket(
-        AF_INET, protocol_type == PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM));
+        AF_INET,
+        protocol_type == webrtc::PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM));
     ASSERT_NE(nullptr, loopback_socket.get());
     ASSERT_EQ(0, loopback_socket->Bind(loopback_address));
-    if (protocol_type == PROTO_TCP) {
+    if (protocol_type == webrtc::PROTO_TCP) {
       ASSERT_EQ(0, loopback_socket->Listen(1));
     }
 
@@ -652,7 +657,7 @@
     // loopback port we created (or in the case of TCP, no connection attempt
     // occurred).
     SIMULATED_WAIT(false, kSimulatedRtt, fake_clock_);
-    if (protocol_type == PROTO_UDP) {
+    if (protocol_type == webrtc::PROTO_UDP) {
       char buf[1];
       EXPECT_EQ(-1, loopback_socket->Recv(&buf, 1, nullptr));
     } else {
@@ -662,7 +667,7 @@
     }
   }
 
-  void TestTurnConnection(ProtocolType protocol_type) {
+  void TestTurnConnection(webrtc::ProtocolType protocol_type) {
     // Create ports and prepare addresses.
     PrepareTurnAndUdpPorts(protocol_type);
 
@@ -711,7 +716,7 @@
   }
 
   void TestDestroyTurnConnection() {
-    PrepareTurnAndUdpPorts(PROTO_UDP);
+    PrepareTurnAndUdpPorts(webrtc::PROTO_UDP);
 
     // Create connections on both ends.
     Connection* conn1 = udp_port_->CreateConnection(turn_port_->Candidates()[0],
@@ -797,7 +802,7 @@
         webrtc::IsRtcOk());
   }
 
-  void TestTurnSendData(ProtocolType protocol_type) {
+  void TestTurnSendData(webrtc::ProtocolType protocol_type) {
     PrepareTurnAndUdpPorts(protocol_type);
 
     // Create connections and send pings.
@@ -859,7 +864,7 @@
   }
 
   // Test that a TURN allocation is released when the port is closed.
-  void TestTurnReleaseAllocation(ProtocolType protocol_type) {
+  void TestTurnReleaseAllocation(webrtc::ProtocolType protocol_type) {
     PrepareTurnAndUdpPorts(protocol_type);
     turn_port_.reset();
     EXPECT_THAT(
@@ -872,7 +877,7 @@
 
   // Test that the TURN allocation is released by sending a refresh request
   // with lifetime 0 when Release is called.
-  void TestTurnGracefulReleaseAllocation(ProtocolType protocol_type) {
+  void TestTurnGracefulReleaseAllocation(webrtc::ProtocolType protocol_type) {
     PrepareTurnAndUdpPorts(protocol_type);
 
     // Create connections and send pings.
@@ -980,29 +985,32 @@
 // gathering the candidates.
 TEST_F(TurnPortTest, TestReconstructedServerUrlForUdpIPv4) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestReconstructedServerUrl(PROTO_UDP, "turn:99.99.99.3:3478?transport=udp");
+  TestReconstructedServerUrl(webrtc::PROTO_UDP,
+                             "turn:99.99.99.3:3478?transport=udp");
 }
 
 TEST_F(TurnPortTest, TestReconstructedServerUrlForUdpIPv6) {
-  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, webrtc::PROTO_UDP);
   CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
                  kTurnUdpIPv6ProtoAddr);
   // Should add [] around the IPv6.
   TestReconstructedServerUrl(
-      PROTO_UDP,
+      webrtc::PROTO_UDP,
       "turn:[2400:4030:1:2c00:be30:abcd:efab:cdef]:3478?transport=udp");
 }
 
 TEST_F(TurnPortTest, TestReconstructedServerUrlForTcp) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  TestReconstructedServerUrl(PROTO_TCP, "turn:99.99.99.4:3478?transport=tcp");
+  TestReconstructedServerUrl(webrtc::PROTO_TCP,
+                             "turn:99.99.99.4:3478?transport=tcp");
 }
 
 TEST_F(TurnPortTest, TestReconstructedServerUrlForTls) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestReconstructedServerUrl(PROTO_TLS, "turns:99.99.99.4:3478?transport=tcp");
+  TestReconstructedServerUrl(webrtc::PROTO_TLS,
+                             "turns:99.99.99.4:3478?transport=tcp");
 }
 
 TEST_F(TurnPortTest, TestReconstructedServerUrlForHostname) {
@@ -1116,7 +1124,7 @@
 
 // Testing a normal UDP allocation using TCP connection.
 TEST_F(TurnPortTest, TestTurnTcpAllocate) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
   EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10 * 1024));
   TestTurnAllocateSucceeds(kSimulatedRtt * 3);
@@ -1131,7 +1139,7 @@
   // kLocalAddr, it will end up using localhost instead.
   ss_->SetAlternativeLocalAddress(kLocalAddr1.ipaddr(), local_address.ipaddr());
 
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kLocalAddr1, kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
   EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10 * 1024));
   TestTurnAllocateSucceeds(kSimulatedRtt * 3);
@@ -1154,7 +1162,7 @@
   ss_->SetAlternativeLocalAddress(kLocalAddr1.ipaddr(), kLocalAddr2.ipaddr());
 
   // Set up TURN server to use TCP (this logic only exists for TCP).
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
 
   // Create TURN port and tell it to start allocation.
   CreateTurnPort(kLocalAddr1, kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
@@ -1195,7 +1203,7 @@
   ASSERT_EQ(kLocalAddr1.ipaddr(), network->GetBestIP());
 
   // Set up TURN server to use TCP (this logic only exists for TCP).
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
 
   // Create TURN port using our special Network, and tell it to start
   // allocation.
@@ -1225,13 +1233,13 @@
       kLocalIPv6Addr.ipaddr(), webrtc::IPV6_ADDRESS_FLAG_TEMPORARY));
 
   // Set up TURN server to use TCP (this logic only exists for TCP).
-  turn_server_.AddInternalSocket(kTurnIPv6IntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnIPv6IntAddr, webrtc::PROTO_TCP);
 
   // Create TURN port using our special Network, and tell it to start
   // allocation.
   CreateTurnPortWithNetwork(
       &networks_.back(), kTurnUsername, kTurnPassword,
-      cricket::ProtocolAddress(kTurnIPv6IntAddr, PROTO_TCP));
+      cricket::ProtocolAddress(kTurnIPv6IntAddr, webrtc::PROTO_TCP));
   turn_port_->PrepareAddress();
 
   // Candidate should be gathered as normally.
@@ -1246,9 +1254,9 @@
 // Testing turn port will attempt to create TCP socket on address resolution
 // failure.
 TEST_F(TurnPortTest, TestTurnTcpOnAddressResolveFailure) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword,
-                 ProtocolAddress(kTurnInvalidAddr, PROTO_TCP));
+                 ProtocolAddress(kTurnInvalidAddr, webrtc::PROTO_TCP));
   turn_port_->PrepareAddress();
   EXPECT_THAT(webrtc::WaitUntil(
                   [&] { return turn_error_; }, IsTrue(),
@@ -1272,9 +1280,9 @@
 // Testing turn port will attempt to create TLS socket on address resolution
 // failure.
 TEST_F(TurnPortTest, TestTurnTlsOnAddressResolveFailure) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   CreateTurnPort(kTurnUsername, kTurnPassword,
-                 ProtocolAddress(kTurnInvalidAddr, PROTO_TLS));
+                 ProtocolAddress(kTurnInvalidAddr, webrtc::PROTO_TLS));
   turn_port_->PrepareAddress();
   EXPECT_THAT(webrtc::WaitUntil(
                   [&] { return turn_error_; }, IsTrue(),
@@ -1287,7 +1295,7 @@
 // and return allocate failure.
 TEST_F(TurnPortTest, TestTurnUdpOnAddressResolveFailure) {
   CreateTurnPort(kTurnUsername, kTurnPassword,
-                 ProtocolAddress(kTurnInvalidAddr, PROTO_UDP));
+                 ProtocolAddress(kTurnInvalidAddr, webrtc::PROTO_UDP));
   turn_port_->PrepareAddress();
   EXPECT_THAT(webrtc::WaitUntil(
                   [&] { return turn_error_; }, IsTrue(),
@@ -1439,7 +1447,7 @@
 }
 
 TEST_F(TurnPortTest, TestTurnTcpAllocateMismatch) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
 
   // Do a normal allocation first.
@@ -1478,7 +1486,7 @@
 
 TEST_F(TurnPortTest, TestRefreshRequestGetsErrorResponse) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_UDP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_UDP);
   turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                Port::ORIGIN_MESSAGE);
   // Set bad credentials.
@@ -1510,7 +1518,7 @@
 // closed.
 TEST_F(TurnPortTest, TestStopProcessingPacketsAfterClosed) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_UDP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_UDP);
   Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                                    Port::ORIGIN_MESSAGE);
   Connection* conn2 = udp_port_->CreateConnection(turn_port_->Candidates()[0],
@@ -1538,9 +1546,9 @@
 
 // Test that CreateConnection will return null if port becomes disconnected.
 TEST_F(TurnPortTest, TestCreateConnectionWhenSocketClosed) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_TCP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_TCP);
   // Create a connection.
   Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                                    Port::ORIGIN_MESSAGE);
@@ -1556,9 +1564,9 @@
 // Tests that when a TCP socket is closed, the respective TURN connection will
 // be destroyed.
 TEST_F(TurnPortTest, TestSocketCloseWillDestroyConnection) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_TCP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_TCP);
   Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                                   Port::ORIGIN_MESSAGE);
   EXPECT_NE(nullptr, conn);
@@ -1574,80 +1582,80 @@
 
 // Test try-alternate-server feature.
 TEST_F(TurnPortTest, TestTurnAlternateServerUDP) {
-  TestTurnAlternateServer(PROTO_UDP);
+  TestTurnAlternateServer(webrtc::PROTO_UDP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerTCP) {
-  TestTurnAlternateServer(PROTO_TCP);
+  TestTurnAlternateServer(webrtc::PROTO_TCP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerTLS) {
-  TestTurnAlternateServer(PROTO_TLS);
+  TestTurnAlternateServer(webrtc::PROTO_TLS);
 }
 
 // Test that we fail when we redirect to an address different from
 // current IP family.
 TEST_F(TurnPortTest, TestTurnAlternateServerV4toV6UDP) {
-  TestTurnAlternateServerV4toV6(PROTO_UDP);
+  TestTurnAlternateServerV4toV6(webrtc::PROTO_UDP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerV4toV6TCP) {
-  TestTurnAlternateServerV4toV6(PROTO_TCP);
+  TestTurnAlternateServerV4toV6(webrtc::PROTO_TCP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerV4toV6TLS) {
-  TestTurnAlternateServerV4toV6(PROTO_TLS);
+  TestTurnAlternateServerV4toV6(webrtc::PROTO_TLS);
 }
 
 // Test try-alternate-server catches the case of pingpong.
 TEST_F(TurnPortTest, TestTurnAlternateServerPingPongUDP) {
-  TestTurnAlternateServerPingPong(PROTO_UDP);
+  TestTurnAlternateServerPingPong(webrtc::PROTO_UDP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerPingPongTCP) {
-  TestTurnAlternateServerPingPong(PROTO_TCP);
+  TestTurnAlternateServerPingPong(webrtc::PROTO_TCP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerPingPongTLS) {
-  TestTurnAlternateServerPingPong(PROTO_TLS);
+  TestTurnAlternateServerPingPong(webrtc::PROTO_TLS);
 }
 
 // Test try-alternate-server catch the case of repeated server.
 TEST_F(TurnPortTest, TestTurnAlternateServerDetectRepetitionUDP) {
-  TestTurnAlternateServerDetectRepetition(PROTO_UDP);
+  TestTurnAlternateServerDetectRepetition(webrtc::PROTO_UDP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerDetectRepetitionTCP) {
-  TestTurnAlternateServerDetectRepetition(PROTO_TCP);
+  TestTurnAlternateServerDetectRepetition(webrtc::PROTO_TCP);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerDetectRepetitionTLS) {
-  TestTurnAlternateServerDetectRepetition(PROTO_TCP);
+  TestTurnAlternateServerDetectRepetition(webrtc::PROTO_TCP);
 }
 
 // Test catching the case of a redirect to loopback.
 TEST_F(TurnPortTest, TestTurnAlternateServerLoopbackUdpIpv4) {
-  TestTurnAlternateServerLoopback(PROTO_UDP, false);
+  TestTurnAlternateServerLoopback(webrtc::PROTO_UDP, false);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerLoopbackUdpIpv6) {
-  TestTurnAlternateServerLoopback(PROTO_UDP, true);
+  TestTurnAlternateServerLoopback(webrtc::PROTO_UDP, true);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerLoopbackTcpIpv4) {
-  TestTurnAlternateServerLoopback(PROTO_TCP, false);
+  TestTurnAlternateServerLoopback(webrtc::PROTO_TCP, false);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerLoopbackTcpIpv6) {
-  TestTurnAlternateServerLoopback(PROTO_TCP, true);
+  TestTurnAlternateServerLoopback(webrtc::PROTO_TCP, true);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerLoopbackTlsIpv4) {
-  TestTurnAlternateServerLoopback(PROTO_TLS, false);
+  TestTurnAlternateServerLoopback(webrtc::PROTO_TLS, false);
 }
 
 TEST_F(TurnPortTest, TestTurnAlternateServerLoopbackTlsIpv6) {
-  TestTurnAlternateServerLoopback(PROTO_TLS, true);
+  TestTurnAlternateServerLoopback(webrtc::PROTO_TLS, true);
 }
 
 // Do a TURN allocation and try to send a packet to it from the outside.
@@ -1656,27 +1664,27 @@
 // outside. It should now work as well.
 TEST_F(TurnPortTest, TestTurnConnection) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestTurnConnection(PROTO_UDP);
+  TestTurnConnection(webrtc::PROTO_UDP);
 }
 
 // Similar to above, except that this test will use the shared socket.
 TEST_F(TurnPortTest, TestTurnConnectionUsingSharedSocket) {
   CreateSharedTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestTurnConnection(PROTO_UDP);
+  TestTurnConnection(webrtc::PROTO_UDP);
 }
 
 // Test that we can establish a TCP connection with TURN server.
 TEST_F(TurnPortTest, TestTurnTcpConnection) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  TestTurnConnection(PROTO_TCP);
+  TestTurnConnection(webrtc::PROTO_TCP);
 }
 
 // Test that we can establish a TLS connection with TURN server.
 TEST_F(TurnPortTest, TestTurnTlsConnection) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnConnection(PROTO_TLS);
+  TestTurnConnection(webrtc::PROTO_TLS);
 }
 
 // Test that if a connection on a TURN port is destroyed, the TURN port can
@@ -1699,7 +1707,7 @@
 TEST_F(TurnPortTest, TestTurnConnectionUsingOTUNonce) {
   turn_server_.set_enable_otu_nonce(true);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestTurnConnection(PROTO_UDP);
+  TestTurnConnection(webrtc::PROTO_UDP);
 }
 
 // Test that CreatePermissionRequest will be scheduled after the success
@@ -1707,7 +1715,7 @@
 // ErrorResponse if the ufrag and pwd are incorrect.
 TEST_F(TurnPortTest, TestRefreshCreatePermissionRequest) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_UDP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_UDP);
 
   Connection* conn = turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                                   Port::ORIGIN_MESSAGE);
@@ -1741,7 +1749,7 @@
 
 TEST_F(TurnPortTest, TestChannelBindGetErrorResponse) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_UDP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_UDP);
   Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                                    Port::ORIGIN_MESSAGE);
   ASSERT_TRUE(conn1 != nullptr);
@@ -1791,31 +1799,31 @@
 TEST_F(TurnPortTest, TestTurnSendDataTurnUdpToUdp) {
   // Create ports and prepare addresses.
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestTurnSendData(PROTO_UDP);
+  TestTurnSendData(webrtc::PROTO_UDP);
   EXPECT_EQ(UDP_PROTOCOL_NAME, turn_port_->Candidates()[0].relay_protocol());
 }
 
 // Do a TURN allocation, establish a TCP connection, and send some data.
 TEST_F(TurnPortTest, TestTurnSendDataTurnTcpToUdp) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   // Create ports and prepare addresses.
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  TestTurnSendData(PROTO_TCP);
+  TestTurnSendData(webrtc::PROTO_TCP);
   EXPECT_EQ(TCP_PROTOCOL_NAME, turn_port_->Candidates()[0].relay_protocol());
 }
 
 // Do a TURN allocation, establish a TLS connection, and send some data.
 TEST_F(TurnPortTest, TestTurnSendDataTurnTlsToUdp) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnSendData(PROTO_TLS);
+  TestTurnSendData(webrtc::PROTO_TLS);
   EXPECT_EQ(TLS_PROTOCOL_NAME, turn_port_->Candidates()[0].relay_protocol());
 }
 
 // Test TURN fails to make a connection from IPv6 address to a server which has
 // IPv4 address.
 TEST_F(TurnPortTest, TestTurnLocalIPv6AddressServerIPv4) {
-  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, webrtc::PROTO_UDP);
   CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
                  kTurnUdpProtoAddr);
   turn_port_->PrepareAddress();
@@ -1831,7 +1839,7 @@
 // IPv6 intenal address. But in this test external address is a IPv4 address,
 // hence allocated address will be a IPv4 address.
 TEST_F(TurnPortTest, TestTurnLocalIPv6AddressServerIPv6ExtenalIPv4) {
-  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, webrtc::PROTO_UDP);
   CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
                  kTurnUdpIPv6ProtoAddr);
   TestTurnAllocateSucceeds(kSimulatedRtt * 2);
@@ -1842,7 +1850,7 @@
 // its local candidate will still be an IPv4 address and it can only create
 // connections with IPv4 remote candidates.
 TEST_F(TurnPortTest, TestCandidateAddressFamilyMatch) {
-  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, webrtc::PROTO_UDP);
 
   CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
                  kTurnUdpIPv6ProtoAddr);
@@ -1873,7 +1881,7 @@
 // Test that a CreatePermission failure will result in the connection being
 // pruned and failed.
 TEST_F(TurnPortTest, TestConnectionFailedAndPrunedOnCreatePermissionFailure) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   turn_server_.server()->set_reject_private_addresses(true);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
   turn_port_->PrepareAddress();
@@ -1918,38 +1926,38 @@
 // Test that a TURN allocation is released when the port is closed.
 TEST_F(TurnPortTest, TestTurnReleaseAllocation) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestTurnReleaseAllocation(PROTO_UDP);
+  TestTurnReleaseAllocation(webrtc::PROTO_UDP);
 }
 
 // Test that a TURN TCP allocation is released when the port is closed.
 TEST_F(TurnPortTest, TestTurnTCPReleaseAllocation) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  TestTurnReleaseAllocation(PROTO_TCP);
+  TestTurnReleaseAllocation(webrtc::PROTO_TCP);
 }
 
 TEST_F(TurnPortTest, TestTurnTLSReleaseAllocation) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnReleaseAllocation(PROTO_TLS);
+  TestTurnReleaseAllocation(webrtc::PROTO_TLS);
 }
 
 TEST_F(TurnPortTest, TestTurnUDPGracefulReleaseAllocation) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_UDP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  TestTurnGracefulReleaseAllocation(PROTO_UDP);
+  TestTurnGracefulReleaseAllocation(webrtc::PROTO_UDP);
 }
 
 TEST_F(TurnPortTest, TestTurnTCPGracefulReleaseAllocation) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
-  TestTurnGracefulReleaseAllocation(PROTO_TCP);
+  TestTurnGracefulReleaseAllocation(webrtc::PROTO_TCP);
 }
 
 TEST_F(TurnPortTest, TestTurnTLSGracefulReleaseAllocation) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnGracefulReleaseAllocation(PROTO_TLS);
+  TestTurnGracefulReleaseAllocation(webrtc::PROTO_TLS);
 }
 
 // Test that nothing bad happens if we try to create a connection to the same
@@ -1957,7 +1965,7 @@
 // DCHECK.
 TEST_F(TurnPortTest, CanCreateTwoConnectionsToSameAddress) {
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
-  PrepareTurnAndUdpPorts(PROTO_UDP);
+  PrepareTurnAndUdpPorts(webrtc::PROTO_UDP);
   Connection* conn1 = turn_port_->CreateConnection(udp_port_->Candidates()[0],
                                                    Port::ORIGIN_MESSAGE);
   Connection* conn2 = turn_port_->CreateConnection(udp_port_->Candidates()[0],
@@ -1970,11 +1978,11 @@
 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
 
 TEST_F(TurnPortTest, TestResolverShutdown) {
-  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, webrtc::PROTO_UDP);
   int last_fd_count = GetFDCount();
   // Need to supply unresolved address to kick off resolver.
   CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
-                 ProtocolAddress(kTurnInvalidAddr, PROTO_UDP));
+                 ProtocolAddress(kTurnInvalidAddr, webrtc::PROTO_UDP));
   turn_port_->PrepareAddress();
   ASSERT_THAT(webrtc::WaitUntil(
                   [&] { return turn_error_; }, IsTrue(),
@@ -2042,12 +2050,12 @@
       &observer_message_counter, &observer_channel_data_counter,
       &observer_attr_counter));
 
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   turn_customizer_.reset(customizer);
   turn_server_.server()->SetStunMessageObserver(std::move(validator));
 
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnSendData(PROTO_TLS);
+  TestTurnSendData(webrtc::PROTO_TLS);
   EXPECT_EQ(TLS_PROTOCOL_NAME, turn_port_->Candidates()[0].relay_protocol());
 
   // There should have been at least turn_packets_.size() calls to `customizer`.
@@ -2072,12 +2080,12 @@
       &observer_message_counter, &observer_channel_data_counter,
       &observer_attr_counter));
   customizer->allow_channel_data_ = false;
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   turn_customizer_.reset(customizer);
   turn_server_.server()->SetStunMessageObserver(std::move(validator));
 
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnSendData(PROTO_TLS);
+  TestTurnSendData(webrtc::PROTO_TLS);
   EXPECT_EQ(TLS_PROTOCOL_NAME, turn_port_->Candidates()[0].relay_protocol());
 
   // There should have been at least turn_packets_.size() calls to `customizer`.
@@ -2102,12 +2110,12 @@
       &observer_attr_counter));
   customizer->allow_channel_data_ = false;
   customizer->add_counter_ = true;
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TLS);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TLS);
   turn_customizer_.reset(customizer);
   turn_server_.server()->SetStunMessageObserver(std::move(validator));
 
   CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTlsProtoAddr);
-  TestTurnSendData(PROTO_TLS);
+  TestTurnSendData(webrtc::PROTO_TLS);
   EXPECT_EQ(TLS_PROTOCOL_NAME, turn_port_->Candidates()[0].relay_protocol());
 
   // There should have been at least turn_packets_.size() calls to `customizer`.
@@ -2158,7 +2166,7 @@
 }
 
 TEST_F(TurnPortTest, TestTurnDangerousAlternateServer) {
-  const ProtocolType protocol_type = PROTO_TCP;
+  const webrtc::ProtocolType protocol_type = webrtc::PROTO_TCP;
   std::vector<rtc::SocketAddress> redirect_addresses;
   redirect_addresses.push_back(kTurnDangerousAddr);
 
@@ -2226,7 +2234,7 @@
 // Test an allocation from a TURN server specified by a hostname on an IPv6
 // network.
 TEST_F(TurnPortWithMockDnsResolverTest, TestHostnameResolvedIPv6Network) {
-  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, PROTO_UDP);
+  turn_server_.AddInternalSocket(kTurnUdpIPv6IntAddr, webrtc::PROTO_UDP);
   CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
                  kTurnPortValidHostnameProtoAddr);
   SetDnsResolverExpectations(
diff --git a/p2p/client/basic_port_allocator.cc b/p2p/client/basic_port_allocator.cc
index 9169163..5a8a81b 100644
--- a/p2p/client/basic_port_allocator.cc
+++ b/p2p/client/basic_port_allocator.cc
@@ -68,14 +68,14 @@
 const int kNumPhases = 3;
 
 // Gets protocol priority: UDP > TCP > SSLTCP == TLS.
-int GetProtocolPriority(cricket::ProtocolType protocol) {
+int GetProtocolPriority(webrtc::ProtocolType protocol) {
   switch (protocol) {
-    case cricket::PROTO_UDP:
+    case webrtc::PROTO_UDP:
       return 2;
-    case cricket::PROTO_TCP:
+    case webrtc::PROTO_TCP:
       return 1;
-    case cricket::PROTO_SSLTCP:
-    case cricket::PROTO_TLS:
+    case webrtc::PROTO_SSLTCP:
+    case webrtc::PROTO_TLS:
       return 0;
     default:
       RTC_DCHECK_NOTREACHED();
@@ -511,16 +511,17 @@
     // IceCandidateType::kHost but uses the protocol PROTO_TCP.
     if (port->Type() == IceCandidateType::kSrflx ||
         (port->Type() == IceCandidateType::kHost &&
-         port->GetProtocol() == PROTO_UDP)) {
+         port->GetProtocol() == webrtc::PROTO_UDP)) {
       static_cast<UDPPort*>(port)->set_stun_keepalive_delay(
           stun_keepalive_interval);
     }
   }
 }
 
-std::vector<PortInterface*> BasicPortAllocatorSession::ReadyPorts() const {
+std::vector<webrtc::PortInterface*> BasicPortAllocatorSession::ReadyPorts()
+    const {
   RTC_DCHECK_RUN_ON(network_thread_);
-  std::vector<PortInterface*> ret;
+  std::vector<webrtc::PortInterface*> ret;
   for (const PortData& data : ports_) {
     if (data.ready()) {
       ret.push_back(data.port());
@@ -1198,7 +1199,7 @@
   }
 }
 
-void BasicPortAllocatorSession::OnPortDestroyed(PortInterface* port) {
+void BasicPortAllocatorSession::OnPortDestroyed(webrtc::PortInterface* port) {
   RTC_DCHECK_RUN_ON(network_thread_);
   for (std::vector<PortData>::iterator iter = ports_.begin();
        iter != ports_.end(); ++iter) {
@@ -1241,7 +1242,7 @@
 void BasicPortAllocatorSession::PrunePortsAndRemoveCandidates(
     const std::vector<PortData*>& port_data_list) {
   RTC_DCHECK_RUN_ON(network_thread_);
-  std::vector<PortInterface*> pruned_ports;
+  std::vector<webrtc::PortInterface*> pruned_ports;
   std::vector<Candidate> removed_candidates;
   for (PortData* data : port_data_list) {
     // Prune the port so that it may be destroyed.
@@ -1352,7 +1353,7 @@
   if (absl::c_any_of(session_->ports_,
                      [this](const BasicPortAllocatorSession::PortData& p) {
                        return !p.pruned() && p.port()->Network() == network_ &&
-                              p.port()->GetProtocol() == PROTO_UDP &&
+                              p.port()->GetProtocol() == webrtc::PROTO_UDP &&
                               p.port()->Type() == IceCandidateType::kHost &&
                               !p.error();
                      })) {
@@ -1363,7 +1364,7 @@
   if (absl::c_any_of(session_->ports_,
                      [this](const BasicPortAllocatorSession::PortData& p) {
                        return !p.pruned() && p.port()->Network() == network_ &&
-                              p.port()->GetProtocol() == PROTO_TCP &&
+                              p.port()->GetProtocol() == webrtc::PROTO_TCP &&
                               p.port()->Type() == IceCandidateType::kHost &&
                               !p.error();
                      })) {
@@ -1604,7 +1605,7 @@
        ++relay_port) {
     // Skip UDP connections to relay servers if it's disallowed.
     if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP_RELAY) &&
-        relay_port->proto == PROTO_UDP) {
+        relay_port->proto == webrtc::PROTO_UDP) {
       continue;
     }
 
@@ -1639,7 +1640,7 @@
     // TODO(mallinath) - Enable shared socket mode for TURN ports. Disabled
     // due to webrtc bug https://code.google.com/p/webrtc/issues/detail?id=3537
     if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) &&
-        relay_port->proto == PROTO_UDP && udp_socket_) {
+        relay_port->proto == webrtc::PROTO_UDP && udp_socket_) {
       port = session_->allocator()->relay_port_factory()->Create(
           args, udp_socket_.get());
 
@@ -1706,7 +1707,7 @@
   }
 }
 
-void AllocationSequence::OnPortDestroyed(PortInterface* port) {
+void AllocationSequence::OnPortDestroyed(webrtc::PortInterface* port) {
   if (udp_port_ == port) {
     udp_port_ = NULL;
     return;
@@ -1749,7 +1750,7 @@
   // Every UDP TURN server should also be used as a STUN server if
   // use_turn_server_as_stun_server is not disabled or the stun servers are
   // empty.
-  ServerAddresses turn_servers = GetRelayServerAddresses(PROTO_UDP);
+  ServerAddresses turn_servers = GetRelayServerAddresses(webrtc::PROTO_UDP);
   for (const rtc::SocketAddress& turn_server : turn_servers) {
     if (stun_servers.find(turn_server) == stun_servers.end()) {
       stun_servers.insert(turn_server);
@@ -1763,7 +1764,7 @@
 }
 
 bool PortConfiguration::SupportsProtocol(const RelayServerConfig& relay,
-                                         ProtocolType type) const {
+                                         webrtc::ProtocolType type) const {
   PortList::const_iterator relay_port;
   for (relay_port = relay.ports.begin(); relay_port != relay.ports.end();
        ++relay_port) {
@@ -1773,7 +1774,7 @@
   return false;
 }
 
-bool PortConfiguration::SupportsProtocol(ProtocolType type) const {
+bool PortConfiguration::SupportsProtocol(webrtc::ProtocolType type) const {
   for (size_t i = 0; i < relays.size(); ++i) {
     if (SupportsProtocol(relays[i], type))
       return true;
@@ -1782,7 +1783,7 @@
 }
 
 ServerAddresses PortConfiguration::GetRelayServerAddresses(
-    ProtocolType type) const {
+    webrtc::ProtocolType type) const {
   ServerAddresses servers;
   for (size_t i = 0; i < relays.size(); ++i) {
     if (SupportsProtocol(relays[i], type)) {
diff --git a/p2p/client/basic_port_allocator.h b/p2p/client/basic_port_allocator.h
index a22eb33..6dc0ffb 100644
--- a/p2p/client/basic_port_allocator.h
+++ b/p2p/client/basic_port_allocator.h
@@ -154,7 +154,7 @@
   bool IsCleared() const override;
   bool IsStopped() const override;
   // These will all be cricket::Ports.
-  std::vector<PortInterface*> ReadyPorts() const override;
+  std::vector<webrtc::PortInterface*> ReadyPorts() const override;
   std::vector<Candidate> ReadyCandidates() const override;
   bool CandidatesAllocationDone() const override;
   void RegatherOnFailedNetworks() override;
@@ -249,8 +249,8 @@
   void OnCandidateError(Port* port, const IceCandidateErrorEvent& event);
   void OnPortComplete(Port* port);
   void OnPortError(Port* port);
-  void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto);
-  void OnPortDestroyed(PortInterface* port);
+  void OnProtocolEnabled(AllocationSequence* seq, webrtc::ProtocolType proto);
+  void OnPortDestroyed(webrtc::PortInterface* port);
   void MaybeSignalCandidatesAllocationDone();
   void OnPortAllocationComplete();
   PortData* FindPort(Port* port);
@@ -325,11 +325,11 @@
 
   // Determines whether the given relay server supports the given protocol.
   bool SupportsProtocol(const RelayServerConfig& relay,
-                        ProtocolType type) const;
-  bool SupportsProtocol(ProtocolType type) const;
+                        webrtc::ProtocolType type) const;
+  bool SupportsProtocol(webrtc::ProtocolType type) const;
   // Helper method returns the server addresses for the matching RelayType and
   // Protocol type.
-  ServerAddresses GetRelayServerAddresses(ProtocolType type) const;
+  ServerAddresses GetRelayServerAddresses(webrtc::ProtocolType type) const;
 };
 
 class UDPPort;
@@ -384,7 +384,7 @@
  private:
   void CreateTurnPort(const RelayServerConfig& config, int relative_priority);
 
-  typedef std::vector<ProtocolType> ProtocolList;
+  typedef std::vector<webrtc::ProtocolType> ProtocolList;
 
   void Process(int epoch);
   bool IsFlagSet(uint32_t flag) { return ((flags_ & flag) != 0); }
@@ -396,7 +396,7 @@
   void OnReadPacket(rtc::AsyncPacketSocket* socket,
                     const rtc::ReceivedPacket& packet);
 
-  void OnPortDestroyed(PortInterface* port);
+  void OnPortDestroyed(webrtc::PortInterface* port);
 
   BasicPortAllocatorSession* session_;
   bool network_failed_ = false;
diff --git a/p2p/client/basic_port_allocator_unittest.cc b/p2p/client/basic_port_allocator_unittest.cc
index 1d2fdb2..bfb4f68 100644
--- a/p2p/client/basic_port_allocator_unittest.cc
+++ b/p2p/client/basic_port_allocator_unittest.cc
@@ -135,7 +135,7 @@
   for (const auto* port : ready_ports) {
     if (port->Type() == IceCandidateType::kSrflx ||
         (port->Type() == IceCandidateType::kHost &&
-         port->GetProtocol() == cricket::PROTO_UDP)) {
+         port->GetProtocol() == webrtc::PROTO_UDP)) {
       EXPECT_EQ(
           static_cast<const cricket::UDPPort*>(port)->stun_keepalive_delay(),
           expected);
@@ -233,10 +233,10 @@
     turn_server.credentials = credentials;
 
     if (!udp_turn.IsNil()) {
-      turn_server.ports.push_back(ProtocolAddress(udp_turn, PROTO_UDP));
+      turn_server.ports.push_back(ProtocolAddress(udp_turn, webrtc::PROTO_UDP));
     }
     if (!tcp_turn.IsNil()) {
-      turn_server.ports.push_back(ProtocolAddress(tcp_turn, PROTO_TCP));
+      turn_server.ports.push_back(ProtocolAddress(tcp_turn, webrtc::PROTO_TCP));
     }
     return turn_server;
   }
@@ -310,9 +310,9 @@
 
   // Returns the number of ports that have matching type, protocol and
   // address.
-  static int CountPorts(const std::vector<PortInterface*>& ports,
+  static int CountPorts(const std::vector<webrtc::PortInterface*>& ports,
                         IceCandidateType type,
-                        ProtocolType protocol,
+                        webrtc::ProtocolType protocol,
                         const SocketAddress& client_addr) {
     return absl::c_count_if(
         ports, [type, protocol, client_addr](PortInterface* port) {
@@ -391,7 +391,7 @@
   // Check if all ports allocated have send-buffer size `expected`. If
   // `expected` == -1, check if GetOptions returns SOCKET_ERROR.
   void CheckSendBufferSizesOfAllPorts(int expected) {
-    std::vector<PortInterface*>::iterator it;
+    std::vector<webrtc::PortInterface*>::iterator it;
     for (it = ports_.begin(); it < ports_.end(); ++it) {
       int send_buffer_size;
       if (expected == -1) {
@@ -410,7 +410,7 @@
  protected:
   BasicPortAllocator& allocator() { return *allocator_; }
 
-  void OnPortReady(PortAllocatorSession* ses, PortInterface* port) {
+  void OnPortReady(PortAllocatorSession* ses, webrtc::PortInterface* port) {
     RTC_LOG(LS_INFO) << "OnPortReady: " << port->ToString();
     ports_.push_back(port);
     // Make sure the new port is added to ReadyPorts.
@@ -418,7 +418,7 @@
     EXPECT_THAT(ready_ports, Contains(port));
   }
   void OnPortsPruned(PortAllocatorSession* ses,
-                     const std::vector<PortInterface*>& pruned_ports) {
+                     const std::vector<webrtc::PortInterface*>& pruned_ports) {
     RTC_LOG(LS_INFO) << "Number of ports pruned: " << pruned_ports.size();
     auto ready_ports = ses->ReadyPorts();
     auto new_end = ports_.end();
@@ -512,7 +512,7 @@
   rtc::FakeNetworkManager network_manager_;
   std::unique_ptr<BasicPortAllocator> allocator_;
   std::unique_ptr<PortAllocatorSession> session_;
-  std::vector<PortInterface*> ports_;
+  std::vector<webrtc::PortInterface*> ports_;
   std::vector<Candidate> candidates_;
   bool candidate_allocation_done_;
   webrtc::test::ScopedKeyValueConfig field_trials_;
@@ -593,7 +593,7 @@
   }
 
   void TestIPv6TurnPortPrunesIPv4TurnPort() {
-    turn_server_.AddInternalSocket(kTurnUdpIntIPv6Addr, PROTO_UDP);
+    turn_server_.AddInternalSocket(kTurnUdpIntIPv6Addr, webrtc::PROTO_UDP);
     // Add two IP addresses on the same interface.
     AddInterface(kClientAddr, "net1");
     AddInterface(kClientIPv6Addr, "net1");
@@ -622,13 +622,13 @@
     // Three ports (one IPv4 STUN, one IPv6 STUN and one TURN) will be ready.
     EXPECT_EQ(3U, session_->ReadyPorts().size());
     EXPECT_EQ(3U, ports_.size());
-    EXPECT_EQ(
-        1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP, kClientAddr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
+                            kClientAddr));
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
                             kClientIPv6Addr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, webrtc::PROTO_UDP,
                             kClientIPv6Addr));
-    EXPECT_EQ(0, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
+    EXPECT_EQ(0, CountPorts(ports_, IceCandidateType::kRelay, webrtc::PROTO_UDP,
                             kClientAddr));
 
     // Now that we remove candidates when a TURN port is pruned, there will be
@@ -646,7 +646,7 @@
   void TestTurnPortPrunesWithUdpAndTcpPorts(
       webrtc::PortPrunePolicy prune_policy,
       bool tcp_pruned) {
-    turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+    turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
     AddInterface(kClientAddr);
     allocator_.reset(
         new BasicPortAllocator(&network_manager_, &socket_factory_));
@@ -673,13 +673,13 @@
     // found in `ready_ports`, and when it is pruned, it is not found in
     // `ready_ports`, so we only need to verify the content in one of them.
     EXPECT_EQ(2U, ports_.size());
-    EXPECT_EQ(
-        1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP, kClientAddr));
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
+                            kClientAddr));
     int num_udp_ports = tcp_pruned ? 1 : 0;
     EXPECT_EQ(num_udp_ports, CountPorts(ports_, IceCandidateType::kRelay,
-                                        PROTO_UDP, kClientAddr));
+                                        webrtc::PROTO_UDP, kClientAddr));
     EXPECT_EQ(1 - num_udp_ports, CountPorts(ports_, IceCandidateType::kRelay,
-                                            PROTO_TCP, kClientAddr));
+                                            webrtc::PROTO_TCP, kClientAddr));
 
     // Now that we remove candidates when a TURN port is pruned, `candidates_`
     // should only contains two candidates regardless whether the TCP TURN port
@@ -699,9 +699,9 @@
   }
 
   void TestEachInterfaceHasItsOwnTurnPorts() {
-    turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
-    turn_server_.AddInternalSocket(kTurnUdpIntIPv6Addr, PROTO_UDP);
-    turn_server_.AddInternalSocket(kTurnTcpIntIPv6Addr, PROTO_TCP);
+    turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
+    turn_server_.AddInternalSocket(kTurnUdpIntIPv6Addr, webrtc::PROTO_UDP);
+    turn_server_.AddInternalSocket(kTurnTcpIntIPv6Addr, webrtc::PROTO_TCP);
     // Add two interfaces both having IPv4 and IPv6 addresses.
     AddInterface(kClientAddr, "net1", rtc::ADAPTER_TYPE_WIFI);
     AddInterface(kClientIPv6Addr, "net1", rtc::ADAPTER_TYPE_WIFI);
@@ -733,25 +733,25 @@
     // use.
     EXPECT_EQ(10U, session_->ReadyPorts().size());
     EXPECT_EQ(10U, ports_.size());
-    EXPECT_EQ(
-        1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP, kClientAddr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
+                            kClientAddr));
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
                             kClientAddr2));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
                             kClientIPv6Addr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_UDP,
                             kClientIPv6Addr2));
-    EXPECT_EQ(
-        1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP, kClientAddr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_TCP,
+                            kClientAddr));
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_TCP,
                             kClientAddr2));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_TCP,
                             kClientIPv6Addr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_TCP,
                             kClientIPv6Addr2));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, webrtc::PROTO_UDP,
                             kClientIPv6Addr));
-    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
+    EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, webrtc::PROTO_UDP,
                             kClientIPv6Addr2));
 
     // Now that we remove candidates when TURN ports are pruned, there will be
@@ -1386,7 +1386,7 @@
   // Default config uses GTURN and no NAT, so replace that with the
   // desired setup (NAT, STUN server, TURN server, UDP/TCP).
   ResetWithStunServerAndNat(kStunAddr);
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
   AddTurnServers(kTurnUdpIntIPv6Addr, kTurnTcpIntIPv6Addr);
   ASSERT_TRUE(CreateSession(ICE_CANDIDATE_COMPONENT_RTP));
@@ -1398,15 +1398,15 @@
            .clock = &fake_clock}),
       webrtc::IsRtcOk());
   EXPECT_EQ(4U, ports_.size());
-  EXPECT_EQ(1,
-            CountPorts(ports_, IceCandidateType::kSrflx, PROTO_UDP, kAnyAddr));
-  EXPECT_EQ(1,
-            CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP, kAnyAddr));
+  EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kSrflx, webrtc::PROTO_UDP,
+                          kAnyAddr));
+  EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, webrtc::PROTO_TCP,
+                          kAnyAddr));
   // Two TURN ports, using UDP/TCP for the first hop to the TURN server.
-  EXPECT_EQ(1,
-            CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP, kAnyAddr));
-  EXPECT_EQ(1,
-            CountPorts(ports_, IceCandidateType::kRelay, PROTO_TCP, kAnyAddr));
+  EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, webrtc::PROTO_UDP,
+                          kAnyAddr));
+  EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, webrtc::PROTO_TCP,
+                          kAnyAddr));
   // The "any" address port should be in the signaled ready ports, but the host
   // candidate for it is useless and shouldn't be signaled. So we only have
   // STUN/TURN candidates.
@@ -1460,7 +1460,7 @@
 // Test that we should get a default private, STUN, TURN/UDP and TURN/TCP
 // candidates when both TURN/UDP and TURN/TCP servers are specified.
 TEST_F(BasicPortAllocatorTest, TestDisableAdapterEnumerationBehindNatWithTcp) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   AddInterface(kPrivateAddr);
   ResetWithStunServerAndNat(kStunAddr);
   AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
@@ -1528,7 +1528,7 @@
 // Test that we disable relay over UDP, and only TCP is used when connecting to
 // the relay server.
 TEST_F(BasicPortAllocatorTest, TestDisableUdpTurn) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   AddInterface(kClientAddr);
   ResetWithStunServerAndNat(kStunAddr);
   AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
@@ -1892,7 +1892,7 @@
 
 // Test TURN port in shared socket mode with UDP and TCP TURN server addresses.
 TEST_F(BasicPortAllocatorTest, TestSharedSocketWithoutNatUsingTurn) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   AddInterface(kClientAddr);
   allocator_.reset(new BasicPortAllocator(&network_manager_, &socket_factory_));
   allocator_->Initialize();
@@ -2032,15 +2032,15 @@
   // IPv6-only machine.
   MAYBE_SKIP_IPV4;
   turn_server_.AddInternalSocket(rtc::SocketAddress("127.0.0.1", 3478),
-                                 PROTO_UDP);
+                                 webrtc::PROTO_UDP);
   AddInterface(kClientAddr);
   allocator_.reset(new BasicPortAllocator(&network_manager_, &socket_factory_));
   allocator_->Initialize();
   RelayServerConfig turn_server;
   RelayCredentials credentials(kTurnUsername, kTurnPassword);
   turn_server.credentials = credentials;
-  turn_server.ports.push_back(
-      ProtocolAddress(rtc::SocketAddress("localhost", 3478), PROTO_UDP));
+  turn_server.ports.push_back(ProtocolAddress(
+      rtc::SocketAddress("localhost", 3478), webrtc::PROTO_UDP));
   allocator_->AddTurnServerForTesting(turn_server);
 
   allocator_->set_step_delay(kMinimumStepDelay);
@@ -2151,7 +2151,7 @@
 // a UDP STUN server, as this could leak our IP address. Thus we should only
 // expect two ports, a UDPPort and TurnPort.
 TEST_F(BasicPortAllocatorTest, TestSharedSocketWithNatUsingTurnTcpOnly) {
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   AddInterface(kClientAddr);
   ResetWithStunServerAndNat(rtc::SocketAddress());
   AddTurnServers(rtc::SocketAddress(), kTurnTcpIntAddr);
@@ -2755,7 +2755,7 @@
   // Default config uses GTURN and no NAT, so replace that with the
   // desired setup (NAT, STUN server, TURN server, UDP/TCP).
   ResetWithStunServerAndNat(kStunAddr);
-  turn_server_.AddInternalSocket(kTurnTcpIntAddr, PROTO_TCP);
+  turn_server_.AddInternalSocket(kTurnTcpIntAddr, webrtc::PROTO_TCP);
   AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
   AddTurnServers(kTurnUdpIntIPv6Addr, kTurnTcpIntIPv6Addr);
 
diff --git a/p2p/test/fake_port_allocator.h b/p2p/test/fake_port_allocator.h
index f5203ca..3e386ca 100644
--- a/p2p/test/fake_port_allocator.h
+++ b/p2p/test/fake_port_allocator.h
@@ -154,7 +154,7 @@
     SignalIceRegathering(this, IceRegatheringReason::NETWORK_FAILURE);
   }
 
-  std::vector<PortInterface*> ReadyPorts() const override {
+  std::vector<webrtc::PortInterface*> ReadyPorts() const override {
     return ready_ports_;
   }
   std::vector<Candidate> ReadyCandidates() const override {
@@ -203,7 +203,7 @@
     allocation_done_ = true;
     SignalCandidatesAllocationDone(this);
   }
-  void OnPortDestroyed(cricket::PortInterface* /* port */) {
+  void OnPortDestroyed(webrtc::PortInterface* /* port */) {
     // Don't want to double-delete port if it deletes itself.
     port_.release();
   }
@@ -216,7 +216,7 @@
   std::unique_ptr<cricket::Port> port_;
   int port_config_count_;
   std::vector<Candidate> candidates_;
-  std::vector<PortInterface*> ready_ports_;
+  std::vector<webrtc::PortInterface*> ready_ports_;
   bool allocation_done_ = false;
   bool is_cleared = false;
   ServerAddresses stun_servers_;
diff --git a/p2p/test/test_turn_customizer.h b/p2p/test/test_turn_customizer.h
index 26d8ab2..4ab2420 100644
--- a/p2p/test/test_turn_customizer.h
+++ b/p2p/test/test_turn_customizer.h
@@ -28,7 +28,7 @@
     STUN_ATTR_COUNTER = 0xFF02  // Number
   };
 
-  void MaybeModifyOutgoingStunMessage(cricket::PortInterface* port,
+  void MaybeModifyOutgoingStunMessage(webrtc::PortInterface* port,
                                       cricket::StunMessage* message) override {
     modify_cnt_++;
 
@@ -40,7 +40,7 @@
     return;
   }
 
-  bool AllowChannelData(cricket::PortInterface* port,
+  bool AllowChannelData(webrtc::PortInterface* port,
                         const void* data,
                         size_t size,
                         bool payload) override {
diff --git a/p2p/test/test_turn_server.h b/p2p/test/test_turn_server.h
index 25e0330..09bb706 100644
--- a/p2p/test/test_turn_server.h
+++ b/p2p/test/test_turn_server.h
@@ -57,7 +57,7 @@
                  rtc::SocketFactory* socket_factory,
                  const rtc::SocketAddress& int_addr,
                  const rtc::SocketAddress& udp_ext_addr,
-                 ProtocolType int_protocol = PROTO_UDP,
+                 webrtc::ProtocolType int_protocol = webrtc::PROTO_UDP,
                  bool ignore_bad_cert = true,
                  absl::string_view common_name = "test turn server")
       : server_(thread), socket_factory_(socket_factory) {
@@ -92,20 +92,20 @@
   }
 
   void AddInternalSocket(const rtc::SocketAddress& int_addr,
-                         ProtocolType proto,
+                         webrtc::ProtocolType proto,
                          bool ignore_bad_cert = true,
                          absl::string_view common_name = "test turn server") {
     RTC_DCHECK(thread_checker_.IsCurrent());
-    if (proto == cricket::PROTO_UDP) {
+    if (proto == webrtc::PROTO_UDP) {
       server_.AddInternalSocket(
           rtc::AsyncUDPSocket::Create(socket_factory_, int_addr), proto);
-    } else if (proto == cricket::PROTO_TCP || proto == cricket::PROTO_TLS) {
+    } else if (proto == webrtc::PROTO_TCP || proto == webrtc::PROTO_TLS) {
       // For TCP we need to create a server socket which can listen for incoming
       // new connections.
       rtc::Socket* socket = socket_factory_->CreateSocket(AF_INET, SOCK_STREAM);
       socket->Bind(int_addr);
       socket->Listen(5);
-      if (proto == cricket::PROTO_TLS) {
+      if (proto == webrtc::PROTO_TLS) {
         // For TLS, wrap the TCP socket with an SSL adapter. The adapter must
         // be configured with a self-signed certificate for testing.
         // Additionally, the client will not present a valid certificate, so we
diff --git a/p2p/test/turn_server.cc b/p2p/test/turn_server.cc
index ad5e865..9c7e666 100644
--- a/p2p/test/turn_server.cc
+++ b/p2p/test/turn_server.cc
@@ -96,7 +96,7 @@
 }
 
 void TurnServer::AddInternalSocket(rtc::AsyncPacketSocket* socket,
-                                   ProtocolType proto) {
+                                   webrtc::ProtocolType proto) {
   RTC_DCHECK_RUN_ON(thread_);
   RTC_DCHECK(server_sockets_.end() == server_sockets_.find(socket));
   server_sockets_[socket] = proto;
@@ -109,7 +109,7 @@
 
 void TurnServer::AddInternalServerSocket(
     rtc::Socket* socket,
-    ProtocolType proto,
+    webrtc::ProtocolType proto,
     std::unique_ptr<rtc::SSLAdapterFactory> ssl_adapter_factory) {
   RTC_DCHECK_RUN_ON(thread_);
 
@@ -503,7 +503,7 @@
   // by all allocations.
   // Note: We may not find a socket if it's a TCP socket that was closed, and
   // the allocation is only now timing out.
-  if (iter != server_sockets_.end() && iter->second != cricket::PROTO_UDP) {
+  if (iter != server_sockets_.end() && iter->second != webrtc::PROTO_UDP) {
     DestroyInternalSocket(socket);
   }
 
@@ -527,7 +527,7 @@
 }
 
 TurnServerConnection::TurnServerConnection(const rtc::SocketAddress& src,
-                                           ProtocolType proto,
+                                           webrtc::ProtocolType proto,
                                            rtc::AsyncPacketSocket* socket)
     : src_(src),
       dst_(socket->GetRemoteAddress()),
diff --git a/p2p/test/turn_server.h b/p2p/test/turn_server.h
index 2b149fe..23474be 100644
--- a/p2p/test/turn_server.h
+++ b/p2p/test/turn_server.h
@@ -51,9 +51,9 @@
 // Encapsulates the client's connection to the server.
 class TurnServerConnection {
  public:
-  TurnServerConnection() : proto_(PROTO_UDP), socket_(NULL) {}
+  TurnServerConnection() : proto_(webrtc::PROTO_UDP), socket_(NULL) {}
   TurnServerConnection(const rtc::SocketAddress& src,
-                       ProtocolType proto,
+                       webrtc::ProtocolType proto,
                        rtc::AsyncPacketSocket* socket);
   const rtc::SocketAddress& src() const { return src_; }
   rtc::AsyncPacketSocket* socket() { return socket_; }
@@ -64,7 +64,7 @@
  private:
   rtc::SocketAddress src_;
   rtc::SocketAddress dst_;
-  cricket::ProtocolType proto_;
+  webrtc::ProtocolType proto_;
   rtc::AsyncPacketSocket* socket_;
 };
 
@@ -246,13 +246,14 @@
   }
 
   // Starts listening for packets from internal clients.
-  void AddInternalSocket(rtc::AsyncPacketSocket* socket, ProtocolType proto);
+  void AddInternalSocket(rtc::AsyncPacketSocket* socket,
+                         webrtc::ProtocolType proto);
   // Starts listening for the connections on this socket. When someone tries
   // to connect, the connection will be accepted and a new internal socket
   // will be added.
   void AddInternalServerSocket(
       rtc::Socket* socket,
-      ProtocolType proto,
+      webrtc::ProtocolType proto,
       std::unique_ptr<rtc::SSLAdapterFactory> ssl_adapter_factory = nullptr);
   // Specifies the factory to use for creating external sockets.
   void SetExternalSocketFactory(rtc::PacketSocketFactory* factory,
@@ -329,9 +330,10 @@
   void DestroyInternalSocket(rtc::AsyncPacketSocket* socket)
       RTC_RUN_ON(thread_);
 
-  typedef std::map<rtc::AsyncPacketSocket*, ProtocolType> InternalSocketMap;
+  typedef std::map<rtc::AsyncPacketSocket*, webrtc::ProtocolType>
+      InternalSocketMap;
   struct ServerSocketInfo {
-    ProtocolType proto;
+    webrtc::ProtocolType proto;
     // If non-null, used to wrap accepted sockets.
     std::unique_ptr<rtc::SSLAdapterFactory> ssl_adapter_factory;
   };
diff --git a/pc/ice_server_parsing.cc b/pc/ice_server_parsing.cc
index 9cfde43..07504fd 100644
--- a/pc/ice_server_parsing.cc
+++ b/pc/ice_server_parsing.cc
@@ -177,7 +177,7 @@
 
   RTC_DCHECK(stun_servers != nullptr);
   RTC_DCHECK(turn_servers != nullptr);
-  cricket::ProtocolType turn_transport_type = cricket::PROTO_UDP;
+  ProtocolType turn_transport_type = PROTO_UDP;
   RTC_DCHECK(!url.empty());
   std::vector<absl::string_view> tokens = rtc::split(url, '?');
   absl::string_view uri_without_transport = tokens[0];
@@ -196,10 +196,9 @@
           "ICE server parsing failed: Transport parameter missing value.");
     }
 
-    std::optional<cricket::ProtocolType> proto =
+    std::optional<ProtocolType> proto =
         cricket::StringToProto(transport_tokens[1]);
-    if (!proto ||
-        (*proto != cricket::PROTO_UDP && *proto != cricket::PROTO_TCP)) {
+    if (!proto || (*proto != PROTO_UDP && *proto != PROTO_TCP)) {
       LOG_AND_RETURN_ERROR(
           RTCErrorType::SYNTAX_ERROR,
           "ICE server parsing failed: Transport parameter should "
@@ -232,7 +231,7 @@
   int default_port = kDefaultStunPort;
   if (service_type == ServiceType::TURNS) {
     default_port = kDefaultStunTlsPort;
-    turn_transport_type = cricket::PROTO_TLS;
+    turn_transport_type = PROTO_TLS;
   }
 
   if (hoststring.find('@') != absl::string_view::npos) {
diff --git a/pc/peer_connection_rampup_tests.cc b/pc/peer_connection_rampup_tests.cc
index 469d821..643f29b 100644
--- a/pc/peer_connection_rampup_tests.cc
+++ b/pc/peer_connection_rampup_tests.cc
@@ -248,7 +248,7 @@
                 IsRtcOk());
   }
 
-  void CreateTurnServer(cricket::ProtocolType type,
+  void CreateTurnServer(ProtocolType type,
                         const std::string& common_name = "test turn server") {
     rtc::Thread* thread = network_thread();
     rtc::SocketFactory* factory = &firewall_socket_server_;
@@ -354,7 +354,7 @@
 };
 
 TEST_F(PeerConnectionRampUpTest, Bwe_After_TurnOverTCP) {
-  CreateTurnServer(cricket::ProtocolType::PROTO_TCP);
+  CreateTurnServer(ProtocolType::PROTO_TCP);
   PeerConnectionInterface::IceServer ice_server;
   std::string ice_server_url = "turn:" + std::string(kTurnInternalAddress) +
                                ":" + std::to_string(kTurnInternalPort) +
@@ -377,7 +377,7 @@
 }
 
 TEST_F(PeerConnectionRampUpTest, Bwe_After_TurnOverUDP) {
-  CreateTurnServer(cricket::ProtocolType::PROTO_UDP);
+  CreateTurnServer(ProtocolType::PROTO_UDP);
   PeerConnectionInterface::IceServer ice_server;
   std::string ice_server_url = "turn:" + std::string(kTurnInternalAddress) +
                                ":" + std::to_string(kTurnInternalPort);
@@ -400,7 +400,7 @@
 }
 
 TEST_F(PeerConnectionRampUpTest, Bwe_After_TurnOverTLS) {
-  CreateTurnServer(cricket::ProtocolType::PROTO_TLS, kTurnInternalAddress);
+  CreateTurnServer(ProtocolType::PROTO_TLS, kTurnInternalAddress);
   PeerConnectionInterface::IceServer ice_server;
   std::string ice_server_url = "turns:" + std::string(kTurnInternalAddress) +
                                ":" + std::to_string(kTurnInternalPort) +
diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h
index 70d7057..14f54c5 100644
--- a/pc/test/integration_test_helpers.h
+++ b/pc/test/integration_test_helpers.h
@@ -1638,7 +1638,7 @@
   cricket::TestTurnServer* CreateTurnServer(
       rtc::SocketAddress internal_address,
       rtc::SocketAddress external_address,
-      cricket::ProtocolType type = cricket::ProtocolType::PROTO_UDP,
+      ProtocolType type = ProtocolType::PROTO_UDP,
       const std::string& common_name = "test turn server") {
     rtc::Thread* thread = network_thread();
     rtc::SocketFactory* socket_factory = fss_.get();
diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc
index 8106b14..93506b8 100644
--- a/pc/webrtc_sdp.cc
+++ b/pc/webrtc_sdp.cc
@@ -1101,18 +1101,17 @@
   }
   SocketAddress address(connection_address, port);
 
-  std::optional<cricket::ProtocolType> protocol =
-      cricket::StringToProto(transport);
+  std::optional<ProtocolType> protocol = cricket::StringToProto(transport);
   if (!protocol) {
     return ParseFailed(first_line, "Unsupported transport type.", error);
   }
   bool tcp_protocol = false;
   switch (*protocol) {
     // Supported protocols.
-    case cricket::PROTO_UDP:
+    case PROTO_UDP:
       break;
-    case cricket::PROTO_TCP:
-    case cricket::PROTO_SSLTCP:
+    case PROTO_TCP:
+    case PROTO_SSLTCP:
       tcp_protocol = true;
       break;
     default: