aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Api.h
Go to the documentation of this file.
1#pragma once
6#include <aws/crt/Types.h>
13
14#include <aws/common/logging.h>
15
16namespace Aws
17{
18 namespace Crt
19 {
20 enum class LogLevel
21 {
22 None = AWS_LL_NONE,
23 Fatal = AWS_LL_FATAL,
24 Error = AWS_LL_ERROR,
25 Warn = AWS_LL_WARN,
26 Info = AWS_LL_INFO,
27 Debug = AWS_LL_DEBUG,
28 Trace = AWS_LL_TRACE,
29
30 Count
31 };
32
34 {
37 };
38
40 {
41 public:
42 ApiHandle(Allocator *allocator) noexcept;
43 ApiHandle() noexcept;
44 ~ApiHandle();
45 ApiHandle(const ApiHandle &) = delete;
46 ApiHandle(ApiHandle &&) = delete;
47 ApiHandle &operator=(const ApiHandle &) = delete;
55 void InitializeLogging(LogLevel level, const char *filename);
62 void InitializeLogging(LogLevel level, FILE *fp);
63
68 void SetShutdownBehavior(ApiHandleShutdownBehavior behavior);
69
74 void SetBYOCryptoNewMD5Callback(Crypto::CreateHashCallback &&callback);
75
80 void SetBYOCryptoNewSHA256Callback(Crypto::CreateHashCallback &&callback);
81
86 void SetBYOCryptoNewSHA256HMACCallback(Crypto::CreateHMACCallback &&callback);
87
93 void SetBYOCryptoClientTlsCallback(Io::NewClientTlsHandlerCallback &&callback);
94
104 void SetBYOCryptoTlsContextCallbacks(
105 Io::NewTlsContextImplCallback &&newCallback,
106 Io::DeleteTlsContextImplCallback &&deleteCallback,
107 Io::IsTlsAlpnSupportedCallback &&alpnCallback);
108
110 static const Io::NewTlsContextImplCallback &GetBYOCryptoNewTlsContextImplCallback();
112 static const Io::DeleteTlsContextImplCallback &GetBYOCryptoDeleteTlsContextImplCallback();
114 static const Io::IsTlsAlpnSupportedCallback &GetBYOCryptoIsTlsAlpnSupportedCallback();
115
116 private:
117 void InitializeLoggingCommon(struct aws_logger_standard_options &options);
118
119 aws_logger m_logger;
120
121 ApiHandleShutdownBehavior m_shutdownBehavior;
122 };
123
124 AWS_CRT_CPP_API const char *ErrorDebugString(int error) noexcept;
128 AWS_CRT_CPP_API int LastError() noexcept;
133 AWS_CRT_CPP_API int LastErrorOrUnknown() noexcept;
134 } // namespace Crt
135} // namespace Aws
#define AWS_CRT_CPP_API
Definition: Exports.h:37
Definition: Api.h:40
ApiHandle(ApiHandle &&)=delete
ApiHandle & operator=(ApiHandle &&)=delete
ApiHandle & operator=(const ApiHandle &)=delete
ApiHandle(const ApiHandle &)=delete
std::function< std::shared_ptr< ByoHMAC >(size_t digestSize, const ByteCursor &secret, Allocator *)> CreateHMACCallback
Definition: HMAC.h:146
std::function< std::shared_ptr< ByoHash >(size_t digestSize, Allocator *)> CreateHashCallback
Definition: Hash.h:164
std::function< void *(TlsContextOptions &, TlsMode, Allocator *)> NewTlsContextImplCallback
Definition: TlsOptions.h:248
std::function< bool()> IsTlsAlpnSupportedCallback
Definition: TlsOptions.h:250
std::function< std::shared_ptr< ClientTlsChannelHandler >(struct aws_channel_slot *slot, const struct aws_tls_connection_options &options, Allocator *allocator)> NewClientTlsHandlerCallback
Definition: TlsOptions.h:311
std::function< void(void *)> DeleteTlsContextImplCallback
Definition: TlsOptions.h:249
AWS_CRT_CPP_API int LastErrorOrUnknown() noexcept
Definition: Api.cpp:317
ApiHandleShutdownBehavior
Definition: Api.h:34
AWS_CRT_CPP_API const char * ErrorDebugString(int error) noexcept
Definition: Api.cpp:313
LogLevel
Definition: Api.h:21
aws_allocator Allocator
Definition: StlAllocator.h:17
AWS_CRT_CPP_API int LastError() noexcept
Definition: Api.cpp:315
Definition: Api.h:17
Definition: cJSON.cpp:105