14 template <
typename SM>
17 const std::shared_ptr<FizzServerContext>& fizzContext,
18 const std::shared_ptr<ServerExtensions>& extensions)
20 fizzContext_(fizzContext),
21 extensions_(extensions),
23 fizzServer_(state_, transportReadBuf_, visitor_, this) {}
25 template <
typename SM>
33 template <
typename SM>
38 template <
typename SM>
43 template <
typename SM>
48 template <
typename SM>
53 template <
typename SM>
58 template <
typename SM>
64 template <
typename SM>
68 return cert->getX509();
74 template <
typename SM>
78 return cert->getX509().get();
84 template <
typename SM>
89 template <
typename SM>
94 template <
typename SM>
100 template <
typename SM>
103 LOG(FATAL) <<
"setReplaySafetyCallback() called on replay safe transport";
106 template <
typename SM>
115 template <
typename SM>
120 DelayedDestruction::DestructorGuard dg(
this);
128 template <
typename SM>
130 DelayedDestruction::DestructorGuard dg(
this);
140 template <
typename SM>
142 DelayedDestruction::DestructorGuard dg(
this);
152 template <
typename SM>
157 template <
typename SM>
163 template <
typename SM>
171 template <
typename SM>
176 return fizzServer_.getEarlyEkm(label, context, length);
179 template <
typename SM>
182 std::unique_ptr<folly::IOBuf>&& buf,
190 "fizz app write in error state"));
202 template <
typename SM>
205 DelayedDestruction::DestructorGuard dg(
this);
209 template <
typename SM>
214 template <
typename SM>
217 bool closeTransport) {
223 template <
typename SM>
232 template <
typename SM>
237 template <
typename SM>
241 for (
size_t i = 1;
i < data.
contents.size(); ++
i) {
247 template <
typename SM>
250 if (server_.handshakeCallback_) {
251 auto callback = server_.handshakeCallback_;
252 server_.handshakeCallback_ =
nullptr;
253 callback->fizzHandshakeSuccess(&server_);
257 template <
typename SM>
260 if (server_.handshakeCallback_) {
261 auto callback = server_.handshakeCallback_;
262 server_.handshakeCallback_ =
nullptr;
263 callback->fizzHandshakeSuccess(&server_);
267 template <
typename SM>
272 server_.deliverAllErrors(ase);
275 template <
typename SM>
277 server_.fizzServer_.waitForData();
279 if (server_.handshakeCallback_) {
281 server_.startTransportReads();
285 template <
typename SM>
287 mutator(server_.state_);
290 template <
typename SM>
293 if (!server_.handshakeCallback_) {
294 VLOG(2) <<
"fizz fallback without callback";
297 auto callback = server_.handshakeCallback_;
298 server_.handshakeCallback_ =
nullptr;
299 if (!server_.transportReadBuf_.empty()) {
300 fallback.
clientHello->prependChain(server_.transportReadBuf_.move());
const Cert * getPeerCertificate() const override
folly::fbstring what() const
const auto & getSupportedSigSchemes() const
virtual void deliverError(const folly::AsyncSocketException &ex, bool closeTransport=true)
HandshakeCallback * handshakeCallback_
const X509 * getSelfCert() const override
std::unique_ptr< X509, X509Deleter > X509UniquePtr
FizzServer< ActionMoveVisitor, SM > fizzServer_
void deliverAllErrors(const folly::AsyncSocketException &ex, bool closeTransport=true)
void setReplaySafetyCallback(folly::AsyncTransport::ReplaySafetyCallback *callback) override
constexpr detail::Map< Move > move
folly::small_vector< TLSContent, 4 > contents
const Cert * getSelfCertificate() const override
AsyncFizzServerT(folly::AsyncTransportWrapper::UniquePtr socket, const std::shared_ptr< FizzServerContext > &fizzContext, const std::shared_ptr< ServerExtensions > &extensions=nullptr)
void writeAppData(folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override
folly::ssl::X509UniquePtr getPeerCert() const override
requires E e noexcept(noexcept(s.error(std::move(e))))
virtual Buf getEarlyEkm(folly::StringPiece label, const Buf &hashedContext, uint16_t length) const
void attachEventBase(folly::EventBase *eventBase) override
virtual void accept(HandshakeCallback *callback)
const State & getState() const
std::vector< SignatureScheme > getSupportedSigSchemes() const override
folly::AsyncTransportWrapper::UniquePtr transport_
std::unique_ptr< AsyncTransportWrapper, Destructor > UniquePtr
folly::Executor * executor() const
const std::shared_ptr< const Cert > & clientCert() const
folly::Optional< CipherSuite > getCipher() const override
void write(folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override
std::basic_string< E, T, A > toStdString() const
folly::exception_wrapper error
void closeWithReset() override
bool isDetachable() const override
std::string getApplicationProtocol() const noexceptoverride
void transportDataAvailable() override
NetworkSocket socket(int af, int type, int protocol)
void attachEventBase(folly::EventBase *evb) override
bool good() const override
void operator()(DeliverAppData &)
virtual void startTransportReads()
folly::AsyncTransportWrapper::WriteCallback * callback
std::shared_ptr< ServerExtensions > extensions_
bool readable() const override
const FizzServerContext * context() const
std::unique_ptr< folly::IOBuf > Buf
bool connecting() const override
virtual void writeErr(size_t bytesWritten, const AsyncSocketException &ex) noexcept=0
std::shared_ptr< FizzServerContext > fizzContext_
bool isReplaySafe() const override
const folly::Optional< std::string > & alpn() const
bool error() const override
bool isDetachable() const override
static constexpr uint64_t data[1]
std::shared_ptr< const Cert > serverCert() const
folly::Optional< CipherSuite > cipher() const
std::unique_ptr< folly::IOBuf > data
virtual void fizzHandshakeError(AsyncFizzServerT *transport, folly::exception_wrapper ex) noexcept=0
std::unique_ptr< folly::IOBuf > clientHello
void deliverHandshakeError(folly::exception_wrapper ex)
void transportError(const folly::AsyncSocketException &ex) override
std::unique_ptr< folly::IOBuf > data
folly::AsyncTransportWrapper::WriteCallback * callback
Buf getEkm(folly::StringPiece label, const Buf &hashedContext, uint16_t length) const override