Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: net/quic/quic_protocol.h

Issue 11973021: Teach gtest how to print QuicConsumedData and QuicEncryptedPacket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/quic_protocol.cc » ('j') | net/quic/quic_protocol.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 typedef uint8 QuicFecGroupNumber; 35 typedef uint8 QuicFecGroupNumber;
36 36
37 // A struct for functions which consume data payloads and fins. 37 // A struct for functions which consume data payloads and fins.
38 // The first member of the pair indicates bytes consumed. 38 // The first member of the pair indicates bytes consumed.
39 // The second member of the pair indicates if an incoming fin was consumed. 39 // The second member of the pair indicates if an incoming fin was consumed.
40 struct QuicConsumedData { 40 struct QuicConsumedData {
41 QuicConsumedData(size_t bytes_consumed, bool fin_consumed) 41 QuicConsumedData(size_t bytes_consumed, bool fin_consumed)
42 : bytes_consumed(bytes_consumed), 42 : bytes_consumed(bytes_consumed),
43 fin_consumed(fin_consumed) { 43 fin_consumed(fin_consumed) {
44 } 44 }
45 friend std::ostream& operator<<(
46 std::ostream& os, const QuicConsumedData& s);
47
45 size_t bytes_consumed; 48 size_t bytes_consumed;
46 bool fin_consumed; 49 bool fin_consumed;
wtc 2013/01/17 02:34:58 There are padding bytes after this bool member.
Alexander Potapenko 2013/01/17 08:20:06 It's better to have this in the code comment rathe
wtc 2013/01/17 18:59:35 Done. I verified the bool member was the problem
47 }; 50 };
48 51
49 52
50 // TODO(rch): Consider Quic specific names for these constants. 53 // TODO(rch): Consider Quic specific names for these constants.
51 const size_t kMaxPacketSize = 1200; // Maximum size in bytes of a QUIC packet. 54 const size_t kMaxPacketSize = 1200; // Maximum size in bytes of a QUIC packet.
52 55
53 // Maximum number of open streams per connection. 56 // Maximum number of open streams per connection.
54 const size_t kDefaultMaxStreamsPerConnection = 100; 57 const size_t kDefaultMaxStreamsPerConnection = 100;
55 58
56 // Size in bytes of the packet header common across all packets. 59 // Size in bytes of the packet header common across all packets.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 base::StringPiece AsStringPiece() const { 377 base::StringPiece AsStringPiece() const {
375 return base::StringPiece(data(), length()); 378 return base::StringPiece(data(), length());
376 } 379 }
377 380
378 const char* data() const { return buffer_; } 381 const char* data() const { return buffer_; }
379 size_t length() const { return length_; } 382 size_t length() const { return length_; }
380 383
381 private: 384 private:
382 const char* buffer_; 385 const char* buffer_;
383 size_t length_; 386 size_t length_;
384 bool owns_buffer_; 387 bool owns_buffer_;
wtc 2013/01/17 02:34:58 This class (QuicData) is the base class of QuicEnc
385 388
386 DISALLOW_COPY_AND_ASSIGN(QuicData); 389 DISALLOW_COPY_AND_ASSIGN(QuicData);
387 }; 390 };
388 391
389 class NET_EXPORT_PRIVATE QuicPacket : public QuicData { 392 class NET_EXPORT_PRIVATE QuicPacket : public QuicData {
390 public: 393 public:
391 QuicPacket( 394 QuicPacket(
392 char* buffer, size_t length, bool owns_buffer, QuicPacketFlags flags) 395 char* buffer, size_t length, bool owns_buffer, QuicPacketFlags flags)
393 : QuicData(buffer, length, owns_buffer), 396 : QuicData(buffer, length, owns_buffer),
394 buffer_(buffer), 397 buffer_(buffer),
(...skipping 27 matching lines...) Expand all
422 }; 425 };
423 426
424 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData { 427 class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData {
425 public: 428 public:
426 QuicEncryptedPacket(const char* buffer, size_t length) 429 QuicEncryptedPacket(const char* buffer, size_t length)
427 : QuicData(buffer, length) { } 430 : QuicData(buffer, length) { }
428 431
429 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer) 432 QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer)
430 : QuicData(buffer, length, owns_buffer) { } 433 : QuicData(buffer, length, owns_buffer) { }
431 434
435 friend std::ostream& operator<<(
436 std::ostream& os, const QuicEncryptedPacket& s);
437
432 base::StringPiece AssociatedData() const { 438 base::StringPiece AssociatedData() const {
433 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); 439 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData);
434 } 440 }
435 441
436 private: 442 private:
437 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); 443 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket);
438 }; 444 };
439 445
440 } // namespace net 446 } // namespace net
441 447
442 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 448 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_protocol.cc » ('j') | net/quic/quic_protocol.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698