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 | |
100 // Returns PeerAddressChangeType as a std::string. | 97 // Returns PeerAddressChangeType as a std::string. |
101 static std::string PeerAddressChangeTypeToString(PeerAddressChangeType type); | 98 static std::string PeerAddressChangeTypeToString(PeerAddressChangeType type); |
102 | 99 |
103 static char* AsChars(unsigned char* data) { | 100 static char* AsChars(unsigned char* data) { |
104 return reinterpret_cast<char*>(data); | 101 return reinterpret_cast<char*>(data); |
105 } | 102 } |
106 | 103 |
107 // Deletes all the sub-frames contained in |frames|. | 104 // Deletes all the sub-frames contained in |frames|. |
108 static void DeleteFrames(QuicFrames* frames); | 105 static void DeleteFrames(QuicFrames* frames); |
109 | 106 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { | 151 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { |
155 iov->iov_base = const_cast<char*>(str.data()); | 152 iov->iov_base = const_cast<char*>(str.data()); |
156 iov->iov_len = static_cast<size_t>(str.size()); | 153 iov->iov_len = static_cast<size_t>(str.size()); |
157 QuicIOVector quic_iov(iov, 1, str.size()); | 154 QuicIOVector quic_iov(iov, 1, str.size()); |
158 return quic_iov; | 155 return quic_iov; |
159 } | 156 } |
160 | 157 |
161 } // namespace net | 158 } // namespace net |
162 | 159 |
163 #endif // NET_QUIC_QUIC_UTILS_H_ | 160 #endif // NET_QUIC_QUIC_UTILS_H_ |
OLD | NEW |