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_QUIC_DATA_READER_H_ | 5 #ifndef NET_QUIC_QUIC_DATA_READER_H_ |
6 #define NET_QUIC_QUIC_DATA_READER_H_ | 6 #define NET_QUIC_QUIC_DATA_READER_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <cstddef> | 11 #include <cstddef> |
9 | 12 |
10 #include "base/basictypes.h" | 13 #include "base/macros.h" |
11 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
12 #include "net/base/int128.h" | 15 #include "net/base/int128.h" |
13 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
14 | 17 |
15 namespace net { | 18 namespace net { |
16 | 19 |
17 // Used for reading QUIC data. Though there isn't really anything terribly | 20 // Used for reading QUIC data. Though there isn't really anything terribly |
18 // QUIC-specific here, it's a helper class that's useful when doing QUIC | 21 // QUIC-specific here, it's a helper class that's useful when doing QUIC |
19 // framing. | 22 // framing. |
20 // | 23 // |
(...skipping 11 matching lines...) Expand all Loading... |
32 public: | 35 public: |
33 // Caller must provide an underlying buffer to work on. | 36 // Caller must provide an underlying buffer to work on. |
34 QuicDataReader(const char* data, const size_t len); | 37 QuicDataReader(const char* data, const size_t len); |
35 | 38 |
36 // Empty destructor. | 39 // Empty destructor. |
37 ~QuicDataReader() {} | 40 ~QuicDataReader() {} |
38 | 41 |
39 // Reads a 16-bit unsigned integer into the given output parameter. | 42 // Reads a 16-bit unsigned integer into the given output parameter. |
40 // Forwards the internal iterator on success. | 43 // Forwards the internal iterator on success. |
41 // Returns true on success, false otherwise. | 44 // Returns true on success, false otherwise. |
42 bool ReadUInt16(uint16* result); | 45 bool ReadUInt16(uint16_t* result); |
43 | 46 |
44 // Reads a 32-bit unsigned integer into the given output parameter. | 47 // Reads a 32-bit unsigned integer into the given output parameter. |
45 // Forwards the internal iterator on success. | 48 // Forwards the internal iterator on success. |
46 // Returns true on success, false otherwise. | 49 // Returns true on success, false otherwise. |
47 bool ReadUInt32(uint32* result); | 50 bool ReadUInt32(uint32_t* result); |
48 | 51 |
49 // Reads a 64-bit unsigned integer into the given output parameter. | 52 // Reads a 64-bit unsigned integer into the given output parameter. |
50 // Forwards the internal iterator on success. | 53 // Forwards the internal iterator on success. |
51 // Returns true on success, false otherwise. | 54 // Returns true on success, false otherwise. |
52 bool ReadUInt64(uint64* result); | 55 bool ReadUInt64(uint64_t* result); |
53 | 56 |
54 // Reads a 16-bit unsigned float into the given output parameter. | 57 // Reads a 16-bit unsigned float into the given output parameter. |
55 // Forwards the internal iterator on success. | 58 // Forwards the internal iterator on success. |
56 // Returns true on success, false otherwise. | 59 // Returns true on success, false otherwise. |
57 bool ReadUFloat16(uint64* result); | 60 bool ReadUFloat16(uint64_t* result); |
58 | 61 |
59 // Reads a string prefixed with 16-bit length into the given output parameter. | 62 // Reads a string prefixed with 16-bit length into the given output parameter. |
60 // | 63 // |
61 // NOTE: Does not copy but rather references strings in the underlying buffer. | 64 // NOTE: Does not copy but rather references strings in the underlying buffer. |
62 // This should be kept in mind when handling memory management! | 65 // This should be kept in mind when handling memory management! |
63 // | 66 // |
64 // Forwards the internal iterator on success. | 67 // Forwards the internal iterator on success. |
65 // Returns true on success, false otherwise. | 68 // Returns true on success, false otherwise. |
66 bool ReadStringPiece16(base::StringPiece* result); | 69 bool ReadStringPiece16(base::StringPiece* result); |
67 | 70 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 119 |
117 // The location of the next read from our data buffer. | 120 // The location of the next read from our data buffer. |
118 size_t pos_; | 121 size_t pos_; |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(QuicDataReader); | 123 DISALLOW_COPY_AND_ASSIGN(QuicDataReader); |
121 }; | 124 }; |
122 | 125 |
123 } // namespace net | 126 } // namespace net |
124 | 127 |
125 #endif // NET_QUIC_QUIC_DATA_READER_H_ | 128 #endif // NET_QUIC_QUIC_DATA_READER_H_ |
OLD | NEW |