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

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

Issue 111073003: Cleanup of QUIC stream classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_CLIENT_STREAM_H_
6 #define NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
7
8 #include <sys/types.h>
9 #include <string>
10
11 #include "base/strings/string_piece.h"
12 #include "net/quic/quic_protocol.h"
13 #include "net/quic/reliable_quic_stream.h"
14 #include "net/tools/balsa/balsa_frame.h"
15 #include "net/tools/balsa/balsa_headers.h"
16
17 namespace net {
18
19 class QuicSession;
20
21 namespace tools {
22
23 class QuicClientSession;
24
25 // A base class for spdy/http client streams which handles the concept
26 // of sending and receiving headers and bodies.
27 class QuicReliableClientStream : public ReliableQuicStream {
28 public:
29 QuicReliableClientStream(QuicStreamId id, QuicSession* session)
30 : ReliableQuicStream(id, session) {
31 }
32
33 // Serializes the headers and body, sends it to the server, and
34 // returns the number of bytes sent.
35 virtual ssize_t SendRequest(const BalsaHeaders& headers,
36 base::StringPiece body,
37 bool fin) = 0;
38 // Sends body data to the server and returns the number of bytes sent.
39 virtual ssize_t SendBody(const std::string& data, bool fin);
40
41 // Override the base class to close the Write side as soon as we get a
42 // response.
43 // SPDY/HTTP do not support bidirectional streaming.
44 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE;
45
46 // Returns the response data.
47 const std::string& data() { return data_; }
48
49 // Returns whatever headers have been received for this stream.
50 const BalsaHeaders& headers() { return headers_; }
51
52 protected:
53 std::string* mutable_data() { return &data_; }
54 BalsaHeaders* mutable_headers() { return &headers_; }
55
56 private:
57 BalsaHeaders headers_;
58 std::string data_;
59
60 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream);
61 };
62
63 } // namespace tools
64 } // namespace net
65
66 #endif // NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_session_test.cc ('k') | net/tools/quic/quic_reliable_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698