proxygen
fizz::client::FizzClientContext Class Reference

#include <FizzClientContext.h>

Public Member Functions

 FizzClientContext ()
 
virtual ~FizzClientContext ()=default
 
void setSupportedVersions (std::vector< ProtocolVersion > versions)
 
const auto & getSupportedVersions () const
 
void setSupportedCiphers (std::vector< CipherSuite > ciphers)
 
const auto & getSupportedCiphers () const
 
void setSupportedSigSchemes (std::vector< SignatureScheme > schemes)
 
const auto & getSupportedSigSchemes () const
 
void setSupportedGroups (std::vector< NamedGroup > groups)
 
const auto & getSupportedGroups () const
 
void setDefaultShares (std::vector< NamedGroup > groups)
 
const auto & getDefaultShares () const
 
void setSupportedPskModes (std::vector< PskKeyExchangeMode > modes)
 
const auto & getSupportedPskModes () const
 
void setSupportedAlpns (std::vector< std::string > protocols)
 
const auto & getSupportedAlpns () const
 
void setClientCertificate (std::shared_ptr< SelfCert > cert)
 
const auto & getClientCertificate () const
 
void setPskCache (std::shared_ptr< PskCache > pskCache)
 
folly::Optional< CachedPskgetPsk (const std::string &identity) const
 
void putPsk (const std::string &identity, CachedPsk psk) const
 
void removePsk (const std::string &identity) const
 
void setSendEarlyData (bool sendEarlyData)
 
bool getSendEarlyData () const
 
void setCompatibilityMode (bool enabled)
 
bool getCompatibilityMode () const
 
void setFactory (std::unique_ptr< Factory > factory)
 
const FactorygetFactory () const
 
void setCertDecompressionManager (std::shared_ptr< CertDecompressionManager > mgr)
 
std::vector< CertificateCompressionAlgorithmgetSupportedCertDecompressionAlgorithms () const
 
std::shared_ptr< CertificateDecompressorgetCertDecompressorForAlgorithm (CertificateCompressionAlgorithm algo) const
 

Private Attributes

std::unique_ptr< Factoryfactory_
 
std::vector< ProtocolVersionsupportedVersions_ = {ProtocolVersion::tls_1_3}
 
std::vector< CipherSuitesupportedCiphers_
 
std::vector< SignatureSchemesupportedSigSchemes_
 
std::vector< NamedGroupsupportedGroups_
 
std::vector< NamedGroupdefaultShares_ = {NamedGroup::x25519}
 
std::vector< PskKeyExchangeModesupportedPskModes_
 
std::vector< std::stringsupportedAlpns_
 
bool sendEarlyData_ {false}
 
bool compatMode_ {false}
 
std::shared_ptr< PskCachepskCache_
 
std::shared_ptr< const SelfCertclientCert_
 
std::shared_ptr< CertDecompressionManagercertDecompressionManager_
 

Detailed Description

Definition at line 20 of file FizzClientContext.h.

Constructor & Destructor Documentation

fizz::client::FizzClientContext::FizzClientContext ( )
inline

Definition at line 22 of file FizzClientContext.h.

References ~FizzClientContext().

22 : factory_(std::make_unique<Factory>()) {}
std::unique_ptr< Factory > factory_
virtual fizz::client::FizzClientContext::~FizzClientContext ( )
virtualdefault

Referenced by FizzClientContext().

Member Function Documentation

std::shared_ptr<CertificateDecompressor> fizz::client::FizzClientContext::getCertDecompressorForAlgorithm ( CertificateCompressionAlgorithm  algo) const
inline

Given a compression algorithm, returns the decompressor to decompress certs. If the algorithm isn't found, returns nullptr.

Definition at line 198 of file FizzClientContext.h.

References certDecompressionManager_.

Referenced by fizz::sm::handleCertMsg().

199  {
201  return certDecompressionManager_->getDecompressor(algo);
202  } else {
203  return nullptr;
204  }
205  }
std::shared_ptr< CertDecompressionManager > certDecompressionManager_
const auto& fizz::client::FizzClientContext::getClientCertificate ( ) const
inline

Definition at line 108 of file FizzClientContext.h.

References clientCert_.

Referenced by fizz::sm::getClientCert().

108  {
109  return clientCert_;
110  }
std::shared_ptr< const SelfCert > clientCert_
bool fizz::client::FizzClientContext::getCompatibilityMode ( ) const
inline
const auto& fizz::client::FizzClientContext::getDefaultShares ( ) const
inline

Definition at line 75 of file FizzClientContext.h.

References defaultShares_.

75  {
76  return defaultShares_;
77  }
std::vector< NamedGroup > defaultShares_
const Factory* fizz::client::FizzClientContext::getFactory ( ) const
inline

Definition at line 169 of file FizzClientContext.h.

References factory_.

Referenced by fizz::sm::getHrrKeyExchangers(), fizz::sm::getMaxEarlyDataSize(), fizz::sm::handleCertMsg(), and fizz::sm::negotiatePsk().

169  {
170  return factory_.get();
171  }
std::unique_ptr< Factory > factory_
folly::Optional<CachedPsk> fizz::client::FizzClientContext::getPsk ( const std::string identity) const
inline

Definition at line 119 of file FizzClientContext.h.

References folly::none, and pskCache_.

119  {
120  if (pskCache_) {
121  return pskCache_->getPsk(identity);
122  } else {
123  return folly::none;
124  }
125  }
std::shared_ptr< PskCache > pskCache_
constexpr None none
Definition: Optional.h:87
bool fizz::client::FizzClientContext::getSendEarlyData ( ) const
inline

Definition at line 146 of file FizzClientContext.h.

References sendEarlyData_.

Referenced by fizz::sm::getEarlyDataParams().

146  {
147  return sendEarlyData_;
148  }
const auto& fizz::client::FizzClientContext::getSupportedAlpns ( ) const
inline

Definition at line 97 of file FizzClientContext.h.

References supportedAlpns_.

Referenced by fizz::sm::getEarlyDataParams(), fizz::sm::getHrrKeyExchangers(), and fizz::sm::validateAcceptedEarly().

97  {
98  return supportedAlpns_;
99  }
std::vector< std::string > supportedAlpns_
std::vector<CertificateCompressionAlgorithm> fizz::client::FizzClientContext::getSupportedCertDecompressionAlgorithms ( ) const
inline

Returns a vector representing the compression algorithms the manager has decompressors for.

Definition at line 186 of file FizzClientContext.h.

References certDecompressionManager_.

Referenced by fizz::sm::getHrrKeyExchangers(), and fizz::sm::handleCertMsg().

186  {
188  return certDecompressionManager_->getSupportedAlgorithms();
189  } else {
190  return {};
191  }
192  }
std::shared_ptr< CertDecompressionManager > certDecompressionManager_
const auto& fizz::client::FizzClientContext::getSupportedCiphers ( ) const
inline

Definition at line 43 of file FizzClientContext.h.

References supportedCiphers_.

Referenced by fizz::sm::getHrrKeyExchangers(), fizz::sm::negotiatePsk(), and fizz::sm::validatePsk().

43  {
44  return supportedCiphers_;
45  }
std::vector< CipherSuite > supportedCiphers_
const auto& fizz::client::FizzClientContext::getSupportedGroups ( ) const
inline

Definition at line 65 of file FizzClientContext.h.

References supportedGroups_.

Referenced by fizz::sm::getHrrKeyExchangers().

65  {
66  return supportedGroups_;
67  }
std::vector< NamedGroup > supportedGroups_
const auto& fizz::client::FizzClientContext::getSupportedPskModes ( ) const
inline

Definition at line 86 of file FizzClientContext.h.

References supportedPskModes_.

Referenced by fizz::sm::getHrrKeyExchangers(), and fizz::sm::negotiatePsk().

86  {
87  return supportedPskModes_;
88  }
std::vector< PskKeyExchangeMode > supportedPskModes_
const auto& fizz::client::FizzClientContext::getSupportedSigSchemes ( ) const
inline
const auto& fizz::client::FizzClientContext::getSupportedVersions ( ) const
inline

Definition at line 32 of file FizzClientContext.h.

References supportedVersions_.

Referenced by fizz::sm::getHrrKeyExchangers(), fizz::sm::negotiatePsk(), and fizz::sm::validatePsk().

32  {
33  return supportedVersions_;
34  }
std::vector< ProtocolVersion > supportedVersions_
void fizz::client::FizzClientContext::putPsk ( const std::string identity,
CachedPsk  psk 
) const
inline

Definition at line 127 of file FizzClientContext.h.

References folly::gen::move, and pskCache_.

127  {
128  if (pskCache_) {
129  pskCache_->putPsk(identity, std::move(psk));
130  }
131  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< PskCache > pskCache_
void fizz::client::FizzClientContext::removePsk ( const std::string identity) const
inline

Definition at line 133 of file FizzClientContext.h.

References pskCache_.

133  {
134  if (pskCache_) {
135  pskCache_->removePsk(identity);
136  }
137  }
std::shared_ptr< PskCache > pskCache_
void fizz::client::FizzClientContext::setCertDecompressionManager ( std::shared_ptr< CertDecompressionManager mgr)
inline

Sets the certificate decompression manager for server certs.

Definition at line 176 of file FizzClientContext.h.

References certDecompressionManager_.

177  {
179  }
std::shared_ptr< CertDecompressionManager > certDecompressionManager_
void fizz::client::FizzClientContext::setClientCertificate ( std::shared_ptr< SelfCert cert)
inline

Sets the certificate to use if the server requests client authentication

Definition at line 104 of file FizzClientContext.h.

References clientCert_, and folly::gen::move.

104  {
105  clientCert_ = std::move(cert);
106  }
std::shared_ptr< const SelfCert > clientCert_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void fizz::client::FizzClientContext::setCompatibilityMode ( bool  enabled)
inline

Sets whether we want to use compatibility mode (sending a fake session ID and ChangeCipherSpec).

Definition at line 154 of file FizzClientContext.h.

References compatMode_.

154  {
155  compatMode_ = enabled;
156  }
void fizz::client::FizzClientContext::setDefaultShares ( std::vector< NamedGroup groups)
inline

Set the default key shares to send. Must be a subset of supported groups.

Definition at line 72 of file FizzClientContext.h.

References defaultShares_, and folly::gen::move.

72  {
73  defaultShares_ = std::move(groups);
74  }
std::vector< NamedGroup > defaultShares_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void fizz::client::FizzClientContext::setFactory ( std::unique_ptr< Factory factory)
inline

Set the factory to use. Should generally only be changed for testing.

Definition at line 165 of file FizzClientContext.h.

References factory_, and folly::gen::move.

165  {
166  factory_ = std::move(factory);
167  }
std::unique_ptr< Factory > factory_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void fizz::client::FizzClientContext::setPskCache ( std::shared_ptr< PskCache pskCache)
inline

Set the Psk Cache to use.

Definition at line 115 of file FizzClientContext.h.

References folly::gen::move, and pskCache_.

115  {
116  pskCache_ = std::move(pskCache);
117  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< PskCache > pskCache_
void fizz::client::FizzClientContext::setSendEarlyData ( bool  sendEarlyData)
inline

Sets whether we should attempt to send early data.

Definition at line 142 of file FizzClientContext.h.

References sendEarlyData_.

142  {
143  sendEarlyData_ = sendEarlyData;
144  }
void fizz::client::FizzClientContext::setSupportedAlpns ( std::vector< std::string protocols)
inline

Sets the supported ALPN supported protocols, in preference order.

Definition at line 93 of file FizzClientContext.h.

References folly::gen::move, and supportedAlpns_.

93  {
94  supportedAlpns_ = std::move(protocols);
95  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::vector< std::string > supportedAlpns_
void fizz::client::FizzClientContext::setSupportedCiphers ( std::vector< CipherSuite ciphers)
inline

Set the supported ciphers, in preference order.

Definition at line 39 of file FizzClientContext.h.

References folly::gen::move, and supportedCiphers_.

39  {
40  supportedCiphers_ = std::move(ciphers);
41  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::vector< CipherSuite > supportedCiphers_
void fizz::client::FizzClientContext::setSupportedGroups ( std::vector< NamedGroup groups)
inline

Set the supported named groups, in preference order.

Definition at line 61 of file FizzClientContext.h.

References folly::gen::move, and supportedGroups_.

61  {
62  supportedGroups_ = std::move(groups);
63  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::vector< NamedGroup > supportedGroups_
void fizz::client::FizzClientContext::setSupportedPskModes ( std::vector< PskKeyExchangeMode modes)
inline

Set the supported psk modes, in preference order.

Definition at line 82 of file FizzClientContext.h.

References folly::gen::move, and supportedPskModes_.

82  {
84  }
std::vector< PskKeyExchangeMode > supportedPskModes_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void fizz::client::FizzClientContext::setSupportedSigSchemes ( std::vector< SignatureScheme schemes)
inline

Set the supported signature schemes, in preference order.

Definition at line 50 of file FizzClientContext.h.

References folly::gen::move, and supportedSigSchemes_.

50  {
52  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::vector< SignatureScheme > supportedSigSchemes_
void fizz::client::FizzClientContext::setSupportedVersions ( std::vector< ProtocolVersion versions)
inline

Set the supported protocol versions, in preference order.

Definition at line 28 of file FizzClientContext.h.

References folly::gen::move, and supportedVersions_.

28  {
29  supportedVersions_ = std::move(versions);
30  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::vector< ProtocolVersion > supportedVersions_

Member Data Documentation

std::shared_ptr<CertDecompressionManager> fizz::client::FizzClientContext::certDecompressionManager_
private
std::shared_ptr<const SelfCert> fizz::client::FizzClientContext::clientCert_
private

Definition at line 233 of file FizzClientContext.h.

Referenced by getClientCertificate(), and setClientCertificate().

bool fizz::client::FizzClientContext::compatMode_ {false}
private

Definition at line 230 of file FizzClientContext.h.

Referenced by getCompatibilityMode(), and setCompatibilityMode().

std::vector<NamedGroup> fizz::client::FizzClientContext::defaultShares_ = {NamedGroup::x25519}
private

Definition at line 223 of file FizzClientContext.h.

Referenced by getDefaultShares(), and setDefaultShares().

std::unique_ptr<Factory> fizz::client::FizzClientContext::factory_
private

Definition at line 208 of file FizzClientContext.h.

Referenced by getFactory(), and setFactory().

std::shared_ptr<PskCache> fizz::client::FizzClientContext::pskCache_
private

Definition at line 232 of file FizzClientContext.h.

Referenced by getPsk(), putPsk(), removePsk(), and setPskCache().

bool fizz::client::FizzClientContext::sendEarlyData_ {false}
private

Definition at line 228 of file FizzClientContext.h.

Referenced by getSendEarlyData(), and setSendEarlyData().

std::vector<std::string> fizz::client::FizzClientContext::supportedAlpns_
private

Definition at line 227 of file FizzClientContext.h.

Referenced by getSupportedAlpns(), and setSupportedAlpns().

std::vector<CipherSuite> fizz::client::FizzClientContext::supportedCiphers_
private
std::vector<NamedGroup> fizz::client::FizzClientContext::supportedGroups_
private
Initial value:

Definition at line 221 of file FizzClientContext.h.

Referenced by getSupportedGroups(), and setSupportedGroups().

std::vector<PskKeyExchangeMode> fizz::client::FizzClientContext::supportedPskModes_
private
std::vector<SignatureScheme> fizz::client::FizzClientContext::supportedSigSchemes_
private
std::vector<ProtocolVersion> fizz::client::FizzClientContext::supportedVersions_ = {ProtocolVersion::tls_1_3}
private

Definition at line 210 of file FizzClientContext.h.

Referenced by getSupportedVersions(), and setSupportedVersions().


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