| 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 #ifndef NET_QUIC_CORE_QUIC_UTILS_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_UTILS_H_ |
| 6 #define NET_QUIC_CORE_QUIC_UTILS_H_ | 6 #define NET_QUIC_CORE_QUIC_UTILS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
| 15 #include "net/base/int128.h" | 15 #include "net/base/int128.h" |
| 16 #include "net/base/net_export.h" | |
| 17 #include "net/quic/core/quic_error_codes.h" | 16 #include "net/quic/core/quic_error_codes.h" |
| 18 #include "net/quic/core/quic_tag.h" | 17 #include "net/quic/core/quic_tag.h" |
| 19 #include "net/quic/core/quic_types.h" | 18 #include "net/quic/core/quic_types.h" |
| 19 #include "net/quic/platform/api/quic_export.h" |
| 20 #include "net/quic/platform/api/quic_socket_address.h" | 20 #include "net/quic/platform/api/quic_socket_address.h" |
| 21 | 21 |
| 22 #ifdef _MSC_VER | 22 #ifdef _MSC_VER |
| 23 // MSVC 2013 and prior don't have alignof or aligned(); they have __alignof and | 23 // MSVC 2013 and prior don't have alignof or aligned(); they have __alignof and |
| 24 // a __declspec instead. | 24 // a __declspec instead. |
| 25 #define QUIC_ALIGN_OF __alignof | 25 #define QUIC_ALIGN_OF __alignof |
| 26 #define QUIC_ALIGNED(X) __declspec(align(X)) | 26 #define QUIC_ALIGNED(X) __declspec(align(X)) |
| 27 #else | 27 #else |
| 28 #define QUIC_ALIGN_OF alignof | 28 #define QUIC_ALIGN_OF alignof |
| 29 #define QUIC_ALIGNED(X) __attribute__((aligned(X))) | 29 #define QUIC_ALIGNED(X) __attribute__((aligned(X))) |
| 30 #endif // _MSC_VER | 30 #endif // _MSC_VER |
| 31 | 31 |
| 32 namespace net { | 32 namespace net { |
| 33 | 33 |
| 34 class NET_EXPORT_PRIVATE QuicUtils { | 34 class QUIC_EXPORT_PRIVATE QuicUtils { |
| 35 public: | 35 public: |
| 36 // Returns the 64 bit FNV1a hash of the data. See | 36 // Returns the 64 bit FNV1a hash of the data. See |
| 37 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param | 37 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param |
| 38 static uint64_t FNV1a_64_Hash(const char* data, int len); | 38 static uint64_t FNV1a_64_Hash(const char* data, int len); |
| 39 | 39 |
| 40 // returns the 128 bit FNV1a hash of the data. See | 40 // returns the 128 bit FNV1a hash of the data. See |
| 41 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param | 41 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param |
| 42 static uint128 FNV1a_128_Hash(const char* data1, int len1); | 42 static uint128 FNV1a_128_Hash(const char* data1, int len1); |
| 43 | 43 |
| 44 // returns the 128 bit FNV1a hash of the two sequences of data. See | 44 // returns the 128 bit FNV1a hash of the two sequences of data. See |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // "0x0000: 4865 6c6c 6f2c 2051 5549 4321 0102 0304 Hello,.QUIC!...." | 93 // "0x0000: 4865 6c6c 6f2c 2051 5549 4321 0102 0304 Hello,.QUIC!...." |
| 94 static std::string HexDump(base::StringPiece binary_data); | 94 static std::string HexDump(base::StringPiece binary_data); |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 DISALLOW_COPY_AND_ASSIGN(QuicUtils); | 97 DISALLOW_COPY_AND_ASSIGN(QuicUtils); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace net | 100 } // namespace net |
| 101 | 101 |
| 102 #endif // NET_QUIC_CORE_QUIC_UTILS_H_ | 102 #endif // NET_QUIC_CORE_QUIC_UTILS_H_ |
| OLD | NEW |