OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/tools/quic/chlo_extractor.h" | 5 #include "net/tools/quic/chlo_extractor.h" |
6 | 6 |
7 #include "net/quic/core/crypto/crypto_framer.h" | 7 #include "net/quic/core/crypto/crypto_framer.h" |
8 #include "net/quic/core/crypto/crypto_handshake_message.h" | 8 #include "net/quic/core/crypto/crypto_handshake_message.h" |
9 #include "net/quic/core/crypto/crypto_protocol.h" | 9 #include "net/quic/core/crypto/crypto_protocol.h" |
10 #include "net/quic/core/crypto/quic_decrypter.h" | 10 #include "net/quic/core/crypto/quic_decrypter.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 bool ChloFramerVisitor::OnPaddingFrame(const QuicPaddingFrame& frame) { | 143 bool ChloFramerVisitor::OnPaddingFrame(const QuicPaddingFrame& frame) { |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 void ChloFramerVisitor::OnError(CryptoFramer* framer) {} | 147 void ChloFramerVisitor::OnError(CryptoFramer* framer) {} |
148 | 148 |
149 void ChloFramerVisitor::OnHandshakeMessage( | 149 void ChloFramerVisitor::OnHandshakeMessage( |
150 const CryptoHandshakeMessage& message) { | 150 const CryptoHandshakeMessage& message) { |
151 delegate_->OnChlo(framer_->version(), connection_id_, message); | 151 if (delegate_ != nullptr) { |
| 152 delegate_->OnChlo(framer_->version(), connection_id_, message); |
| 153 } |
152 found_chlo_ = true; | 154 found_chlo_ = true; |
153 } | 155 } |
154 | 156 |
155 } // namespace | 157 } // namespace |
156 | 158 |
157 // static | 159 // static |
158 bool ChloExtractor::Extract(const QuicEncryptedPacket& packet, | 160 bool ChloExtractor::Extract(const QuicEncryptedPacket& packet, |
159 const QuicVersionVector& versions, | 161 const QuicVersionVector& versions, |
160 Delegate* delegate) { | 162 Delegate* delegate) { |
161 QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER); | 163 QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER); |
162 ChloFramerVisitor visitor(&framer, delegate); | 164 ChloFramerVisitor visitor(&framer, delegate); |
163 framer.set_visitor(&visitor); | 165 framer.set_visitor(&visitor); |
164 if (!framer.ProcessPacket(packet)) { | 166 if (!framer.ProcessPacket(packet)) { |
165 return false; | 167 return false; |
166 } | 168 } |
167 return visitor.found_chlo(); | 169 return visitor.found_chlo(); |
168 } | 170 } |
169 | 171 |
170 } // namespace net | 172 } // namespace net |
OLD | NEW |