| 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. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (perspective_string == "client") { | 177 if (perspective_string == "client") { |
| 178 perspective = net::Perspective::IS_CLIENT; | 178 perspective = net::Perspective::IS_CLIENT; |
| 179 } else if (perspective_string == "server") { | 179 } else if (perspective_string == "server") { |
| 180 perspective = net::Perspective::IS_SERVER; | 180 perspective = net::Perspective::IS_SERVER; |
| 181 } else { | 181 } else { |
| 182 cerr << "Invalid perspective. " << perspective_string | 182 cerr << "Invalid perspective. " << perspective_string |
| 183 << " Usage: " << args[0] << " client|server <hex>\n"; | 183 << " Usage: " << args[0] << " client|server <hex>\n"; |
| 184 return 1; | 184 return 1; |
| 185 } | 185 } |
| 186 string hex = net::QuicUtils::HexDecode(ArgToString(args[1])); | 186 string hex = net::QuicUtils::HexDecode(ArgToString(args[1])); |
| 187 net::QuicVersionVector versions = net::QuicSupportedVersions(); | 187 net::QuicVersionVector versions = net::AllSupportedVersions(); |
| 188 // Fake a time since we're not actually generating acks. | 188 // Fake a time since we're not actually generating acks. |
| 189 net::QuicTime start(net::QuicTime::Zero()); | 189 net::QuicTime start(net::QuicTime::Zero()); |
| 190 net::QuicFramer framer(versions, start, perspective); | 190 net::QuicFramer framer(versions, start, perspective); |
| 191 if (!FLAGS_quic_version.empty()) { | 191 if (!FLAGS_quic_version.empty()) { |
| 192 for (net::QuicVersion version : versions) { | 192 for (net::QuicVersion version : versions) { |
| 193 if (net::QuicVersionToString(version) == FLAGS_quic_version) { | 193 if (net::QuicVersionToString(version) == FLAGS_quic_version) { |
| 194 framer.set_version(version); | 194 framer.set_version(version); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 net::QuicPacketPrinter visitor(&framer); | 198 net::QuicPacketPrinter visitor(&framer); |
| 199 framer.set_visitor(&visitor); | 199 framer.set_visitor(&visitor); |
| 200 net::QuicEncryptedPacket encrypted(hex.c_str(), hex.length()); | 200 net::QuicEncryptedPacket encrypted(hex.c_str(), hex.length()); |
| 201 return framer.ProcessPacket(encrypted); | 201 return framer.ProcessPacket(encrypted); |
| 202 } | 202 } |
| OLD | NEW |