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

Side by Side Diff: net/quic/core/quic_data_reader.h

Issue 2561893002: Add QUIC_EXPORT macros (Closed)
Patch Set: More Created 4 years 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_crypto_stream.h ('k') | net/quic/core/quic_data_writer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_READER_H_ 5 #ifndef NET_QUIC_CORE_QUIC_DATA_READER_H_
6 #define NET_QUIC_CORE_QUIC_DATA_READER_H_ 6 #define NET_QUIC_CORE_QUIC_DATA_READER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <cstddef> 11 #include <cstddef>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "net/base/int128.h" 15 #include "net/base/int128.h"
16 #include "net/base/net_export.h" 16 #include "net/quic/platform/api/quic_export.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 // 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
21 // 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
22 // framing. 22 // framing.
23 // 23 //
24 // To use, simply construct a QuicDataReader using the underlying buffer that 24 // To use, simply construct a QuicDataReader using the underlying buffer that
25 // you'd like to read fields from, then call one of the Read*() methods to 25 // you'd like to read fields from, then call one of the Read*() methods to
26 // actually do some reading. 26 // actually do some reading.
27 // 27 //
28 // This class keeps an internal iterator to keep track of what's already been 28 // This class keeps an internal iterator to keep track of what's already been
29 // read and each successive Read*() call automatically increments said iterator 29 // read and each successive Read*() call automatically increments said iterator
30 // on success. On failure, internal state of the QuicDataReader should not be 30 // on success. On failure, internal state of the QuicDataReader should not be
31 // trusted and it is up to the caller to throw away the failed instance and 31 // trusted and it is up to the caller to throw away the failed instance and
32 // handle the error as appropriate. None of the Read*() methods should ever be 32 // handle the error as appropriate. None of the Read*() methods should ever be
33 // called after failure, as they will also fail immediately. 33 // called after failure, as they will also fail immediately.
34 class NET_EXPORT_PRIVATE QuicDataReader { 34 class QUIC_EXPORT_PRIVATE QuicDataReader {
35 public: 35 public:
36 // Caller must provide an underlying buffer to work on. 36 // Caller must provide an underlying buffer to work on.
37 QuicDataReader(const char* data, const size_t len); 37 QuicDataReader(const char* data, const size_t len);
38 38
39 // Empty destructor. 39 // Empty destructor.
40 ~QuicDataReader() {} 40 ~QuicDataReader() {}
41 41
42 // Reads a 16-bit unsigned integer into the given output parameter. 42 // Reads a 16-bit unsigned integer into the given output parameter.
43 // Forwards the internal iterator on success. 43 // Forwards the internal iterator on success.
44 // Returns true on success, false otherwise. 44 // Returns true on success, false otherwise.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // The location of the next read from our data buffer. 120 // The location of the next read from our data buffer.
121 size_t pos_; 121 size_t pos_;
122 122
123 DISALLOW_COPY_AND_ASSIGN(QuicDataReader); 123 DISALLOW_COPY_AND_ASSIGN(QuicDataReader);
124 }; 124 };
125 125
126 } // namespace net 126 } // namespace net
127 127
128 #endif // NET_QUIC_CORE_QUIC_DATA_READER_H_ 128 #endif // NET_QUIC_CORE_QUIC_DATA_READER_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_stream.h ('k') | net/quic/core/quic_data_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698