Index: net/quic/quic_utils.h |
diff --git a/net/quic/quic_utils.h b/net/quic/quic_utils.h |
index 14345eb6f64b56386a38b87cb7ebbfac26d2ada5..e866a07004753e0eb0aa467fdcf0e844b11c37a5 100644 |
--- a/net/quic/quic_utils.h |
+++ b/net/quic/quic_utils.h |
@@ -15,6 +15,11 @@ namespace net { |
class NET_EXPORT_PRIVATE QuicUtils { |
public: |
+ enum Priority { |
+ LOCAL_PRIORITY, |
+ PEER_PRIORITY, |
+ }; |
+ |
// returns the 64 bit FNV1a hash of the data. See |
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param |
static uint64 FNV1a_64_Hash(const char* data, int len); |
@@ -23,6 +28,21 @@ class NET_EXPORT_PRIVATE QuicUtils { |
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param |
static uint128 FNV1a_128_Hash(const char* data, int len); |
+ // FindMutualTag sets |out_result| to the first tag in the priority list that |
+ // is also in the other list and returns true. If there is no intersection it |
+ // returns false. |
+ // |
+ // Which list has priority is determined by |priority|. |
+ // |
+ // If |out_index| is non-NULL and a match is found then the index of that |
+ // match in |their_tags| is written to |out_index|. |
+ static bool FindMutualTag(const QuicTagVector& our_tags, |
+ const QuicTag* their_tags, |
+ size_t num_their_tags, |
+ Priority priority, |
+ QuicTag* out_result, |
+ size_t* out_index); |
+ |
// SerializeUint128 writes |v| in little-endian form to |out|. |
static void SerializeUint128(uint128 v, uint8* out); |
@@ -34,6 +54,12 @@ class NET_EXPORT_PRIVATE QuicUtils { |
// Returns the name of the QuicErrorCode as a char* |
static const char* ErrorToString(QuicErrorCode error); |
+ |
+ // TagToString is a utility function for pretty-printing handshake messages |
+ // that converts a tag to a string. It will try to maintain the human friendly |
+ // name if possible (i.e. kABCD -> "ABCD"), or will just treat it as a number |
+ // if not. |
+ static std::string TagToString(QuicTag tag); |
}; |
} // namespace net |