proxygen
proxygen::QPACKCodec Class Reference

#include <QPACKCodec.h>

Inheritance diagram for proxygen::QPACKCodec:
proxygen::HeaderCodec

Public Member Functions

 QPACKCodec ()
 
 ~QPACKCodec () override
 
QPACKEncoder::EncodeResult encode (std::vector< compress::Header > &headers, uint64_t id) noexcept
 
HPACK::DecodeError decodeEncoderStream (std::unique_ptr< folly::IOBuf > buf)
 
void decodeStreaming (uint64_t streamId, std::unique_ptr< folly::IOBuf > block, uint32_t length, HPACK::StreamingCallback *streamingCb) noexcept
 
void setEncoderHeaderTableSize (uint32_t size)
 
void setDecoderHeaderTableMaxSize (uint32_t size)
 
HPACK::DecodeError decodeDecoderStream (std::unique_ptr< folly::IOBuf > buf)
 
void onStreamReset (uint64_t streamId)
 
std::unique_ptr< folly::IOBufencodeTableStateSync ()
 
std::unique_ptr< folly::IOBufencodeHeaderAck (uint64_t streamId)
 
std::unique_ptr< folly::IOBufencodeCancelStream (uint64_t streamId)
 
void describe (std::ostream &os) const
 
void setMaxUncompressed (uint64_t maxUncompressed) override
 
HPACKTableInfo getHPACKTableInfo () const
 
void setHeaderIndexingStrategy (const HeaderIndexingStrategy *indexingStrat)
 
const HeaderIndexingStrategygetHeaderIndexingStrategy () const
 
uint64_t getHolBlockCount () const
 
uint64_t getQueuedBytes () const
 
void setMaxVulnerable (uint32_t maxVulnerable)
 
void setMaxBlocking (uint32_t maxBlocking)
 
- 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

QPACKEncoder encoder_
 
QPACKDecoder 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 QPACKEncoder::EncodeResult &encodeRes)
 

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 36 of file QPACKCodec.h.

Constructor & Destructor Documentation

proxygen::QPACKCodec::QPACKCodec ( )

Definition at line 29 of file QPACKCodec.cpp.

30  : encoder_(true, HPACK::kTableSize),
const uint32_t kTableSize
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
uint64_t maxUncompressed_
Definition: HeaderCodec.h:92
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
proxygen::QPACKCodec::~QPACKCodec ( )
inlineoverride

Definition at line 39 of file QPACKCodec.h.

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

39 {}

Member Function Documentation

HPACK::DecodeError proxygen::QPACKCodec::decodeDecoderStream ( std::unique_ptr< folly::IOBuf buf)
inline

Definition at line 67 of file QPACKCodec.h.

References folly::gen::move.

Referenced by proxygen::compress::QPACKScheme::recvAck().

68  {
70  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
HPACK::DecodeError decodeDecoderStream(std::unique_ptr< folly::IOBuf > buf)
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
HPACK::DecodeError proxygen::QPACKCodec::decodeEncoderStream ( std::unique_ptr< folly::IOBuf buf)
inline

Definition at line 45 of file QPACKCodec.h.

References folly::gen::move, folly::pushmi::__adl::noexcept(), uint32_t, and uint64_t.

Referenced by proxygen::compress::QPACKScheme::decode().

45  {
46  // stats?
48  }
HPACK::DecodeError decodeEncoderStream(std::unique_ptr< folly::IOBuf > buf)
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void proxygen::QPACKCodec::decodeStreaming ( uint64_t  streamId,
std::unique_ptr< folly::IOBuf block,
uint32_t  length,
HPACK::StreamingCallback streamingCb 
)
noexcept

Definition at line 56 of file QPACKCodec.cpp.

References decoder_, proxygen::QPACKDecoder::decodeStreaming(), folly::gen::move, proxygen::HeaderCodec::stats_, and streamID.

Referenced by proxygen::compress::QPACKScheme::decode().

60  {
61  if (streamingCb) {
62  streamingCb->stats = stats_;
63  }
64  decoder_.decodeStreaming(streamID, std::move(block), length, streamingCb);
65 }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void decodeStreaming(uint64_t streamId, std::unique_ptr< folly::IOBuf > block, uint32_t totalBytes, HPACK::StreamingCallback *streamingCb)
uint32_t streamID
Definition: SPDYCodec.cpp:131
void proxygen::QPACKCodec::describe ( std::ostream &  os) const

Definition at line 67 of file QPACKCodec.cpp.

References decoder_, and encoder_.

Referenced by proxygen::operator<<().

67  {
68  stream << "DecoderTable:\n" << decoder_;
69  stream << "EncoderTable:\n" << encoder_;
70 }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
QPACKEncoder::EncodeResult proxygen::QPACKCodec::encode ( std::vector< compress::Header > &  headers,
uint64_t  id 
)
noexcept

Definition at line 47 of file QPACKCodec.cpp.

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

Referenced by proxygen::compress::QPACKScheme::encode().

48  {
49  auto prepared = compress::prepareHeaders(headers);
50  encodedSize_.uncompressed = prepared.second;
51  auto res = encoder_.encode(prepared.first, encodeHeadroom_, streamId);
53  return res;
54 }
HTTPHeaderSize encodedSize_
Definition: HeaderCodec.h:90
EncodeResult encode(const std::vector< HPACKHeader > &headers, uint32_t headroom, uint64_t streamId)
std::pair< vector< HPACKHeader >, uint32_t > prepareHeaders(vector< Header > &headers)
Definition: HPACKCodec.cpp:29
uint32_t encodeHeadroom_
Definition: HeaderCodec.h:91
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
void recordCompressedSize(const QPACKEncoder::EncodeResult &encodeRes)
Definition: QPACKCodec.cpp:33
std::unique_ptr<folly::IOBuf> proxygen::QPACKCodec::encodeCancelStream ( uint64_t  streamId)
inline

Definition at line 86 of file QPACKCodec.h.

86  {
87  return decoder_.encodeCancelStream(streamId);
88  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
std::unique_ptr< folly::IOBuf > encodeCancelStream(uint64_t streamId)
std::unique_ptr<folly::IOBuf> proxygen::QPACKCodec::encodeHeaderAck ( uint64_t  streamId)
inline

Definition at line 82 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::getAck().

82  {
83  return decoder_.encodeHeaderAck(streamId);
84  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
std::unique_ptr< folly::IOBuf > encodeHeaderAck(uint64_t streamId) const
std::unique_ptr<folly::IOBuf> proxygen::QPACKCodec::encodeTableStateSync ( )
inline

Definition at line 78 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::getAck().

78  {
80  }
std::unique_ptr< folly::IOBuf > encodeTableStateSync()
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
const HeaderIndexingStrategy* proxygen::QPACKCodec::getHeaderIndexingStrategy ( ) const
inline

Definition at line 109 of file QPACKCodec.h.

109  {
111  }
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
const HeaderIndexingStrategy * getHeaderIndexingStrategy() const
uint64_t proxygen::QPACKCodec::getHolBlockCount ( ) const
inline

Definition at line 113 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::getHolBlockCount().

113  {
114  return decoder_.getHolBlockCount();
115  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
uint64_t getHolBlockCount() const
Definition: QPACKDecoder.h:46
HPACKTableInfo proxygen::QPACKCodec::getHPACKTableInfo ( ) const
inline

Definition at line 97 of file QPACKCodec.h.

97  {
98  return HPACKTableInfo(encoder_.getTableSize(),
104  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
uint32_t getTableSize() const
Definition: QPACKContext.h:33
uint32_t getBytesStored() const
Definition: QPACKContext.h:37
uint32_t getHeadersStored() const
Definition: QPACKContext.h:41
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
uint64_t proxygen::QPACKCodec::getQueuedBytes ( ) const
inline

Definition at line 117 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::decode(), and proxygen::compress::QPACKScheme::~QPACKScheme().

117  {
118  return decoder_.getQueuedBytes();
119  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
uint64_t getQueuedBytes() const
Definition: QPACKDecoder.h:50
void proxygen::QPACKCodec::onStreamReset ( uint64_t  streamId)
inline

Definition at line 74 of file QPACKCodec.h.

74  {
75  encoder_.onHeaderAck(streamId, true);
76  }
HPACK::DecodeError onHeaderAck(uint64_t streamId, bool all)
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
void proxygen::QPACKCodec::recordCompressedSize ( const QPACKEncoder::EncodeResult encodeRes)
private

Definition at line 33 of file QPACKCodec.cpp.

References wangle::HTTPHeaderSize::compressed, proxygen::QPACKEncoder::EncodeResult::control, proxygen::HeaderCodec::encodedSize_, proxygen::HeaderCodec::QPACK, proxygen::HeaderCodec::Stats::recordEncode(), proxygen::HeaderCodec::stats_, and proxygen::QPACKEncoder::EncodeResult::stream.

Referenced by encode().

34  {
36  if (encodeRes.control) {
37  encodedSize_.compressed += encodeRes.control->computeChainDataLength();
38  }
39  if (encodeRes.stream) {
40  encodedSize_.compressed += encodeRes.stream->computeChainDataLength();
41  }
42  if (stats_) {
44  }
45 }
HTTPHeaderSize encodedSize_
Definition: HeaderCodec.h:90
virtual void recordEncode(Type type, HTTPHeaderSize &size)=0
void proxygen::QPACKCodec::setDecoderHeaderTableMaxSize ( uint32_t  size)
inline

Definition at line 62 of file QPACKCodec.h.

Referenced by main(), and proxygen::compress::QPACKScheme::QPACKScheme().

62  {
64  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
void setHeaderTableMaxSize(uint32_t maxSize)
void proxygen::QPACKCodec::setEncoderHeaderTableSize ( uint32_t  size)
inline

Definition at line 58 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::QPACKScheme().

58  {
60  }
void setHeaderTableSize(uint32_t size)
Definition: QPACKEncoder.h:57
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
void proxygen::QPACKCodec::setHeaderIndexingStrategy ( const HeaderIndexingStrategy indexingStrat)
inline

Definition at line 106 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::QPACKScheme().

106  {
107  encoder_.setHeaderIndexingStrategy(indexingStrat);
108  }
void setHeaderIndexingStrategy(const HeaderIndexingStrategy *indexingStrat)
QPACKEncoder encoder_
Definition: QPACKCodec.h:130
void proxygen::QPACKCodec::setMaxBlocking ( uint32_t  maxBlocking)
inline

Definition at line 125 of file QPACKCodec.h.

Referenced by main(), and proxygen::compress::QPACKScheme::QPACKScheme().

125  {
126  decoder_.setMaxBlocking(maxBlocking);
127  }
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
void setMaxBlocking(uint32_t maxBlocking)
Definition: QPACKDecoder.h:54
void proxygen::QPACKCodec::setMaxUncompressed ( uint64_t  maxUncompressed)
inlineoverridevirtual

Reimplemented from proxygen::HeaderCodec.

Definition at line 92 of file QPACKCodec.h.

92  {
93  HeaderCodec::setMaxUncompressed(maxUncompressed);
94  decoder_.setMaxUncompressed(maxUncompressed);
95  }
void setMaxUncompressed(uint64_t maxUncompressed)
QPACKDecoder decoder_
Definition: QPACKCodec.h:131
virtual void setMaxUncompressed(uint64_t maxUncompressed)
Definition: HeaderCodec.h:73
void proxygen::QPACKCodec::setMaxVulnerable ( uint32_t  maxVulnerable)
inline

Definition at line 121 of file QPACKCodec.h.

Referenced by proxygen::compress::QPACKScheme::QPACKScheme().

121  {
122  encoder_.setMaxVulnerable(maxVulnerable);
123  }
void setMaxVulnerable(uint32_t maxVulnerable)
Definition: QPACKEncoder.h:61
QPACKEncoder encoder_
Definition: QPACKCodec.h:130

Member Data Documentation

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

Definition at line 136 of file QPACKCodec.h.

QPACKDecoder proxygen::QPACKCodec::decoder_
protected

Definition at line 131 of file QPACKCodec.h.

Referenced by decodeStreaming(), and describe().

QPACKEncoder proxygen::QPACKCodec::encoder_
protected

Definition at line 130 of file QPACKCodec.h.

Referenced by describe(), and encode().


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