| 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 "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 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 vector<QuicStreamFrame> stream_frames_; | 121 vector<QuicStreamFrame> stream_frames_; |
| 122 vector<QuicRstStreamFrame> rst_stream_frames_; | 122 vector<QuicRstStreamFrame> rst_stream_frames_; |
| 123 vector<QuicGoAwayFrame> goaway_frames_; | 123 vector<QuicGoAwayFrame> goaway_frames_; |
| 124 vector<QuicConnectionCloseFrame> connection_close_frames_; | 124 vector<QuicConnectionCloseFrame> connection_close_frames_; |
| 125 vector<string> stream_data_; | 125 vector<string> stream_data_; |
| 126 | 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(SimpleFramerVisitor); | 127 DISALLOW_COPY_AND_ASSIGN(SimpleFramerVisitor); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 SimpleQuicFramer::SimpleQuicFramer() | 130 SimpleQuicFramer::SimpleQuicFramer() |
| 131 : framer_(kQuicVersion1, | 131 : framer_(kQuicVersion1, QuicTime::Zero(), true), |
| 132 QuicDecrypter::Create(kNULL), | |
| 133 QuicEncrypter::Create(kNULL), | |
| 134 QuicTime::Zero(), | |
| 135 true), | |
| 136 visitor_(NULL) { | 132 visitor_(NULL) { |
| 137 } | 133 } |
| 138 | 134 |
| 139 SimpleQuicFramer::~SimpleQuicFramer() { | 135 SimpleQuicFramer::~SimpleQuicFramer() { |
| 140 } | 136 } |
| 141 | 137 |
| 142 bool SimpleQuicFramer::ProcessPacket(const QuicPacket& packet) { | 138 bool SimpleQuicFramer::ProcessPacket(const QuicPacket& packet) { |
| 143 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket(0, packet)); | 139 scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket( |
| 140 ENCRYPTION_NONE, 0, packet)); |
| 144 return ProcessPacket(*encrypted); | 141 return ProcessPacket(*encrypted); |
| 145 } | 142 } |
| 146 | 143 |
| 147 bool SimpleQuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) { | 144 bool SimpleQuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) { |
| 148 visitor_.reset(new SimpleFramerVisitor); | 145 visitor_.reset(new SimpleFramerVisitor); |
| 149 framer_.set_visitor(visitor_.get()); | 146 framer_.set_visitor(visitor_.get()); |
| 150 return framer_.ProcessPacket(packet); | 147 return framer_.ProcessPacket(packet); |
| 151 } | 148 } |
| 152 | 149 |
| 153 const QuicPacketHeader& SimpleQuicFramer::header() const { | 150 const QuicPacketHeader& SimpleQuicFramer::header() const { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return visitor_->goaway_frames(); | 186 return visitor_->goaway_frames(); |
| 190 } | 187 } |
| 191 | 188 |
| 192 const vector<QuicConnectionCloseFrame>& | 189 const vector<QuicConnectionCloseFrame>& |
| 193 SimpleQuicFramer::connection_close_frames() const { | 190 SimpleQuicFramer::connection_close_frames() const { |
| 194 return visitor_->connection_close_frames(); | 191 return visitor_->connection_close_frames(); |
| 195 } | 192 } |
| 196 | 193 |
| 197 } // namespace test | 194 } // namespace test |
| 198 } // namespace net | 195 } // namespace net |
| OLD | NEW |