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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // QuicTag is the type of a tag in the wire protocol. | 49 // QuicTag is the type of a tag in the wire protocol. |
50 typedef uint32_t QuicTag; | 50 typedef uint32_t QuicTag; |
51 typedef std::vector<QuicTag> QuicTagVector; | 51 typedef std::vector<QuicTag> QuicTagVector; |
52 typedef std::map<QuicTag, std::string> QuicTagValueMap; | 52 typedef std::map<QuicTag, std::string> QuicTagValueMap; |
53 typedef uint16_t QuicPacketLength; | 53 typedef uint16_t QuicPacketLength; |
54 | 54 |
55 // Default initial maximum size in bytes of a QUIC packet. | 55 // Default initial maximum size in bytes of a QUIC packet. |
56 const QuicByteCount kDefaultMaxPacketSize = 1350; | 56 const QuicByteCount kDefaultMaxPacketSize = 1350; |
57 // Default initial maximum size in bytes of a QUIC packet for servers. | 57 // Default initial maximum size in bytes of a QUIC packet for servers. |
58 const QuicByteCount kDefaultServerMaxPacketSize = 1000; | 58 const QuicByteCount kDefaultServerMaxPacketSize = 1000; |
59 // Minimum size of a QUIC packet, used if a server receives packets from a | |
60 // client with unusual network headers. 1280 - sizeof(eth) - sizeof(ipv6). | |
61 const QuicByteCount kMinimumSupportedPacketSize = 1214; | |
62 // The maximum packet size of any QUIC packet, based on ethernet's max size, | 59 // The maximum packet size of any QUIC packet, based on ethernet's max size, |
63 // minus the IP and UDP headers. IPv6 has a 40 byte header, UDP adds an | 60 // minus the IP and UDP headers. IPv6 has a 40 byte header, UDP adds an |
64 // additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's | 61 // additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's |
65 // max packet size is 1500 bytes, 1500 - 48 = 1452. | 62 // max packet size is 1500 bytes, 1500 - 48 = 1452. |
66 const QuicByteCount kMaxPacketSize = 1452; | 63 const QuicByteCount kMaxPacketSize = 1452; |
67 // Default maximum packet size used in the Linux TCP implementation. | 64 // Default maximum packet size used in the Linux TCP implementation. |
68 // Used in QUIC for congestion window computations in bytes. | 65 // Used in QUIC for congestion window computations in bytes. |
69 const QuicByteCount kDefaultTCPMSS = 1460; | 66 const QuicByteCount kDefaultTCPMSS = 1460; |
70 | 67 |
71 // We match SPDY's use of 32 (since we'd compete with SPDY). | 68 // We match SPDY's use of 32 (since we'd compete with SPDY). |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 public: | 1310 public: |
1314 QuicReceivedPacket(const char* buffer, size_t length, QuicTime receipt_time); | 1311 QuicReceivedPacket(const char* buffer, size_t length, QuicTime receipt_time); |
1315 QuicReceivedPacket(const char* buffer, | 1312 QuicReceivedPacket(const char* buffer, |
1316 size_t length, | 1313 size_t length, |
1317 QuicTime receipt_time, | 1314 QuicTime receipt_time, |
1318 bool owns_buffer); | 1315 bool owns_buffer); |
1319 QuicReceivedPacket(const char* buffer, | 1316 QuicReceivedPacket(const char* buffer, |
1320 size_t length, | 1317 size_t length, |
1321 QuicTime receipt_time, | 1318 QuicTime receipt_time, |
1322 bool owns_buffer, | 1319 bool owns_buffer, |
1323 bool potentially_small_mtu, | |
1324 int ttl, | 1320 int ttl, |
1325 bool ttl_valid); | 1321 bool ttl_valid); |
1326 | 1322 |
1327 // Clones the packet into a new packet which owns the buffer. | 1323 // Clones the packet into a new packet which owns the buffer. |
1328 QuicReceivedPacket* Clone() const; | 1324 QuicReceivedPacket* Clone() const; |
1329 | 1325 |
1330 // Returns the time at which the packet was received. | 1326 // Returns the time at which the packet was received. |
1331 QuicTime receipt_time() const { return receipt_time_; } | 1327 QuicTime receipt_time() const { return receipt_time_; } |
1332 | 1328 |
1333 // This is the TTL of the packet, assuming ttl_vaild_ is true. | 1329 // This is the TTL of the packet, assuming ttl_vaild_ is true. |
1334 int ttl() const { return ttl_; } | 1330 int ttl() const { return ttl_; } |
1335 | 1331 |
1336 bool potentially_small_mtu() const { return potentially_small_mtu_; } | |
1337 | |
1338 // By default, gtest prints the raw bytes of an object. The bool data | 1332 // By default, gtest prints the raw bytes of an object. The bool data |
1339 // member (in the base class QuicData) causes this object to have padding | 1333 // member (in the base class QuicData) causes this object to have padding |
1340 // bytes, which causes the default gtest object printer to read | 1334 // bytes, which causes the default gtest object printer to read |
1341 // uninitialize memory. So we need to teach gtest how to print this object. | 1335 // uninitialize memory. So we need to teach gtest how to print this object. |
1342 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 1336 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
1343 std::ostream& os, | 1337 std::ostream& os, |
1344 const QuicReceivedPacket& s); | 1338 const QuicReceivedPacket& s); |
1345 | 1339 |
1346 private: | 1340 private: |
1347 const QuicTime receipt_time_; | 1341 const QuicTime receipt_time_; |
1348 int ttl_; | 1342 int ttl_; |
1349 bool potentially_small_mtu_; | |
1350 | 1343 |
1351 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacket); | 1344 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacket); |
1352 }; | 1345 }; |
1353 | 1346 |
1354 // Pure virtual class to listen for packet acknowledgements. | 1347 // Pure virtual class to listen for packet acknowledgements. |
1355 class NET_EXPORT_PRIVATE QuicAckListenerInterface | 1348 class NET_EXPORT_PRIVATE QuicAckListenerInterface |
1356 : public base::RefCounted<QuicAckListenerInterface> { | 1349 : public base::RefCounted<QuicAckListenerInterface> { |
1357 public: | 1350 public: |
1358 QuicAckListenerInterface() {} | 1351 QuicAckListenerInterface() {} |
1359 | 1352 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 : iov(iov), iov_count(iov_count), total_length(total_length) {} | 1524 : iov(iov), iov_count(iov_count), total_length(total_length) {} |
1532 | 1525 |
1533 const struct iovec* iov; | 1526 const struct iovec* iov; |
1534 const int iov_count; | 1527 const int iov_count; |
1535 const size_t total_length; | 1528 const size_t total_length; |
1536 }; | 1529 }; |
1537 | 1530 |
1538 } // namespace net | 1531 } // namespace net |
1539 | 1532 |
1540 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1533 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |