Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: net/quic/quic_utils.h

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 enum Priority {
19 LOCAL_PRIORITY,
20 PEER_PRIORITY,
21 };
22
18 // returns the 64 bit FNV1a hash of the data. See 23 // returns the 64 bit FNV1a hash of the data. See
19 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param 24 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
20 static uint64 FNV1a_64_Hash(const char* data, int len); 25 static uint64 FNV1a_64_Hash(const char* data, int len);
21 26
22 // returns the 128 bit FNV1a hash of the data. See 27 // returns the 128 bit FNV1a hash of the data. See
23 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param 28 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
24 static uint128 FNV1a_128_Hash(const char* data, int len); 29 static uint128 FNV1a_128_Hash(const char* data, int len);
25 30
31 // FindMutualTag sets |out_result| to the first tag in the priority list that
32 // is also in the other list and returns true. If there is no intersection it
33 // returns false.
34 //
35 // Which list has priority is determined by |priority|.
36 //
37 // If |out_index| is non-NULL and a match is found then the index of that
38 // match in |their_tags| is written to |out_index|.
39 static bool FindMutualTag(const QuicTagVector& our_tags,
40 const QuicTag* their_tags,
41 size_t num_their_tags,
42 Priority priority,
43 QuicTag* out_result,
44 size_t* out_index);
45
26 // SerializeUint128 writes |v| in little-endian form to |out|. 46 // SerializeUint128 writes |v| in little-endian form to |out|.
27 static void SerializeUint128(uint128 v, uint8* out); 47 static void SerializeUint128(uint128 v, uint8* out);
28 48
29 // ParseUint128 parses a little-endian uint128 from |in| and returns it. 49 // ParseUint128 parses a little-endian uint128 from |in| and returns it.
30 static uint128 ParseUint128(const uint8* in); 50 static uint128 ParseUint128(const uint8* in);
31 51
32 // Returns the name of the QuicRstStreamErrorCode as a char* 52 // Returns the name of the QuicRstStreamErrorCode as a char*
33 static const char* StreamErrorToString(QuicRstStreamErrorCode error); 53 static const char* StreamErrorToString(QuicRstStreamErrorCode error);
34 54
35 // Returns the name of the QuicErrorCode as a char* 55 // Returns the name of the QuicErrorCode as a char*
36 static const char* ErrorToString(QuicErrorCode error); 56 static const char* ErrorToString(QuicErrorCode error);
57
58 // TagToString is a utility function for pretty-printing handshake messages
59 // that converts a tag to a string. It will try to maintain the human friendly
60 // name if possible (i.e. kABCD -> "ABCD"), or will just treat it as a number
61 // if not.
62 static std::string TagToString(QuicTag tag);
37 }; 63 };
38 64
39 } // namespace net 65 } // namespace net
40 66
41 #endif // NET_QUIC_QUIC_UTILS_H_ 67 #endif // NET_QUIC_QUIC_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698