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_CORE_QUIC_DATA_WRITER_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_DATA_WRITER_H_ |
6 #define NET_QUIC_CORE_QUIC_DATA_WRITER_H_ | 6 #define NET_QUIC_CORE_QUIC_DATA_WRITER_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <cstdint> | 9 #include <cstdint> |
10 #include <string> | 10 #include <string> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool WriteUInt64(uint64_t value); | 45 bool WriteUInt64(uint64_t value); |
46 // Write unsigned floating point corresponding to the value. Large values are | 46 // Write unsigned floating point corresponding to the value. Large values are |
47 // clamped to the maximum representable (kUFloat16MaxValue). Values that can | 47 // clamped to the maximum representable (kUFloat16MaxValue). Values that can |
48 // not be represented directly are rounded down. | 48 // not be represented directly are rounded down. |
49 bool WriteUFloat16(uint64_t value); | 49 bool WriteUFloat16(uint64_t value); |
50 bool WriteStringPiece16(QuicStringPiece val); | 50 bool WriteStringPiece16(QuicStringPiece val); |
51 bool WriteBytes(const void* data, size_t data_len); | 51 bool WriteBytes(const void* data, size_t data_len); |
52 bool WriteRepeatedByte(uint8_t byte, size_t count); | 52 bool WriteRepeatedByte(uint8_t byte, size_t count); |
53 // Fills the remaining buffer with null characters. | 53 // Fills the remaining buffer with null characters. |
54 void WritePadding(); | 54 void WritePadding(); |
| 55 // Write padding of |count| bytes. |
| 56 bool WritePaddingBytes(size_t count); |
55 | 57 |
56 // Write connection ID as a 64-bit unsigned integer to the payload. | 58 // Write connection ID as a 64-bit unsigned integer to the payload. |
57 // TODO(fayang): Remove this method and use WriteUInt64() once deprecating | 59 // TODO(fayang): Remove this method and use WriteUInt64() once deprecating |
58 // quic_restart_flag_quic_rw_cid_in_big_endian and QuicDataWriter has a mode | 60 // quic_restart_flag_quic_rw_cid_in_big_endian and QuicDataWriter has a mode |
59 // indicating writing in little/big endian. | 61 // indicating writing in little/big endian. |
60 bool WriteConnectionId(uint64_t connection_id); | 62 bool WriteConnectionId(uint64_t connection_id); |
61 | 63 |
62 // Write tag as a 32-bit unsigned integer to the payload. As tags are already | 64 // Write tag as a 32-bit unsigned integer to the payload. As tags are already |
63 // converted to big endian (e.g., CHLO is 'C','H','L','O') in memory by TAG or | 65 // converted to big endian (e.g., CHLO is 'C','H','L','O') in memory by TAG or |
64 // MakeQuicTag and tags are written in byte order, so tags on the wire are | 66 // MakeQuicTag and tags are written in byte order, so tags on the wire are |
(...skipping 16 matching lines...) Expand all Loading... |
81 // may have different in-memory representation of the same field, the on wire | 83 // may have different in-memory representation of the same field, the on wire |
82 // representation must be consistent. | 84 // representation must be consistent. |
83 Perspective perspective_; | 85 Perspective perspective_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(QuicDataWriter); | 87 DISALLOW_COPY_AND_ASSIGN(QuicDataWriter); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace net | 90 } // namespace net |
89 | 91 |
90 #endif // NET_QUIC_CORE_QUIC_DATA_WRITER_H_ | 92 #endif // NET_QUIC_CORE_QUIC_DATA_WRITER_H_ |
OLD | NEW |