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

Side by Side Diff: webrtc/p2p/base/tcpport.h

Issue 2989303002: Make Port (and subclasses) fully "Network"-based, instead of IP-based. (Closed)
Patch Set: Add back Port constructor that takes IP for backwards compatibility. Created 3 years, 4 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/stunport_unittest.cc ('k') | webrtc/p2p/base/tcpport.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
(...skipping 15 matching lines...) Expand all
26 // 26 //
27 // This class is designed to allow subclasses to take advantage of the 27 // This class is designed to allow subclasses to take advantage of the
28 // connection management provided by this class. A subclass should take of all 28 // connection management provided by this class. A subclass should take of all
29 // packet sending and preparation, but when a packet is received, it should 29 // packet sending and preparation, but when a packet is received, it should
30 // call this TCPPort::OnReadPacket (3 arg) to dispatch to a connection. 30 // call this TCPPort::OnReadPacket (3 arg) to dispatch to a connection.
31 class TCPPort : public Port { 31 class TCPPort : public Port {
32 public: 32 public:
33 static TCPPort* Create(rtc::Thread* thread, 33 static TCPPort* Create(rtc::Thread* thread,
34 rtc::PacketSocketFactory* factory, 34 rtc::PacketSocketFactory* factory,
35 rtc::Network* network, 35 rtc::Network* network,
36 const rtc::IPAddress& ip,
37 uint16_t min_port, 36 uint16_t min_port,
38 uint16_t max_port, 37 uint16_t max_port,
39 const std::string& username, 38 const std::string& username,
40 const std::string& password, 39 const std::string& password,
41 bool allow_listen) { 40 bool allow_listen) {
42 return new TCPPort(thread, factory, network, ip, min_port, max_port, 41 return new TCPPort(thread, factory, network, min_port, max_port, username,
43 username, password, allow_listen); 42 password, allow_listen);
44 } 43 }
45 ~TCPPort() override; 44 ~TCPPort() override;
46 45
47 Connection* CreateConnection(const Candidate& address, 46 Connection* CreateConnection(const Candidate& address,
48 CandidateOrigin origin) override; 47 CandidateOrigin origin) override;
49 48
50 void PrepareAddress() override; 49 void PrepareAddress() override;
51 50
52 int GetOption(rtc::Socket::Option opt, int* value) override; 51 int GetOption(rtc::Socket::Option opt, int* value) override;
53 int SetOption(rtc::Socket::Option opt, int value) override; 52 int SetOption(rtc::Socket::Option opt, int value) override;
54 int GetError() override; 53 int GetError() override;
55 bool SupportsProtocol(const std::string& protocol) const override { 54 bool SupportsProtocol(const std::string& protocol) const override {
56 return protocol == TCP_PROTOCOL_NAME || protocol == SSLTCP_PROTOCOL_NAME; 55 return protocol == TCP_PROTOCOL_NAME || protocol == SSLTCP_PROTOCOL_NAME;
57 } 56 }
58 57
59 ProtocolType GetProtocol() const override { return PROTO_TCP; } 58 ProtocolType GetProtocol() const override { return PROTO_TCP; }
60 59
61 protected: 60 protected:
62 TCPPort(rtc::Thread* thread, 61 TCPPort(rtc::Thread* thread,
63 rtc::PacketSocketFactory* factory, 62 rtc::PacketSocketFactory* factory,
64 rtc::Network* network, 63 rtc::Network* network,
65 const rtc::IPAddress& ip,
66 uint16_t min_port, 64 uint16_t min_port,
67 uint16_t max_port, 65 uint16_t max_port,
68 const std::string& username, 66 const std::string& username,
69 const std::string& password, 67 const std::string& password,
70 bool allow_listen); 68 bool allow_listen);
71 69
72 // Handles sending using the local TCP socket. 70 // Handles sending using the local TCP socket.
73 int SendTo(const void* data, 71 int SendTo(const void* data,
74 size_t size, 72 size_t size,
75 const rtc::SocketAddress& addr, 73 const rtc::SocketAddress& addr,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 179
182 // Allow test case to overwrite the default timeout period. 180 // Allow test case to overwrite the default timeout period.
183 int reconnection_timeout_; 181 int reconnection_timeout_;
184 182
185 friend class TCPPort; 183 friend class TCPPort;
186 }; 184 };
187 185
188 } // namespace cricket 186 } // namespace cricket
189 187
190 #endif // WEBRTC_P2P_BASE_TCPPORT_H_ 188 #endif // WEBRTC_P2P_BASE_TCPPORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/stunport_unittest.cc ('k') | webrtc/p2p/base/tcpport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698