proxygen
proxygen::HPACKCodec Class Reference

#include <HPACKCodec.h>

Inheritance diagram for proxygen::HPACKCodec:
proxygen::HeaderCodec

Public Member Functions

 HPACKCodec (TransportDirection direction)
 
 ~HPACKCodec () override
 
std::unique_ptr< folly::IOBufencode (std::vector< compress::Header > &headers) noexcept
 
void decodeStreaming (folly::io::Cursor &cursor, uint32_t length, HPACK::StreamingCallback *streamingCb) noexcept
 
void setEncoderHeaderTableSize (uint32_t size)
 
void setDecoderHeaderTableMaxSize (uint32_t size)
 
void describe (std::ostream &os) const
 
void setMaxUncompressed (uint64_t maxUncompressed) override
 
HPACKTableInfo getHPACKTableInfo () const
 
void setHeaderIndexingStrategy (const HeaderIndexingStrategy *indexingStrat)
 
const HeaderIndexingStrategygetHeaderIndexingStrategy () const
 
- Public Member Functions inherited from proxygen::HeaderCodec
 HeaderCodec ()
 
virtual ~HeaderCodec ()
 
const HTTPHeaderSizegetEncodedSize ()
 
void setEncodeHeadroom (uint32_t headroom)
 
uint64_t getMaxUncompressed () const
 
void setStats (Stats *stats)
 

Protected Attributes

HPACKEncoder encoder_
 
HPACKDecoder decoder_
 
- Protected Attributes inherited from proxygen::HeaderCodec
HTTPHeaderSize encodedSize_
 
uint32_t encodeHeadroom_ {0}
 
uint64_t maxUncompressed_ {kMaxUncompressed}
 
Statsstats_ {nullptr}
 

Private Member Functions

void recordCompressedSize (const folly::IOBuf *buf)
 

Private Attributes

std::vector< HPACKHeaderdecodedHeaders_
 

Additional Inherited Members

- Public Types inherited from proxygen::HeaderCodec
enum  Type : uint8_t { Type::GZIP = 0, Type::HPACK = 1, Type::QPACK = 2 }
 
- Static Public Attributes inherited from proxygen::HeaderCodec
static const uint32_t kMaxUncompressed = 128 * 1024
 

Detailed Description

Definition at line 41 of file HPACKCodec.h.

Constructor & Destructor Documentation

proxygen::HPACKCodec::HPACKCodec ( TransportDirection  direction)
explicit

Definition at line 44 of file HPACKCodec.cpp.

45  : encoder_(true, HPACK::kTableSize),
const uint32_t kTableSize
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
uint64_t maxUncompressed_
Definition: HeaderCodec.h:92
HPACKDecoder decoder_
Definition: HPACKCodec.h:87
proxygen::HPACKCodec::~HPACKCodec ( )
inlineoverride

Definition at line 44 of file HPACKCodec.h.

References encode(), folly::pushmi::__adl::noexcept(), and uint32_t.

44 {}

Member Function Documentation

void proxygen::HPACKCodec::decodeStreaming ( folly::io::Cursor cursor,
uint32_t  length,
HPACK::StreamingCallback streamingCb 
)
noexcept

Definition at line 67 of file HPACKCodec.cpp.

References decoder_, proxygen::HPACKDecoder::decodeStreaming(), and proxygen::HeaderCodec::stats_.

Referenced by proxygen::HPACKQueue::decodeBlock(), isLowercase(), and proxygen::HTTP2Codec::parseHeadersDecodeFrames().

70  {
71  streamingCb->stats = stats_;
72  decoder_.decodeStreaming(cursor, length, streamingCb);
73 }
HPACKDecoder decoder_
Definition: HPACKCodec.h:87
void decodeStreaming(folly::io::Cursor &cursor, uint32_t totalBytes, HPACK::StreamingCallback *streamingCb)
void proxygen::HPACKCodec::describe ( std::ostream &  os) const

Definition at line 75 of file HPACKCodec.cpp.

References decoder_, and encoder_.

Referenced by proxygen::operator<<().

75  {
76  stream << "DecoderTable:\n" << decoder_;
77  stream << "EncoderTable:\n" << encoder_;
78 }
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
HPACKDecoder decoder_
Definition: HPACKCodec.h:87
unique_ptr< IOBuf > proxygen::HPACKCodec::encode ( std::vector< compress::Header > &  headers)
noexcept

Definition at line 48 of file HPACKCodec.cpp.

References proxygen::HPACKEncoder::encode(), proxygen::HeaderCodec::encodedSize_, proxygen::HeaderCodec::encodeHeadroom_, encoder_, proxygen::compress::prepareHeaders(), recordCompressedSize(), and wangle::HTTPHeaderSize::uncompressed.

Referenced by proxygen::compress::HPACKScheme::encode(), proxygen::HTTP2Codec::encodeHeaders(), isLowercase(), and TEST_F().

48  {
49  auto prepared = compress::prepareHeaders(headers);
50  encodedSize_.uncompressed = prepared.second;
51  auto buf = encoder_.encode(prepared.first, encodeHeadroom_);
52  recordCompressedSize(buf.get());
53  return buf;
54 }
void recordCompressedSize(const folly::IOBuf *buf)
Definition: HPACKCodec.cpp:56
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
HTTPHeaderSize encodedSize_
Definition: HeaderCodec.h:90
std::pair< vector< HPACKHeader >, uint32_t > prepareHeaders(vector< Header > &headers)
Definition: HPACKCodec.cpp:29
uint32_t encodeHeadroom_
Definition: HeaderCodec.h:91
std::unique_ptr< folly::IOBuf > encode(const std::vector< HPACKHeader > &headers, uint32_t headroom=0)
const HeaderIndexingStrategy* proxygen::HPACKCodec::getHeaderIndexingStrategy ( ) const
inline

Definition at line 81 of file HPACKCodec.h.

Referenced by proxygen::HTTP2Codec::getHeaderIndexingStrategy().

81  {
83  }
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
const HeaderIndexingStrategy * getHeaderIndexingStrategy() const
HPACKTableInfo proxygen::HPACKCodec::getHPACKTableInfo ( ) const
inline

Definition at line 69 of file HPACKCodec.h.

Referenced by proxygen::HTTP2Codec::getHPACKTableInfo().

69  {
70  return HPACKTableInfo(encoder_.getTableSize(),
76  }
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
uint32_t getHeadersStored() const
Definition: HPACKContext.h:60
HPACKDecoder decoder_
Definition: HPACKCodec.h:87
uint32_t getTableSize() const
Definition: HPACKContext.h:52
uint32_t getBytesStored() const
Definition: HPACKContext.h:56
void proxygen::HPACKCodec::recordCompressedSize ( const folly::IOBuf buf)
private
void proxygen::HPACKCodec::setDecoderHeaderTableMaxSize ( uint32_t  size)
inline

Definition at line 58 of file HPACKCodec.h.

Referenced by proxygen::HTTP2Codec::generateSettings(), proxygen::compress::HPACKScheme::HPACKScheme(), and proxygen::HTTP2Codec::HTTP2Codec().

58  {
60  }
HPACKDecoder decoder_
Definition: HPACKCodec.h:87
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
void setHeaderTableMaxSize(uint32_t maxSize)
void proxygen::HPACKCodec::setEncoderHeaderTableSize ( uint32_t  size)
inline

Definition at line 54 of file HPACKCodec.h.

Referenced by proxygen::HTTP2Codec::handleSettings(), and proxygen::compress::HPACKScheme::HPACKScheme().

54  {
56  }
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
void setHeaderTableSize(uint32_t size)
Definition: HPACKEncoder.h:35
void proxygen::HPACKCodec::setHeaderIndexingStrategy ( const HeaderIndexingStrategy indexingStrat)
inline

Definition at line 78 of file HPACKCodec.h.

Referenced by proxygen::compress::HPACKScheme::HPACKScheme(), and proxygen::HTTP2Codec::setHeaderIndexingStrategy().

78  {
79  encoder_.setHeaderIndexingStrategy(indexingStrat);
80  }
HPACKEncoder encoder_
Definition: HPACKCodec.h:86
void setHeaderIndexingStrategy(const HeaderIndexingStrategy *indexingStrat)
void proxygen::HPACKCodec::setMaxUncompressed ( uint64_t  maxUncompressed)
inlineoverridevirtual

Reimplemented from proxygen::HeaderCodec.

Definition at line 64 of file HPACKCodec.h.

Referenced by proxygen::HTTP2Codec::generateSettings(), and proxygen::HTTP2Codec::HTTP2Codec().

64  {
65  HeaderCodec::setMaxUncompressed(maxUncompressed);
66  decoder_.setMaxUncompressed(maxUncompressed);
67  }
void setMaxUncompressed(uint64_t maxUncompressed)
HPACKDecoder decoder_
Definition: HPACKCodec.h:87
virtual void setMaxUncompressed(uint64_t maxUncompressed)
Definition: HeaderCodec.h:73

Member Data Documentation

std::vector<HPACKHeader> proxygen::HPACKCodec::decodedHeaders_
private

Definition at line 92 of file HPACKCodec.h.

HPACKDecoder proxygen::HPACKCodec::decoder_
protected

Definition at line 87 of file HPACKCodec.h.

Referenced by decodeStreaming(), and describe().

HPACKEncoder proxygen::HPACKCodec::encoder_
protected

Definition at line 86 of file HPACKCodec.h.

Referenced by describe(), and encode().


The documentation for this class was generated from the following files: