AWS IoT Device SDK C++ v2: crt/aws-crt-cpp/include/aws/crt/Api.h Source File

AWS IoT Device SDK C++ v2 1.14.0 AWS IoT Device SDK C++ v2

Api.h
Go to the documentation of this file.
1#pragma once
6#include <aws/crt/Types.h>
7#include <aws/crt/crypto/HMAC.h>
8#include <aws/crt/crypto/Hash.h>
9#include <aws/crt/io/Bootstrap.h>
10#include <aws/crt/io/EventLoopGroup.h>
11#include <aws/crt/io/TlsOptions.h>
12#include <aws/crt/mqtt/MqttClient.h>
13
14#include <aws/common/logging.h>
15
16 namespace Aws
17{
18 namespace Crt
19 {
23 enum class LogLevel
24 {
25 None = AWS_LL_NONE,
26 Fatal = AWS_LL_FATAL,
27 Error = AWS_LL_ERROR,
28 Warn = AWS_LL_WARN,
29 Info = AWS_LL_INFO,
30 Debug = AWS_LL_DEBUG,
31 Trace = AWS_LL_TRACE,
32
33 Count
34 };
35
39 enum class ApiHandleShutdownBehavior
40 {
41 Blocking,
42 NonBlocking
43 };
44
49 class AWS_CRT_CPP_API ApiHandle
50 {
51 public:
52 ApiHandle(Allocator *allocator) noexcept;
53 ApiHandle() noexcept;
54 ~ApiHandle();
55 ApiHandle(const ApiHandle &) = delete;
56 ApiHandle(ApiHandle &&) = delete;
57 ApiHandle &operator=(const ApiHandle &) = delete;
58 ApiHandle &operator=(ApiHandle &&) = delete;
59
66 void InitializeLogging(LogLevel level, const char *filename);
67
74 void InitializeLogging(LogLevel level, FILE *fp);
75
80 void SetShutdownBehavior(ApiHandleShutdownBehavior behavior);
81
86 void SetBYOCryptoNewMD5Callback(Crypto::CreateHashCallback &&callback);
87
92 void SetBYOCryptoNewSHA256Callback(Crypto::CreateHashCallback &&callback);
93
98 void SetBYOCryptoNewSHA256HMACCallback(Crypto::CreateHMACCallback &&callback);
99
105 void SetBYOCryptoClientTlsCallback(Io::NewClientTlsHandlerCallback &&callback);
106
116 void SetBYOCryptoTlsContextCallbacks(
117 Io::NewTlsContextImplCallback &&newCallback,
118 Io::DeleteTlsContextImplCallback &&deleteCallback,
119 Io::IsTlsAlpnSupportedCallback &&alpnCallback);
120
122 static const Io::NewTlsContextImplCallback &GetBYOCryptoNewTlsContextImplCallback();
124 static const Io::DeleteTlsContextImplCallback &GetBYOCryptoDeleteTlsContextImplCallback();
126 static const Io::IsTlsAlpnSupportedCallback &GetBYOCryptoIsTlsAlpnSupportedCallback();
127
128 private:
129 void InitializeLoggingCommon(struct aws_logger_standard_options &options);
130
131 aws_logger m_logger;
132
133 ApiHandleShutdownBehavior m_shutdownBehavior;
134 };
135
141 AWS_CRT_CPP_API const char *ErrorDebugString(int error) noexcept;
142
146 AWS_CRT_CPP_API int LastError() noexcept;
147
152 AWS_CRT_CPP_API int LastErrorOrUnknown() noexcept;
153 } // namespace Crt
154} // namespace Aws
Bootstrap.h
EventLoopGroup.h
HMAC.h
Hash.h
TlsOptions.h
Types.h
Aws::Crt::ApiHandle
Definition: Api.h:50
Aws::Crt::ApiHandle::ApiHandle
ApiHandle(ApiHandle &&)=delete
Aws::Crt::ApiHandle::operator=
ApiHandle & operator=(ApiHandle &&)=delete
Aws::Crt::ApiHandle::operator=
ApiHandle & operator=(const ApiHandle &)=delete
Aws::Crt::ApiHandle::ApiHandle
ApiHandle(const ApiHandle &)=delete
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition: Exports.h:37
MqttClient.h
Aws::Crt::Crypto::CreateHMACCallback
std::function< std::shared_ptr< ByoHMAC >(size_t digestSize, const ByteCursor &secret, Allocator *)> CreateHMACCallback
Definition: HMAC.h:146
Aws::Crt::Crypto::CreateHashCallback
std::function< std::shared_ptr< ByoHash >(size_t digestSize, Allocator *)> CreateHashCallback
Definition: Hash.h:164
Aws::Crt::Io::NewTlsContextImplCallback
std::function< void *(TlsContextOptions &, TlsMode, Allocator *)> NewTlsContextImplCallback
Definition: TlsOptions.h:367
Aws::Crt::Io::IsTlsAlpnSupportedCallback
std::function< bool()> IsTlsAlpnSupportedCallback
Definition: TlsOptions.h:369
Aws::Crt::Io::NewClientTlsHandlerCallback
std::function< std::shared_ptr< ClientTlsChannelHandler >(struct aws_channel_slot *slot, const struct aws_tls_connection_options &options, Allocator *allocator)> NewClientTlsHandlerCallback
Definition: TlsOptions.h:430
Aws::Crt::Io::DeleteTlsContextImplCallback
std::function< void(void *)> DeleteTlsContextImplCallback
Definition: TlsOptions.h:368
Aws::Crt::LastErrorOrUnknown
AWS_CRT_CPP_API int LastErrorOrUnknown() noexcept
Definition: Api.cpp:317
Aws::Crt::ApiHandleShutdownBehavior
ApiHandleShutdownBehavior
Definition: Api.h:40
Aws::Crt::ApiHandleShutdownBehavior::NonBlocking
@ NonBlocking
Aws::Crt::ApiHandleShutdownBehavior::Blocking
@ Blocking
Aws::Crt::ErrorDebugString
AWS_CRT_CPP_API const char * ErrorDebugString(int error) noexcept
Definition: Api.cpp:313
Aws::Crt::LogLevel
LogLevel
Definition: Api.h:24
Aws::Crt::LogLevel::Info
@ Info
Aws::Crt::LogLevel::Warn
@ Warn
Aws::Crt::LogLevel::None
@ None
Aws::Crt::LogLevel::Fatal
@ Fatal
Aws::Crt::LogLevel::Error
@ Error
Aws::Crt::LogLevel::Debug
@ Debug
Aws::Crt::LogLevel::Trace
@ Trace
Aws::Crt::LogLevel::Count
@ Count
Aws::Crt::Allocator
aws_allocator Allocator
Definition: StlAllocator.h:17
Aws::Crt::LastError
AWS_CRT_CPP_API int LastError() noexcept
Definition: Api.cpp:315
Aws
Definition: Api.h:17
error
Definition: cJSON.cpp:105