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

Unified Diff: net/quic/core/quic_data_reader.h

Issue 2850573002: Landing Recent QUIC changes until 3:35 PM, Apr 26, 2017 UTC-4 (Closed)
Patch Set: Remove Disconnect from ~QuicTestClient Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_data_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_data_reader.h
diff --git a/net/quic/core/quic_data_reader.h b/net/quic/core/quic_data_reader.h
index ffce87f5b6d1932f0734a6a141eeb34875582ddc..755f2fcc66fa5c4b25cfc3bf2510b6572589a823 100644
--- a/net/quic/core/quic_data_reader.h
+++ b/net/quic/core/quic_data_reader.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "net/base/int128.h"
#include "net/quic/core/quic_types.h"
+#include "net/quic/platform/api/quic_endian.h"
#include "net/quic/platform/api/quic_export.h"
#include "net/quic/platform/api/quic_string_piece.h"
@@ -33,26 +34,26 @@ namespace net {
class QUIC_EXPORT_PRIVATE QuicDataReader {
public:
// Caller must provide an underlying buffer to work on.
- QuicDataReader(const char* data, const size_t len, Perspective perspective);
+ QuicDataReader(const char* data,
+ const size_t len,
+ Perspective perspective,
+ Endianness endianness);
// Empty destructor.
~QuicDataReader() {}
- // Reads a 16-bit unsigned integer into the given output parameter.
- // Forwards the internal iterator on success.
- // Returns true on success, false otherwise.
+ // Reads an 8/16/32/64-bit unsigned integer into the given output
+ // parameter. Forwards the internal iterator on success. Returns true on
+ // success, false otherwise.
+ bool ReadUInt8(uint8_t* result);
bool ReadUInt16(uint16_t* result);
-
- // Reads a 32-bit unsigned integer into the given output parameter.
- // Forwards the internal iterator on success.
- // Returns true on success, false otherwise.
bool ReadUInt32(uint32_t* result);
-
- // Reads a 64-bit unsigned integer into the given output parameter.
- // Forwards the internal iterator on success.
- // Returns true on success, false otherwise.
bool ReadUInt64(uint64_t* result);
+ // Reads |num_bytes| bytes in the correct byte order into least significant
+ // bytes of |result|.
+ bool ReadBytesToUInt64(size_t num_bytes, uint64_t* result);
+
// Reads a 16-bit unsigned float into the given output parameter.
// Forwards the internal iterator on success.
// Returns true on success, false otherwise.
@@ -124,6 +125,8 @@ class QUIC_EXPORT_PRIVATE QuicDataReader {
// DOES NOT forward the internal iterator.
uint8_t PeekByte() const;
+ void set_endianness(Endianness endianness) { endianness_ = endianness; }
+
private:
// Returns true if the underlying buffer has enough room to read the given
// amount of bytes.
@@ -146,6 +149,9 @@ class QUIC_EXPORT_PRIVATE QuicDataReader {
// representation must be consistent.
Perspective perspective_;
+ // The endianness to read integers and floating numbers.
+ Endianness endianness_;
+
DISALLOW_COPY_AND_ASSIGN(QuicDataReader);
};
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_data_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698