proxygen
fizz::CertDecompressionManager Class Reference

#include <CertDecompressionManager.h>

Public Member Functions

 CertDecompressionManager ()
 
 CertDecompressionManager (std::vector< std::shared_ptr< CertificateDecompressor >> decompressors)
 
void setDecompressors (std::vector< std::shared_ptr< CertificateDecompressor >> decompressors)
 
std::vector< CertificateCompressionAlgorithmgetSupportedAlgorithms () const
 
std::shared_ptr< CertificateDecompressorgetDecompressor (CertificateCompressionAlgorithm algo) const
 

Private Attributes

std::map< CertificateCompressionAlgorithm, std::shared_ptr< CertificateDecompressor > > decompressors_
 
std::vector< CertificateCompressionAlgorithmsupportedAlgos_
 

Detailed Description

Definition at line 18 of file CertDecompressionManager.h.

Constructor & Destructor Documentation

fizz::CertDecompressionManager::CertDecompressionManager ( )

Can be constructed empty with no arguments or initialized with the decompressors provided.

Definition at line 13 of file CertDecompressionManager.cpp.

13 {}
fizz::CertDecompressionManager::CertDecompressionManager ( std::vector< std::shared_ptr< CertificateDecompressor >>  decompressors)
explicit

Definition at line 15 of file CertDecompressionManager.cpp.

References folly::gen::move, and setDecompressors().

16  {
17  setDecompressors(std::move(decompressors));
18 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void setDecompressors(std::vector< std::shared_ptr< CertificateDecompressor >> decompressors)

Member Function Documentation

std::shared_ptr< CertificateDecompressor > fizz::CertDecompressionManager::getDecompressor ( CertificateCompressionAlgorithm  algo) const

Returns the decompressor for a given algorithm. If not found, returns nullptr;

Definition at line 38 of file CertDecompressionManager.cpp.

References decompressors_, and fizz::toString().

39  {
40  try {
41  return decompressors_.at(algo);
42  } catch (const std::out_of_range&) {
43  VLOG(4) << "Requested unknown algorithm: " << toString(algo);
44  return nullptr;
45  }
46 }
folly::StringPiece toString(StateEnum state)
Definition: State.cpp:16
std::map< CertificateCompressionAlgorithm, std::shared_ptr< CertificateDecompressor > > decompressors_
std::vector< CertificateCompressionAlgorithm > fizz::CertDecompressionManager::getSupportedAlgorithms ( ) const

Return supported decompression algorithms.

Definition at line 33 of file CertDecompressionManager.cpp.

References supportedAlgos_.

33  {
34  return supportedAlgos_;
35 }
std::vector< CertificateCompressionAlgorithm > supportedAlgos_
void fizz::CertDecompressionManager::setDecompressors ( std::vector< std::shared_ptr< CertificateDecompressor >>  decompressors)

Explicitly sets the decompressors. Clears the internal storage before using the new list.

Definition at line 20 of file CertDecompressionManager.cpp.

References decompressors_, and supportedAlgos_.

Referenced by CertDecompressionManager().

21  {
22  decompressors_.clear();
23  for (const auto& decompressor : decompressors) {
24  decompressors_[decompressor->getAlgorithm()] = decompressor;
25  }
26  supportedAlgos_.clear();
27  for (const auto& pair : decompressors_) {
28  supportedAlgos_.push_back(pair.first);
29  }
30 }
std::vector< CertificateCompressionAlgorithm > supportedAlgos_
std::map< CertificateCompressionAlgorithm, std::shared_ptr< CertificateDecompressor > > decompressors_
Definition: Traits.h:577

Member Data Documentation

std::map< CertificateCompressionAlgorithm, std::shared_ptr<CertificateDecompressor> > fizz::CertDecompressionManager::decompressors_
private

Definition at line 51 of file CertDecompressionManager.h.

Referenced by getDecompressor(), and setDecompressors().

std::vector<CertificateCompressionAlgorithm> fizz::CertDecompressionManager::supportedAlgos_
private

Definition at line 53 of file CertDecompressionManager.h.

Referenced by getSupportedAlgorithms(), and setDecompressors().


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