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 <stddef.h> | 10 #include <stddef.h> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // that converts a tag to a string. It will try to maintain the human friendly | 87 // that converts a tag to a string. It will try to maintain the human friendly |
88 // name if possible (i.e. kABCD -> "ABCD"), or will just treat it as a number | 88 // name if possible (i.e. kABCD -> "ABCD"), or will just treat it as a number |
89 // if not. | 89 // if not. |
90 static std::string TagToString(QuicTag tag); | 90 static std::string TagToString(QuicTag tag); |
91 | 91 |
92 // Returns the list of QUIC tags represented by the comma separated | 92 // Returns the list of QUIC tags represented by the comma separated |
93 // string in |connection_options|. | 93 // string in |connection_options|. |
94 static QuicTagVector ParseQuicConnectionOptions( | 94 static QuicTagVector ParseQuicConnectionOptions( |
95 const std::string& connection_options); | 95 const std::string& connection_options); |
96 | 96 |
| 97 // ListTags prints all of the tags in |tag_map| using TagToString. |
| 98 static std::string ListTags(QuicTagValueMap tag_map); |
| 99 |
97 // Returns PeerAddressChangeType as a std::string. | 100 // Returns PeerAddressChangeType as a std::string. |
98 static std::string PeerAddressChangeTypeToString(PeerAddressChangeType type); | 101 static std::string PeerAddressChangeTypeToString(PeerAddressChangeType type); |
99 | 102 |
100 static char* AsChars(unsigned char* data) { | 103 static char* AsChars(unsigned char* data) { |
101 return reinterpret_cast<char*>(data); | 104 return reinterpret_cast<char*>(data); |
102 } | 105 } |
103 | 106 |
104 // Deletes all the sub-frames contained in |frames|. | 107 // Deletes all the sub-frames contained in |frames|. |
105 static void DeleteFrames(QuicFrames* frames); | 108 static void DeleteFrames(QuicFrames* frames); |
106 | 109 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { | 154 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { |
152 iov->iov_base = const_cast<char*>(str.data()); | 155 iov->iov_base = const_cast<char*>(str.data()); |
153 iov->iov_len = static_cast<size_t>(str.size()); | 156 iov->iov_len = static_cast<size_t>(str.size()); |
154 QuicIOVector quic_iov(iov, 1, str.size()); | 157 QuicIOVector quic_iov(iov, 1, str.size()); |
155 return quic_iov; | 158 return quic_iov; |
156 } | 159 } |
157 | 160 |
158 } // namespace net | 161 } // namespace net |
159 | 162 |
160 #endif // NET_QUIC_QUIC_UTILS_H_ | 163 #endif // NET_QUIC_QUIC_UTILS_H_ |
OLD | NEW |