OLD | NEW |
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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/crypto/crypto_framer.h" | 8 #include "net/quic/crypto/crypto_framer.h" |
9 #include "net/quic/crypto/quic_decrypter.h" | 9 #include "net/quic/crypto/quic_decrypter.h" |
10 #include "net/quic/crypto/quic_encrypter.h" | 10 #include "net/quic/crypto/quic_encrypter.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 const vector<QuicPingFrame>& ping_frames() const { | 135 const vector<QuicPingFrame>& ping_frames() const { |
136 return ping_frames_; | 136 return ping_frames_; |
137 } | 137 } |
138 const QuicFecData& fec_data() const { | 138 const QuicFecData& fec_data() const { |
139 return fec_data_; | 139 return fec_data_; |
140 } | 140 } |
141 const QuicVersionNegotiationPacket* version_negotiation_packet() const { | 141 const QuicVersionNegotiationPacket* version_negotiation_packet() const { |
142 return version_negotiation_packet_.get(); | 142 return version_negotiation_packet_.get(); |
143 } | 143 } |
144 const QuicPublicResetPacket* public_reset_packet() const { | |
145 return public_reset_packet_.get(); | |
146 } | |
147 | 144 |
148 private: | 145 private: |
149 QuicErrorCode error_; | 146 QuicErrorCode error_; |
150 bool has_header_; | 147 bool has_header_; |
151 QuicPacketHeader header_; | 148 QuicPacketHeader header_; |
152 QuicFecData fec_data_; | 149 QuicFecData fec_data_; |
153 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; | 150 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; |
154 scoped_ptr<QuicPublicResetPacket> public_reset_packet_; | 151 scoped_ptr<QuicPublicResetPacket> public_reset_packet_; |
155 string fec_redundancy_; | 152 string fec_redundancy_; |
156 vector<QuicAckFrame> ack_frames_; | 153 vector<QuicAckFrame> ack_frames_; |
(...skipping 14 matching lines...) Expand all Loading... |
171 : framer_(QuicSupportedVersions(), QuicTime::Zero(), true) { | 168 : framer_(QuicSupportedVersions(), QuicTime::Zero(), true) { |
172 } | 169 } |
173 | 170 |
174 SimpleQuicFramer::SimpleQuicFramer(const QuicVersionVector& supported_versions) | 171 SimpleQuicFramer::SimpleQuicFramer(const QuicVersionVector& supported_versions) |
175 : framer_(supported_versions, QuicTime::Zero(), true) { | 172 : framer_(supported_versions, QuicTime::Zero(), true) { |
176 } | 173 } |
177 | 174 |
178 SimpleQuicFramer::~SimpleQuicFramer() { | 175 SimpleQuicFramer::~SimpleQuicFramer() { |
179 } | 176 } |
180 | 177 |
181 bool SimpleQuicFramer::ProcessPacket(const QuicPacket& packet) { | |
182 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket( | |
183 ENCRYPTION_NONE, 0, packet)); | |
184 return ProcessPacket(*encrypted); | |
185 } | |
186 | |
187 bool SimpleQuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) { | 178 bool SimpleQuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) { |
188 visitor_.reset(new SimpleFramerVisitor); | 179 visitor_.reset(new SimpleFramerVisitor); |
189 framer_.set_visitor(visitor_.get()); | 180 framer_.set_visitor(visitor_.get()); |
190 return framer_.ProcessPacket(packet); | 181 return framer_.ProcessPacket(packet); |
191 } | 182 } |
192 | 183 |
193 void SimpleQuicFramer::Reset() { | 184 void SimpleQuicFramer::Reset() { |
194 visitor_.reset(new SimpleFramerVisitor); | 185 visitor_.reset(new SimpleFramerVisitor); |
195 } | 186 } |
196 | 187 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return visitor_->goaway_frames(); | 239 return visitor_->goaway_frames(); |
249 } | 240 } |
250 | 241 |
251 const vector<QuicConnectionCloseFrame>& | 242 const vector<QuicConnectionCloseFrame>& |
252 SimpleQuicFramer::connection_close_frames() const { | 243 SimpleQuicFramer::connection_close_frames() const { |
253 return visitor_->connection_close_frames(); | 244 return visitor_->connection_close_frames(); |
254 } | 245 } |
255 | 246 |
256 } // namespace test | 247 } // namespace test |
257 } // namespace net | 248 } // namespace net |
OLD | NEW |