proxygen
ServerProtocol.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <folly/futures/Future.h>
12 
15 #include <fizz/protocol/Params.h>
17 #include <fizz/server/Actions.h>
20 #include <fizz/server/State.h>
21 
22 namespace fizz {
23 namespace server {
24 
26  public:
27  using StateType = State;
30 
31  virtual ~ServerStateMachine() = default;
32 
34  const State&,
36  std::shared_ptr<const FizzServerContext> context,
37  const std::shared_ptr<ServerExtensions>& extensions);
38 
40 
42  const State&,
44 
45  virtual AsyncActions processAppWrite(const State&, AppWrite);
46 
48 
49  virtual Actions processAppClose(const State&);
50 };
51 
52 namespace detail {
53 
55 
57  const State& state,
60 
62 
63 Actions handleInvalidEvent(const State& state, Event event, Param param);
64 } // namespace detail
65 
66 struct ServerTypes {
69  using Event = fizz::Event;
70  using Param = fizz::Param;
72  static constexpr auto NumStates =
73  static_cast<std::size_t>(StateEnum::NUM_STATES);
74  static constexpr auto NumEvents = static_cast<std::size_t>(Event::NUM_EVENTS);
75  static constexpr auto InvalidEventHandler =
77 };
78 } // namespace server
79 } // namespace fizz
fizz::server::AsyncActions Actions
virtual ~ServerStateMachine()=default
boost::variant< ClientHello, ServerHello, EndOfEarlyData, HelloRetryRequest, EncryptedExtensions, CertificateRequest, CompressedCertificate, CertificateMsg, CertificateVerify, Finished, NewSessionTicket, KeyUpdate, Alert, Accept, Connect, AppData, AppWrite, EarlyAppWrite, WriteNewSessionTicket > Param
Definition: Params.h:90
Actions handleError(const State &state, ReportError error, Optional< AlertDescription > alertDesc)
context
Definition: CMakeCache.txt:563
boost::variant< Actions, folly::Future< Actions >> AsyncActions
Definition: Actions.h:52
Actions handleAppClose(const State &state)
virtual AsyncActions processEarlyAppWrite(const State &, EarlyAppWrite)
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
virtual AsyncActions processAppWrite(const State &, AppWrite)
PUSHMI_INLINE_VAR constexpr __adl::get_executor_fn executor
virtual Actions processAppClose(const State &)
State
See Core for details.
Definition: Core.h:43
virtual AsyncActions processSocketData(const State &, folly::IOBufQueue &)
virtual AsyncActions processAccept(const State &, folly::Executor *executor, std::shared_ptr< const FizzServerContext > context, const std::shared_ptr< ServerExtensions > &extensions)
Definition: Actions.h:16
Actions handleInvalidEvent(const State &state, Event event, Param param)
folly::small_vector< Action, 4 > Actions
Definition: Actions.h:51
Event
Definition: Events.h:15
virtual AsyncActions processWriteNewSessionTicket(const State &, WriteNewSessionTicket)
Actions handleInvalidEvent(const State &state, Event event, Param param)
Actions processEvent(const State &state, Param param)
state
Definition: http_parser.c:272