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_QUIC_PROTOCOL_H_ | 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ |
6 #define NET_QUIC_QUIC_PROTOCOL_H_ | 6 #define NET_QUIC_QUIC_PROTOCOL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND, | 215 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND, |
216 // An internal error occured in crypto processing. | 216 // An internal error occured in crypto processing. |
217 QUIC_CRYPTO_INTERNAL_ERROR, | 217 QUIC_CRYPTO_INTERNAL_ERROR, |
218 // A crypto handshake message specified an unsupported version. | 218 // A crypto handshake message specified an unsupported version. |
219 QUIC_CRYPTO_VERSION_NOT_SUPPORTED, | 219 QUIC_CRYPTO_VERSION_NOT_SUPPORTED, |
220 // There was no intersection between the crypto primitives supported by the | 220 // There was no intersection between the crypto primitives supported by the |
221 // peer and ourselves. | 221 // peer and ourselves. |
222 QUIC_CRYPTO_NO_SUPPORT, | 222 QUIC_CRYPTO_NO_SUPPORT, |
223 // The server rejected our client hello messages too many times. | 223 // The server rejected our client hello messages too many times. |
224 QUIC_CRYPTO_TOO_MANY_REJECTS, | 224 QUIC_CRYPTO_TOO_MANY_REJECTS, |
| 225 // The client rejected the server's certificate chain or signature. |
| 226 QUIC_PROOF_INVALID, |
225 | 227 |
226 // No error. Used as bound while iterating. | 228 // No error. Used as bound while iterating. |
227 QUIC_LAST_ERROR, | 229 QUIC_LAST_ERROR, |
228 }; | 230 }; |
229 | 231 |
230 // Version and Crypto tags are written to the wire with a big-endian | 232 // Version and Crypto tags are written to the wire with a big-endian |
231 // representation of the name of the tag. For example | 233 // representation of the name of the tag. For example |
232 // the client hello tag (CHLO) will be written as the | 234 // the client hello tag (CHLO) will be written as the |
233 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is | 235 // following 4 bytes: 'C' 'H' 'L' 'O'. Since it is |
234 // stored in memory as a little endian uint32, we need | 236 // stored in memory as a little endian uint32, we need |
235 // to reverse the order of the bytes. | 237 // to reverse the order of the bytes. |
236 #define MAKE_TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) | 238 // |
| 239 // The TAG macro is used in header files to ensure that we don't create static |
| 240 // initialisers. In normal code, the MakeQuicTag function should be used. |
| 241 #define TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) |
| 242 const QuicVersionTag kUnsupportedVersion = -1; |
| 243 const QuicVersionTag kQuicVersion1 = TAG('Q', '1', '.', '0'); |
| 244 #undef TAG |
237 | 245 |
238 const QuicVersionTag kUnsupportedVersion = -1; | 246 // MakeQuicTag returns a value given the four bytes. For example: |
239 const QuicVersionTag kQuicVersion1 = MAKE_TAG('Q', '1', '.', '0'); | 247 // MakeQuicTag('C', 'H', 'L', 'O'); |
| 248 uint32 NET_EXPORT_PRIVATE MakeQuicTag(char a, char b, char c, char d); |
240 | 249 |
241 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { | 250 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { |
242 QuicPacketPublicHeader(); | 251 QuicPacketPublicHeader(); |
243 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); | 252 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); |
244 ~QuicPacketPublicHeader(); | 253 ~QuicPacketPublicHeader(); |
245 | 254 |
246 QuicPacketPublicHeader& operator=(const QuicPacketPublicHeader& other); | 255 QuicPacketPublicHeader& operator=(const QuicPacketPublicHeader& other); |
247 | 256 |
248 // Universal header. All QuicPacket headers will have a guid and public flags. | 257 // Universal header. All QuicPacket headers will have a guid and public flags. |
249 QuicGuid guid; | 258 QuicGuid guid; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 667 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
659 std::ostream& os, const QuicConsumedData& s); | 668 std::ostream& os, const QuicConsumedData& s); |
660 | 669 |
661 size_t bytes_consumed; | 670 size_t bytes_consumed; |
662 bool fin_consumed; | 671 bool fin_consumed; |
663 }; | 672 }; |
664 | 673 |
665 } // namespace net | 674 } // namespace net |
666 | 675 |
667 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 676 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |