| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override { | 111 bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override { |
| 112 path_close_frames_.push_back(frame); | 112 path_close_frames_.push_back(frame); |
| 113 return true; | 113 return true; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void OnPacketComplete() override {} | 116 void OnPacketComplete() override {} |
| 117 | 117 |
| 118 const QuicPacketHeader& header() const { return header_; } | 118 const QuicPacketHeader& header() const { return header_; } |
| 119 const vector<QuicAckFrame>& ack_frames() const { return ack_frames_; } | 119 const std::vector<QuicAckFrame>& ack_frames() const { return ack_frames_; } |
| 120 const vector<QuicConnectionCloseFrame>& connection_close_frames() const { | 120 const std::vector<QuicConnectionCloseFrame>& connection_close_frames() const { |
| 121 return connection_close_frames_; | 121 return connection_close_frames_; |
| 122 } | 122 } |
| 123 const vector<QuicGoAwayFrame>& goaway_frames() const { | 123 const std::vector<QuicGoAwayFrame>& goaway_frames() const { |
| 124 return goaway_frames_; | 124 return goaway_frames_; |
| 125 } | 125 } |
| 126 const vector<QuicRstStreamFrame>& rst_stream_frames() const { | 126 const std::vector<QuicRstStreamFrame>& rst_stream_frames() const { |
| 127 return rst_stream_frames_; | 127 return rst_stream_frames_; |
| 128 } | 128 } |
| 129 const vector<std::unique_ptr<QuicStreamFrame>>& stream_frames() const { | 129 const std::vector<std::unique_ptr<QuicStreamFrame>>& stream_frames() const { |
| 130 return stream_frames_; | 130 return stream_frames_; |
| 131 } | 131 } |
| 132 const vector<QuicStopWaitingFrame>& stop_waiting_frames() const { | 132 const std::vector<QuicStopWaitingFrame>& stop_waiting_frames() const { |
| 133 return stop_waiting_frames_; | 133 return stop_waiting_frames_; |
| 134 } | 134 } |
| 135 const vector<QuicPingFrame>& ping_frames() const { return ping_frames_; } | 135 const std::vector<QuicPingFrame>& ping_frames() const { return ping_frames_; } |
| 136 const QuicVersionNegotiationPacket* version_negotiation_packet() const { | 136 const QuicVersionNegotiationPacket* version_negotiation_packet() const { |
| 137 return version_negotiation_packet_.get(); | 137 return version_negotiation_packet_.get(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 QuicErrorCode error_; | 141 QuicErrorCode error_; |
| 142 bool has_header_; | 142 bool has_header_; |
| 143 QuicPacketHeader header_; | 143 QuicPacketHeader header_; |
| 144 std::unique_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; | 144 std::unique_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; |
| 145 std::unique_ptr<QuicPublicResetPacket> public_reset_packet_; | 145 std::unique_ptr<QuicPublicResetPacket> public_reset_packet_; |
| 146 vector<QuicAckFrame> ack_frames_; | 146 std::vector<QuicAckFrame> ack_frames_; |
| 147 vector<QuicStopWaitingFrame> stop_waiting_frames_; | 147 std::vector<QuicStopWaitingFrame> stop_waiting_frames_; |
| 148 vector<QuicPaddingFrame> padding_frames_; | 148 std::vector<QuicPaddingFrame> padding_frames_; |
| 149 vector<QuicPingFrame> ping_frames_; | 149 std::vector<QuicPingFrame> ping_frames_; |
| 150 vector<std::unique_ptr<QuicStreamFrame>> stream_frames_; | 150 std::vector<std::unique_ptr<QuicStreamFrame>> stream_frames_; |
| 151 vector<QuicRstStreamFrame> rst_stream_frames_; | 151 std::vector<QuicRstStreamFrame> rst_stream_frames_; |
| 152 vector<QuicGoAwayFrame> goaway_frames_; | 152 std::vector<QuicGoAwayFrame> goaway_frames_; |
| 153 vector<QuicConnectionCloseFrame> connection_close_frames_; | 153 std::vector<QuicConnectionCloseFrame> connection_close_frames_; |
| 154 vector<QuicWindowUpdateFrame> window_update_frames_; | 154 std::vector<QuicWindowUpdateFrame> window_update_frames_; |
| 155 vector<QuicBlockedFrame> blocked_frames_; | 155 std::vector<QuicBlockedFrame> blocked_frames_; |
| 156 vector<QuicPathCloseFrame> path_close_frames_; | 156 std::vector<QuicPathCloseFrame> path_close_frames_; |
| 157 vector<std::unique_ptr<string>> stream_data_; | 157 std::vector<std::unique_ptr<string>> stream_data_; |
| 158 | 158 |
| 159 DISALLOW_COPY_AND_ASSIGN(SimpleFramerVisitor); | 159 DISALLOW_COPY_AND_ASSIGN(SimpleFramerVisitor); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 SimpleQuicFramer::SimpleQuicFramer() | 162 SimpleQuicFramer::SimpleQuicFramer() |
| 163 : framer_(AllSupportedVersions(), | 163 : framer_(AllSupportedVersions(), |
| 164 QuicTime::Zero(), | 164 QuicTime::Zero(), |
| 165 Perspective::IS_SERVER) {} | 165 Perspective::IS_SERVER) {} |
| 166 | 166 |
| 167 SimpleQuicFramer::SimpleQuicFramer(const QuicVersionVector& supported_versions) | 167 SimpleQuicFramer::SimpleQuicFramer(const QuicVersionVector& supported_versions) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 196 return &framer_; | 196 return &framer_; |
| 197 } | 197 } |
| 198 | 198 |
| 199 size_t SimpleQuicFramer::num_frames() const { | 199 size_t SimpleQuicFramer::num_frames() const { |
| 200 return ack_frames().size() + goaway_frames().size() + | 200 return ack_frames().size() + goaway_frames().size() + |
| 201 rst_stream_frames().size() + stop_waiting_frames().size() + | 201 rst_stream_frames().size() + stop_waiting_frames().size() + |
| 202 stream_frames().size() + ping_frames().size() + | 202 stream_frames().size() + ping_frames().size() + |
| 203 connection_close_frames().size(); | 203 connection_close_frames().size(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 const vector<QuicAckFrame>& SimpleQuicFramer::ack_frames() const { | 206 const std::vector<QuicAckFrame>& SimpleQuicFramer::ack_frames() const { |
| 207 return visitor_->ack_frames(); | 207 return visitor_->ack_frames(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 const vector<QuicStopWaitingFrame>& SimpleQuicFramer::stop_waiting_frames() | 210 const std::vector<QuicStopWaitingFrame>& SimpleQuicFramer::stop_waiting_frames() |
| 211 const { | 211 const { |
| 212 return visitor_->stop_waiting_frames(); | 212 return visitor_->stop_waiting_frames(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 const vector<QuicPingFrame>& SimpleQuicFramer::ping_frames() const { | 215 const std::vector<QuicPingFrame>& SimpleQuicFramer::ping_frames() const { |
| 216 return visitor_->ping_frames(); | 216 return visitor_->ping_frames(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 const vector<std::unique_ptr<QuicStreamFrame>>& | 219 const std::vector<std::unique_ptr<QuicStreamFrame>>& |
| 220 SimpleQuicFramer::stream_frames() const { | 220 SimpleQuicFramer::stream_frames() const { |
| 221 return visitor_->stream_frames(); | 221 return visitor_->stream_frames(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 const vector<QuicRstStreamFrame>& SimpleQuicFramer::rst_stream_frames() const { | 224 const std::vector<QuicRstStreamFrame>& SimpleQuicFramer::rst_stream_frames() |
| 225 const { |
| 225 return visitor_->rst_stream_frames(); | 226 return visitor_->rst_stream_frames(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 const vector<QuicGoAwayFrame>& SimpleQuicFramer::goaway_frames() const { | 229 const std::vector<QuicGoAwayFrame>& SimpleQuicFramer::goaway_frames() const { |
| 229 return visitor_->goaway_frames(); | 230 return visitor_->goaway_frames(); |
| 230 } | 231 } |
| 231 | 232 |
| 232 const vector<QuicConnectionCloseFrame>& | 233 const std::vector<QuicConnectionCloseFrame>& |
| 233 SimpleQuicFramer::connection_close_frames() const { | 234 SimpleQuicFramer::connection_close_frames() const { |
| 234 return visitor_->connection_close_frames(); | 235 return visitor_->connection_close_frames(); |
| 235 } | 236 } |
| 236 | 237 |
| 237 } // namespace test | 238 } // namespace test |
| 238 } // namespace net | 239 } // namespace net |
| OLD | NEW |