| 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 <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const size_t kQuicPathIdSize = 1; | 115 const size_t kQuicPathIdSize = 1; |
| 116 // Number of bytes reserved for private flags in the packet header. | 116 // Number of bytes reserved for private flags in the packet header. |
| 117 const size_t kPrivateFlagsSize = 1; | 117 const size_t kPrivateFlagsSize = 1; |
| 118 // Number of bytes reserved for FEC group in the packet header. | 118 // Number of bytes reserved for FEC group in the packet header. |
| 119 const size_t kFecGroupSize = 1; | 119 const size_t kFecGroupSize = 1; |
| 120 | 120 |
| 121 // Signifies that the QuicPacket will contain version of the protocol. | 121 // Signifies that the QuicPacket will contain version of the protocol. |
| 122 const bool kIncludeVersion = true; | 122 const bool kIncludeVersion = true; |
| 123 // Signifies that the QuicPacket will contain path id. | 123 // Signifies that the QuicPacket will contain path id. |
| 124 const bool kIncludePathId = true; | 124 const bool kIncludePathId = true; |
| 125 // Signifies that the QuicPacket will include a diversification nonce. |
| 126 const bool kIncludeDiversificationNonce = true; |
| 125 | 127 |
| 126 // Stream ID is reserved to denote an invalid ID. | 128 // Stream ID is reserved to denote an invalid ID. |
| 127 const QuicStreamId kInvalidStreamId = 0; | 129 const QuicStreamId kInvalidStreamId = 0; |
| 128 | 130 |
| 129 // Reserved ID for the crypto stream. | 131 // Reserved ID for the crypto stream. |
| 130 const QuicStreamId kCryptoStreamId = 1; | 132 const QuicStreamId kCryptoStreamId = 1; |
| 131 | 133 |
| 132 // Reserved ID for the headers stream. | 134 // Reserved ID for the headers stream. |
| 133 const QuicStreamId kHeadersStreamId = 3; | 135 const QuicStreamId kHeadersStreamId = 3; |
| 134 | 136 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12 | 204 const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12 |
| 203 const uint64_t kUFloat16MaxValue = // 0x3FFC0000000 | 205 const uint64_t kUFloat16MaxValue = // 0x3FFC0000000 |
| 204 ((UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) | 206 ((UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) |
| 205 << kUFloat16MaxExponent; | 207 << kUFloat16MaxExponent; |
| 206 | 208 |
| 207 // Default path ID. | 209 // Default path ID. |
| 208 const QuicPathId kDefaultPathId = 0; | 210 const QuicPathId kDefaultPathId = 0; |
| 209 // Invalid path ID. | 211 // Invalid path ID. |
| 210 const QuicPathId kInvalidPathId = 0xff; | 212 const QuicPathId kInvalidPathId = 0xff; |
| 211 | 213 |
| 214 // kDiversificationNonceSize is the size, in bytes, of the nonce that a server |
| 215 // may set in the packet header to ensure that its INITIAL keys are not |
| 216 // duplicated. |
| 217 const size_t kDiversificationNonceSize = 32; |
| 218 |
| 212 enum TransmissionType : int8_t { | 219 enum TransmissionType : int8_t { |
| 213 NOT_RETRANSMISSION, | 220 NOT_RETRANSMISSION, |
| 214 FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION, | 221 FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION, |
| 215 HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. | 222 HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. |
| 216 ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets. | 223 ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets. |
| 217 ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets. | 224 ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets. |
| 218 LOSS_RETRANSMISSION, // Retransmits due to loss detection. | 225 LOSS_RETRANSMISSION, // Retransmits due to loss detection. |
| 219 RTO_RETRANSMISSION, // Retransmits due to retransmit time out. | 226 RTO_RETRANSMISSION, // Retransmits due to retransmit time out. |
| 220 TLP_RETRANSMISSION, // Tail loss probes. | 227 TLP_RETRANSMISSION, // Tail loss probes. |
| 221 LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION, | 228 LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // the wire and their values do not need to be stable. | 265 // the wire and their values do not need to be stable. |
| 259 STREAM_FRAME, | 266 STREAM_FRAME, |
| 260 ACK_FRAME, | 267 ACK_FRAME, |
| 261 // The path MTU discovery frame is encoded as a PING frame on the wire. | 268 // The path MTU discovery frame is encoded as a PING frame on the wire. |
| 262 MTU_DISCOVERY_FRAME, | 269 MTU_DISCOVERY_FRAME, |
| 263 NUM_FRAME_TYPES | 270 NUM_FRAME_TYPES |
| 264 }; | 271 }; |
| 265 | 272 |
| 266 enum QuicConnectionIdLength { | 273 enum QuicConnectionIdLength { |
| 267 PACKET_0BYTE_CONNECTION_ID = 0, | 274 PACKET_0BYTE_CONNECTION_ID = 0, |
| 268 PACKET_1BYTE_CONNECTION_ID = 1, | |
| 269 PACKET_4BYTE_CONNECTION_ID = 4, | |
| 270 PACKET_8BYTE_CONNECTION_ID = 8 | 275 PACKET_8BYTE_CONNECTION_ID = 8 |
| 271 }; | 276 }; |
| 272 | 277 |
| 273 enum InFecGroup { | 278 enum InFecGroup { |
| 274 NOT_IN_FEC_GROUP, | 279 NOT_IN_FEC_GROUP, |
| 275 IN_FEC_GROUP, | 280 IN_FEC_GROUP, |
| 276 }; | 281 }; |
| 277 | 282 |
| 278 enum QuicPacketNumberLength : int8_t { | 283 enum QuicPacketNumberLength : int8_t { |
| 279 PACKET_1BYTE_PACKET_NUMBER = 1, | 284 PACKET_1BYTE_PACKET_NUMBER = 1, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 293 // The public flags are specified in one byte. | 298 // The public flags are specified in one byte. |
| 294 enum QuicPacketPublicFlags { | 299 enum QuicPacketPublicFlags { |
| 295 PACKET_PUBLIC_FLAGS_NONE = 0, | 300 PACKET_PUBLIC_FLAGS_NONE = 0, |
| 296 | 301 |
| 297 // Bit 0: Does the packet header contains version info? | 302 // Bit 0: Does the packet header contains version info? |
| 298 PACKET_PUBLIC_FLAGS_VERSION = 1 << 0, | 303 PACKET_PUBLIC_FLAGS_VERSION = 1 << 0, |
| 299 | 304 |
| 300 // Bit 1: Is this packet a public reset packet? | 305 // Bit 1: Is this packet a public reset packet? |
| 301 PACKET_PUBLIC_FLAGS_RST = 1 << 1, | 306 PACKET_PUBLIC_FLAGS_RST = 1 << 1, |
| 302 | 307 |
| 303 // Bits 2 and 3 specify the length of the ConnectionId as follows: | 308 // Bit 2: indicates the that public header includes a nonce. |
| 304 // ----00--: 0 bytes | 309 PACKET_PUBLIC_FLAGS_NONCE = 1 << 2, |
| 305 // ----01--: 1 byte | 310 |
| 306 // ----10--: 4 bytes | 311 // Bit 3: indicates whether a ConnectionID is included. |
| 307 // ----11--: 8 bytes | |
| 308 PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID = 0, | 312 PACKET_PUBLIC_FLAGS_0BYTE_CONNECTION_ID = 0, |
| 309 PACKET_PUBLIC_FLAGS_1BYTE_CONNECTION_ID = 1 << 2, | 313 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID = 1 << 3, |
| 310 PACKET_PUBLIC_FLAGS_4BYTE_CONNECTION_ID = 1 << 3, | 314 |
| 311 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID = 1 << 3 | 1 << 2, | 315 // QUIC_VERSION_32 and earlier use two bits for an 8 byte |
| 316 // connection id. |
| 317 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID_OLD = 1 << 3 | 1 << 2, |
| 312 | 318 |
| 313 // Bits 4 and 5 describe the packet number length as follows: | 319 // Bits 4 and 5 describe the packet number length as follows: |
| 314 // --00----: 1 byte | 320 // --00----: 1 byte |
| 315 // --01----: 2 bytes | 321 // --01----: 2 bytes |
| 316 // --10----: 4 bytes | 322 // --10----: 4 bytes |
| 317 // --11----: 6 bytes | 323 // --11----: 6 bytes |
| 318 PACKET_PUBLIC_FLAGS_1BYTE_PACKET = PACKET_FLAGS_1BYTE_PACKET << 4, | 324 PACKET_PUBLIC_FLAGS_1BYTE_PACKET = PACKET_FLAGS_1BYTE_PACKET << 4, |
| 319 PACKET_PUBLIC_FLAGS_2BYTE_PACKET = PACKET_FLAGS_2BYTE_PACKET << 4, | 325 PACKET_PUBLIC_FLAGS_2BYTE_PACKET = PACKET_FLAGS_2BYTE_PACKET << 4, |
| 320 PACKET_PUBLIC_FLAGS_4BYTE_PACKET = PACKET_FLAGS_4BYTE_PACKET << 4, | 326 PACKET_PUBLIC_FLAGS_4BYTE_PACKET = PACKET_FLAGS_4BYTE_PACKET << 4, |
| 321 PACKET_PUBLIC_FLAGS_6BYTE_PACKET = PACKET_FLAGS_6BYTE_PACKET << 4, | 327 PACKET_PUBLIC_FLAGS_6BYTE_PACKET = PACKET_FLAGS_6BYTE_PACKET << 4, |
| 322 | 328 |
| 323 // Bit 6: Does the packet header contain a path id? | 329 // Bit 6: Does the packet header contain a path id? |
| 324 PACKET_PUBLIC_FLAGS_MULTIPATH = 1 << 6, | 330 PACKET_PUBLIC_FLAGS_MULTIPATH = 1 << 6, |
| 325 | 331 |
| 332 // Reserved, unimplemented flags: |
| 333 |
| 334 // Bit 7: indicates the presence of a second flags byte. |
| 335 PACKET_PUBLIC_FLAGS_TWO_OR_MORE_BYTES = 1 << 7, |
| 336 |
| 326 // All bits set (bit 7 is not currently used): 01111111 | 337 // All bits set (bit 7 is not currently used): 01111111 |
| 327 PACKET_PUBLIC_FLAGS_MAX = (1 << 7) - 1, | 338 PACKET_PUBLIC_FLAGS_MAX = (1 << 7) - 1, |
| 328 }; | 339 }; |
| 329 | 340 |
| 330 // The private flags are specified in one byte. | 341 // The private flags are specified in one byte. |
| 331 enum QuicPacketPrivateFlags { | 342 enum QuicPacketPrivateFlags { |
| 332 PACKET_PRIVATE_FLAGS_NONE = 0, | 343 PACKET_PRIVATE_FLAGS_NONE = 0, |
| 333 | 344 |
| 334 // Bit 0: Does this packet contain an entropy bit? | 345 // Bit 0: Does this packet contain an entropy bit? |
| 335 PACKET_PRIVATE_FLAGS_ENTROPY = 1 << 0, | 346 PACKET_PRIVATE_FLAGS_ENTROPY = 1 << 0, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 359 | 370 |
| 360 QUIC_VERSION_25 = 25, // SPDY/4 header keys, and removal of error_details | 371 QUIC_VERSION_25 = 25, // SPDY/4 header keys, and removal of error_details |
| 361 // from QuicRstStreamFrame | 372 // from QuicRstStreamFrame |
| 362 QUIC_VERSION_26 = 26, // In CHLO, send XLCT tag containing hash of leaf cert | 373 QUIC_VERSION_26 = 26, // In CHLO, send XLCT tag containing hash of leaf cert |
| 363 QUIC_VERSION_27 = 27, // Sends a nonce in the SHLO. | 374 QUIC_VERSION_27 = 27, // Sends a nonce in the SHLO. |
| 364 QUIC_VERSION_28 = 28, // Receiver can refuse to create a requested stream. | 375 QUIC_VERSION_28 = 28, // Receiver can refuse to create a requested stream. |
| 365 QUIC_VERSION_29 = 29, // Server and client honor QUIC_STREAM_NO_ERROR. | 376 QUIC_VERSION_29 = 29, // Server and client honor QUIC_STREAM_NO_ERROR. |
| 366 QUIC_VERSION_30 = 30, // Add server side support of cert transparency. | 377 QUIC_VERSION_30 = 30, // Add server side support of cert transparency. |
| 367 QUIC_VERSION_31 = 31, // Adds a hash of the client hello to crypto proof. | 378 QUIC_VERSION_31 = 31, // Adds a hash of the client hello to crypto proof. |
| 368 QUIC_VERSION_32 = 32, // FEC related fields are removed from wire format. | 379 QUIC_VERSION_32 = 32, // FEC related fields are removed from wire format. |
| 380 QUIC_VERSION_33 = 33, // Adds diversification nonces. |
| 369 }; | 381 }; |
| 370 | 382 |
| 371 // This vector contains QUIC versions which we currently support. | 383 // This vector contains QUIC versions which we currently support. |
| 372 // This should be ordered such that the highest supported version is the first | 384 // This should be ordered such that the highest supported version is the first |
| 373 // element, with subsequent elements in descending order (versions can be | 385 // element, with subsequent elements in descending order (versions can be |
| 374 // skipped as necessary). | 386 // skipped as necessary). |
| 375 // | 387 // |
| 376 // IMPORTANT: if you are adding to this list, follow the instructions at | 388 // IMPORTANT: if you are adding to this list, follow the instructions at |
| 377 // http://sites/quic/adding-and-removing-versions | 389 // http://sites/quic/adding-and-removing-versions |
| 378 static const QuicVersion kSupportedQuicVersions[] = { | 390 static const QuicVersion kSupportedQuicVersions[] = { |
| 379 QUIC_VERSION_32, QUIC_VERSION_31, QUIC_VERSION_30, QUIC_VERSION_29, | 391 QUIC_VERSION_33, QUIC_VERSION_32, QUIC_VERSION_31, |
| 380 QUIC_VERSION_28, QUIC_VERSION_27, QUIC_VERSION_26, QUIC_VERSION_25}; | 392 QUIC_VERSION_30, QUIC_VERSION_29, QUIC_VERSION_28, |
| 393 QUIC_VERSION_27, QUIC_VERSION_26, QUIC_VERSION_25}; |
| 381 | 394 |
| 382 typedef std::vector<QuicVersion> QuicVersionVector; | 395 typedef std::vector<QuicVersion> QuicVersionVector; |
| 383 | 396 |
| 384 // Returns a vector of QUIC versions in kSupportedQuicVersions. | 397 // Returns a vector of QUIC versions in kSupportedQuicVersions. |
| 385 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); | 398 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); |
| 386 | 399 |
| 387 // QuicTag is written to and read from the wire, but we prefer to use | 400 // QuicTag is written to and read from the wire, but we prefer to use |
| 388 // the more readable QuicVersion at other levels. | 401 // the more readable QuicVersion at other levels. |
| 389 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 | 402 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 |
| 390 // if QuicVersion is unsupported. | 403 // if QuicVersion is unsupported. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 418 NET_EXPORT_PRIVATE bool ContainsQuicTag(const QuicTagVector& tag_vector, | 431 NET_EXPORT_PRIVATE bool ContainsQuicTag(const QuicTagVector& tag_vector, |
| 419 QuicTag tag); | 432 QuicTag tag); |
| 420 | 433 |
| 421 // Size in bytes of the data packet header. | 434 // Size in bytes of the data packet header. |
| 422 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header); | 435 NET_EXPORT_PRIVATE size_t GetPacketHeaderSize(const QuicPacketHeader& header); |
| 423 | 436 |
| 424 NET_EXPORT_PRIVATE size_t | 437 NET_EXPORT_PRIVATE size_t |
| 425 GetPacketHeaderSize(QuicConnectionIdLength connection_id_length, | 438 GetPacketHeaderSize(QuicConnectionIdLength connection_id_length, |
| 426 bool include_version, | 439 bool include_version, |
| 427 bool include_path_id, | 440 bool include_path_id, |
| 441 bool include_diversification_nonce, |
| 428 QuicPacketNumberLength packet_number_length); | 442 QuicPacketNumberLength packet_number_length); |
| 429 | 443 |
| 430 // Index of the first byte in a QUIC packet of encrypted data. | 444 // Index of the first byte in a QUIC packet of encrypted data. |
| 431 NET_EXPORT_PRIVATE size_t | 445 NET_EXPORT_PRIVATE size_t |
| 432 GetStartOfEncryptedData(const QuicPacketHeader& header); | 446 GetStartOfEncryptedData(const QuicPacketHeader& header); |
| 433 | 447 |
| 434 NET_EXPORT_PRIVATE size_t | 448 NET_EXPORT_PRIVATE size_t |
| 435 GetStartOfEncryptedData(QuicConnectionIdLength connection_id_length, | 449 GetStartOfEncryptedData(QuicConnectionIdLength connection_id_length, |
| 436 bool include_version, | 450 bool include_version, |
| 437 bool include_path_id, | 451 bool include_path_id, |
| 452 bool include_diversification_nonce, |
| 438 QuicPacketNumberLength packet_number_length); | 453 QuicPacketNumberLength packet_number_length); |
| 439 | 454 |
| 440 enum QuicRstStreamErrorCode { | 455 enum QuicRstStreamErrorCode { |
| 441 // Complete response has been sent, sending a RST to ask the other endpoint | 456 // Complete response has been sent, sending a RST to ask the other endpoint |
| 442 // to stop sending request data without discarding the response. | 457 // to stop sending request data without discarding the response. |
| 443 QUIC_STREAM_NO_ERROR = 0, | 458 QUIC_STREAM_NO_ERROR = 0, |
| 444 | 459 |
| 445 // There was some error which halted stream processing. | 460 // There was some error which halted stream processing. |
| 446 QUIC_ERROR_PROCESSING_STREAM, | 461 QUIC_ERROR_PROCESSING_STREAM, |
| 447 // We got two fin or reset offsets which did not match. | 462 // We got two fin or reset offsets which did not match. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84, | 689 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84, |
| 675 | 690 |
| 676 // No error. Used as bound while iterating. | 691 // No error. Used as bound while iterating. |
| 677 QUIC_LAST_ERROR = 89, | 692 QUIC_LAST_ERROR = 89, |
| 678 }; | 693 }; |
| 679 | 694 |
| 680 // Must be updated any time a QuicErrorCode is deprecated. | 695 // Must be updated any time a QuicErrorCode is deprecated. |
| 681 const int kDeprecatedQuicErrorCount = 4; | 696 const int kDeprecatedQuicErrorCount = 4; |
| 682 const int kActiveQuicErrorCount = QUIC_LAST_ERROR - kDeprecatedQuicErrorCount; | 697 const int kActiveQuicErrorCount = QUIC_LAST_ERROR - kDeprecatedQuicErrorCount; |
| 683 | 698 |
| 699 typedef char DiversificationNonce[32]; |
| 700 |
| 684 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { | 701 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { |
| 685 QuicPacketPublicHeader(); | 702 QuicPacketPublicHeader(); |
| 686 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); | 703 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); |
| 687 ~QuicPacketPublicHeader(); | 704 ~QuicPacketPublicHeader(); |
| 688 | 705 |
| 689 // Universal header. All QuicPacket headers will have a connection_id and | 706 // Universal header. All QuicPacket headers will have a connection_id and |
| 690 // public flags. | 707 // public flags. |
| 691 QuicConnectionId connection_id; | 708 QuicConnectionId connection_id; |
| 692 QuicConnectionIdLength connection_id_length; | 709 QuicConnectionIdLength connection_id_length; |
| 693 bool multipath_flag; | 710 bool multipath_flag; |
| 694 bool reset_flag; | 711 bool reset_flag; |
| 695 bool version_flag; | 712 bool version_flag; |
| 696 QuicPacketNumberLength packet_number_length; | 713 QuicPacketNumberLength packet_number_length; |
| 697 QuicVersionVector versions; | 714 QuicVersionVector versions; |
| 715 // nonce contains an optional, 32-byte nonce value. If not included in the |
| 716 // packet, |nonce| will be empty. |
| 717 DiversificationNonce* nonce; |
| 698 }; | 718 }; |
| 699 | 719 |
| 700 // An integer which cannot be a packet number. | 720 // An integer which cannot be a packet number. |
| 701 const QuicPacketNumber kInvalidPacketNumber = 0; | 721 const QuicPacketNumber kInvalidPacketNumber = 0; |
| 702 | 722 |
| 703 // Header for Data packets. | 723 // Header for Data packets. |
| 704 struct NET_EXPORT_PRIVATE QuicPacketHeader { | 724 struct NET_EXPORT_PRIVATE QuicPacketHeader { |
| 705 QuicPacketHeader(); | 725 QuicPacketHeader(); |
| 706 explicit QuicPacketHeader(const QuicPacketPublicHeader& header); | 726 explicit QuicPacketHeader(const QuicPacketPublicHeader& header); |
| 707 QuicPacketHeader(const QuicPacketHeader& other); | 727 QuicPacketHeader(const QuicPacketHeader& other); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 public: | 1233 public: |
| 1214 // TODO(fayang): 4 fields from public header are passed in as arguments. | 1234 // TODO(fayang): 4 fields from public header are passed in as arguments. |
| 1215 // Consider to add a convenience method which directly accepts the entire | 1235 // Consider to add a convenience method which directly accepts the entire |
| 1216 // public header. | 1236 // public header. |
| 1217 QuicPacket(char* buffer, | 1237 QuicPacket(char* buffer, |
| 1218 size_t length, | 1238 size_t length, |
| 1219 bool owns_buffer, | 1239 bool owns_buffer, |
| 1220 QuicConnectionIdLength connection_id_length, | 1240 QuicConnectionIdLength connection_id_length, |
| 1221 bool includes_version, | 1241 bool includes_version, |
| 1222 bool includes_path_id, | 1242 bool includes_path_id, |
| 1243 bool includes_diversification_nonce, |
| 1223 QuicPacketNumberLength packet_number_length); | 1244 QuicPacketNumberLength packet_number_length); |
| 1224 | 1245 |
| 1225 base::StringPiece AssociatedData() const; | 1246 base::StringPiece AssociatedData() const; |
| 1226 base::StringPiece Plaintext() const; | 1247 base::StringPiece Plaintext() const; |
| 1227 | 1248 |
| 1228 char* mutable_data() { return buffer_; } | 1249 char* mutable_data() { return buffer_; } |
| 1229 | 1250 |
| 1230 private: | 1251 private: |
| 1231 char* buffer_; | 1252 char* buffer_; |
| 1232 const QuicConnectionIdLength connection_id_length_; | 1253 const QuicConnectionIdLength connection_id_length_; |
| 1233 const bool includes_version_; | 1254 const bool includes_version_; |
| 1234 const bool includes_path_id_; | 1255 const bool includes_path_id_; |
| 1256 const bool includes_diversification_nonce_; |
| 1235 const QuicPacketNumberLength packet_number_length_; | 1257 const QuicPacketNumberLength packet_number_length_; |
| 1236 | 1258 |
| 1237 DISALLOW_COPY_AND_ASSIGN(QuicPacket); | 1259 DISALLOW_COPY_AND_ASSIGN(QuicPacket); |
| 1238 }; | 1260 }; |
| 1239 | 1261 |
| 1240 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { | 1262 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { |
| 1241 public: | 1263 public: |
| 1242 QuicEncryptedPacket(const char* buffer, size_t length); | 1264 QuicEncryptedPacket(const char* buffer, size_t length); |
| 1243 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer); | 1265 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer); |
| 1244 | 1266 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1449 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
| 1428 | 1450 |
| 1429 const struct iovec* iov; | 1451 const struct iovec* iov; |
| 1430 const int iov_count; | 1452 const int iov_count; |
| 1431 const size_t total_length; | 1453 const size_t total_length; |
| 1432 }; | 1454 }; |
| 1433 | 1455 |
| 1434 } // namespace net | 1456 } // namespace net |
| 1435 | 1457 |
| 1436 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1458 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |