| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 stream_data_.back()->size()); | 65 stream_data_.back()->size()); |
| 66 stream_frames_.push_back(stream_frame); | 66 stream_frames_.push_back(stream_frame); |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool OnAckFrame(const QuicAckFrame& frame) override { | 70 bool OnAckFrame(const QuicAckFrame& frame) override { |
| 71 ack_frames_.push_back(frame); | 71 ack_frames_.push_back(frame); |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool OnCongestionFeedbackFrame( | |
| 76 const QuicCongestionFeedbackFrame& frame) override { | |
| 77 feedback_frames_.push_back(frame); | |
| 78 return true; | |
| 79 } | |
| 80 | |
| 81 bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override { | 75 bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override { |
| 82 stop_waiting_frames_.push_back(frame); | 76 stop_waiting_frames_.push_back(frame); |
| 83 return true; | 77 return true; |
| 84 } | 78 } |
| 85 | 79 |
| 86 bool OnPingFrame(const QuicPingFrame& frame) override { | 80 bool OnPingFrame(const QuicPingFrame& frame) override { |
| 87 ping_frames_.push_back(frame); | 81 ping_frames_.push_back(frame); |
| 88 return true; | 82 return true; |
| 89 } | 83 } |
| 90 | 84 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 119 return true; | 113 return true; |
| 120 } | 114 } |
| 121 | 115 |
| 122 void OnPacketComplete() override {} | 116 void OnPacketComplete() override {} |
| 123 | 117 |
| 124 const QuicPacketHeader& header() const { return header_; } | 118 const QuicPacketHeader& header() const { return header_; } |
| 125 const vector<QuicAckFrame>& ack_frames() const { return ack_frames_; } | 119 const vector<QuicAckFrame>& ack_frames() const { return ack_frames_; } |
| 126 const vector<QuicConnectionCloseFrame>& connection_close_frames() const { | 120 const vector<QuicConnectionCloseFrame>& connection_close_frames() const { |
| 127 return connection_close_frames_; | 121 return connection_close_frames_; |
| 128 } | 122 } |
| 129 const vector<QuicCongestionFeedbackFrame>& feedback_frames() const { | |
| 130 return feedback_frames_; | |
| 131 } | |
| 132 const vector<QuicGoAwayFrame>& goaway_frames() const { | 123 const vector<QuicGoAwayFrame>& goaway_frames() const { |
| 133 return goaway_frames_; | 124 return goaway_frames_; |
| 134 } | 125 } |
| 135 const vector<QuicRstStreamFrame>& rst_stream_frames() const { | 126 const vector<QuicRstStreamFrame>& rst_stream_frames() const { |
| 136 return rst_stream_frames_; | 127 return rst_stream_frames_; |
| 137 } | 128 } |
| 138 const vector<QuicStreamFrame>& stream_frames() const { | 129 const vector<QuicStreamFrame>& stream_frames() const { |
| 139 return stream_frames_; | 130 return stream_frames_; |
| 140 } | 131 } |
| 141 const vector<QuicStopWaitingFrame>& stop_waiting_frames() const { | 132 const vector<QuicStopWaitingFrame>& stop_waiting_frames() const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 156 | 147 |
| 157 private: | 148 private: |
| 158 QuicErrorCode error_; | 149 QuicErrorCode error_; |
| 159 bool has_header_; | 150 bool has_header_; |
| 160 QuicPacketHeader header_; | 151 QuicPacketHeader header_; |
| 161 QuicFecData fec_data_; | 152 QuicFecData fec_data_; |
| 162 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; | 153 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; |
| 163 scoped_ptr<QuicPublicResetPacket> public_reset_packet_; | 154 scoped_ptr<QuicPublicResetPacket> public_reset_packet_; |
| 164 string fec_redundancy_; | 155 string fec_redundancy_; |
| 165 vector<QuicAckFrame> ack_frames_; | 156 vector<QuicAckFrame> ack_frames_; |
| 166 vector<QuicCongestionFeedbackFrame> feedback_frames_; | |
| 167 vector<QuicStopWaitingFrame> stop_waiting_frames_; | 157 vector<QuicStopWaitingFrame> stop_waiting_frames_; |
| 168 vector<QuicPingFrame> ping_frames_; | 158 vector<QuicPingFrame> ping_frames_; |
| 169 vector<QuicStreamFrame> stream_frames_; | 159 vector<QuicStreamFrame> stream_frames_; |
| 170 vector<QuicRstStreamFrame> rst_stream_frames_; | 160 vector<QuicRstStreamFrame> rst_stream_frames_; |
| 171 vector<QuicGoAwayFrame> goaway_frames_; | 161 vector<QuicGoAwayFrame> goaway_frames_; |
| 172 vector<QuicConnectionCloseFrame> connection_close_frames_; | 162 vector<QuicConnectionCloseFrame> connection_close_frames_; |
| 173 vector<QuicWindowUpdateFrame> window_update_frames_; | 163 vector<QuicWindowUpdateFrame> window_update_frames_; |
| 174 vector<QuicBlockedFrame> blocked_frames_; | 164 vector<QuicBlockedFrame> blocked_frames_; |
| 175 vector<string*> stream_data_; | 165 vector<string*> stream_data_; |
| 176 | 166 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 const QuicPublicResetPacket* SimpleQuicFramer::public_reset_packet() const { | 211 const QuicPublicResetPacket* SimpleQuicFramer::public_reset_packet() const { |
| 222 return visitor_->public_reset_packet(); | 212 return visitor_->public_reset_packet(); |
| 223 } | 213 } |
| 224 | 214 |
| 225 QuicFramer* SimpleQuicFramer::framer() { | 215 QuicFramer* SimpleQuicFramer::framer() { |
| 226 return &framer_; | 216 return &framer_; |
| 227 } | 217 } |
| 228 | 218 |
| 229 size_t SimpleQuicFramer::num_frames() const { | 219 size_t SimpleQuicFramer::num_frames() const { |
| 230 return ack_frames().size() + | 220 return ack_frames().size() + |
| 231 feedback_frames().size() + | |
| 232 goaway_frames().size() + | 221 goaway_frames().size() + |
| 233 rst_stream_frames().size() + | 222 rst_stream_frames().size() + |
| 234 stop_waiting_frames().size() + | 223 stop_waiting_frames().size() + |
| 235 stream_frames().size() + | 224 stream_frames().size() + |
| 236 ping_frames().size() + | 225 ping_frames().size() + |
| 237 connection_close_frames().size(); | 226 connection_close_frames().size(); |
| 238 } | 227 } |
| 239 | 228 |
| 240 const vector<QuicAckFrame>& SimpleQuicFramer::ack_frames() const { | 229 const vector<QuicAckFrame>& SimpleQuicFramer::ack_frames() const { |
| 241 return visitor_->ack_frames(); | 230 return visitor_->ack_frames(); |
| 242 } | 231 } |
| 243 | 232 |
| 244 const vector<QuicStopWaitingFrame>& | 233 const vector<QuicStopWaitingFrame>& |
| 245 SimpleQuicFramer::stop_waiting_frames() const { | 234 SimpleQuicFramer::stop_waiting_frames() const { |
| 246 return visitor_->stop_waiting_frames(); | 235 return visitor_->stop_waiting_frames(); |
| 247 } | 236 } |
| 248 | 237 |
| 249 const vector<QuicPingFrame>& SimpleQuicFramer::ping_frames() const { | 238 const vector<QuicPingFrame>& SimpleQuicFramer::ping_frames() const { |
| 250 return visitor_->ping_frames(); | 239 return visitor_->ping_frames(); |
| 251 } | 240 } |
| 252 | 241 |
| 253 const vector<QuicStreamFrame>& SimpleQuicFramer::stream_frames() const { | 242 const vector<QuicStreamFrame>& SimpleQuicFramer::stream_frames() const { |
| 254 return visitor_->stream_frames(); | 243 return visitor_->stream_frames(); |
| 255 } | 244 } |
| 256 | 245 |
| 257 const vector<QuicRstStreamFrame>& SimpleQuicFramer::rst_stream_frames() const { | 246 const vector<QuicRstStreamFrame>& SimpleQuicFramer::rst_stream_frames() const { |
| 258 return visitor_->rst_stream_frames(); | 247 return visitor_->rst_stream_frames(); |
| 259 } | 248 } |
| 260 | 249 |
| 261 const vector<QuicCongestionFeedbackFrame>& | |
| 262 SimpleQuicFramer::feedback_frames() const { | |
| 263 return visitor_->feedback_frames(); | |
| 264 } | |
| 265 | |
| 266 const vector<QuicGoAwayFrame>& | 250 const vector<QuicGoAwayFrame>& |
| 267 SimpleQuicFramer::goaway_frames() const { | 251 SimpleQuicFramer::goaway_frames() const { |
| 268 return visitor_->goaway_frames(); | 252 return visitor_->goaway_frames(); |
| 269 } | 253 } |
| 270 | 254 |
| 271 const vector<QuicConnectionCloseFrame>& | 255 const vector<QuicConnectionCloseFrame>& |
| 272 SimpleQuicFramer::connection_close_frames() const { | 256 SimpleQuicFramer::connection_close_frames() const { |
| 273 return visitor_->connection_close_frames(); | 257 return visitor_->connection_close_frames(); |
| 274 } | 258 } |
| 275 | 259 |
| 276 } // namespace test | 260 } // namespace test |
| 277 } // namespace net | 261 } // namespace net |
| OLD | NEW |