proxygen
|
#include <AsyncFizzServer.h>
Classes | |
class | ActionMoveVisitor |
class | HandshakeCallback |
Public Types | |
using | UniquePtr = std::unique_ptr< AsyncFizzServerT, folly::DelayedDestruction::Destructor > |
Public Types inherited from fizz::AsyncFizzBase | |
using | UniquePtr = std::unique_ptr< AsyncFizzBase, folly::DelayedDestruction::Destructor > |
using | ReadCallback = folly::AsyncTransportWrapper::ReadCallback |
Public Types inherited from folly::AsyncTransportWrapper | |
using | UniquePtr = std::unique_ptr< AsyncTransportWrapper, Destructor > |
using | ReadCallback = AsyncReader::ReadCallback |
using | WriteCallback = AsyncWriter::WriteCallback |
Public Types inherited from folly::AsyncTransport | |
typedef std::unique_ptr< AsyncTransport, Destructor > | UniquePtr |
Protected Member Functions | |
void | writeAppData (folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override |
void | transportError (const folly::AsyncSocketException &ex) override |
void | transportDataAvailable () override |
Protected Member Functions inherited from fizz::AsyncFizzBase | |
virtual void | startTransportReads () |
virtual void | startHandshakeTimeout (std::chrono::milliseconds) |
virtual void | cancelHandshakeTimeout () |
virtual void | deliverAppData (std::unique_ptr< folly::IOBuf > buf) |
virtual void | deliverError (const folly::AsyncSocketException &ex, bool closeTransport=true) |
Protected Member Functions inherited from folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper > | |
~DecoratedAsyncTransportWrapper () override | |
Protected Member Functions inherited from folly::AsyncTransport | |
~AsyncTransport () override=default | |
Protected Member Functions inherited from folly::DelayedDestruction | |
~DelayedDestruction () override=default | |
DelayedDestruction () | |
Protected Member Functions inherited from folly::DelayedDestructionBase | |
DelayedDestructionBase () | |
uint32_t | getDestructorGuardCount () const |
Protected Member Functions inherited from folly::AsyncReader | |
virtual | ~AsyncReader ()=default |
Protected Member Functions inherited from folly::AsyncWriter | |
virtual | ~AsyncWriter ()=default |
Protected Member Functions inherited from folly::AsyncWriter::WriteCallback | |
virtual | ~WriteCallback ()=default |
Private Member Functions | |
void | deliverAllErrors (const folly::AsyncSocketException &ex, bool closeTransport=true) |
void | deliverHandshakeError (folly::exception_wrapper ex) |
Private Attributes | |
HandshakeCallback * | handshakeCallback_ {nullptr} |
std::shared_ptr< FizzServerContext > | fizzContext_ |
std::shared_ptr< ServerExtensions > | extensions_ |
State | state_ |
ActionMoveVisitor | visitor_ |
FizzServer< ActionMoveVisitor, SM > | fizzServer_ |
Additional Inherited Members | |
Protected Attributes inherited from fizz::AsyncFizzBase | |
folly::IOBufQueue | transportReadBuf_ {folly::IOBufQueue::cacheChainLength()} |
Protected Attributes inherited from folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper > | |
folly::AsyncTransportWrapper::UniquePtr | transport_ |
Definition at line 21 of file AsyncFizzServer.h.
using fizz::server::AsyncFizzServerT< SM >::UniquePtr = std::unique_ptr<AsyncFizzServerT, folly::DelayedDestruction::Destructor> |
Definition at line 38 of file AsyncFizzServer.h.
fizz::server::AsyncFizzServerT< SM >::AsyncFizzServerT | ( | folly::AsyncTransportWrapper::UniquePtr | socket, |
const std::shared_ptr< FizzServerContext > & | fizzContext, | ||
const std::shared_ptr< ServerExtensions > & | extensions = nullptr |
||
) |
Definition at line 15 of file AsyncFizzServer-inl.h.
|
virtual |
Definition at line 26 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::extensions_, fizz::server::AsyncFizzServerT< SM >::fizzContext_, fizz::server::AsyncFizzServerT< SM >::fizzServer_, fizz::server::AsyncFizzServerT< SM >::handshakeCallback_, fizz::AsyncFizzBase::startTransportReads(), and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
overridevirtual |
Attach the transport to a EventBase.
This may only be called if the transport is not currently attached to a EventBase (by an earlier call to detachEventBase()).
This method must be invoked in the EventBase's thread.
Reimplemented from fizz::AsyncFizzBase.
Definition at line 59 of file AsyncFizzServer-inl.h.
References fizz::AsyncFizzBase::attachEventBase(), fizz::server::State::executor(), and fizz::server::AsyncFizzServerT< SM >::state_.
|
overridevirtual |
Close the transport.
This gracefully closes the transport, waiting for all pending write requests to complete before actually closing the underlying transport.
If a read callback is set, readEOF() will be called immediately. If there are outstanding write requests, the close will be delayed until all remaining writes have completed. No new writes may be started after close() has been called.
Implements folly::AsyncTransport.
Definition at line 116 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), folly::AsyncSocketException::END_OF_FILE, fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
overridevirtual |
Close the transport immediately.
This closes the transport immediately, dropping any outstanding data waiting to be written.
If a read callback is set, readEOF() will be called immediately. If there are outstanding write requests, these requests will be aborted and writeError() will be invoked immediately on all outstanding write callbacks.
Implements folly::AsyncTransport.
Definition at line 141 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), folly::AsyncSocketException::END_OF_FILE, fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
overridevirtual |
Reset the transport immediately.
This closes the transport immediately, sending a reset to the remote peer if possible to indicate abnormal shutdown.
Note that not all subclasses implement this reset functionality: some subclasses may treat reset() the same as closeNow(). Subclasses that use TCP transports should terminate the connection with a TCP reset.
Reimplemented from folly::AsyncTransport.
Definition at line 129 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), folly::AsyncSocketException::END_OF_FILE, fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
overridevirtual |
Determine if transport is connected to the endpoint
Implements fizz::AsyncFizzBase.
Definition at line 44 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::handshakeCallback_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
private |
Definition at line 215 of file AsyncFizzServer-inl.h.
References fizz::AsyncFizzBase::deliverError(), fizz::server::AsyncFizzServerT< SM >::deliverHandshakeError(), and fizz::server::AsyncFizzServerT< SM >::fizzServer_.
Referenced by fizz::server::AsyncFizzServerT< SM >::close(), fizz::server::AsyncFizzServerT< SM >::closeNow(), fizz::server::AsyncFizzServerT< SM >::closeWithReset(), fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState(), and fizz::server::AsyncFizzServerT< SM >::transportError().
|
private |
Definition at line 224 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::HandshakeCallback::fizzHandshakeError(), fizz::server::AsyncFizzServerT< SM >::handshakeCallback_, and folly::gen::move.
Referenced by fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), and fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overridevirtual |
Determine if an error has occurred with this transport.
Implements fizz::AsyncFizzBase.
Definition at line 49 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::fizzServer_, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
Referenced by fizz::server::AsyncFizzServerT< SM >::good(), and fizz::server::AsyncFizzServerT< SM >::writeAppData().
|
overridevirtualnoexcept |
Return the application protocol being used by the underlying transport protocol. This is useful for transports which are used to tunnel other protocols.
Implements fizz::AsyncFizzBase.
Definition at line 107 of file AsyncFizzServer-inl.h.
References alpn, fizz::server::State::alpn(), and fizz::server::AsyncFizzServerT< SM >::getState().
|
overridevirtual |
Get the CipherSuite negotiated in this transport.
Implements fizz::AsyncFizzBase.
Definition at line 153 of file AsyncFizzServer-inl.h.
References fizz::server::State::cipher(), and fizz::server::AsyncFizzServerT< SM >::getState().
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
virtual |
Definition at line 172 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::fizzServer_.
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overridevirtual |
Get the exported material.
Implements fizz::AsyncFizzBase.
Definition at line 164 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::fizzServer_.
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overridevirtual |
Information about the current security state. To be implemented by derived classes.
Implements fizz::AsyncFizzBase.
Definition at line 65 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::getPeerCertificate().
|
overridevirtual |
Get the certificates in fizz::Cert form.
Implements fizz::AsyncFizzBase.
Definition at line 85 of file AsyncFizzServer-inl.h.
References fizz::server::State::clientCert(), and fizz::server::AsyncFizzServerT< SM >::getState().
Referenced by fizz::server::AsyncFizzServerT< SM >::getPeerCert(), and fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overridevirtual |
The local certificate used for this connection. May be null
Implements fizz::AsyncFizzBase.
Definition at line 75 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::getSelfCertificate().
|
overridevirtual |
Get the certificate information of this transport, if any
Implements fizz::AsyncFizzBase.
Definition at line 90 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::getState(), and fizz::server::State::serverCert().
Referenced by fizz::server::AsyncFizzServerT< SM >::getSelfCert(), and fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
inline |
Internal state access for logging/testing.
Definition at line 68 of file AsyncFizzServer.h.
Referenced by fizz::server::AsyncFizzServerT< SM >::getApplicationProtocol(), fizz::server::AsyncFizzServerT< SM >::getCipher(), fizz::server::AsyncFizzServerT< SM >::getPeerCertificate(), fizz::server::AsyncFizzServerT< SM >::getSelfCertificate(), and fizz::server::AsyncFizzServerT< SM >::getSupportedSigSchemes().
|
overridevirtual |
Get the supported signature schemes in this transport.
Implements fizz::AsyncFizzBase.
Definition at line 158 of file AsyncFizzServer-inl.h.
References fizz::server::State::context(), fizz::server::AsyncFizzServerT< SM >::getState(), and fizz::server::FizzServerContext::getSupportedSigSchemes().
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overridevirtual |
Information about the current transport state. To be implemented by derived classes.
Implements fizz::AsyncFizzBase.
Definition at line 34 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::error(), and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
overridevirtual |
Determine if the transport can be detached.
This method must be called from the current EventBase's thread.
Reimplemented from fizz::AsyncFizzBase.
Definition at line 54 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::fizzServer_, and fizz::AsyncFizzBase::isDetachable().
|
overridevirtual |
False if the transport does not have replay protection, but will in the future.
Implements fizz::AsyncFizzBase.
Definition at line 95 of file AsyncFizzServer-inl.h.
|
overridevirtual |
Determine if the transport is readable or not.
Implements fizz::AsyncFizzBase.
Definition at line 39 of file AsyncFizzServer-inl.h.
References folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >::transport_.
|
overridevirtual |
Set the ReplaySafeCallback on this transport.
This should only be called if isReplaySafe() returns false.
Implements fizz::AsyncFizzBase.
Definition at line 101 of file AsyncFizzServer-inl.h.
|
overrideprotectedvirtual |
Alert the derived class that additional data is available in transportReadBuf_.
Implements fizz::AsyncFizzBase.
Definition at line 210 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::fizzServer_.
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overrideprotectedvirtual |
Alert the derived class that a transport error occured.
Implements fizz::AsyncFizzBase.
Definition at line 203 of file AsyncFizzServer-inl.h.
References fizz::server::AsyncFizzServerT< SM >::deliverAllErrors().
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
overrideprotectedvirtual |
Interface for the derived class to implement to receive app data from the app layer.
Implements fizz::AsyncFizzBase.
Definition at line 180 of file AsyncFizzServer-inl.h.
References fizz::AppWrite::callback, fizz::AppWrite::data, fizz::server::AsyncFizzServerT< SM >::error(), fizz::server::AsyncFizzServerT< SM >::fizzServer_, fizz::AppWrite::flags, folly::AsyncSocketException::INVALID_STATE, folly::gen::move, folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >::write(), and folly::AsyncWriter::WriteCallback::writeErr().
Referenced by fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
private |
Definition at line 127 of file AsyncFizzServer.h.
Referenced by fizz::server::AsyncFizzServerT< SM >::accept().
|
private |
Definition at line 125 of file AsyncFizzServer.h.
Referenced by fizz::server::AsyncFizzServerT< SM >::accept().
|
private |
Definition at line 133 of file AsyncFizzServer.h.
Referenced by fizz::server::AsyncFizzServerT< SM >::accept(), fizz::server::AsyncFizzServerT< SM >::close(), fizz::server::AsyncFizzServerT< SM >::closeNow(), fizz::server::AsyncFizzServerT< SM >::closeWithReset(), fizz::server::AsyncFizzServerT< SM >::deliverAllErrors(), fizz::server::AsyncFizzServerT< SM >::error(), fizz::server::AsyncFizzServerT< SM >::getEarlyEkm(), fizz::server::AsyncFizzServerT< SM >::getEkm(), fizz::server::AsyncFizzServerT< SM >::isDetachable(), fizz::server::AsyncFizzServerT< SM >::transportDataAvailable(), and fizz::server::AsyncFizzServerT< SM >::writeAppData().
|
private |
Definition at line 123 of file AsyncFizzServer.h.
Referenced by fizz::server::AsyncFizzServerT< SM >::accept(), fizz::server::AsyncFizzServerT< SM >::connecting(), and fizz::server::AsyncFizzServerT< SM >::deliverHandshakeError().
|
private |
Definition at line 129 of file AsyncFizzServer.h.
Referenced by fizz::server::AsyncFizzServerT< SM >::attachEventBase(), and fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance >::getState().
|
private |
Definition at line 131 of file AsyncFizzServer.h.