| 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_CRYPTO_CRYPTO_PROTOCOL_H_ | 5 #ifndef NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 6 #define NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ | 6 #define NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| 11 #include "net/quic/quic_protocol.h" | 11 #include "net/quic/quic_protocol.h" |
| 12 | 12 |
| 13 // Version and Crypto tags are written to the wire with a big-endian | 13 // Version and Crypto tags are written to the wire with a big-endian |
| 14 // representation of the name of the tag. For example | 14 // representation of the name of the tag. For example |
| 15 // the client hello tag (CHLO) will be written as the | 15 // the client hello tag (CHLO) will be written as the |
| 16 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is | 16 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is |
| 17 // stored in memory as a little endian uint32, we need | 17 // stored in memory as a little endian uint32, we need |
| 18 // to reverse the order of the bytes. | 18 // to reverse the order of the bytes. |
| 19 // | 19 // |
| 20 // We use a macro to ensure that no static initialisers are created. Use the | 20 // We use a macro to ensure that no static initialisers are created. Use the |
| 21 // MakeQuicTag function in normal code. | 21 // MakeQuicTag function in normal code. |
| 22 #define TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) | 22 #define TAG(a, b, c, d) \ |
| 23 static_cast<QuicTag>((d << 24) + (c << 16) + (b << 8) + a) |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 | 26 |
| 26 typedef std::string ServerConfigID; | 27 typedef std::string ServerConfigID; |
| 27 | 28 |
| 28 const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello | 29 const QuicTag kCHLO = TAG('C', 'H', 'L', 'O'); // Client hello |
| 29 const QuicTag kSHLO = TAG('S', 'H', 'L', 'O'); // Server hello | 30 const QuicTag kSHLO = TAG('S', 'H', 'L', 'O'); // Server hello |
| 30 const QuicTag kSCFG = TAG('S', 'C', 'F', 'G'); // Server config | 31 const QuicTag kSCFG = TAG('S', 'C', 'F', 'G'); // Server config |
| 31 const QuicTag kREJ = TAG('R', 'E', 'J', '\0'); // Reject | 32 const QuicTag kREJ = TAG('R', 'E', 'J', '\0'); // Reject |
| 32 const QuicTag kCETV = TAG('C', 'E', 'T', 'V'); // Client encrypted tag-value | 33 const QuicTag kCETV = TAG('C', 'E', 'T', 'V'); // Client encrypted tag-value |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // amplification factor of any mirror DoS attack. | 161 // amplification factor of any mirror DoS attack. |
| 161 // | 162 // |
| 162 // A client may pad an inchoate client hello to a size larger than | 163 // A client may pad an inchoate client hello to a size larger than |
| 163 // kClientHelloMinimumSize to make it more likely to receive a complete | 164 // kClientHelloMinimumSize to make it more likely to receive a complete |
| 164 // rejection message. | 165 // rejection message. |
| 165 const size_t kClientHelloMinimumSize = 1024; | 166 const size_t kClientHelloMinimumSize = 1024; |
| 166 | 167 |
| 167 } // namespace net | 168 } // namespace net |
| 168 | 169 |
| 169 #endif // NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ | 170 #endif // NET_QUIC_CRYPTO_CRYPTO_PROTOCOL_H_ |
| OLD | NEW |