| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 25 // This class is designed to allow subclasses to take advantage of the | 25 // This class is designed to allow subclasses to take advantage of the |
| 26 // connection management provided by this class. A subclass should take of all | 26 // connection management provided by this class. A subclass should take of all |
| 27 // packet sending and preparation, but when a packet is received, it should | 27 // packet sending and preparation, but when a packet is received, it should |
| 28 // call this TCPPort::OnReadPacket (3 arg) to dispatch to a connection. | 28 // call this TCPPort::OnReadPacket (3 arg) to dispatch to a connection. |
| 29 class TCPPort : public Port { | 29 class TCPPort : public Port { |
| 30 public: | 30 public: |
| 31 static TCPPort* Create(rtc::Thread* thread, | 31 static TCPPort* Create(rtc::Thread* thread, |
| 32 rtc::PacketSocketFactory* factory, | 32 rtc::PacketSocketFactory* factory, |
| 33 rtc::Network* network, | 33 rtc::Network* network, |
| 34 const rtc::IPAddress& ip, | 34 const rtc::IPAddress& ip, |
| 35 uint16 min_port, | 35 uint16_t min_port, |
| 36 uint16 max_port, | 36 uint16_t max_port, |
| 37 const std::string& username, | 37 const std::string& username, |
| 38 const std::string& password, | 38 const std::string& password, |
| 39 bool allow_listen) { | 39 bool allow_listen) { |
| 40 TCPPort* port = new TCPPort(thread, factory, network, ip, min_port, | 40 TCPPort* port = new TCPPort(thread, factory, network, ip, min_port, |
| 41 max_port, username, password, allow_listen); | 41 max_port, username, password, allow_listen); |
| 42 if (!port->Init()) { | 42 if (!port->Init()) { |
| 43 delete port; | 43 delete port; |
| 44 port = NULL; | 44 port = NULL; |
| 45 } | 45 } |
| 46 return port; | 46 return port; |
| 47 } | 47 } |
| 48 virtual ~TCPPort(); | 48 virtual ~TCPPort(); |
| 49 | 49 |
| 50 virtual Connection* CreateConnection(const Candidate& address, | 50 virtual Connection* CreateConnection(const Candidate& address, |
| 51 CandidateOrigin origin); | 51 CandidateOrigin origin); |
| 52 | 52 |
| 53 virtual void PrepareAddress(); | 53 virtual void PrepareAddress(); |
| 54 | 54 |
| 55 virtual int GetOption(rtc::Socket::Option opt, int* value); | 55 virtual int GetOption(rtc::Socket::Option opt, int* value); |
| 56 virtual int SetOption(rtc::Socket::Option opt, int value); | 56 virtual int SetOption(rtc::Socket::Option opt, int value); |
| 57 virtual int GetError(); | 57 virtual int GetError(); |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 TCPPort(rtc::Thread* thread, | 60 TCPPort(rtc::Thread* thread, |
| 61 rtc::PacketSocketFactory* factory, | 61 rtc::PacketSocketFactory* factory, |
| 62 rtc::Network* network, | 62 rtc::Network* network, |
| 63 const rtc::IPAddress& ip, | 63 const rtc::IPAddress& ip, |
| 64 uint16 min_port, | 64 uint16_t min_port, |
| 65 uint16 max_port, | 65 uint16_t max_port, |
| 66 const std::string& username, | 66 const std::string& username, |
| 67 const std::string& password, | 67 const std::string& password, |
| 68 bool allow_listen); | 68 bool allow_listen); |
| 69 bool Init(); | 69 bool Init(); |
| 70 | 70 |
| 71 // Handles sending using the local TCP socket. | 71 // Handles sending using the local TCP socket. |
| 72 virtual int SendTo(const void* data, size_t size, | 72 virtual int SendTo(const void* data, size_t size, |
| 73 const rtc::SocketAddress& addr, | 73 const rtc::SocketAddress& addr, |
| 74 const rtc::PacketOptions& options, | 74 const rtc::PacketOptions& options, |
| 75 bool payload); | 75 bool payload); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Allow test case to overwrite the default timeout period. | 174 // Allow test case to overwrite the default timeout period. |
| 175 int reconnection_timeout_; | 175 int reconnection_timeout_; |
| 176 | 176 |
| 177 friend class TCPPort; | 177 friend class TCPPort; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace cricket | 180 } // namespace cricket |
| 181 | 181 |
| 182 #endif // WEBRTC_P2P_BASE_TCPPORT_H_ | 182 #endif // WEBRTC_P2P_BASE_TCPPORT_H_ |
| OLD | NEW |