proxygen
|
#include <QPACKEncoder.h>
Classes | |
struct | EncodeResult |
struct | OutstandingBlock |
Public Types | |
using | Buf = std::unique_ptr< folly::IOBuf > |
Private Types | |
using | BlockReferences = std::set< uint32_t > |
Private Member Functions | |
bool | allowVulnerable () const |
bool | shouldIndex (const HPACKHeader &header) const |
void | encodeControl (const HPACKHeader &header) |
std::pair< bool, uint32_t > | maybeDuplicate (uint32_t relativeIndex) |
QPACKEncoder::EncodeResult | encodeQ (const std::vector< HPACKHeader > &headers, uint64_t streamId) |
std::tuple< bool, uint32_t, uint32_t > | getNameIndexQ (const HPACKHeaderName &headerName) |
void | encodeStreamLiteralQ (const HPACKHeader &header, bool isStaticName, uint32_t nameIndex, uint32_t absoluteNameIndex, uint32_t baseIndex, uint32_t *largestReference) |
void | encodeHeaderQ (const HPACKHeader &header, uint32_t baseIndex, uint32_t *largestReference) |
void | encodeInsertQ (const HPACKHeader &header, bool isStaticName, uint32_t nameIndex) |
void | encodeLiteralQ (const HPACKHeader &header, bool isStaticName, bool postBase, uint32_t nameIndex, const HPACK::Instruction &idxInstr) |
void | encodeLiteralQHelper (HPACKEncodeBuffer &buffer, const HPACKHeader &header, bool isStaticName, uint32_t nameIndex, uint8_t staticFlag, const HPACK::Instruction &idxInstr, const HPACK::Instruction &litInstr) |
void | trackReference (uint32_t index, uint32_t *largestReference) |
void | encodeDuplicate (uint32_t index) |
HPACK::DecodeError | decodeHeaderAck (HPACKDecodeBuffer &dbuf, uint8_t prefixLength, bool all) |
Private Attributes | |
HPACKEncodeBuffer | controlBuffer_ |
std::unordered_map< uint64_t, std::list< OutstandingBlock > > | outstanding_ |
OutstandingBlock * | curOutstanding_ {nullptr} |
uint32_t | maxDepends_ {0} |
uint32_t | maxVulnerable_ {HPACK::kDefaultBlocking} |
uint32_t | numVulnerable_ {0} |
folly::IOBufQueue | decoderIngress_ {folly::IOBufQueue::cacheChainLength()} |
Additional Inherited Members | |
Static Public Attributes inherited from proxygen::HPACKEncoderBase | |
static const uint32_t | kBufferGrowth = 4000 |
Protected Member Functions inherited from proxygen::HPACKEncoderBase | |
void | handlePendingContextUpdate (HPACKEncodeBuffer &buf, uint32_t tableCapacity) |
Protected Member Functions inherited from proxygen::QPACKContext | |
const StaticHeaderTable & | getStaticTable () const |
Protected Attributes inherited from proxygen::HPACKEncoderBase | |
const HeaderIndexingStrategy * | indexingStrat_ |
HPACKEncodeBuffer | streamBuffer_ |
bool | pendingContextUpdate_ {false} |
Protected Attributes inherited from proxygen::QPACKContext | |
QPACKHeaderTable | table_ |
Definition at line 25 of file QPACKEncoder.h.
|
private |
Definition at line 116 of file QPACKEncoder.h.
using proxygen::QPACKEncoder::Buf = std::unique_ptr<folly::IOBuf> |
Encode the given headers.
Definition at line 35 of file QPACKEncoder.h.
|
explicit |
Definition at line 17 of file QPACKEncoder.cpp.
References proxygen::HeaderIndexingStrategy::getDefaultInstance(), and proxygen::HPACKEncoderBase::setHeaderIndexingStrategy().
|
inlineprivate |
Definition at line 66 of file QPACKEncoder.h.
References folly::gen::all(), buffer(), decodeHeaderAck(), encodeControl(), encodeDuplicate(), encodeHeaderQ(), encodeInsertQ(), encodeLiteralQ(), encodeLiteralQHelper(), encodeQ(), encodeStreamLiteralQ(), getNameIndexQ(), maxVulnerable_, maybeDuplicate(), numVulnerable_, shouldIndex(), trackReference(), uint32_t, uint64_t, and uint8_t.
Referenced by encodeHeaderQ(), encodeQ(), encodeStreamLiteralQ(), getNameIndexQ(), and maybeDuplicate().
HPACK::DecodeError proxygen::QPACKEncoder::decodeDecoderStream | ( | std::unique_ptr< folly::IOBuf > | buf | ) |
Definition at line 277 of file QPACKEncoder.cpp.
References folly::IOBufQueue::append(), proxygen::HPACK::BUFFER_UNDERFLOW, folly::IOBufQueue::chainLength(), decodeHeaderAck(), decoderIngress_, proxygen::ERROR, folly::IOBufQueue::front(), folly::gen::move, proxygen::HPACK::NONE, onTableStateSync(), proxygen::HPACK::Q_CANCEL_STREAM, proxygen::HPACK::Q_HEADER_ACK, proxygen::HPACK::Q_TABLE_STATE_SYNC, folly::IOBufQueue::trimStart(), uint32_t, and uint64_t.
Referenced by proxygen::hpack::encodeDecode(), and TEST().
|
private |
Definition at line 310 of file QPACKEncoder.cpp.
References proxygen::HPACK::BUFFER_UNDERFLOW, proxygen::HPACKDecodeBuffer::decodeInteger(), proxygen::ERROR, proxygen::HPACK::NONE, onHeaderAck(), and uint64_t.
Referenced by allowVulnerable(), and decodeDecoderStream().
QPACKEncoder::EncodeResult proxygen::QPACKEncoder::encode | ( | const std::vector< HPACKHeader > & | headers, |
uint32_t | headroom, | ||
uint64_t | streamId | ||
) |
Definition at line 27 of file QPACKEncoder.cpp.
References proxygen::HPACKEncodeBuffer::addHeadroom(), proxygen::HeaderTable::capacity(), controlBuffer_, encodeQ(), proxygen::HPACKEncoderBase::handlePendingContextUpdate(), proxygen::HPACKEncoderBase::streamBuffer_, and proxygen::QPACKContext::table_.
Referenced by proxygen::QPACKCodec::encode(), proxygen::hpack::encodeDecode(), and TEST().
|
private |
Referenced by allowVulnerable().
|
private |
Definition at line 224 of file QPACKEncoder.cpp.
References controlBuffer_, proxygen::HPACKEncodeBuffer::encodeInteger(), and proxygen::HPACK::Q_DUPLICATE.
Referenced by allowVulnerable(), and maybeDuplicate().
|
private |
Definition at line 76 of file QPACKEncoder.cpp.
References proxygen::QPACKHeaderTable::absoluteToRelative(), proxygen::QPACKHeaderTable::add(), allowVulnerable(), proxygen::QPACKHeaderTable::canIndex(), proxygen::HPACKHeader::copy(), encodeInsertQ(), proxygen::HPACKEncodeBuffer::encodeInteger(), encodeStreamLiteralQ(), proxygen::QPACKHeaderTable::getBaseIndex(), proxygen::HeaderTable::getIndex(), proxygen::QPACKHeaderTable::getIndex(), getNameIndexQ(), proxygen::QPACKContext::getStaticTable(), proxygen::QPACKHeaderTable::isValid(), maybeDuplicate(), proxygen::HPACKHeader::name, proxygen::HPACK::Q_INDEXED, proxygen::HPACK::Q_INDEXED_POST, proxygen::HPACK::Q_INDEXED_STATIC, shouldIndex(), proxygen::HPACKEncoderBase::streamBuffer_, proxygen::QPACKContext::table_, trackReference(), uint32_t, and proxygen::QPACKHeaderTable::UNACKED.
Referenced by allowVulnerable(), and encodeQ().
|
private |
Definition at line 229 of file QPACKEncoder.cpp.
References controlBuffer_, encodeLiteralQHelper(), proxygen::HPACK::Q_INSERT_NAME_REF, proxygen::HPACK::Q_INSERT_NAME_REF_STATIC, and proxygen::HPACK::Q_INSERT_NO_NAME_REF.
Referenced by allowVulnerable(), and encodeHeaderQ().
|
private |
Definition at line 238 of file QPACKEncoder.cpp.
References encodeLiteralQHelper(), proxygen::HPACK::Q_LITERAL, proxygen::HPACK::Q_LITERAL_STATIC, and proxygen::HPACKEncoderBase::streamBuffer_.
Referenced by allowVulnerable(), and encodeStreamLiteralQ().
|
private |
Definition at line 250 of file QPACKEncoder.cpp.
References proxygen::HPACK::Instruction::code, proxygen::HPACKEncodeBuffer::encodeInteger(), proxygen::HPACKEncodeBuffer::encodeLiteral(), proxygen::HPACKHeaderName::get(), proxygen::HPACKHeader::name, proxygen::HPACK::Instruction::prefixLength, uint8_t, proxygen::QPACKHeaderTable::UNACKED, and proxygen::HPACKHeader::value.
Referenced by allowVulnerable(), encodeInsertQ(), and encodeLiteralQ().
|
private |
Definition at line 38 of file QPACKEncoder.cpp.
References allowVulnerable(), controlBuffer_, curOutstanding_, encodeHeaderQ(), proxygen::HPACKEncodeBuffer::encodeInteger(), proxygen::QPACKHeaderTable::getBaseIndex(), folly::gen::move, numVulnerable_, outstanding_, proxygen::HPACK::Q_DELTA_BASE, proxygen::HPACK::Q_DELTA_BASE_NEG, proxygen::HPACK::Q_DELTA_BASE_POS, proxygen::HPACKEncodeBuffer::release(), proxygen::HPACKEncoderBase::streamBuffer_, proxygen::QPACKContext::table_, uint32_t, and proxygen::QPACKEncoder::OutstandingBlock::vulnerable.
Referenced by allowVulnerable(), and encode().
|
private |
Definition at line 184 of file QPACKEncoder.cpp.
References allowVulnerable(), encodeLiteralQ(), proxygen::HPACK::Q_LITERAL_NAME_REF, proxygen::HPACK::Q_LITERAL_NAME_REF_POST, and trackReference().
Referenced by allowVulnerable(), and encodeHeaderQ().
|
private |
Definition at line 161 of file QPACKEncoder.cpp.
References proxygen::QPACKHeaderTable::absoluteToRelative(), allowVulnerable(), proxygen::QPACKContext::getStaticTable(), maybeDuplicate(), proxygen::HeaderTable::nameIndex(), proxygen::QPACKHeaderTable::nameIndex(), proxygen::QPACKContext::table_, and uint32_t.
Referenced by allowVulnerable(), and encodeHeaderQ().
|
private |
Definition at line 151 of file QPACKEncoder.cpp.
References allowVulnerable(), encodeDuplicate(), proxygen::QPACKHeaderTable::maybeDuplicate(), and proxygen::QPACKContext::table_.
Referenced by allowVulnerable(), encodeHeaderQ(), and getNameIndexQ().
HPACK::DecodeError proxygen::QPACKEncoder::onHeaderAck | ( | uint64_t | streamId, |
bool | all | ||
) |
Definition at line 330 of file QPACKEncoder.cpp.
References folly::gen::all(), proxygen::ERROR, i, proxygen::HPACK::INVALID_ACK, folly::gen::move, proxygen::HPACK::NONE, numVulnerable_, outstanding_, proxygen::QPACKHeaderTable::setMaxAcked(), proxygen::QPACKHeaderTable::subRef(), and proxygen::QPACKContext::table_.
Referenced by decodeHeaderAck(), and TEST().
HPACK::DecodeError proxygen::QPACKEncoder::onTableStateSync | ( | uint32_t | inserts | ) |
Definition at line 323 of file QPACKEncoder.cpp.
References proxygen::HPACK::INVALID_ACK, proxygen::HPACK::NONE, proxygen::QPACKHeaderTable::onTableStateSync(), and proxygen::QPACKContext::table_.
Referenced by decodeDecoderStream(), and TEST().
|
inline |
Definition at line 57 of file QPACKEncoder.h.
References proxygen::HPACKEncoderBase::setHeaderTableSize(), and proxygen::QPACKContext::table_.
Referenced by TEST().
|
inline |
|
private |
Definition at line 146 of file QPACKEncoder.cpp.
References proxygen::HPACKHeader::bytes(), proxygen::HeaderTable::capacity(), proxygen::HeaderIndexingStrategy::indexHeader(), proxygen::HPACKEncoderBase::indexingStrat_, and proxygen::QPACKContext::table_.
Referenced by allowVulnerable(), and encodeHeaderQ().
Definition at line 207 of file QPACKEncoder.cpp.
References proxygen::QPACKHeaderTable::addRef(), curOutstanding_, proxygen::QPACKHeaderTable::isVulnerable(), proxygen::QPACKEncoder::OutstandingBlock::references, proxygen::QPACKContext::table_, and proxygen::QPACKEncoder::OutstandingBlock::vulnerable.
Referenced by allowVulnerable(), encodeHeaderQ(), and encodeStreamLiteralQ().
|
private |
Definition at line 115 of file QPACKEncoder.h.
Referenced by encode(), encodeDuplicate(), encodeInsertQ(), and encodeQ().
|
private |
Definition at line 123 of file QPACKEncoder.h.
Referenced by encodeQ(), and trackReference().
|
private |
Definition at line 127 of file QPACKEncoder.h.
Referenced by decodeDecoderStream().
|
private |
Definition at line 124 of file QPACKEncoder.h.
|
private |
Definition at line 125 of file QPACKEncoder.h.
Referenced by allowVulnerable(), and setMaxVulnerable().
|
private |
Definition at line 126 of file QPACKEncoder.h.
Referenced by allowVulnerable(), encodeQ(), and onHeaderAck().
|
private |
Definition at line 122 of file QPACKEncoder.h.
Referenced by encodeQ(), and onHeaderAck().