| 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 <string> | 10 #include <string> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // tcpdump's -X and -XX options: | 88 // tcpdump's -X and -XX options: |
| 89 // "0x0000: 0090 69bd 5400 000d 610f 0189 0800 4500 ..i.T...a.....E.\n" | 89 // "0x0000: 0090 69bd 5400 000d 610f 0189 0800 4500 ..i.T...a.....E.\n" |
| 90 // "0x0010: 001c fb98 4000 4001 7e18 d8ef 2301 455d ....@.@.~...#.E]\n" | 90 // "0x0010: 001c fb98 4000 4001 7e18 d8ef 2301 455d ....@.@.~...#.E]\n" |
| 91 // "0x0020: 7fe2 0800 6bcb 0bc6 806e ....k....n\n" | 91 // "0x0020: 7fe2 0800 6bcb 0bc6 806e ....k....n\n" |
| 92 static std::string StringToHexASCIIDump(base::StringPiece in_buffer); | 92 static std::string StringToHexASCIIDump(base::StringPiece in_buffer); |
| 93 | 93 |
| 94 static char* AsChars(unsigned char* data) { | 94 static char* AsChars(unsigned char* data) { |
| 95 return reinterpret_cast<char*>(data); | 95 return reinterpret_cast<char*>(data); |
| 96 } | 96 } |
| 97 | 97 |
| 98 static QuicPriority HighestPriority(); | |
| 99 | |
| 100 private: | 98 private: |
| 101 DISALLOW_COPY_AND_ASSIGN(QuicUtils); | 99 DISALLOW_COPY_AND_ASSIGN(QuicUtils); |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 // Utility function that returns an QuicIOVector object wrapped around |str|. | 102 // Utility function that returns an QuicIOVector object wrapped around |str|. |
| 105 // |str|'s data is stored in |iov|. | 103 // |str|'s data is stored in |iov|. |
| 106 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { | 104 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { |
| 107 iov->iov_base = const_cast<char*>(str.data()); | 105 iov->iov_base = const_cast<char*>(str.data()); |
| 108 iov->iov_len = static_cast<size_t>(str.size()); | 106 iov->iov_len = static_cast<size_t>(str.size()); |
| 109 QuicIOVector quic_iov(iov, 1, str.size()); | 107 QuicIOVector quic_iov(iov, 1, str.size()); |
| 110 return quic_iov; | 108 return quic_iov; |
| 111 } | 109 } |
| 112 | 110 |
| 113 } // namespace net | 111 } // namespace net |
| 114 | 112 |
| 115 #endif // NET_QUIC_QUIC_UTILS_H_ | 113 #endif // NET_QUIC_QUIC_UTILS_H_ |
| OLD | NEW |