summaryrefslogtreecommitdiff
path: root/chromium/net/quic/core/quic_data_reader.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 13:57:45 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-19 13:44:40 +0000
commit6ec7b8da05d21a3878bd21c691b41e675d74bb1c (patch)
treeb87f250bc19413750b9bb9cdbf2da20ef5014820 /chromium/net/quic/core/quic_data_reader.h
parentec02ee4181c49b61fce1c8fb99292dbb8139cc90 (diff)
downloadqtwebengine-chromium-6ec7b8da05d21a3878bd21c691b41e675d74bb1c.tar.gz
BASELINE: Update Chromium to 60.0.3112.70
Change-Id: I9911c2280a014d4632f254857876a395d4baed2d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/net/quic/core/quic_data_reader.h')
-rw-r--r--chromium/net/quic/core/quic_data_reader.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/chromium/net/quic/core/quic_data_reader.h b/chromium/net/quic/core/quic_data_reader.h
index 9507ec19bf4..755f2fcc66f 100644
--- a/chromium/net/quic/core/quic_data_reader.h
+++ b/chromium/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.
@@ -118,6 +119,14 @@ class QUIC_EXPORT_PRIVATE QuicDataReader {
// Returns the number of bytes remaining to be read.
size_t BytesRemaining() const;
+ // Returns the next byte that to be read. Must not be called when there are no
+ // bytes to be read.
+ //
+ // 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.
@@ -140,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);
};