| 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" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/quic/quic_protocol.h" | 12 #include "net/quic/quic_protocol.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 class NET_EXPORT_PRIVATE QuicUtils { | 16 class NET_EXPORT_PRIVATE QuicUtils { |
| 17 public: | 17 public: |
| 18 // returns the 64 bit FNV1a hash of the data. See | |
| 19 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param | |
| 20 static uint64 FNV1a_64_Hash(const char* data, int len); | |
| 21 | |
| 22 // returns the 128 bit FNV1a hash of the data. See | 18 // returns the 128 bit FNV1a hash of the data. See |
| 23 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param | 19 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param |
| 24 static uint128 FNV1a_128_Hash(const char* data, int len); | 20 static uint128 FNV1a_128_Hash(const char* data, int len); |
| 25 | 21 |
| 26 // SerializeUint128 writes |v| in little-endian form to |out|. | |
| 27 static void SerializeUint128(uint128 v, uint8* out); | |
| 28 | |
| 29 // ParseUint128 parses a little-endian uint128 from |in| and returns it. | |
| 30 static uint128 ParseUint128(const uint8* in); | |
| 31 | |
| 32 // Returns the name of the QuicRstStreamErrorCode as a char* | 22 // Returns the name of the QuicRstStreamErrorCode as a char* |
| 33 static const char* StreamErrorToString(QuicRstStreamErrorCode error); | 23 static const char* StreamErrorToString(QuicRstStreamErrorCode error); |
| 34 | 24 |
| 35 // Returns the name of the QuicErrorCode as a char* | 25 // Returns the name of the QuicErrorCode as a char* |
| 36 static const char* ErrorToString(QuicErrorCode error); | 26 static const char* ErrorToString(QuicErrorCode error); |
| 37 }; | 27 }; |
| 38 | 28 |
| 39 } // namespace net | 29 } // namespace net |
| 40 | 30 |
| 41 #endif // NET_QUIC_QUIC_UTILS_H_ | 31 #endif // NET_QUIC_QUIC_UTILS_H_ |
| OLD | NEW |