Chromium Code Reviews| 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 gfe2 { | 14 namespace gfe2 { |
| 15 class BalsaHeaders; | 15 class BalsaHeaders; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class QuicClientHelloConfig; | |
| 21 class QuicClock; | |
| 22 class QuicRandom; | |
| 23 struct CryptoHandshakeMessage; | |
| 24 | |
| 20 class NET_EXPORT_PRIVATE QuicUtils { | 25 class NET_EXPORT_PRIVATE QuicUtils { |
| 21 public: | 26 public: |
| 22 // The overhead the quic framing will add for a packet with num_frames | 27 // The overhead the quic framing will add for a packet with num_frames |
| 23 // frames. | 28 // frames. |
| 24 static size_t StreamFramePacketOverhead(int num_frames); | 29 static size_t StreamFramePacketOverhead(int num_frames); |
| 25 | 30 |
| 26 // returns the 128 bit FNV1a hash of the data. See | 31 // returns the 128 bit FNV1a hash of the data. See |
| 27 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param | 32 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param |
| 28 static uint128 FNV1a_128_Hash(const char* data, int len); | 33 static uint128 FNV1a_128_Hash(const char* data, int len); |
| 29 | 34 |
| 30 // Returns the name of the quic error code as a char* | 35 // Returns the name of the quic error code as a char* |
| 31 static const char* ErrorToString(QuicErrorCode error); | 36 static const char* ErrorToString(QuicErrorCode error); |
| 37 | |
| 38 // Generates the connection nonce. | |
| 39 static void GenerateNonce(const QuicClock* clock, | |
| 40 QuicRandom* random_generator, | |
| 41 std::string* nonce); | |
| 42 | |
| 43 static void FillClientHelloMessage(const QuicClientHelloConfig& config, | |
|
Ryan Hamilton
2012/12/22 22:31:32
I think you'll end up wanting the inverse of this
| |
| 44 const std::string& nonce, | |
|
Ryan Hamilton
2012/12/22 22:31:32
nit: add #include <string>
| |
| 45 CryptoHandshakeMessage* message); | |
|
wtc
2012/12/22 04:21:51
Is QuicUtils the right home for these two utility
Ryan Hamilton
2012/12/22 22:31:32
This is fine. I think I'd probably create a Crypt
| |
| 32 }; | 46 }; |
| 33 | 47 |
| 34 } // namespace net | 48 } // namespace net |
| 35 | 49 |
| 36 #endif // NET_QUIC_QUIC_UTILS_H_ | 50 #endif // NET_QUIC_QUIC_UTILS_H_ |
| OLD | NEW |