OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
| 7 |
| 8 #include "content/common/p2p_sockets.h" |
| 9 |
| 10 class P2PSocketsHost; |
| 11 |
| 12 // Base class for P2P sockets used by P2PSocketsHost. |
| 13 class P2PSocketHost { |
| 14 public: |
| 15 // Creates P2PSocketHost for the current platform. Must be |
| 16 // implemented in a platform-specific file. |
| 17 static P2PSocketHost* Create(P2PSocketsHost* host, int routing_id, int id, |
| 18 P2PSocketType type); |
| 19 |
| 20 virtual ~P2PSocketHost(); |
| 21 |
| 22 // Initalizes the socket. Returns false when initiazations fails. |
| 23 virtual bool Init() = 0; |
| 24 |
| 25 // Sends |data| on the socket to |socket_address|. |
| 26 virtual void Send(P2PSocketAddress socket_address, |
| 27 const std::vector<char>& data) = 0; |
| 28 |
| 29 protected: |
| 30 P2PSocketHost(P2PSocketsHost* host, int routing_id, int id); |
| 31 |
| 32 P2PSocketsHost* host_; |
| 33 int routing_id_; |
| 34 int id_; |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
| 37 }; |
| 38 |
| 39 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
OLD | NEW |