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 // Some helpers for quic. | 5 // Some helpers for quic. |
6 | 6 |
7 #ifndef NET_QUIC_QUIC_UTILS_H_ | 7 #ifndef NET_QUIC_QUIC_UTILS_H_ |
8 #define NET_QUIC_QUIC_UTILS_H_ | 8 #define NET_QUIC_QUIC_UTILS_H_ |
9 | 9 |
10 #include "net/base/int128.h" | 10 #include "net/base/int128.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Returns the name of the QuicRstStreamErrorCode as a char* | 53 // Returns the name of the QuicRstStreamErrorCode as a char* |
54 static const char* StreamErrorToString(QuicRstStreamErrorCode error); | 54 static const char* StreamErrorToString(QuicRstStreamErrorCode error); |
55 | 55 |
56 // Returns the name of the QuicErrorCode as a char* | 56 // Returns the name of the QuicErrorCode as a char* |
57 static const char* ErrorToString(QuicErrorCode error); | 57 static const char* ErrorToString(QuicErrorCode error); |
58 | 58 |
59 // Returns the level of encryption as a char* | 59 // Returns the level of encryption as a char* |
60 static const char* EncryptionLevelToString(EncryptionLevel level); | 60 static const char* EncryptionLevelToString(EncryptionLevel level); |
61 | 61 |
| 62 // Returns TransmissionType as a char* |
| 63 static const char* TransmissionTypeToString(TransmissionType type); |
| 64 |
62 // TagToString is a utility function for pretty-printing handshake messages | 65 // TagToString is a utility function for pretty-printing handshake messages |
63 // that converts a tag to a string. It will try to maintain the human friendly | 66 // that converts a tag to a string. It will try to maintain the human friendly |
64 // name if possible (i.e. kABCD -> "ABCD"), or will just treat it as a number | 67 // name if possible (i.e. kABCD -> "ABCD"), or will just treat it as a number |
65 // if not. | 68 // if not. |
66 static std::string TagToString(QuicTag tag); | 69 static std::string TagToString(QuicTag tag); |
67 | 70 |
68 // Given a binary buffer, return a hex+ASCII dump in the style of | 71 // Given a binary buffer, return a hex+ASCII dump in the style of |
69 // tcpdump's -X and -XX options: | 72 // tcpdump's -X and -XX options: |
70 // "0x0000: 0090 69bd 5400 000d 610f 0189 0800 4500 ..i.T...a.....E.\n" | 73 // "0x0000: 0090 69bd 5400 000d 610f 0189 0800 4500 ..i.T...a.....E.\n" |
71 // "0x0010: 001c fb98 4000 4001 7e18 d8ef 2301 455d ....@.@.~...#.E]\n" | 74 // "0x0010: 001c fb98 4000 4001 7e18 d8ef 2301 455d ....@.@.~...#.E]\n" |
(...skipping 12 matching lines...) Expand all Loading... |
84 // Utility function that returns an IOVector object wrapped around |str|. | 87 // Utility function that returns an IOVector object wrapped around |str|. |
85 inline IOVector MakeIOVector(base::StringPiece str) { | 88 inline IOVector MakeIOVector(base::StringPiece str) { |
86 IOVector iov; | 89 IOVector iov; |
87 iov.Append(const_cast<char*>(str.data()), str.size()); | 90 iov.Append(const_cast<char*>(str.data()), str.size()); |
88 return iov; | 91 return iov; |
89 } | 92 } |
90 | 93 |
91 } // namespace net | 94 } // namespace net |
92 | 95 |
93 #endif // NET_QUIC_QUIC_UTILS_H_ | 96 #endif // NET_QUIC_QUIC_UTILS_H_ |
OLD | NEW |