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

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

Issue 11300020: Add QuicStream and friends to QUIC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: License 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
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 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 int Readv(const struct iovec* iov, int iov_len);
49 virtual bool IsHalfClosed();
50 virtual bool HasBytesToRead();
jar (doing other things) 2012/11/01 22:21:10 nit: both above are probably const methods.
Ryan Hamilton 2012/11/01 22:52:20 Fixed upstream.
51
52 QuicStreamId id() { return id_; }
53
54 QuicErrorCode error() { return error_; }
55
56 protected:
57 virtual ssize_t WriteData(base::StringPiece data, bool fin);
58 // Close the read side of the socket. Further frames will not be accepted.
59 virtual void CloseReadSide();
60 // Close the write side of the socket. Further writes will fail.
61 void CloseWriteSide();
62
63 QuicSession* session() { return session_; }
jar (doing other things) 2012/11/01 22:21:10 nit: const method
Ryan Hamilton 2012/11/01 22:52:20 It's gauche to return mutable pointers to members
64
65 private:
66 friend class ReliableQuicStreamPeer;
67
68 QuicStreamSequencer sequencer_;
69 QuicStreamId id_;
70 QuicStreamOffset offset_;
71 QuicSession* session_;
72 QuicErrorCode error_;
73 // True if the read side is closed and further frames should be rejected.
74 bool read_side_closed_;
75 // True if the write side is closed, and further writes should fail.
76 bool write_side_closed_;
77 };
78
79 } // namespace net
80
81 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698