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 // clang-format off | 5 // clang-format off |
6 | 6 |
7 // Dumps out the decryptable contents of a QUIC packet in a human-readable way. | 7 // Dumps out the decryptable contents of a QUIC packet in a human-readable way. |
8 // If the packet is null encrypted, this will dump full packet contents. | 8 // If the packet is null encrypted, this will dump full packet contents. |
9 // Otherwise it will dump the public header, and fail with an error that the | 9 // Otherwise it will dump the public header, and fail with an error that the |
10 // packet is undecryptable. | 10 // packet is undecryptable. |
11 // | 11 // |
12 // Usage: quic_packet_printer [server|client] [hex dump of packet] | 12 // Usage: quic_packet_printer server|client <hex dump of packet> |
13 // | 13 // |
14 // Example input: | 14 // Example input: |
15 // quic_packet_printer server 0c6b810308320f24c004a939a38a2e3fd6ca589917f200400 | 15 // quic_packet_printer server 0c6b810308320f24c004a939a38a2e3fd6ca589917f200400 |
16 // 201b80b0100501c0700060003023d0000001c00556e656e637279707465642073747265616d2 | 16 // 201b80b0100501c0700060003023d0000001c00556e656e637279707465642073747265616d2 |
17 // 064617461207365656e | 17 // 064617461207365656e |
18 // | 18 // |
19 // Example output: | 19 // Example output: |
20 // OnPacket | 20 // OnPacket |
21 // OnUnauthenticatedPublicHeader | 21 // OnUnauthenticatedPublicHeader |
22 // OnUnauthenticatedHeader: { connection_id: 13845207862000976235, | 22 // OnUnauthenticatedHeader: { connection_id: 13845207862000976235, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 QuicFramer* framer_; // Unowned. | 155 QuicFramer* framer_; // Unowned. |
156 }; | 156 }; |
157 | 157 |
158 } // namespace net | 158 } // namespace net |
159 | 159 |
160 int main(int argc, char* argv[]) { | 160 int main(int argc, char* argv[]) { |
161 base::CommandLine::Init(argc, argv); | 161 base::CommandLine::Init(argc, argv); |
162 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); | 162 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); |
163 const base::CommandLine::StringVector& args = line->GetArgs(); | 163 const base::CommandLine::StringVector& args = line->GetArgs(); |
164 | 164 |
165 if (args.size() != 2) { | 165 if (args.size() != 3) { |
166 cerr << "Usage: " << argv[0] << " client|server <hex>\n"; | 166 cerr << "Missing argument " << argc << ". (Usage: " << argv[0] |
| 167 << " client|server <hex>\n"; |
167 return 1; | 168 return 1; |
168 } | 169 } |
169 | 170 |
170 if (line->HasSwitch("quic_version")) { | 171 if (line->HasSwitch("quic_version")) { |
171 FLAGS_quic_version = line->GetSwitchValueASCII("quic_version"); | 172 FLAGS_quic_version = line->GetSwitchValueASCII("quic_version"); |
172 } | 173 } |
173 | 174 |
174 string perspective_string = ArgToString(args[0]); | 175 string perspective_string = ArgToString(args[0]); |
175 net::Perspective perspective; | 176 net::Perspective perspective; |
176 if (perspective_string == "client") { | 177 if (perspective_string == "client") { |
(...skipping 15 matching lines...) Expand all Loading... |
192 if (net::QuicVersionToString(version) == FLAGS_quic_version) { | 193 if (net::QuicVersionToString(version) == FLAGS_quic_version) { |
193 framer.set_version(version); | 194 framer.set_version(version); |
194 } | 195 } |
195 } | 196 } |
196 } | 197 } |
197 net::QuicPacketPrinter visitor(&framer); | 198 net::QuicPacketPrinter visitor(&framer); |
198 framer.set_visitor(&visitor); | 199 framer.set_visitor(&visitor); |
199 net::QuicEncryptedPacket encrypted(hex.c_str(), hex.length()); | 200 net::QuicEncryptedPacket encrypted(hex.c_str(), hex.length()); |
200 return framer.ProcessPacket(encrypted); | 201 return framer.ProcessPacket(encrypted); |
201 } | 202 } |
OLD | NEW |