proxygen
fizz::server::FizzServer< ActionMoveVisitor, SM > Class Template Reference

#include <FizzServer.h>

Inheritance diagram for fizz::server::FizzServer< ActionMoveVisitor, SM >:
fizz::FizzBase< Derived, ActionMoveVisitor, StateMachine >

Public Member Functions

void accept (folly::Executor *executor, std::shared_ptr< const FizzServerContext > context, std::shared_ptr< ServerExtensions > extensions=nullptr)
 
void newTransportData ()
 
Buf getEarlyEkm (folly::StringPiece label, const Buf &context, uint16_t length) const
 
- Public Member Functions inherited from fizz::FizzBase< Derived, ActionMoveVisitor, StateMachine >
 FizzBase (const typename StateMachine::StateType &state, folly::IOBufQueue &transportReadBuf, ActionMoveVisitor &visitor, folly::DelayedDestructionBase *owner)
 
void writeNewSessionTicket (WriteNewSessionTicket writeNewSessionTicket)
 
void appWrite (AppWrite appWrite)
 
void earlyAppWrite (EarlyAppWrite appWrite)
 
void appClose ()
 
void waitForData ()
 
void newTransportData ()
 
void moveToErrorState (const folly::AsyncSocketException &ex)
 
bool inErrorState () const
 
bool actionProcessing () const
 
Buf getEkm (folly::StringPiece label, const Buf &context, uint16_t length) const
 

Private Member Functions

void startActions (AsyncActions actions)
 

Private Attributes

bool checkV2Hello_ {false}
 

Friends

class FizzBase< FizzServer< ActionMoveVisitor, SM >, ActionMoveVisitor, SM >
 

Additional Inherited Members

- Protected Member Functions inherited from fizz::FizzBase< Derived, ActionMoveVisitor, StateMachine >
void processActions (typename StateMachine::CompletedActions actions)
 
void addProcessingActions (typename StateMachine::ProcessingActions actions)
 
- Protected Attributes inherited from fizz::FizzBase< Derived, ActionMoveVisitor, StateMachine >
StateMachine machine_
 
const StateMachine::StateType & state_
 
folly::IOBufQueuetransportReadBuf_
 

Detailed Description

template<typename ActionMoveVisitor, typename SM = ServerStateMachine>
class fizz::server::FizzServer< ActionMoveVisitor, SM >

Definition at line 21 of file FizzServer.h.

Member Function Documentation

template<typename ActionMoveVisitor , typename SM >
void fizz::server::FizzServer< ActionMoveVisitor, SM >::accept ( folly::Executor executor,
std::shared_ptr< const FizzServerContext context,
std::shared_ptr< ServerExtensions extensions = nullptr 
)

Definition at line 13 of file FizzServer-inl.h.

References folly::gen::move.

16  {
17  checkV2Hello_ = context->getVersionFallbackEnabled();
18  this->addProcessingActions(this->machine_.processAccept(
19  this->state_, executor, std::move(context), std::move(extensions)));
20 }
context
Definition: CMakeCache.txt:563
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void addProcessingActions(typename StateMachine::ProcessingActions actions)
Definition: FizzBase-inl.h:102
StateMachine machine_
Definition: FizzBase.h:101
template<typename ActionMoveVisitor , typename SM >
Buf fizz::server::FizzServer< ActionMoveVisitor, SM >::getEarlyEkm ( folly::StringPiece  label,
const Buf context,
uint16_t  length 
) const

Returns an exported key material derived from the early secret of the TLS connection. Throws if the early secret is not available.

Definition at line 46 of file FizzServer-inl.h.

References fizz::Exporter::getEkm(), and fizz::test::label.

49  {
50  if (!this->state_.earlyExporterMasterSecret()) {
51  throw std::runtime_error("early ekm not available");
52  }
53  return Exporter::getEkm(
54  *this->state_.cipher(),
55  (*this->state_.earlyExporterMasterSecret())->coalesce(),
56  label,
57  context ? context->clone() : nullptr,
58  length);
59 }
context
Definition: CMakeCache.txt:563
const StateMachine::StateType & state_
Definition: FizzBase.h:102
static Buf getEkm(CipherSuite cipher, folly::ByteRange exporterMaster, folly::StringPiece label, Buf context, uint16_t length)
Definition: Exporter.cpp:13
StringPiece label
template<typename ActionMoveVisitor , typename SM >
void fizz::server::FizzServer< ActionMoveVisitor, SM >::newTransportData ( )

Definition at line 23 of file FizzServer-inl.h.

References fizz::server::detail::actions(), fizz::server::AttemptVersionFallback::clientHello, fizz::server::Error, fizz::server::looksLikeV2ClientHello(), folly::gen::move, and fizz::server::State::state().

23  {
24  // If the first data we receive looks like an SSLv2 Client Hello we trigger
25  // fallback immediately. This uses the same check as OpenSSL, and OpenSSL
26  // does not allow extensions in an SSLv2 Client Hello, so this should not
27  // add additional downgrade concerns.
28  if (checkV2Hello_) {
29  if (!this->actionProcessing() &&
31  VLOG(3) << "Attempting fallback due to V2 ClientHello";
32  AttemptVersionFallback fallback;
33  fallback.clientHello = this->transportReadBuf_.move();
35  [](State& newState) { newState.state() = StateEnum::Error; },
36  std::move(fallback)));
37  }
38  checkV2Hello_ = false;
39  }
40 
41  FizzBase<FizzServer<ActionMoveVisitor, SM>, ActionMoveVisitor, SM>::
43 }
Actions actions(Args &&...act)
Definition: Actions.h:57
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
bool looksLikeV2ClientHello(const folly::IOBufQueue &queue)
Definition: FizzServer.cpp:14
std::unique_ptr< folly::IOBuf > move()
Definition: IOBufQueue.h:459
State
See Core for details.
Definition: Core.h:43
folly::IOBufQueue & transportReadBuf_
Definition: FizzBase.h:103
void addProcessingActions(typename StateMachine::ProcessingActions actions)
Definition: FizzBase-inl.h:102
bool actionProcessing() const
Definition: FizzBase-inl.h:81
template<typename ActionMoveVisitor , typename SM >
void fizz::server::FizzServer< ActionMoveVisitor, SM >::startActions ( AsyncActions  actions)
private

Definition at line 62 of file FizzServer-inl.h.

References folly::gen::move, fizz::FizzBase< Derived, ActionMoveVisitor, StateMachine >::processActions(), and folly::variant_match().

62  {
64  actions,
65  [this](folly::Future<Actions>& futureActions) {
66  std::move(futureActions)
67  .then(
69  static_cast<FizzBase<
70  FizzServer<ActionMoveVisitor, SM>,
71  ActionMoveVisitor,
72  SM>*>(this));
73  },
74  [this](Actions& immediateActions) {
75  this->processActions(std::move(immediateActions));
76  });
77 }
FizzBase(const typename StateMachine::StateType &state, folly::IOBufQueue &transportReadBuf, ActionMoveVisitor &visitor, folly::DelayedDestructionBase *owner)
Definition: FizzBase.h:28
void processActions(typename StateMachine::CompletedActions actions)
Definition: FizzBase-inl.h:87
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Actions actions(Args &&...act)
Definition: Actions.h:86
folly::small_vector< Action, 4 > Actions
Definition: Actions.h:51
decltype(auto) variant_match(Variant &&variant, Cases &&...cases)
Definition: Overload.h:74

Friends And Related Function Documentation

template<typename ActionMoveVisitor, typename SM = ServerStateMachine>
friend class FizzBase< FizzServer< ActionMoveVisitor, SM >,ActionMoveVisitor,SM >
friend

Definition at line 47 of file FizzServer.h.

Member Data Documentation

template<typename ActionMoveVisitor, typename SM = ServerStateMachine>
bool fizz::server::FizzServer< ActionMoveVisitor, SM >::checkV2Hello_ {false}
private

Definition at line 51 of file FizzServer.h.


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