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

Side by Side Diff: net/tools/quic/quic_reliable_server_stream.h

Issue 103973007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for android compile error Created 7 years 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 #ifndef NET_TOOLS_QUIC_QUIC_RELIABLE_SERVER_STREAM_H_
6 #define NET_TOOLS_QUIC_QUIC_RELIABLE_SERVER_STREAM_H_
7
8 #include <string>
9
10 #include "net/quic/quic_protocol.h"
11 #include "net/quic/reliable_quic_stream.h"
12 #include "net/tools/balsa/balsa_headers.h"
13
14 namespace net {
15
16 class QuicSession;
17
18 namespace tools {
19
20 namespace test {
21 class QuicReliableServerStreamPeer;
22 } // namespace test
23
24 // A base class for spdy/http server streams which handles the concept
25 // of sending and receiving headers and bodies.
26 class QuicReliableServerStream : public ReliableQuicStream {
27 public:
28 QuicReliableServerStream(QuicStreamId id, QuicSession* session);
29 virtual ~QuicReliableServerStream() {}
30
31 // Subclasses should process and frame data when this is called, returning
32 // how many bytes are processed.
33 virtual uint32 ProcessData(const char* data, uint32 data_len) = 0;
34 // Subclasses should implement this to serialize headers in a
35 // protocol-specific manner, and send it out to the client.
36 virtual void SendHeaders(const BalsaHeaders& response_headers) = 0;
37
38 // Sends a basic 200 response using SendHeaders for the headers and WriteData
39 // for the body.
40 void SendResponse();
41 // Sends a basic 500 response using SendHeaders for the headers and WriteData
42 // for the body
43 void SendErrorResponse();
44 // Make sure that as soon as we start writing data, we stop reading.
45 virtual QuicConsumedData WriteData(base::StringPiece data, bool fin) OVERRIDE;
46
47 // Returns whatever headers have been received for this stream.
48 const BalsaHeaders& headers() { return headers_; }
49
50 const string& body() { return body_; }
51
52 protected:
53 BalsaHeaders* mutable_headers() { return &headers_; }
54 string* mutable_body() { return &body_; }
55
56 private:
57 friend class test::QuicReliableServerStreamPeer;
58
59 BalsaHeaders headers_;
60 string body_;
61 };
62
63 } // namespace tools
64 } // namespace net
65
66 #endif // NET_TOOLS_QUIC_QUIC_RELIABLE_SERVER_STREAM_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_reliable_client_stream_test.cc ('k') | net/tools/quic/quic_reliable_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698