Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: webrtc/p2p/client/basicportallocator.h

Issue 3012473002: Revert of Add logging of host lookups made by TurnPort to the RtcEventLog. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/turnport_unittest.cc ('k') | webrtc/p2p/client/basicportallocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ 11 #ifndef WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
12 #define WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ 12 #define WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/p2p/base/portallocator.h" 18 #include "webrtc/p2p/base/portallocator.h"
19 #include "webrtc/rtc_base/checks.h" 19 #include "webrtc/rtc_base/checks.h"
20 #include "webrtc/rtc_base/messagequeue.h" 20 #include "webrtc/rtc_base/messagequeue.h"
21 #include "webrtc/rtc_base/network.h" 21 #include "webrtc/rtc_base/network.h"
22 #include "webrtc/rtc_base/thread.h" 22 #include "webrtc/rtc_base/thread.h"
23 23
24 namespace webrtc {
25 class RtcEventLog;
26 } // namespace webrtc
27
28 namespace cricket { 24 namespace cricket {
29 25
30 class BasicPortAllocator : public PortAllocator { 26 class BasicPortAllocator : public PortAllocator {
31 public: 27 public:
32 BasicPortAllocator(rtc::NetworkManager* network_manager, 28 BasicPortAllocator(rtc::NetworkManager* network_manager,
33 rtc::PacketSocketFactory* socket_factory, 29 rtc::PacketSocketFactory* socket_factory);
34 webrtc::RtcEventLog* event_log);
35 explicit BasicPortAllocator(rtc::NetworkManager* network_manager); 30 explicit BasicPortAllocator(rtc::NetworkManager* network_manager);
36 BasicPortAllocator(rtc::NetworkManager* network_manager, 31 BasicPortAllocator(rtc::NetworkManager* network_manager,
37 rtc::PacketSocketFactory* socket_factory, 32 rtc::PacketSocketFactory* socket_factory,
38 const ServerAddresses& stun_servers); 33 const ServerAddresses& stun_servers);
39 BasicPortAllocator(rtc::NetworkManager* network_manager, 34 BasicPortAllocator(rtc::NetworkManager* network_manager,
40 const ServerAddresses& stun_servers, 35 const ServerAddresses& stun_servers,
41 const rtc::SocketAddress& relay_server_udp, 36 const rtc::SocketAddress& relay_server_udp,
42 const rtc::SocketAddress& relay_server_tcp, 37 const rtc::SocketAddress& relay_server_tcp,
43 const rtc::SocketAddress& relay_server_ssl); 38 const rtc::SocketAddress& relay_server_ssl);
44 virtual ~BasicPortAllocator(); 39 virtual ~BasicPortAllocator();
45 40
46 // Set to kDefaultNetworkIgnoreMask by default. 41 // Set to kDefaultNetworkIgnoreMask by default.
47 void SetNetworkIgnoreMask(int network_ignore_mask) override { 42 void SetNetworkIgnoreMask(int network_ignore_mask) override {
48 // TODO(phoglund): implement support for other types than loopback. 43 // TODO(phoglund): implement support for other types than loopback.
49 // See https://code.google.com/p/webrtc/issues/detail?id=4288. 44 // See https://code.google.com/p/webrtc/issues/detail?id=4288.
50 // Then remove set_network_ignore_list from NetworkManager. 45 // Then remove set_network_ignore_list from NetworkManager.
51 network_ignore_mask_ = network_ignore_mask; 46 network_ignore_mask_ = network_ignore_mask;
52 } 47 }
53 48
54 int network_ignore_mask() const { return network_ignore_mask_; } 49 int network_ignore_mask() const { return network_ignore_mask_; }
55 50
56 rtc::NetworkManager* network_manager() const { return network_manager_; } 51 rtc::NetworkManager* network_manager() const { return network_manager_; }
57 webrtc::RtcEventLog* event_log() const { return event_log_; }
58 52
59 // If socket_factory() is set to NULL each PortAllocatorSession 53 // If socket_factory() is set to NULL each PortAllocatorSession
60 // creates its own socket factory. 54 // creates its own socket factory.
61 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } 55 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; }
62 56
63 PortAllocatorSession* CreateSessionInternal( 57 PortAllocatorSession* CreateSessionInternal(
64 const std::string& content_name, 58 const std::string& content_name,
65 int component, 59 int component,
66 const std::string& ice_ufrag, 60 const std::string& ice_ufrag,
67 const std::string& ice_pwd) override; 61 const std::string& ice_pwd) override;
68 62
69 // Convenience method that adds a TURN server to the configuration. 63 // Convenience method that adds a TURN server to the configuration.
70 void AddTurnServer(const RelayServerConfig& turn_server); 64 void AddTurnServer(const RelayServerConfig& turn_server);
71 65
72 private: 66 private:
73 void Construct(); 67 void Construct();
74 68
75 void OnIceRegathering(PortAllocatorSession* session, 69 void OnIceRegathering(PortAllocatorSession* session,
76 IceRegatheringReason reason); 70 IceRegatheringReason reason);
77 71
78 rtc::NetworkManager* network_manager_; 72 rtc::NetworkManager* network_manager_;
79 rtc::PacketSocketFactory* socket_factory_; 73 rtc::PacketSocketFactory* socket_factory_;
80 webrtc::RtcEventLog* event_log_;
81 bool allow_tcp_listen_; 74 bool allow_tcp_listen_;
82 int network_ignore_mask_ = rtc::kDefaultNetworkIgnoreMask; 75 int network_ignore_mask_ = rtc::kDefaultNetworkIgnoreMask;
83 }; 76 };
84 77
85 struct PortConfiguration; 78 struct PortConfiguration;
86 class AllocationSequence; 79 class AllocationSequence;
87 80
88 enum class SessionState { 81 enum class SessionState {
89 GATHERING, // Actively allocating ports and gathering candidates. 82 GATHERING, // Actively allocating ports and gathering candidates.
90 CLEARED, // Current allocation process has been stopped but may start 83 CLEARED, // Current allocation process has been stopped but may start
91 // new ones. 84 // new ones.
92 STOPPED // This session has completely stopped, no new allocation 85 STOPPED // This session has completely stopped, no new allocation
93 // process will be started. 86 // process will be started.
94 }; 87 };
95 88
96 class BasicPortAllocatorSession : public PortAllocatorSession, 89 class BasicPortAllocatorSession : public PortAllocatorSession,
97 public rtc::MessageHandler { 90 public rtc::MessageHandler {
98 public: 91 public:
99 BasicPortAllocatorSession(BasicPortAllocator* allocator, 92 BasicPortAllocatorSession(BasicPortAllocator* allocator,
100 const std::string& content_name, 93 const std::string& content_name,
101 int component, 94 int component,
102 const std::string& ice_ufrag, 95 const std::string& ice_ufrag,
103 const std::string& ice_pwd); 96 const std::string& ice_pwd);
104 ~BasicPortAllocatorSession(); 97 ~BasicPortAllocatorSession();
105 98
106 virtual BasicPortAllocator* allocator() { return allocator_; } 99 virtual BasicPortAllocator* allocator() { return allocator_; }
107 rtc::Thread* network_thread() { return network_thread_; } 100 rtc::Thread* network_thread() { return network_thread_; }
108 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } 101 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; }
109 webrtc::RtcEventLog* event_log() { return allocator_->event_log(); }
110 102
111 void SetCandidateFilter(uint32_t filter) override; 103 void SetCandidateFilter(uint32_t filter) override;
112 void StartGettingPorts() override; 104 void StartGettingPorts() override;
113 void StopGettingPorts() override; 105 void StopGettingPorts() override;
114 void ClearGettingPorts() override; 106 void ClearGettingPorts() override;
115 bool IsGettingPorts() override { return state_ == SessionState::GATHERING; } 107 bool IsGettingPorts() override { return state_ == SessionState::GATHERING; }
116 bool IsCleared() const override { return state_ == SessionState::CLEARED; } 108 bool IsCleared() const override { return state_ == SessionState::CLEARED; }
117 bool IsStopped() const override { return state_ == SessionState::STOPPED; } 109 bool IsStopped() const override { return state_ == SessionState::STOPPED; }
118 // These will all be cricket::Ports. 110 // These will all be cricket::Ports.
119 std::vector<PortInterface*> ReadyPorts() const override; 111 std::vector<PortInterface*> ReadyPorts() const override;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_; 374 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_;
383 // There will be only one udp port per AllocationSequence. 375 // There will be only one udp port per AllocationSequence.
384 UDPPort* udp_port_; 376 UDPPort* udp_port_;
385 std::vector<TurnPort*> turn_ports_; 377 std::vector<TurnPort*> turn_ports_;
386 int phase_; 378 int phase_;
387 }; 379 };
388 380
389 } // namespace cricket 381 } // namespace cricket
390 382
391 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ 383 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnport_unittest.cc ('k') | webrtc/p2p/client/basicportallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698