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

Side by Side Diff: net/quic/test_tools/simple_quic_framer.cc

Issue 12806002: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor comment fix Created 7 years, 9 months 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/test_tools/quic_test_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/test_tools/simple_quic_framer.h" 5 #include "net/quic/test_tools/simple_quic_framer.h"
6 6
7 #include "net/quic/crypto/crypto_framer.h" 7 #include "net/quic/crypto/crypto_framer.h"
8 #include "net/quic/crypto/quic_decrypter.h" 8 #include "net/quic/crypto/quic_decrypter.h"
9 #include "net/quic/crypto/quic_encrypter.h" 9 #include "net/quic/crypto/quic_encrypter.h"
10 10
11 using base::StringPiece; 11 using base::StringPiece;
12 using std::string; 12 using std::string;
13 using std::vector; 13 using std::vector;
14 14
15 namespace net { 15 namespace net {
16 namespace test { 16 namespace test {
17 17
18 class SimpleFramerVisitor : public QuicFramerVisitorInterface { 18 class SimpleFramerVisitor : public QuicFramerVisitorInterface {
19 public: 19 public:
20 SimpleFramerVisitor() 20 SimpleFramerVisitor()
21 : error_(QUIC_NO_ERROR) { 21 : error_(QUIC_NO_ERROR) {
22 } 22 }
23 23
24 virtual void OnError(QuicFramer* framer) { 24 virtual void OnError(QuicFramer* framer) {
25 error_ = framer->error(); 25 error_ = framer->error();
26 } 26 }
27 27
28 virtual bool OnProtocolVersionMismatch(QuicVersionTag version) {
29 return false;
30 }
31
28 virtual void OnPacket() {} 32 virtual void OnPacket() {}
29 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) {} 33 virtual void OnPublicResetPacket(const QuicPublicResetPacket& packet) {}
34 virtual void OnVersionNegotiationPacket(
35 const QuicVersionNegotiationPacket& packet) {}
30 virtual void OnRevivedPacket() {} 36 virtual void OnRevivedPacket() {}
37
31 virtual bool OnPacketHeader(const QuicPacketHeader& header) { 38 virtual bool OnPacketHeader(const QuicPacketHeader& header) {
32 has_header_ = true; 39 has_header_ = true;
33 header_ = header; 40 header_ = header;
34 return true; 41 return true;
35 } 42 }
36 43
37 virtual void OnFecProtectedPayload(StringPiece payload) {} 44 virtual void OnFecProtectedPayload(StringPiece payload) {}
38 45
39 virtual void OnStreamFrame(const QuicStreamFrame& frame) { 46 virtual void OnStreamFrame(const QuicStreamFrame& frame) {
40 // Save a copy of the data so it is valid after the packet is processed. 47 // Save a copy of the data so it is valid after the packet is processed.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 vector<QuicGoAwayFrame> goaway_frames_; 116 vector<QuicGoAwayFrame> goaway_frames_;
110 vector<QuicConnectionCloseFrame> connection_close_frames_; 117 vector<QuicConnectionCloseFrame> connection_close_frames_;
111 vector<string> stream_data_; 118 vector<string> stream_data_;
112 119
113 DISALLOW_COPY_AND_ASSIGN(SimpleFramerVisitor); 120 DISALLOW_COPY_AND_ASSIGN(SimpleFramerVisitor);
114 }; 121 };
115 122
116 SimpleQuicFramer::SimpleQuicFramer() 123 SimpleQuicFramer::SimpleQuicFramer()
117 : framer_(kQuicVersion1, 124 : framer_(kQuicVersion1,
118 QuicDecrypter::Create(kNULL), 125 QuicDecrypter::Create(kNULL),
119 QuicEncrypter::Create(kNULL)) { 126 QuicEncrypter::Create(kNULL),
127 true),
128 visitor_(NULL) {
120 } 129 }
121 130
122 SimpleQuicFramer::~SimpleQuicFramer() { 131 SimpleQuicFramer::~SimpleQuicFramer() {
123 } 132 }
124 133
125 bool SimpleQuicFramer::ProcessPacket(const QuicPacket& packet) { 134 bool SimpleQuicFramer::ProcessPacket(const QuicPacket& packet) {
126 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket(0, packet)); 135 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket(0, packet));
127 return ProcessPacket(*encrypted); 136 return ProcessPacket(*encrypted);
128 } 137 }
129 138
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return visitor_->goaway_frames(); 188 return visitor_->goaway_frames();
180 } 189 }
181 190
182 const vector<QuicConnectionCloseFrame>& 191 const vector<QuicConnectionCloseFrame>&
183 SimpleQuicFramer::connection_close_frames() const { 192 SimpleQuicFramer::connection_close_frames() const {
184 return visitor_->connection_close_frames(); 193 return visitor_->connection_close_frames();
185 } 194 }
186 195
187 } // namespace test 196 } // namespace test
188 } // namespace net 197 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698