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_DATAGRAM_SOCKET_H_ | |
6 #define REMOTING_PROTOCOL_P2P_DATAGRAM_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 datagram semantics. | |
18 class P2PDatagramSocket { | |
19 public: | |
20 virtual ~P2PDatagramSocket() {}; | |
21 | |
22 // Receives a packet, up to |buf_len| bytes, from the socket. The number of | |
23 // bytes read is returned, or an error is returned upon failure. | |
24 // ERR_IO_PENDING is returned if the operation could not be completed | |
25 // synchronously, in which case the result will be passed to the callback when | |
26 // available. If the operation is not completed immediately, the socket | |
27 // acquires a reference to the provided buffer until the callback is invoked | |
28 // or the socket is closed. If the socket is destroyed before the read | |
29 // completes, the callback will not be invoked. | |
Wez
2015/07/10 01:18:24
What happens if a packet larger than |buf_len| is
Sergey Ulanov
2015/07/10 20:48:57
Added a separate comment for Send().
Wez
2015/07/14 18:28:09
That comment doesn't clarify the Recv() behaviour
Sergey Ulanov
2015/07/14 21:07:54
Done.
| |
30 virtual int Recv(net::IOBuffer* buf, int buf_len, | |
Wez
2015/07/10 01:18:24
Should these be scoped_refptr<>&, here and in the
Sergey Ulanov
2015/07/10 20:48:57
Done.
| |
31 const net::CompletionCallback& callback) = 0; | |
32 virtual int Send(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_DATAGRAM_SOCKET_H_ | |
OLD | NEW |