AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
EventStreamClient.h
Go to the documentation of this file.
1 #pragma once
2 
8 
9 #include <aws/crt/DateTime.h>
10 #include <aws/crt/JsonObject.h>
11 #include <aws/crt/StlAllocator.h>
12 #include <aws/crt/Types.h>
13 #include <aws/crt/UUID.h>
16 #include <aws/crt/io/TlsOptions.h>
17 
19 
20 #include <aws/event-stream/event_stream_rpc_client.h>
21 #include <aws/io/host_resolver.h>
22 
23 #include <atomic>
24 #include <functional>
25 #include <future>
26 #include <memory>
27 
28 namespace Aws
29 {
30  namespace Crt
31  {
32  namespace Io
33  {
34  class ClientBootstrap;
35  }
36  } // namespace Crt
37  namespace Eventstreamrpc
38  {
39  class EventStreamHeader;
40  class MessageAmendment;
41  class ClientOperation;
42  class ClientConnection;
43  class ClientContinuation;
44 
45  using HeaderValueType = aws_event_stream_header_value_type;
46  using MessageType = aws_event_stream_rpc_message_type;
47 
52  using OnMessageFlushCallback = std::function<void(int errorCode)>;
53 
59  using ConnectMessageAmender = std::function<const MessageAmendment &(void)>;
60 
65  {
66  public:
67  EventStreamHeader(const EventStreamHeader &lhs) noexcept;
68  EventStreamHeader(EventStreamHeader &&rhs) noexcept;
69  EventStreamHeader &operator=(const EventStreamHeader &lhs) noexcept;
70  ~EventStreamHeader() noexcept;
72  const struct aws_event_stream_header_value_pair &header,
73  Crt::Allocator *allocator = Crt::g_allocator);
75  const Crt::String &name,
76  const Crt::String &value,
77  Crt::Allocator *allocator = Crt::g_allocator) noexcept;
78 
79  Crt::String GetHeaderName() const noexcept;
80 
81  bool GetValueAsString(Crt::String &) const noexcept;
82 
83  const struct aws_event_stream_header_value_pair *GetUnderlyingHandle() const;
84 
85  bool operator==(const EventStreamHeader &other) const noexcept;
86 
87  private:
88  Crt::Allocator *m_allocator;
89  Crt::ByteBuf m_valueByteBuf;
90  struct aws_event_stream_header_value_pair m_underlyingHandle;
91  };
92 
99  {
100  public:
103  MessageAmendment &operator=(const MessageAmendment &lhs);
104  ~MessageAmendment() noexcept;
105  explicit MessageAmendment(Crt::Allocator *allocator = Crt::g_allocator) noexcept;
107  const Crt::List<EventStreamHeader> &headers,
109  Crt::Allocator *allocator) noexcept;
111  const Crt::List<EventStreamHeader> &headers,
112  Crt::Allocator *allocator = Crt::g_allocator) noexcept;
115  Crt::Allocator *allocator = Crt::g_allocator) noexcept;
116  MessageAmendment(const Crt::ByteBuf &payload, Crt::Allocator *allocator = Crt::g_allocator) noexcept;
117  void AddHeader(EventStreamHeader &&header) noexcept;
118  void SetPayload(const Crt::Optional<Crt::ByteBuf> &payload) noexcept;
119  const Crt::List<EventStreamHeader> &GetHeaders() const noexcept;
120  const Crt::Optional<Crt::ByteBuf> &GetPayload() const noexcept;
121 
122  private:
124  Crt::Optional<Crt::ByteBuf> m_payload;
125  Crt::Allocator *m_allocator;
126  };
127 
132  {
133  public:
134  ConnectionConfig() noexcept : m_clientBootstrap(nullptr), m_connectRequestCallback(nullptr) {}
135  Crt::Optional<Crt::String> GetHostName() const noexcept { return m_hostName; }
136  Crt::Optional<uint32_t> GetPort() const noexcept { return m_port; }
137  Crt::Optional<Crt::Io::SocketOptions> GetSocketOptions() const noexcept { return m_socketOptions; }
138  Crt::Optional<MessageAmendment> GetConnectAmendment() const noexcept { return m_connectAmendment; }
140  {
141  return m_tlsConnectionOptions;
142  }
143  Crt::Io::ClientBootstrap *GetClientBootstrap() const noexcept { return m_clientBootstrap; }
144  OnMessageFlushCallback GetConnectRequestCallback() const noexcept { return m_connectRequestCallback; }
146  {
147  return [&](void) -> const MessageAmendment & { return m_connectAmendment; };
148  }
149 
150  void SetHostName(Crt::String hostName) noexcept { m_hostName = hostName; }
151  void SetPort(uint32_t port) noexcept { m_port = port; }
152  void SetSocketOptions(const Crt::Io::SocketOptions &socketOptions) noexcept
153  {
154  m_socketOptions = socketOptions;
155  }
156  void SetConnectAmendment(const MessageAmendment &connectAmendment) noexcept
157  {
158  m_connectAmendment = connectAmendment;
159  }
160  void SetTlsConnectionOptions(Crt::Io::TlsConnectionOptions tlsConnectionOptions) noexcept
161  {
162  m_tlsConnectionOptions = tlsConnectionOptions;
163  }
164  void SetClientBootstrap(Crt::Io::ClientBootstrap *clientBootstrap) noexcept
165  {
166  m_clientBootstrap = clientBootstrap;
167  }
168  void SetConnectRequestCallback(OnMessageFlushCallback connectRequestCallback) noexcept
169  {
170  m_connectRequestCallback = connectRequestCallback;
171  }
172 
173  protected:
181  };
182 
184  {
198  };
199 
201  {
203  int crtError;
204  operator bool() const noexcept { return baseStatus == EVENT_STREAM_RPC_SUCCESS; }
205  Crt::String StatusToString();
206  };
207 
212  {
213  public:
214  virtual ~ConnectionLifecycleHandler() noexcept = default;
215 
221  virtual void OnConnectCallback();
227  virtual void OnDisconnectCallback(RpcError status);
235  virtual bool OnErrorCallback(RpcError status);
240  virtual void OnPingCallback(
241  const Crt::List<EventStreamHeader> &headers,
242  const Crt::Optional<Crt::ByteBuf> &payload);
243  };
244 
249  {
250  public:
252  ClientContinuation *clientContinuation,
253  Crt::Allocator *allocator = Crt::g_allocator) noexcept
254  : clientContinuation(clientContinuation), allocator(allocator)
255  {
256  continuationDestroyed = false;
257  }
258  ContinuationCallbackData(const ContinuationCallbackData &lhs) noexcept = delete;
260  std::mutex callbackMutex;
263  };
264 
269  {
270  public:
274  virtual void OnContinuationMessage(
275  const Crt::List<EventStreamHeader> &headers,
276  const Crt::Optional<Crt::ByteBuf> &payload,
277  MessageType messageType,
278  uint32_t messageFlags) = 0;
286  virtual void OnContinuationClosed() = 0;
287  virtual ~ClientContinuationHandler() noexcept = default;
288 
289  private:
290  friend class ClientContinuation;
291  ContinuationCallbackData *m_callbackData;
292  };
293 
298  {
299  public:
310  ClientConnection *connection,
311  ClientContinuationHandler &continuationHandler,
312  Crt::Allocator *allocator) noexcept;
313  ~ClientContinuation() noexcept;
314 
326  std::future<RpcError> Activate(
327  const Crt::String &operation,
328  const Crt::List<EventStreamHeader> &headers,
329  const Crt::Optional<Crt::ByteBuf> &payload,
330  MessageType messageType,
331  uint32_t messageFlags,
332  OnMessageFlushCallback onMessageFlushCallback) noexcept;
333 
338  bool IsClosed() noexcept;
339 
350  std::future<RpcError> SendMessage(
351  const Crt::List<EventStreamHeader> &headers,
352  const Crt::Optional<Crt::ByteBuf> &payload,
353  MessageType messageType,
354  uint32_t messageFlags,
355  OnMessageFlushCallback onMessageFlushCallback) noexcept;
356 
357  private:
358  friend class ClientOperation;
359  Crt::Allocator *m_allocator;
360  ClientContinuationHandler &m_continuationHandler;
361  struct aws_event_stream_rpc_client_continuation_token *m_continuationToken;
362  ContinuationCallbackData *m_callbackData;
363 
364  static void s_onContinuationMessage(
365  struct aws_event_stream_rpc_client_continuation_token *continuationToken,
366  const struct aws_event_stream_rpc_message_args *messageArgs,
367  void *userData) noexcept;
368  static void s_onContinuationClosed(
369  struct aws_event_stream_rpc_client_continuation_token *continuationToken,
370  void *userData) noexcept;
371  };
372 
377  {
378  public:
379  AbstractShapeBase() noexcept;
380  virtual ~AbstractShapeBase() noexcept = default;
381  static void s_customDeleter(AbstractShapeBase *shape) noexcept;
382  virtual void SerializeToJsonObject(Crt::JsonObject &payloadObject) const = 0;
383  virtual Crt::String GetModelName() const noexcept = 0;
384 
385  protected:
386  Crt::Allocator *m_allocator;
387  };
388 
393  {
394  public:
395  explicit OperationError() noexcept = default;
396  static void s_customDeleter(OperationError *shape) noexcept;
397  virtual void SerializeToJsonObject(Crt::JsonObject &payloadObject) const override;
398  virtual Crt::Optional<Crt::String> GetMessage() noexcept = 0;
399  };
400 
407  {
408  public:
409  virtual ~StreamResponseHandler() noexcept = default;
410 
414  virtual void OnStreamClosed();
415 
416  protected:
417  friend class ClientOperation;
421  virtual void OnStreamEvent(Crt::ScopedResource<AbstractShapeBase> response);
427  virtual bool OnStreamError(Crt::ScopedResource<OperationError> operationError, RpcError rpcError);
428  };
429 
431  {
434  RPC_ERROR
435  };
436 
441  {
442  public:
443  TaggedResult() noexcept;
444  explicit TaggedResult(Crt::ScopedResource<AbstractShapeBase> response) noexcept;
445  explicit TaggedResult(Crt::ScopedResource<OperationError> error) noexcept;
446  explicit TaggedResult(RpcError rpcError) noexcept;
447  TaggedResult(TaggedResult &&rhs) noexcept;
448  TaggedResult &operator=(TaggedResult &&rhs) noexcept;
449  ~TaggedResult() noexcept;
454  operator bool() const noexcept;
455 
460  AbstractShapeBase *GetOperationResponse() const noexcept;
461 
466  OperationError *GetOperationError() const noexcept;
467 
472  RpcError GetRpcError() const noexcept;
473 
478  ResultType GetResultType() const noexcept { return m_responseType; }
479 
480  private:
481  union AWS_EVENTSTREAMRPC_API OperationResult
482  {
483  OperationResult(Crt::ScopedResource<AbstractShapeBase> &&response) noexcept
484  : m_response(std::move(response))
485  {
486  }
487  OperationResult(Crt::ScopedResource<OperationError> &&error) noexcept : m_error(std::move(error)) {}
488  OperationResult() noexcept : m_response(nullptr) {}
489  ~OperationResult() noexcept {};
490  Crt::ScopedResource<AbstractShapeBase> m_response;
491  Crt::ScopedResource<OperationError> m_error;
492  };
493  ResultType m_responseType;
494  OperationResult m_operationResult;
495  RpcError m_rpcError;
496  };
497 
498  using ExpectedResponseFactory = std::function<
500  using ErrorResponseFactory = std::function<
502 
503  using LoneResponseRetriever = std::function<ExpectedResponseFactory(const Crt::String &modelName)>;
504  using StreamingResponseRetriever = std::function<ExpectedResponseFactory(const Crt::String &modelName)>;
505  using ErrorResponseRetriever = std::function<ErrorResponseFactory(const Crt::String &modelName)>;
506 
508  {
509  /* An interface shared by all operations for retrieving the response object given the model name. */
510  public:
511  virtual ~ResponseRetriever() noexcept = default;
512  virtual ExpectedResponseFactory GetInitialResponseFromModelName(
513  const Crt::String &modelName) const noexcept = 0;
514  virtual ExpectedResponseFactory GetStreamingResponseFromModelName(
515  const Crt::String &modelName) const noexcept = 0;
516  virtual ErrorResponseFactory GetOperationErrorFromModelName(
517  const Crt::String &modelName) const noexcept = 0;
518  };
519 
521  {
522  public:
523  virtual ~ServiceModel() noexcept = default;
524  virtual Crt::ScopedResource<OperationError> AllocateOperationErrorFromPayload(
525  const Crt::String &errorModelName,
526  Crt::StringView stringView,
527  Crt::Allocator *allocator) const noexcept = 0;
528  };
529 
534  {
535  public:
536  OperationModelContext(const ServiceModel &serviceModel) noexcept;
537 
538  virtual ~OperationModelContext() noexcept = default;
539 
546  virtual Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
547  Crt::StringView stringView,
548  Crt::Allocator *allocator) const noexcept = 0;
549 
556  virtual Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
557  Crt::StringView stringView,
558  Crt::Allocator *allocator) const noexcept = 0;
559 
564  virtual Crt::String GetInitialResponseModelName() const noexcept = 0;
565 
570  virtual Crt::String GetRequestModelName() const noexcept = 0;
571 
576  virtual Crt::Optional<Crt::String> GetStreamingResponseModelName() const noexcept = 0;
577 
584  virtual Crt::String GetOperationName() const noexcept = 0;
585 
593  Crt::ScopedResource<OperationError> AllocateOperationErrorFromPayload(
594  const Crt::String &errorModelName,
595  Crt::StringView stringView,
596  Crt::Allocator *allocator) const noexcept
597  {
598  return m_serviceModel.AllocateOperationErrorFromPayload(errorModelName, stringView, allocator);
599  }
600 
601  private:
602  const ServiceModel &m_serviceModel;
603  };
604 
609  {
610  public:
612  ClientConnection &connection,
613  std::shared_ptr<StreamResponseHandler> streamHandler,
614  const OperationModelContext &operationModelContext,
615  Crt::Allocator *allocator) noexcept;
616  ~ClientOperation() noexcept;
617 
618  ClientOperation(const ClientOperation &clientOperation) noexcept = delete;
619  ClientOperation(ClientOperation &&clientOperation) noexcept = delete;
620  bool operator=(const ClientOperation &clientOperation) noexcept = delete;
621  bool operator=(ClientOperation &&clientOperation) noexcept = delete;
622 
630  std::future<RpcError> Close(OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept;
631 
636  std::future<TaggedResult> GetOperationResult() noexcept;
637 
642  void WithLaunchMode(std::launch mode) noexcept;
643 
644  protected:
651  std::future<RpcError> Activate(
652  const AbstractShapeBase *shape,
653  OnMessageFlushCallback onMessageFlushCallback) noexcept;
654 
660  virtual Crt::String GetModelName() const noexcept = 0;
661 
662  const OperationModelContext &m_operationModelContext;
663  std::launch m_asyncLaunchMode;
664 
665  private:
666  EventStreamRpcStatusCode HandleData(const Crt::Optional<Crt::ByteBuf> &payload);
667  EventStreamRpcStatusCode HandleError(
668  const Crt::String &modelName,
669  const Crt::Optional<Crt::ByteBuf> &payload,
670  uint32_t messageFlags);
674  void OnContinuationMessage(
675  const Crt::List<EventStreamHeader> &headers,
676  const Crt::Optional<Crt::ByteBuf> &payload,
677  MessageType messageType,
678  uint32_t messageFlags) override;
686  void OnContinuationClosed() override;
687 
688  const EventStreamHeader *GetHeaderByName(
689  const Crt::List<EventStreamHeader> &headers,
690  const Crt::String &name) noexcept;
691 
692  enum CloseState
693  {
694  WONT_CLOSE = 0,
695  WILL_CLOSE,
696  ALREADY_CLOSED
697  };
698 
699  uint32_t m_messageCount;
700  Crt::Allocator *m_allocator;
701  std::shared_ptr<StreamResponseHandler> m_streamHandler;
702  ClientContinuation m_clientContinuation;
703  /* This mutex protects m_resultReceived & m_closeState. */
704  std::mutex m_continuationMutex;
705  bool m_resultReceived;
706  std::promise<TaggedResult> m_initialResponsePromise;
707  std::atomic_int m_expectedCloses;
708  std::atomic_bool m_streamClosedCalled;
709  std::condition_variable m_closeReady;
710  };
711 
716  {
717  public:
718  ClientConnection(Crt::Allocator *allocator = Crt::g_allocator) noexcept;
719  ~ClientConnection() noexcept;
720  ClientConnection(const ClientConnection &) noexcept = delete;
721  ClientConnection &operator=(const ClientConnection &) noexcept = delete;
722  ClientConnection(ClientConnection &&) noexcept;
723  ClientConnection &operator=(ClientConnection &&) noexcept;
724 
732  std::future<RpcError> Connect(
733  const ConnectionConfig &connectionOptions,
734  ConnectionLifecycleHandler *connectionLifecycleHandler,
735  Crt::Io::ClientBootstrap &clientBootstrap) noexcept;
736 
737  std::future<RpcError> SendPing(
738  const Crt::List<EventStreamHeader> &headers,
739  const Crt::Optional<Crt::ByteBuf> &payload,
740  OnMessageFlushCallback onMessageFlushCallback) noexcept;
741 
742  std::future<RpcError> SendPingResponse(
743  const Crt::List<EventStreamHeader> &headers,
744  const Crt::Optional<Crt::ByteBuf> &payload,
745  OnMessageFlushCallback onMessageFlushCallback) noexcept;
746 
753  ClientContinuation NewStream(ClientContinuationHandler &clientContinuationHandler) noexcept;
754 
758  void Close() noexcept;
759 
764  bool IsOpen() const noexcept
765  {
766  if (this->m_underlyingConnection == nullptr)
767  {
768  return false;
769  }
770  else
771  {
772  return aws_event_stream_rpc_client_connection_is_open(this->m_underlyingConnection);
773  }
774  }
775 
779  operator bool() const noexcept { return IsOpen(); }
780 
781  private:
782  friend class ClientContinuation;
783  friend std::future<RpcError> ClientOperation::Close(OnMessageFlushCallback onMessageFlushCallback) noexcept;
784  enum ClientState
785  {
786  DISCONNECTED = 1,
787  CONNECTING_SOCKET,
788  WAITING_FOR_CONNECT_ACK,
789  CONNECTED,
790  DISCONNECTING,
791  };
792  /* This recursive mutex protects m_clientState & m_connectionWillSetup */
793  std::recursive_mutex m_stateMutex;
794  Crt::Allocator *m_allocator;
795  struct aws_event_stream_rpc_client_connection *m_underlyingConnection;
796  ClientState m_clientState;
797  ConnectionLifecycleHandler *m_lifecycleHandler;
798  ConnectMessageAmender m_connectMessageAmender;
799  std::promise<void> m_connectionSetupPromise;
800  bool m_connectionWillSetup;
801  std::promise<RpcError> m_connectAckedPromise;
802  std::promise<RpcError> m_closedPromise;
803  bool m_onConnectCalled;
804  RpcError m_closeReason;
805  OnMessageFlushCallback m_onConnectRequestCallback;
806  Crt::Io::SocketOptions m_socketOptions;
807  ConnectionConfig m_connectionConfig;
808  std::future<RpcError> SendProtocolMessage(
809  const Crt::List<EventStreamHeader> &headers,
810  const Crt::Optional<Crt::ByteBuf> &payload,
811  MessageType messageType,
812  uint32_t messageFlags,
813  OnMessageFlushCallback onMessageFlushCallback) noexcept;
814 
815  static void s_onConnectionShutdown(
816  struct aws_event_stream_rpc_client_connection *connection,
817  int errorCode,
818  void *userData) noexcept;
819  static void s_onConnectionSetup(
820  struct aws_event_stream_rpc_client_connection *connection,
821  int errorCode,
822  void *userData) noexcept;
823  static void s_onProtocolMessage(
824  struct aws_event_stream_rpc_client_connection *connection,
825  const struct aws_event_stream_rpc_message_args *messageArgs,
826  void *userData) noexcept;
827 
828  static void s_protocolMessageCallback(int errorCode, void *userData) noexcept;
829 
833  static std::future<RpcError> s_sendProtocolMessage(
834  ClientConnection *connection,
835  const Crt::List<EventStreamHeader> &headers,
836  const Crt::Optional<Crt::ByteBuf> &payload,
837  MessageType messageType,
838  uint32_t messageFlags,
839  OnMessageFlushCallback onMessageFlushCallback) noexcept;
840 
841  static std::future<RpcError> s_sendPing(
842  ClientConnection *connection,
843  const Crt::List<EventStreamHeader> &headers,
844  const Crt::Optional<Crt::ByteBuf> &payload,
845  OnMessageFlushCallback onMessageFlushCallback) noexcept;
846 
847  static std::future<RpcError> s_sendPingResponse(
848  ClientConnection *connection,
849  const Crt::List<EventStreamHeader> &headers,
850  const Crt::Optional<Crt::ByteBuf> &payload,
851  OnMessageFlushCallback onMessageFlushCallback) noexcept;
852  };
853  } // namespace Eventstreamrpc
854 } // namespace Aws
Aws::Eventstreamrpc::ClientContinuation
Definition: EventStreamClient.h:298
Aws::Eventstreamrpc::EVENT_STREAM_RPC_CONTINUATION_CLOSED
@ EVENT_STREAM_RPC_CONTINUATION_CLOSED
Definition: EventStreamClient.h:193
Aws::Eventstreamrpc::ConnectionConfig::GetClientBootstrap
Crt::Io::ClientBootstrap * GetClientBootstrap() const noexcept
Definition: EventStreamClient.h:143
Aws::Eventstreamrpc::ConnectionConfig::m_socketOptions
Crt::Optional< Crt::Io::SocketOptions > m_socketOptions
Definition: EventStreamClient.h:176
Aws::Eventstreamrpc::RpcError
Definition: EventStreamClient.h:201
Aws::Eventstreamrpc::ClientContinuationHandler::OnContinuationMessage
virtual void OnContinuationMessage(const Crt::List< EventStreamHeader > &headers, const Crt::Optional< Crt::ByteBuf > &payload, MessageType messageType, uint32_t messageFlags)=0
Aws::Eventstreamrpc::TaggedResult::GetResultType
ResultType GetResultType() const noexcept
Definition: EventStreamClient.h:478
Aws::Eventstreamrpc::ConnectionConfig::SetSocketOptions
void SetSocketOptions(const Crt::Io::SocketOptions &socketOptions) noexcept
Definition: EventStreamClient.h:152
Aws::Eventstreamrpc::EVENT_STREAM_RPC_CRT_ERROR
@ EVENT_STREAM_RPC_CRT_ERROR
Definition: EventStreamClient.h:197
Aws::Eventstreamrpc::ConnectionLifecycleHandler
Definition: EventStreamClient.h:212
Aws::Eventstreamrpc::OperationError
Definition: EventStreamClient.h:393
Aws::Eventstreamrpc::RPC_ERROR
@ RPC_ERROR
Definition: EventStreamClient.h:434
Aws::Eventstreamrpc::EVENT_STREAM_RPC_ALLOCATION_ERROR
@ EVENT_STREAM_RPC_ALLOCATION_ERROR
Definition: EventStreamClient.h:188
Aws::Eventstreamrpc::LoneResponseRetriever
std::function< ExpectedResponseFactory(const Crt::String &modelName)> LoneResponseRetriever
Definition: EventStreamClient.h:503
Aws::Crt::ScopedResource
std::unique_ptr< T, std::function< void(T *)> > ScopedResource
Definition: Types.h:163
Aws::Eventstreamrpc::ClientOperation::Close
std::future< RpcError > Close(OnMessageFlushCallback onMessageFlushCallback=nullptr) noexcept
Definition: EventStreamClient.cpp:1521
Aws::Eventstreamrpc::ClientConnection::operator=
ClientConnection & operator=(const ClientConnection &) noexcept=delete
Aws::Eventstreamrpc::ContinuationCallbackData::allocator
Crt::Allocator * allocator
Definition: EventStreamClient.h:262
JsonObject.h
Aws::Eventstreamrpc::EVENT_STREAM_RPC_CONNECTION_CLOSED
@ EVENT_STREAM_RPC_CONNECTION_CLOSED
Definition: EventStreamClient.h:192
Aws::Eventstreamrpc::ClientConnection::ClientConnection
ClientConnection(const ClientConnection &) noexcept=delete
Aws::Eventstreamrpc::EventStreamRpcStatusCode
EventStreamRpcStatusCode
Definition: EventStreamClient.h:184
EventLoopGroup.h
TlsOptions.h
Aws::Eventstreamrpc::RpcError::crtError
int crtError
Definition: EventStreamClient.h:203
Aws::Eventstreamrpc::ConnectionConfig::m_clientBootstrap
Crt::Io::ClientBootstrap * m_clientBootstrap
Definition: EventStreamClient.h:178
Aws::Eventstreamrpc::ConnectionConfig::m_connectAmendment
MessageAmendment m_connectAmendment
Definition: EventStreamClient.h:179
DateTime.h
Aws::Eventstreamrpc::ConnectionConfig::GetConnectRequestCallback
OnMessageFlushCallback GetConnectRequestCallback() const noexcept
Definition: EventStreamClient.h:144
Aws::Eventstreamrpc::ClientOperation::operator=
bool operator=(const ClientOperation &clientOperation) noexcept=delete
Aws::Eventstreamrpc::ConnectionConfig::m_port
Crt::Optional< uint32_t > m_port
Definition: EventStreamClient.h:175
Aws::Eventstreamrpc::HeaderValueType
aws_event_stream_header_value_type HeaderValueType
Definition: EventStreamClient.h:45
Aws::Eventstreamrpc::EventStreamHeader
Definition: EventStreamClient.h:65
StlAllocator.h
Aws::Eventstreamrpc::ConnectionConfig::m_tlsConnectionOptions
Crt::Optional< Crt::Io::TlsConnectionOptions > m_tlsConnectionOptions
Definition: EventStreamClient.h:177
Aws::Eventstreamrpc::ConnectionConfig::SetConnectAmendment
void SetConnectAmendment(const MessageAmendment &connectAmendment) noexcept
Definition: EventStreamClient.h:156
Aws::Crt::List
std::list< T, StlAllocator< T > > List
Definition: Types.h:54
Aws::Eventstreamrpc::StreamingResponseRetriever
std::function< ExpectedResponseFactory(const Crt::String &modelName)> StreamingResponseRetriever
Definition: EventStreamClient.h:504
Aws::Crt::Io::TlsConnectionOptions
Definition: TlsOptions.h:293
Aws::Eventstreamrpc::OPERATION_ERROR
@ OPERATION_ERROR
Definition: EventStreamClient.h:433
Aws::Eventstreamrpc::ClientConnection
Definition: EventStreamClient.h:716
Aws::Eventstreamrpc::ClientOperation::ClientOperation
ClientOperation(ClientOperation &&clientOperation) noexcept=delete
Aws::Eventstreamrpc::ServiceModel::~ServiceModel
virtual ~ServiceModel() noexcept=default
Aws::Eventstreamrpc::ConnectionConfig::m_connectRequestCallback
OnMessageFlushCallback m_connectRequestCallback
Definition: EventStreamClient.h:180
Aws::Eventstreamrpc::EVENT_STREAM_RPC_UNMAPPED_DATA
@ EVENT_STREAM_RPC_UNMAPPED_DATA
Definition: EventStreamClient.h:195
Aws::Eventstreamrpc::EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED
@ EVENT_STREAM_RPC_CONNECTION_ALREADY_ESTABLISHED
Definition: EventStreamClient.h:191
Aws::Eventstreamrpc::ClientOperation::operator=
bool operator=(ClientOperation &&clientOperation) noexcept=delete
Aws::Eventstreamrpc::TaggedResult
Definition: EventStreamClient.h:441
Aws::Eventstreamrpc::ClientContinuationHandler
Definition: EventStreamClient.h:269
Aws::Eventstreamrpc::ConnectionConfig
Definition: EventStreamClient.h:132
Aws::Eventstreamrpc::StreamResponseHandler
Definition: EventStreamClient.h:407
Aws::Eventstreamrpc::EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED
@ EVENT_STREAM_RPC_CONNECTION_SETUP_FAILED
Definition: EventStreamClient.h:189
Aws::Eventstreamrpc::ClientContinuationHandler::~ClientContinuationHandler
virtual ~ClientContinuationHandler() noexcept=default
Aws::Eventstreamrpc::RpcError::baseStatus
EventStreamRpcStatusCode baseStatus
Definition: EventStreamClient.h:202
Aws::Eventstreamrpc::ContinuationCallbackData::callbackMutex
std::mutex callbackMutex
Definition: EventStreamClient.h:260
Aws::Eventstreamrpc::ClientOperation::ClientOperation
ClientOperation(const ClientOperation &clientOperation) noexcept=delete
Exports.h
Aws::Eventstreamrpc::ConnectionConfig::GetConnectMessageAmender
ConnectMessageAmender GetConnectMessageAmender() const noexcept
Definition: EventStreamClient.h:145
Aws::Eventstreamrpc::OperationModelContext::~OperationModelContext
virtual ~OperationModelContext() noexcept=default
Aws::Eventstreamrpc::AbstractShapeBase::~AbstractShapeBase
virtual ~AbstractShapeBase() noexcept=default
Aws::Eventstreamrpc::ResponseRetriever
Definition: EventStreamClient.h:508
Aws::Eventstreamrpc::ConnectionConfig::GetTlsConnectionOptions
Crt::Optional< Crt::Io::TlsConnectionOptions > GetTlsConnectionOptions() const noexcept
Definition: EventStreamClient.h:139
Aws::Eventstreamrpc::ConnectMessageAmender
std::function< const MessageAmendment &(void)> ConnectMessageAmender
Definition: EventStreamClient.h:59
Aws::Eventstreamrpc::ConnectionConfig::ConnectionConfig
ConnectionConfig() noexcept
Definition: EventStreamClient.h:134
Aws::Eventstreamrpc::ConnectionConfig::SetPort
void SetPort(uint32_t port) noexcept
Definition: EventStreamClient.h:151
Aws::Crt::Optional< Crt::ByteBuf >
Aws::Eventstreamrpc::ErrorResponseFactory
std::function< Crt::ScopedResource< OperationError >(const Crt::StringView &payload, Crt::Allocator *allocator)> ErrorResponseFactory
Definition: EventStreamClient.h:501
Aws::Crt::g_allocator
AWS_CRT_CPP_API Allocator * g_allocator
Definition: Allocator.cpp:22
Aws::Eventstreamrpc::ClientOperation
Definition: EventStreamClient.h:609
Aws::Eventstreamrpc::ExpectedResponseFactory
std::function< Crt::ScopedResource< AbstractShapeBase >(const Crt::StringView &payload, Crt::Allocator *allocator)> ExpectedResponseFactory
Definition: EventStreamClient.h:499
Aws::Eventstreamrpc::ErrorResponseRetriever
std::function< ErrorResponseFactory(const Crt::String &modelName)> ErrorResponseRetriever
Definition: EventStreamClient.h:505
Aws::Eventstreamrpc::ConnectionConfig::m_hostName
Crt::Optional< Crt::String > m_hostName
Definition: EventStreamClient.h:174
Aws::Eventstreamrpc::OPERATION_RESPONSE
@ OPERATION_RESPONSE
Definition: EventStreamClient.h:432
Aws::Eventstreamrpc::EventStreamHeader::operator==
bool operator==(const EventStreamHeader &other) const noexcept
Aws::Eventstreamrpc::ConnectionConfig::GetConnectAmendment
Crt::Optional< MessageAmendment > GetConnectAmendment() const noexcept
Definition: EventStreamClient.h:138
Aws::Eventstreamrpc::ResultType
ResultType
Definition: EventStreamClient.h:431
Aws::Eventstreamrpc::EVENT_STREAM_RPC_SUCCESS
@ EVENT_STREAM_RPC_SUCCESS
Definition: EventStreamClient.h:185
Types.h
Aws::Eventstreamrpc::ServiceModel
Definition: EventStreamClient.h:521
Aws::Eventstreamrpc::ConnectionConfig::SetConnectRequestCallback
void SetConnectRequestCallback(OnMessageFlushCallback connectRequestCallback) noexcept
Definition: EventStreamClient.h:168
Aws::Eventstreamrpc::ContinuationCallbackData::clientContinuation
ClientContinuation * clientContinuation
Definition: EventStreamClient.h:261
Aws::Eventstreamrpc::EVENT_STREAM_RPC_UNINITIALIZED
@ EVENT_STREAM_RPC_UNINITIALIZED
Definition: EventStreamClient.h:187
Aws::Eventstreamrpc::OperationError::OperationError
OperationError() noexcept=default
Aws::Eventstreamrpc::EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE
@ EVENT_STREAM_RPC_UNKNOWN_PROTOCOL_MESSAGE
Definition: EventStreamClient.h:194
Aws::Eventstreamrpc::ContinuationCallbackData::continuationDestroyed
bool continuationDestroyed
Definition: EventStreamClient.h:259
Aws::Eventstreamrpc::OnMessageFlushCallback
std::function< void(int errorCode)> OnMessageFlushCallback
Definition: EventStreamClient.h:52
Aws::Crt::StringView
string_view StringView
Definition: StringView.h:846
Aws::Crt::Io::SocketOptions
Definition: SocketOptions.h:48
Aws::Eventstreamrpc::ConnectionConfig::SetTlsConnectionOptions
void SetTlsConnectionOptions(Crt::Io::TlsConnectionOptions tlsConnectionOptions) noexcept
Definition: EventStreamClient.h:160
Aws::Crt::basic_string_view
Definition: StringView.h:33
Aws::Crt::ByteBuf
aws_byte_buf ByteBuf
Definition: Types.h:30
std
Definition: StringView.h:852
Aws::Eventstreamrpc::EVENT_STREAM_RPC_NULL_PARAMETER
@ EVENT_STREAM_RPC_NULL_PARAMETER
Definition: EventStreamClient.h:186
Aws
Definition: Allocator.h:11
Aws::Eventstreamrpc::ConnectionLifecycleHandler::~ConnectionLifecycleHandler
virtual ~ConnectionLifecycleHandler() noexcept=default
SocketOptions.h
Aws::Eventstreamrpc::StreamResponseHandler::~StreamResponseHandler
virtual ~StreamResponseHandler() noexcept=default
Aws::Crt::Allocator
aws_allocator Allocator
Definition: Allocator.h:14
HostResolver.h
Aws::Eventstreamrpc::ContinuationCallbackData::ContinuationCallbackData
ContinuationCallbackData(ClientContinuation *clientContinuation, Crt::Allocator *allocator=Crt::g_allocator) noexcept
Definition: EventStreamClient.h:251
Aws::Eventstreamrpc::EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED
@ EVENT_STREAM_RPC_CONNECTION_ACCESS_DENIED
Definition: EventStreamClient.h:190
Aws::Eventstreamrpc::ConnectionConfig::SetClientBootstrap
void SetClientBootstrap(Crt::Io::ClientBootstrap *clientBootstrap) noexcept
Definition: EventStreamClient.h:164
AWS_EVENTSTREAMRPC_API
#define AWS_EVENTSTREAMRPC_API
Definition: Exports.h:19
Aws::Eventstreamrpc::ResponseRetriever::~ResponseRetriever
virtual ~ResponseRetriever() noexcept=default
Aws::Crt::Io::ClientBootstrap
Definition: Bootstrap.h:35
Aws::Eventstreamrpc::OperationModelContext
Definition: EventStreamClient.h:534
Aws::Eventstreamrpc::AbstractShapeBase
Definition: EventStreamClient.h:377
Aws::Eventstreamrpc::ConnectionConfig::GetSocketOptions
Crt::Optional< Crt::Io::SocketOptions > GetSocketOptions() const noexcept
Definition: EventStreamClient.h:137
Aws::Eventstreamrpc::ContinuationCallbackData::ContinuationCallbackData
ContinuationCallbackData(const ContinuationCallbackData &lhs) noexcept=delete
UUID.h
Aws::Eventstreamrpc::EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE
@ EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE
Definition: EventStreamClient.h:196
Aws::Eventstreamrpc::MessageAmendment
Definition: EventStreamClient.h:99
Aws::Eventstreamrpc::MessageType
aws_event_stream_rpc_message_type MessageType
Definition: EventStreamClient.h:46
Aws::Eventstreamrpc::ConnectionConfig::SetHostName
void SetHostName(Crt::String hostName) noexcept
Definition: EventStreamClient.h:150
Aws::Crt::String
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition: Types.h:45
Aws::Eventstreamrpc::ConnectionConfig::GetHostName
Crt::Optional< Crt::String > GetHostName() const noexcept
Definition: EventStreamClient.h:135
Aws::Eventstreamrpc::ConnectionConfig::GetPort
Crt::Optional< uint32_t > GetPort() const noexcept
Definition: EventStreamClient.h:136
Aws::Eventstreamrpc::ContinuationCallbackData
Definition: EventStreamClient.h:249
Aws::Eventstreamrpc::ClientContinuationHandler::OnContinuationClosed
virtual void OnContinuationClosed()=0