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

Side by Side Diff: net/quic/quartc/quartc_stream_interface.h

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Fix the IOS simulator and merge. Created 4 years, 1 month 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 | « net/quic/quartc/quartc_stream.cc ('k') | net/quic/quartc/quartc_stream_test.cc » ('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 (c) 2016 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 NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_
6 #define NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 namespace net {
12
13 // Sends and receives data with a particular QUIC stream ID, reliably and
14 // in-order. To send/receive data out of order, use separate streams. To
15 // send/receive unreliably, close a stream after reliability is no longer
16 // needed.
17 class NET_EXPORT_PRIVATE QuartcStreamInterface {
18 public:
19 virtual ~QuartcStreamInterface() {}
20
21 // The QUIC stream ID.
22 virtual uint32_t stream_id() = 0;
23
24 // The amount of data buffered by the QuicConnection.
25 virtual uint64_t buffered_amount() = 0;
26
27 // Return true if the FIN has been sent. Used by the outgoing streams to
28 // determine if all the data has been sent
29 virtual bool fin_sent() = 0;
30
31 struct WriteParameters {
32 // |fin| is set to be true when there is no more data need to be send
33 // through a particular stream. The receiving side will used it to determine
34 // if the sender finish sending data.
35 bool fin = false;
36 };
37
38 // Sends data reliably and in-order, buffering if necessary until Close() is
39 // called.
40 virtual void Write(const char* data,
41 size_t size,
42 const WriteParameters& param) = 0;
43
44 // Once Close is called, no more data can be sent, all buffered data will be
45 // dropped and no data will be retransmitted.
46 virtual void Close() = 0;
47
48 // Implemented by the user of the QuartcStreamInterface to receive incoming
49 // data and be notified of state changes.
50 class Delegate {
51 public:
52 virtual ~Delegate() {}
53
54 // Called when the stream receives the date.
55 virtual void OnReceived(QuartcStreamInterface* stream,
56 const char* data,
57 size_t size) = 0;
58
59 // Called when the stream is closed, either locally or by the remote
60 // endpoint.
61 // TODO(zhihuang) Creates a map from the integer error_code to WebRTC native
62 // error code.
63 virtual void OnClose(QuartcStreamInterface* stream, int error_code) = 0;
64
65 // Called when buffered_amount() decreases.
66 virtual void OnBufferedAmountDecrease(QuartcStreamInterface* stream) = 0;
67 };
68
69 // The |delegate| is not owned by QuartcStream.
70 virtual void SetDelegate(Delegate* delegate) = 0;
71 };
72
73 } // namespace net
74
75 #endif // NET_QUIC_QUARTC_QUARTC_STREAM_INTERFACE_H_
OLDNEW
« no previous file with comments | « net/quic/quartc/quartc_stream.cc ('k') | net/quic/quartc/quartc_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698