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

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

Issue 2850573002: Landing Recent QUIC changes until 3:35 PM, Apr 26, 2017 UTC-4 (Closed)
Patch Set: remove reinterpret_cast 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
Index: net/quic/core/quic_data_writer.h
diff --git a/net/quic/core/quic_data_writer.h b/net/quic/core/quic_data_writer.h
index ca4b4a23cbcfd48874afa6212f7d2d94921d99c4..8c0f400da79ab9fc715937c8ad19343526dcf46a 100644
--- a/net/quic/core/quic_data_writer.h
+++ b/net/quic/core/quic_data_writer.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "net/base/int128.h"
#include "net/quic/core/quic_packets.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"
@@ -25,7 +26,10 @@ namespace net {
class QUIC_EXPORT_PRIVATE QuicDataWriter {
public:
// Creates a QuicDataWriter where |buffer| is not owned.
- QuicDataWriter(size_t size, char* buffer, Perspective perspective);
+ QuicDataWriter(size_t size,
+ char* buffer,
+ Perspective perspective,
+ Endianness endianness);
~QuicDataWriter();
@@ -36,13 +40,18 @@ class QUIC_EXPORT_PRIVATE QuicDataWriter {
char* data();
// Methods for adding to the payload. These values are appended to the end
- // of the QuicDataWriter payload. Note - binary integers are written in
- // host byte order (little endian) not network byte order (big endian).
+ // of the QuicDataWriter payload.
+
+ // Writes 8/16/32/64-bit unsigned integers.
bool WriteUInt8(uint8_t value);
bool WriteUInt16(uint16_t value);
bool WriteUInt32(uint32_t value);
- bool WriteUInt48(uint64_t value);
bool WriteUInt64(uint64_t value);
+
+ // Writes least significant |num_bytes| of a 64-bit unsigned integer in the
+ // correct byte order.
+ bool WriteBytesToUInt64(size_t num_bytes, uint64_t value);
+
// Write unsigned floating point corresponding to the value. Large values are
// clamped to the maximum representable (kUFloat16MaxValue). Values that can
// not be represented directly are rounded down.
@@ -84,6 +93,9 @@ class QUIC_EXPORT_PRIVATE QuicDataWriter {
// representation must be consistent.
Perspective perspective_;
+ // The endianness to write integers and floating numbers.
+ Endianness endianness_;
+
DISALLOW_COPY_AND_ASSIGN(QuicDataWriter);
};

Powered by Google App Engine
This is Rietveld 408576698