Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: remoting/protocol/p2p_stream_socket.h

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/p2p_datagram_socket.h ('k') | remoting/protocol/pseudotcp_adapter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
31 const net::CompletionCallback& callback) = 0;
32
33 // Writes data, up to |buf_len| bytes, to the socket. Note: data may be
34 // written partially. The number of bytes written is returned, or an error
35 // is returned upon failure. ERR_IO_PENDING is returned if the operation could
36 // not be completed synchronously, in which case the result will be passed to
37 // the callback when available. If the operation is not completed
38 // immediately, the socket acquires a reference to the provided buffer until
39 // the callback is invoked or the socket is closed. Implementations of this
40 // method should not modify the contents of the actual buffer that is written
41 // to the socket.
42 virtual int Write(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
43 const net::CompletionCallback& callback) = 0;
44 };
45
46 } // namespace protocol
47 } // namespace remoting
48
49 #endif // REMOTING_PROTOCOL_P2P_STREAM_SOCKET_H_
OLDNEW
« no previous file with comments | « remoting/protocol/p2p_datagram_socket.h ('k') | remoting/protocol/pseudotcp_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698