Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1540)

Side by Side Diff: net/tools/quic/chlo_extractor.cc

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/simple_quic_framer.cc ('k') | net/tools/quic/chlo_extractor_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/quic/core/crypto/quic_encrypter.h" 11 #include "net/quic/core/crypto/quic_encrypter.h"
12 #include "net/quic/core/quic_framer.h" 12 #include "net/quic/core/quic_framer.h"
13 #include "net/quic/platform/api/quic_string_piece.h"
13 #include "net/quic/platform/api/quic_text_utils.h" 14 #include "net/quic/platform/api/quic_text_utils.h"
14 15
15 using base::StringPiece;
16
17 namespace net { 16 namespace net {
18 17
19 namespace { 18 namespace {
20 19
21 class ChloFramerVisitor : public QuicFramerVisitorInterface, 20 class ChloFramerVisitor : public QuicFramerVisitorInterface,
22 public CryptoFramerVisitorInterface { 21 public CryptoFramerVisitorInterface {
23 public: 22 public:
24 ChloFramerVisitor(QuicFramer* framer, ChloExtractor::Delegate* delegate); 23 ChloFramerVisitor(QuicFramer* framer, ChloExtractor::Delegate* delegate);
25 24
26 ~ChloFramerVisitor() override {} 25 ~ChloFramerVisitor() override {}
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return true; 83 return true;
85 } 84 }
86 bool ChloFramerVisitor::OnUnauthenticatedHeader( 85 bool ChloFramerVisitor::OnUnauthenticatedHeader(
87 const QuicPacketHeader& header) { 86 const QuicPacketHeader& header) {
88 return true; 87 return true;
89 } 88 }
90 bool ChloFramerVisitor::OnPacketHeader(const QuicPacketHeader& header) { 89 bool ChloFramerVisitor::OnPacketHeader(const QuicPacketHeader& header) {
91 return true; 90 return true;
92 } 91 }
93 bool ChloFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) { 92 bool ChloFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) {
94 StringPiece data(frame.data_buffer, frame.data_length); 93 QuicStringPiece data(frame.data_buffer, frame.data_length);
95 if (frame.stream_id == kCryptoStreamId && frame.offset == 0 && 94 if (frame.stream_id == kCryptoStreamId && frame.offset == 0 &&
96 QuicTextUtils::StartsWith(data, "CHLO")) { 95 QuicTextUtils::StartsWith(data, "CHLO")) {
97 CryptoFramer crypto_framer; 96 CryptoFramer crypto_framer;
98 crypto_framer.set_visitor(this); 97 crypto_framer.set_visitor(this);
99 if (!crypto_framer.ProcessInput(data)) { 98 if (!crypto_framer.ProcessInput(data)) {
100 return false; 99 return false;
101 } 100 }
102 } 101 }
103 return true; 102 return true;
104 } 103 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER); 163 QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER);
165 ChloFramerVisitor visitor(&framer, delegate); 164 ChloFramerVisitor visitor(&framer, delegate);
166 framer.set_visitor(&visitor); 165 framer.set_visitor(&visitor);
167 if (!framer.ProcessPacket(packet)) { 166 if (!framer.ProcessPacket(packet)) {
168 return false; 167 return false;
169 } 168 }
170 return visitor.found_chlo(); 169 return visitor.found_chlo();
171 } 170 }
172 171
173 } // namespace net 172 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/simple_quic_framer.cc ('k') | net/tools/quic/chlo_extractor_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698