Fix clang style warnings in p2p/base/portallocator files

Bug: webrtc:163
Change-Id: Id576819149a6a9dcd65a03668bc51e76c71ad820
Reviewed-on: https://webrtc-review.googlesource.com/17003
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20503}
diff --git a/p2p/base/portallocator.cc b/p2p/base/portallocator.cc
index 109472b..6ec6417 100644
--- a/p2p/base/portallocator.cc
+++ b/p2p/base/portallocator.cc
@@ -13,6 +13,43 @@
 
 namespace cricket {
 
+RelayServerConfig::RelayServerConfig(RelayType type) : type(type) {}
+
+RelayServerConfig::RelayServerConfig(const rtc::SocketAddress& address,
+                                     const std::string& username,
+                                     const std::string& password,
+                                     ProtocolType proto)
+    : type(RELAY_TURN), credentials(username, password) {
+  ports.push_back(ProtocolAddress(address, proto));
+}
+
+RelayServerConfig::RelayServerConfig(const std::string& address,
+                                     int port,
+                                     const std::string& username,
+                                     const std::string& password,
+                                     ProtocolType proto)
+    : RelayServerConfig(rtc::SocketAddress(address, port),
+                        username,
+                        password,
+                        proto) {}
+
+// Legacy constructor where "secure" and PROTO_TCP implies PROTO_TLS.
+RelayServerConfig::RelayServerConfig(const std::string& address,
+                                     int port,
+                                     const std::string& username,
+                                     const std::string& password,
+                                     ProtocolType proto,
+                                     bool secure)
+    : RelayServerConfig(address,
+                        port,
+                        username,
+                        password,
+                        (proto == PROTO_TCP && secure ? PROTO_TLS : proto)) {}
+
+RelayServerConfig::RelayServerConfig(const RelayServerConfig&) = default;
+
+RelayServerConfig::~RelayServerConfig() = default;
+
 PortAllocatorSession::PortAllocatorSession(const std::string& content_name,
                                            int component,
                                            const std::string& ice_ufrag,
@@ -29,6 +66,35 @@
   RTC_DCHECK(ice_ufrag.empty() == ice_pwd.empty());
 }
 
+PortAllocatorSession::~PortAllocatorSession() = default;
+
+bool PortAllocatorSession::IsCleared() const {
+  return false;
+}
+
+bool PortAllocatorSession::IsStopped() const {
+  return false;
+}
+
+uint32_t PortAllocatorSession::generation() {
+  return generation_;
+}
+
+void PortAllocatorSession::set_generation(uint32_t generation) {
+  generation_ = generation;
+}
+
+PortAllocator::PortAllocator()
+    : flags_(kDefaultPortAllocatorFlags),
+      min_port_(0),
+      max_port_(0),
+      max_ipv6_networks_(kDefaultMaxIPv6Networks),
+      step_delay_(kDefaultStepDelay),
+      allow_tcp_listen_(true),
+      candidate_filter_(CF_ALL) {}
+
+PortAllocator::~PortAllocator() = default;
+
 bool PortAllocator::SetConfiguration(
     const ServerAddresses& stun_servers,
     const std::vector<RelayServerConfig>& turn_servers,
diff --git a/p2p/base/portallocator.h b/p2p/base/portallocator.h
index 5c0d303..1092910 100644
--- a/p2p/base/portallocator.h
+++ b/p2p/base/portallocator.h
@@ -148,38 +148,25 @@
 typedef std::vector<ProtocolAddress> PortList;
 // TODO(deadbeef): Rename to TurnServerConfig.
 struct RelayServerConfig {
-  RelayServerConfig(RelayType type) : type(type) {}
-
+  RelayServerConfig(RelayType type);
   RelayServerConfig(const rtc::SocketAddress& address,
                     const std::string& username,
                     const std::string& password,
-                    ProtocolType proto)
-      : type(RELAY_TURN), credentials(username, password) {
-    ports.push_back(ProtocolAddress(address, proto));
-  }
-
+                    ProtocolType proto);
   RelayServerConfig(const std::string& address,
                     int port,
                     const std::string& username,
                     const std::string& password,
-                    ProtocolType proto)
-      : RelayServerConfig(rtc::SocketAddress(address, port),
-                          username,
-                          password,
-                          proto) {}
-
+                    ProtocolType proto);
   // Legacy constructor where "secure" and PROTO_TCP implies PROTO_TLS.
   RelayServerConfig(const std::string& address,
                     int port,
                     const std::string& username,
                     const std::string& password,
                     ProtocolType proto,
-                    bool secure)
-      : RelayServerConfig(address,
-                          port,
-                          username,
-                          password,
-                          (proto == PROTO_TCP && secure ? PROTO_TLS : proto)) {}
+                    bool secure);
+  RelayServerConfig(const RelayServerConfig&);
+  ~RelayServerConfig();
 
   bool operator==(const RelayServerConfig& o) const {
     return type == o.type && ports == o.ports && credentials == o.credentials &&
@@ -206,7 +193,7 @@
                        uint32_t flags);
 
   // Subclasses should clean up any ports created.
-  virtual ~PortAllocatorSession() {}
+  ~PortAllocatorSession() override;
 
   uint32_t flags() const { return flags_; }
   void set_flags(uint32_t flags) { flags_ = flags; }
@@ -242,9 +229,9 @@
   virtual void ClearGettingPorts() = 0;
   // Whether it is in the state where the existing gathering process is stopped,
   // but new ones may be started (basically after calling ClearGettingPorts).
-  virtual bool IsCleared() const { return false; }
+  virtual bool IsCleared() const;
   // Whether the session has completely stopped.
-  virtual bool IsStopped() const { return false; }
+  virtual bool IsStopped() const;
   // Re-gathers candidates on networks that do not have any connections. More
   // precisely, a network interface may have more than one IP addresses (e.g.,
   // IPv4 and IPv6 addresses). Each address subnet will be used to create a
@@ -283,8 +270,8 @@
   sigslot::signal2<PortAllocatorSession*, IceRegatheringReason>
       SignalIceRegathering;
 
-  virtual uint32_t generation() { return generation_; }
-  virtual void set_generation(uint32_t generation) { generation_ = generation; }
+  virtual uint32_t generation();
+  virtual void set_generation(uint32_t generation);
   sigslot::signal1<PortAllocatorSession*> SignalDestroyed;
 
  protected:
@@ -333,16 +320,8 @@
 // passing it into an object that uses it on a different thread.
 class PortAllocator : public sigslot::has_slots<> {
  public:
-  PortAllocator()
-      : flags_(kDefaultPortAllocatorFlags),
-        min_port_(0),
-        max_port_(0),
-        max_ipv6_networks_(kDefaultMaxIPv6Networks),
-        step_delay_(kDefaultStepDelay),
-        allow_tcp_listen_(true),
-        candidate_filter_(CF_ALL) {}
-
-  virtual ~PortAllocator() {}
+  PortAllocator();
+  ~PortAllocator() override;
 
   // This should be called on the PortAllocator's thread before the
   // PortAllocator is used. Subclasses may override this if necessary.
diff --git a/p2p/client/basicportallocator.cc b/p2p/client/basicportallocator.cc
index 4717484..c68c4fa 100644
--- a/p2p/client/basicportallocator.cc
+++ b/p2p/client/basicportallocator.cc
@@ -179,6 +179,13 @@
   DiscardCandidatePool();
 }
 
+void BasicPortAllocator::SetNetworkIgnoreMask(int network_ignore_mask) {
+  // TODO(phoglund): implement support for other types than loopback.
+  // See https://code.google.com/p/webrtc/issues/detail?id=4288.
+  // Then remove set_network_ignore_list from NetworkManager.
+  network_ignore_mask_ = network_ignore_mask;
+}
+
 PortAllocatorSession* BasicPortAllocator::CreateSessionInternal(
     const std::string& content_name, int component,
     const std::string& ice_ufrag, const std::string& ice_pwd) {
@@ -242,6 +249,10 @@
     delete sequences_[i];
 }
 
+BasicPortAllocator* BasicPortAllocatorSession::allocator() {
+  return allocator_;
+}
+
 void BasicPortAllocatorSession::SetCandidateFilter(uint32_t filter) {
   if (filter == candidate_filter_) {
     return;
@@ -298,6 +309,18 @@
   state_ = SessionState::CLEARED;
 }
 
+bool BasicPortAllocatorSession::IsGettingPorts() {
+  return state_ == SessionState::GATHERING;
+}
+
+bool BasicPortAllocatorSession::IsCleared() const {
+  return state_ == SessionState::CLEARED;
+}
+
+bool BasicPortAllocatorSession::IsStopped() const {
+  return state_ == SessionState::STOPPED;
+}
+
 std::vector<rtc::Network*> BasicPortAllocatorSession::GetFailedNetworks() {
   std::vector<rtc::Network*> networks = GetNetworks();
 
@@ -1484,6 +1507,8 @@
     stun_address = *(stun_servers.begin());
 }
 
+PortConfiguration::~PortConfiguration() = default;
+
 ServerAddresses PortConfiguration::StunServers() {
   if (!stun_address.IsNil() &&
       stun_servers.find(stun_address) == stun_servers.end()) {
diff --git a/p2p/client/basicportallocator.h b/p2p/client/basicportallocator.h
index 5ec721b..f5cc1d1 100644
--- a/p2p/client/basicportallocator.h
+++ b/p2p/client/basicportallocator.h
@@ -38,16 +38,10 @@
                      const rtc::SocketAddress& relay_server_udp,
                      const rtc::SocketAddress& relay_server_tcp,
                      const rtc::SocketAddress& relay_server_ssl);
-  virtual ~BasicPortAllocator();
+  ~BasicPortAllocator() override;
 
   // Set to kDefaultNetworkIgnoreMask by default.
-  void SetNetworkIgnoreMask(int network_ignore_mask) override {
-    // TODO(phoglund): implement support for other types than loopback.
-    // See https://code.google.com/p/webrtc/issues/detail?id=4288.
-    // Then remove set_network_ignore_list from NetworkManager.
-    network_ignore_mask_ = network_ignore_mask;
-  }
-
+  void SetNetworkIgnoreMask(int network_ignore_mask) override;
   int network_ignore_mask() const { return network_ignore_mask_; }
 
   rtc::NetworkManager* network_manager() const { return network_manager_; }
@@ -96,9 +90,9 @@
                             int component,
                             const std::string& ice_ufrag,
                             const std::string& ice_pwd);
-  ~BasicPortAllocatorSession();
+  ~BasicPortAllocatorSession() override;
 
-  virtual BasicPortAllocator* allocator() { return allocator_; }
+  virtual BasicPortAllocator* allocator();
   rtc::Thread* network_thread() { return network_thread_; }
   rtc::PacketSocketFactory* socket_factory() { return socket_factory_; }
 
@@ -106,9 +100,9 @@
   void StartGettingPorts() override;
   void StopGettingPorts() override;
   void ClearGettingPorts() override;
-  bool IsGettingPorts() override { return state_ == SessionState::GATHERING; }
-  bool IsCleared() const override { return state_ == SessionState::CLEARED; }
-  bool IsStopped() const override { return state_ == SessionState::STOPPED; }
+  bool IsGettingPorts() override;
+  bool IsCleared() const override;
+  bool IsStopped() const override;
   // These will all be cricket::Ports.
   std::vector<PortInterface*> ReadyPorts() const override;
   std::vector<Candidate> ReadyCandidates() const override;
@@ -269,6 +263,8 @@
                     const std::string& username,
                     const std::string& password);
 
+  ~PortConfiguration() override;
+
   // Returns addresses of both the explicitly configured STUN servers,
   // and TURN servers that should be used as STUN servers.
   ServerAddresses StunServers();
@@ -306,7 +302,7 @@
                      rtc::Network* network,
                      PortConfiguration* config,
                      uint32_t flags);
-  ~AllocationSequence();
+  ~AllocationSequence() override;
   void Init();
   void Clear();
   void OnNetworkFailed();
@@ -329,7 +325,7 @@
   void Stop();
 
   // MessageHandler
-  void OnMessage(rtc::Message* msg);
+  void OnMessage(rtc::Message* msg) override;
 
   // Signal from AllocationSequence, when it's done with allocating ports.
   // This signal is useful, when port allocation fails which doesn't result