OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 REMOTING_PROTOCOL_P2P_STREAM_SOCKET_H_ |
| 6 #define REMOTING_PROTOCOL_P2P_STREAM_SOCKET_H_ |
| 7 |
| 8 #include "net/base/completion_callback.h" |
| 9 |
| 10 namespace net { |
| 11 class IOBuffer; |
| 12 } // namespace net |
| 13 |
| 14 namespace remoting { |
| 15 namespace protocol { |
| 16 |
| 17 // Peer-to-peer socket with stream semantics. |
| 18 class P2PStreamSocket { |
| 19 public: |
| 20 virtual ~P2PStreamSocket() {}; |
| 21 |
| 22 // Reads data, up to |buf_len| bytes, from the socket. The number of bytes |
| 23 // read is returned, or an error is returned upon failure. ERR_IO_PENDING |
| 24 // is returned if the operation could not be completed synchronously, in which |
| 25 // case the result will be passed to the callback when available. If the |
| 26 // operation is not completed immediately, the socket acquires a reference to |
| 27 // the provided buffer until the callback is invoked or the socket is |
| 28 // closed. If the socket is destroyed before the read completes, the |
| 29 // callback will not be invoked. |
| 30 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 31 const net::CompletionCallback& callback) = 0; |
| 32 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 33 const net::CompletionCallback& callback) = 0; |
| 34 }; |
| 35 |
| 36 } // namespace protocol |
| 37 } // namespace remoting |
| 38 |
| 39 #endif // REMOTING_PROTOCOL_P2P_STREAM_SOCKET_H_ |
OLD | NEW |