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

Side by Side Diff: net/quic/reliable_quic_stream.h

Issue 11367082: Add QuicStream and friends to QUIC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 8 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_stream_sequencer_test.cc ('k') | net/quic/reliable_quic_stream.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) 2012 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 // The base class for client/server reliable streams.
6
7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_
8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_
9
10 #include "net/quic/quic_stream_sequencer.h"
11
12 namespace net {
13
14 class QuicSession;
15
16 // All this does right now is send data to subclasses via the sequencer.
17 class NET_EXPORT_PRIVATE ReliableQuicStream {
18 public:
19 ReliableQuicStream(QuicStreamId id,
20 QuicSession* session);
21
22 virtual ~ReliableQuicStream();
23
24 bool WillAcceptStreamFrame(const QuicStreamFrame& frame) const;
25 bool OnStreamFrame(const QuicStreamFrame& frame);
26
27 // Called when we get a stream reset from the client.
28 // The rst will be passed through the sequencer, which will call
29 // TerminateFromPeer when 'offset' bytes have been processed.
30 void OnStreamReset(QuicErrorCode error, QuicStreamOffset ofset);
31
32 // Called when we get or send a connection close, and should immediately
33 // close the stream. This is not passed through the sequencer,
34 // but is handled immediately.
35 virtual void ConnectionClose(QuicErrorCode error, bool from_peer);
36
37 // Called by the sequencer, when we should process a stream termination or
38 // stream close from the peer.
39 virtual void TerminateFromPeer(bool half_close);
40
41 virtual uint32 ProcessData(const char* data, uint32 data_len) = 0;
42
43 // Called to close the stream from this end.
44 virtual void Close(QuicErrorCode error);
45
46 // This block of functions wraps the sequencer's functions of the same
47 // name.
48 virtual bool IsHalfClosed();
49 virtual bool HasBytesToRead();
50
51 QuicStreamId id() { return id_; }
52
53 QuicErrorCode error() { return error_; }
54
55 protected:
56 virtual int WriteData(base::StringPiece data, bool fin);
57 // Close the read side of the socket. Further frames will not be accepted.
58 virtual void CloseReadSide();
59 // Close the write side of the socket. Further writes will fail.
60 void CloseWriteSide();
61
62 QuicSession* session() { return session_; }
63
64 private:
65 friend class ReliableQuicStreamPeer;
66
67 QuicStreamSequencer sequencer_;
68 QuicStreamId id_;
69 QuicStreamOffset offset_;
70 QuicSession* session_;
71 QuicErrorCode error_;
72 // True if the read side is closed and further frames should be rejected.
73 bool read_side_closed_;
74 // True if the write side is closed, and further writes should fail.
75 bool write_side_closed_;
76 };
77
78 } // namespace net
79
80 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_stream_sequencer_test.cc ('k') | net/quic/reliable_quic_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698