proxygen
HPACKDecodeBuffer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <folly/Conv.h>
13 #include <folly/FBString.h>
14 #include <folly/io/Cursor.h>
15 #include <folly/io/IOBuf.h>
18 
19 namespace proxygen {
20 
22  public:
23 
24  explicit HPACKDecodeBuffer(folly::io::Cursor& cursorVal,
25  uint32_t totalBytes,
26  uint32_t maxLiteralSize)
27  : cursor_(cursorVal),
28  totalBytes_(totalBytes),
29  remainingBytes_(totalBytes),
30  maxLiteralSize_(maxLiteralSize) {}
31 
33 
34  void reset(folly::io::Cursor& cursorVal) {
35  reset(cursorVal, folly::to<uint32_t>(cursorVal.totalLength()));
36  }
37 
38  void reset(folly::io::Cursor& cursorVal,
39  uint32_t totalBytes) {
40  cursor_ = cursorVal;
41  totalBytes_ = totalBytes;
42  remainingBytes_ = totalBytes;
43  }
44 
47  }
48 
49  const folly::io::Cursor& cursor() const {
50  return cursor_;
51  }
52 
57  bool empty();
58 
62  uint8_t next();
63 
67  uint8_t peek();
68 
74 
79 
84 
86 
87 private:
92 };
93 
94 }
folly::io::Cursor & cursor_
LogLevel max
Definition: LogLevel.cpp:31
void reset(folly::io::Cursor &cursorVal, uint32_t totalBytes)
uint32_t consumedBytes() const
HPACK::DecodeError decodeLiteral(folly::fbstring &literal)
HPACKDecodeBuffer(folly::io::Cursor &cursorVal, uint32_t totalBytes, uint32_t maxLiteralSize)
HPACK::DecodeError decodeInteger(uint8_t nbit, uint64_t &integer)
const folly::io::Cursor & cursor() const
void reset(folly::io::Cursor &cursorVal)
size_t totalLength() const
Definition: Cursor.h:126