| 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_SERVER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 typedef std::map<net::IPEndPoint, net::StreamSocket*> AcceptedSocketsMap; | 29 typedef std::map<net::IPEndPoint, net::StreamSocket*> AcceptedSocketsMap; |
| 30 | 30 |
| 31 P2PSocketHostTcpServer(IPC::Sender* message_sender, int id, | 31 P2PSocketHostTcpServer(IPC::Sender* message_sender, int id, |
| 32 P2PSocketType client_type); | 32 P2PSocketType client_type); |
| 33 virtual ~P2PSocketHostTcpServer(); | 33 virtual ~P2PSocketHostTcpServer(); |
| 34 | 34 |
| 35 // P2PSocketHost overrides. | 35 // P2PSocketHost overrides. |
| 36 virtual bool Init(const net::IPEndPoint& local_address, | 36 virtual bool Init(const net::IPEndPoint& local_address, |
| 37 const net::IPEndPoint& remote_address) OVERRIDE; | 37 const net::IPEndPoint& remote_address) OVERRIDE; |
| 38 virtual void Send(const net::IPEndPoint& to, | 38 virtual void Send(const net::IPEndPoint& to, |
| 39 const std::vector<char>& data) OVERRIDE; | 39 const std::vector<char>& data, |
| 40 net::DiffServCodePoint dscp) OVERRIDE; |
| 40 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 41 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
| 41 const net::IPEndPoint& remote_address, int id) OVERRIDE; | 42 const net::IPEndPoint& remote_address, int id) OVERRIDE; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 friend class P2PSocketHostTcpServerTest; | 45 friend class P2PSocketHostTcpServerTest; |
| 45 | 46 |
| 46 void OnError(); | 47 void OnError(); |
| 47 | 48 |
| 48 void DoAccept(); | 49 void DoAccept(); |
| 49 void HandleAcceptResult(int result); | 50 void HandleAcceptResult(int result); |
| 50 | 51 |
| 51 // Callback for Accept(). | 52 // Callback for Accept(). |
| 52 void OnAccepted(int result); | 53 void OnAccepted(int result); |
| 53 | 54 |
| 54 const P2PSocketType client_type_; | 55 const P2PSocketType client_type_; |
| 55 scoped_ptr<net::ServerSocket> socket_; | 56 scoped_ptr<net::ServerSocket> socket_; |
| 56 net::IPEndPoint local_address_; | 57 net::IPEndPoint local_address_; |
| 57 | 58 |
| 58 scoped_ptr<net::StreamSocket> accept_socket_; | 59 scoped_ptr<net::StreamSocket> accept_socket_; |
| 59 AcceptedSocketsMap accepted_sockets_; | 60 AcceptedSocketsMap accepted_sockets_; |
| 60 | 61 |
| 61 net::CompletionCallback accept_callback_; | 62 net::CompletionCallback accept_callback_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpServer); | 64 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpServer); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace content | 67 } // namespace content |
| 67 | 68 |
| 68 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ | 69 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ |
| OLD | NEW |