| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 int id, | 32 int id, |
| 33 P2PSocketType type, | 33 P2PSocketType type, |
| 34 net::URLRequestContextGetter* url_context); | 34 net::URLRequestContextGetter* url_context); |
| 35 virtual ~P2PSocketHostTcpBase(); | 35 virtual ~P2PSocketHostTcpBase(); |
| 36 | 36 |
| 37 bool InitAccepted(const net::IPEndPoint& remote_address, | 37 bool InitAccepted(const net::IPEndPoint& remote_address, |
| 38 net::StreamSocket* socket); | 38 net::StreamSocket* socket); |
| 39 | 39 |
| 40 // P2PSocketHost overrides. | 40 // P2PSocketHost overrides. |
| 41 virtual bool Init(const net::IPEndPoint& local_address, | 41 virtual bool Init(const net::IPEndPoint& local_address, |
| 42 const net::IPEndPoint& remote_address) OVERRIDE; | 42 const P2PHostAndIPEndPoint& remote_address) OVERRIDE; |
| 43 virtual void Send(const net::IPEndPoint& to, | 43 virtual void Send(const net::IPEndPoint& to, |
| 44 const std::vector<char>& data, | 44 const std::vector<char>& data, |
| 45 const talk_base::PacketOptions& options, | 45 const talk_base::PacketOptions& options, |
| 46 uint64 packet_id) OVERRIDE; | 46 uint64 packet_id) OVERRIDE; |
| 47 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 47 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
| 48 const net::IPEndPoint& remote_address, int id) OVERRIDE; | 48 const net::IPEndPoint& remote_address, int id) OVERRIDE; |
| 49 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE; | 49 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 // Derived classes will provide the implementation. | 52 // Derived classes will provide the implementation. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 | 74 |
| 75 // Callbacks for Connect(), Read() and Write(). | 75 // Callbacks for Connect(), Read() and Write(). |
| 76 void OnConnected(int result); | 76 void OnConnected(int result); |
| 77 void OnRead(int result); | 77 void OnRead(int result); |
| 78 void OnWritten(int result); | 78 void OnWritten(int result); |
| 79 | 79 |
| 80 // Helper method to send socket create message and start read. | 80 // Helper method to send socket create message and start read. |
| 81 void OnOpen(); | 81 void OnOpen(); |
| 82 void DoSendSocketCreateMsg(); | 82 void DoSendSocketCreateMsg(); |
| 83 | 83 |
| 84 net::IPEndPoint remote_address_; | 84 P2PHostAndIPEndPoint remote_address_; |
| 85 | 85 |
| 86 scoped_ptr<net::StreamSocket> socket_; | 86 scoped_ptr<net::StreamSocket> socket_; |
| 87 scoped_refptr<net::GrowableIOBuffer> read_buffer_; | 87 scoped_refptr<net::GrowableIOBuffer> read_buffer_; |
| 88 std::queue<scoped_refptr<net::DrainableIOBuffer> > write_queue_; | 88 std::queue<scoped_refptr<net::DrainableIOBuffer> > write_queue_; |
| 89 scoped_refptr<net::DrainableIOBuffer> write_buffer_; | 89 scoped_refptr<net::DrainableIOBuffer> write_buffer_; |
| 90 | 90 |
| 91 bool write_pending_; | 91 bool write_pending_; |
| 92 | 92 |
| 93 bool connected_; | 93 bool connected_; |
| 94 P2PSocketType type_; | 94 P2PSocketType type_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 private: | 133 private: |
| 134 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); | 134 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); | 136 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 | 139 |
| 140 } // namespace content | 140 } // namespace content |
| 141 | 141 |
| 142 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 142 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
| OLD | NEW |