proxygen
HPACKContext.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 
15 
16 namespace proxygen {
17 
18 class HPACKContext {
19  public:
20  explicit HPACKContext(uint32_t tableSize);
22 
29  uint32_t getIndex(const HPACKHeader& header) const;
30 
36  uint32_t nameIndex(const HPACKHeaderName& headerName) const;
37 
41  bool isStatic(uint32_t index) const;
42 
46  const HPACKHeader& getHeader(uint32_t index);
47 
48  const HeaderTable& getTable() const {
49  return table_;
50  }
51 
53  return table_.capacity();
54  }
55 
57  return table_.bytes();
58  }
59 
61  return table_.size();
62  }
63 
64  void seedHeaderTable(std::vector<HPACKHeader>& headers);
65 
66  void describe(std::ostream& os) const;
67 
68  protected:
70  return StaticHeaderTable::get();
71  }
72 
74  return index - getStaticTable().size();
75  }
77  return index;
78  }
80  return index + getStaticTable().size();
81  }
83  return index;
84  }
85 
87 };
88 
89 std::ostream& operator<<(std::ostream& os, const HPACKContext& context);
90 
91 }
uint32_t globalToStaticIndex(uint32_t index) const
Definition: HPACKContext.h:76
uint32_t capacity() const
Definition: HeaderTable.h:86
std::ostream & operator<<(std::ostream &os, const HeaderTable &table)
void seedHeaderTable(std::vector< HPACKHeader > &headers)
void describe(std::ostream &os) const
context
Definition: CMakeCache.txt:563
uint32_t nameIndex(const HPACKHeaderName &headerName) const
uint32_t bytes() const
Definition: HeaderTable.h:112
uint32_t getHeadersStored() const
Definition: HPACKContext.h:60
uint32_t staticToGlobalIndex(uint32_t index) const
Definition: HPACKContext.h:82
const HPACKHeader & getHeader(uint32_t index)
uint32_t getTableSize() const
Definition: HPACKContext.h:52
uint32_t getIndex(const HPACKHeader &header) const
static const StaticHeaderTable & get()
const StaticHeaderTable & getStaticTable() const
Definition: HPACKContext.h:69
const HeaderTable & getTable() const
Definition: HPACKContext.h:48
bool isStatic(uint32_t index) const
uint32_t getBytesStored() const
Definition: HPACKContext.h:56
uint32_t size() const
Definition: HeaderTable.h:105
HPACKContext(uint32_t tableSize)
uint32_t globalToDynamicIndex(uint32_t index) const
Definition: HPACKContext.h:73
uint32_t dynamicToGlobalIndex(uint32_t index) const
Definition: HPACKContext.h:79