proxygen
ClientProtocol.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 <fizz/client/Actions.h>
14 #include <fizz/client/PskCache.h>
15 #include <fizz/client/State.h>
16 
17 namespace fizz {
18 namespace client {
19 
21  public:
22  using StateType = State;
25 
26  virtual ~ClientStateMachine() = default;
27 
28  virtual Actions processConnect(
29  const State&,
30  std::shared_ptr<const FizzClientContext> context,
31  std::shared_ptr<const CertificateVerifier> verifier,
34  const std::shared_ptr<ClientExtensions>& extensions);
35 
37 
39  const State&,
41 
42  virtual Actions processAppWrite(const State&, AppWrite);
43 
45 
46  virtual Actions processAppClose(const State&);
47 };
48 
49 namespace detail {
50 
51 Actions processEvent(const State& state, Param param);
52 
54  const State& state,
57 
59 
60 Actions handleInvalidEvent(const State& state, Event event, Param param);
61 } // namespace detail
62 
63 struct ClientTypes {
66  using Event = fizz::Event;
67  using Param = fizz::Param;
69  static constexpr auto NumStates =
70  static_cast<std::size_t>(fizz::client::StateEnum::NUM_STATES);
71  static constexpr auto NumEvents = static_cast<std::size_t>(Event::NUM_EVENTS);
72  static constexpr auto InvalidEventHandler =
74 };
75 } // namespace client
76 } // namespace fizz
fizz::client::Actions Actions
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
Actions handleAppClose(const State &state)
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
virtual Actions processEarlyAppWrite(const State &, EarlyAppWrite)
virtual Actions processConnect(const State &, std::shared_ptr< const FizzClientContext > context, std::shared_ptr< const CertificateVerifier > verifier, folly::Optional< std::string > sni, folly::Optional< CachedPsk > cachedPsk, const std::shared_ptr< ClientExtensions > &extensions)
virtual ~ClientStateMachine()=default
virtual Actions processAppClose(const State &)
State
See Core for details.
Definition: Core.h:43
virtual Actions processAppWrite(const State &, AppWrite)
std::vector< Action > Actions
Definition: Actions.h:81
Definition: Actions.h:16
virtual Actions processWriteNewSessionTicket(const State &, WriteNewSessionTicket)
virtual Actions processSocketData(const State &, folly::IOBufQueue &)
Event
Definition: Events.h:15
StringPiece sni
Actions handleInvalidEvent(const State &state, Event event, Param param)
Actions processEvent(const State &state, Param param)
state
Definition: http_parser.c:272