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

Side by Side Diff: net/quic/core/quic_utils.h

Issue 2603723002: Add a new QUIC platform API for text utilities. (Closed)
Patch Set: net/tools/quic/quic_packet_printer_bin.cc Created 3 years, 11 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/core/quic_tag.cc ('k') | net/quic/core/quic_utils.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) 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 #ifndef NET_QUIC_CORE_QUIC_UTILS_H_ 5 #ifndef NET_QUIC_CORE_QUIC_UTILS_H_
6 #define NET_QUIC_CORE_QUIC_UTILS_H_ 6 #define NET_QUIC_CORE_QUIC_UTILS_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdint> 9 #include <cstdint>
10 #include <string> 10 #include <string>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // 7 bytes of |packet_number|. 58 // 7 bytes of |packet_number|.
59 static uint64_t PackPathIdAndPacketNumber(QuicPathId path_id, 59 static uint64_t PackPathIdAndPacketNumber(QuicPathId path_id,
60 QuicPacketNumber packet_number); 60 QuicPacketNumber packet_number);
61 61
62 // Determines and returns change type of address change from |old_address| to 62 // Determines and returns change type of address change from |old_address| to
63 // |new_address|. 63 // |new_address|.
64 static PeerAddressChangeType DetermineAddressChangeType( 64 static PeerAddressChangeType DetermineAddressChangeType(
65 const QuicSocketAddress& old_address, 65 const QuicSocketAddress& old_address,
66 const QuicSocketAddress& new_address); 66 const QuicSocketAddress& new_address);
67 67
68 // This converts |length| bytes of binary to a 2*|length|-character
69 // hexadecimal representation.
70 // Return value: 2*|length| characters of ASCII std::string.
71 static std::string HexEncode(const char* data, size_t length);
72 static std::string HexEncode(base::StringPiece data);
73
74 // Converts |data| from a hexadecimal ASCII std::string to binary.
75 static std::string HexDecode(base::StringPiece data);
76
77 // Returns a std::string containing hex and ASCII representations of |binary|,
78 // side-by-side in the style of hexdump. Non-printable characters will be
79 // printed as '.' in the ASCII output.
80 // For example:
81 // "0x0000: 4865 6c6c 6f2c 2051 5549 4321 0102 0304 Hello,.QUIC!...."
82 static std::string HexDump(base::StringPiece binary_data);
83
84 private: 68 private:
85 DISALLOW_COPY_AND_ASSIGN(QuicUtils); 69 DISALLOW_COPY_AND_ASSIGN(QuicUtils);
86 }; 70 };
87 71
88 } // namespace net 72 } // namespace net
89 73
90 #endif // NET_QUIC_CORE_QUIC_UTILS_H_ 74 #endif // NET_QUIC_CORE_QUIC_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_tag.cc ('k') | net/quic/core/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698