proxygen
QPACKContext.cpp
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  */
11 
12 namespace proxygen {
13 
14 QPACKContext::QPACKContext(uint32_t tableSize, bool trackReferences) :
15  table_(tableSize, trackReferences) {
16 }
17 
18 const HPACKHeader& QPACKContext::getHeader(bool isStatic,
19  uint32_t index,
20  uint32_t base,
21  bool aboveBase) {
22  if (isStatic) {
23  return getStaticTable().getHeader(index);
24  }
25  if (aboveBase) {
26  base += index;
27  index = 1;
28  }
29  return table_.getHeader(index, base);
30 }
31 
33  std::vector<HPACKHeader>& headers) {
34  for (auto& header: headers) {
35  table_.add(std::move(header));
36  }
37 }
38 
39 void QPACKContext::describe(std::ostream& os) const {
40  os << table_;
41 }
42 
43 std::ostream& operator<<(std::ostream& os, const QPACKContext& context) {
44  context.describe(os);
45  return os;
46 }
47 
48 }
QPACKHeaderTable table_
Definition: QPACKContext.h:54
std::ostream & operator<<(std::ostream &os, const HeaderTable &table)
context
Definition: CMakeCache.txt:563
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
const HPACKHeader & getHeader(uint32_t index) const
Definition: HeaderTable.cpp:93
QPACKContext(uint32_t tableSize, bool trackReferences)
bool add(HPACKHeader header) override
const HPACKHeader & getHeader(bool isStatic, uint32_t index, uint32_t base, bool aboveBase)
void seedHeaderTable(std::vector< HPACKHeader > &headers)
const StaticHeaderTable & getStaticTable() const
Definition: QPACKContext.h:50
const HPACKHeader & getHeader(uint32_t index, uint32_t base=0) const
void describe(std::ostream &os) const