AWS IoT Device SDK C++ v2  1.34.0
AWS IoT Device SDK C++ v2
Classes | Public Member Functions | Static Public Member Functions | List of all members
Aws::Crt::ApiHandle Class Reference

#include <Api.h>

Classes

struct  Version
 

Public Member Functions

 ApiHandle (Allocator *allocator) noexcept
 
 ApiHandle () noexcept
 
 ~ApiHandle ()
 
 ApiHandle (const ApiHandle &)=delete
 
 ApiHandle (ApiHandle &&)=delete
 
ApiHandleoperator= (const ApiHandle &)=delete
 
ApiHandleoperator= (ApiHandle &&)=delete
 
void InitializeLogging (LogLevel level, const char *filename)
 
void InitializeLogging (LogLevel level, FILE *fp)
 
void SetShutdownBehavior (ApiHandleShutdownBehavior behavior)
 
void SetBYOCryptoNewMD5Callback (Crypto::CreateHashCallback &&callback)
 
void SetBYOCryptoNewSHA256Callback (Crypto::CreateHashCallback &&callback)
 
void SetBYOCryptoNewSHA1Callback (Crypto::CreateHashCallback &&callback)
 
void SetBYOCryptoNewSHA256HMACCallback (Crypto::CreateHMACCallback &&callback)
 
void SetBYOCryptoClientTlsCallback (Io::NewClientTlsHandlerCallback &&callback)
 
void SetBYOCryptoTlsContextCallbacks (Io::NewTlsContextImplCallback &&newCallback, Io::DeleteTlsContextImplCallback &&deleteCallback, Io::IsTlsAlpnSupportedCallback &&alpnCallback)
 
Version GetCrtVersion () const
 

Static Public Member Functions

static Io::ClientBootstrapGetOrCreateStaticDefaultClientBootstrap ()
 
static Io::EventLoopGroupGetOrCreateStaticDefaultEventLoopGroup ()
 
static Io::HostResolverGetOrCreateStaticDefaultHostResolver ()
 

Detailed Description

A singleton object representing the init/cleanup state of the entire CRT. It's invalid to have more than one active simultaneously and it's also invalid to use CRT functionality without one active.

Constructor & Destructor Documentation

◆ ApiHandle() [1/4]

Aws::Crt::ApiHandle::ApiHandle ( Allocator allocator)
noexcept

Customize the ApiAllocator(), which is be used by any objects constructed without an explicit allocator.

◆ ApiHandle() [2/4]

Aws::Crt::ApiHandle::ApiHandle ( )
noexcept

◆ ~ApiHandle()

Aws::Crt::ApiHandle::~ApiHandle ( )

◆ ApiHandle() [3/4]

Aws::Crt::ApiHandle::ApiHandle ( const ApiHandle )
delete

◆ ApiHandle() [4/4]

Aws::Crt::ApiHandle::ApiHandle ( ApiHandle &&  )
delete

Member Function Documentation

◆ GetCrtVersion()

ApiHandle::Version Aws::Crt::ApiHandle::GetCrtVersion ( ) const

Gets the version of the AWS-CRT-CPP library

Returns
Version representing the library version

◆ GetOrCreateStaticDefaultClientBootstrap()

Io::ClientBootstrap * Aws::Crt::ApiHandle::GetOrCreateStaticDefaultClientBootstrap ( )
static

Gets the static default ClientBootstrap, creating it if necessary.

This default will be used when a ClientBootstrap is not explicitly passed but is needed to allow the process to function. An example of this would be in the MQTT connection creation workflow. The default ClientBootstrap will use the default EventLoopGroup and HostResolver, creating them if necessary.

The default ClientBootstrap will be automatically managed and released by the API handle when it's resources are being freed, not requiring any manual memory management.

Returns
ClientBootstrap* A pointer to the static default ClientBootstrap

◆ GetOrCreateStaticDefaultEventLoopGroup()

Io::EventLoopGroup * Aws::Crt::ApiHandle::GetOrCreateStaticDefaultEventLoopGroup ( )
static

Gets the static default EventLoopGroup, creating it if necessary.

This default will be used when a EventLoopGroup is not explicitly passed but is needed to allow the process to function. An example of this would be in the MQTT connection creation workflow.

The EventLoopGroup will automatically pick a default number of threads based on the system. You can manually adjust the number of threads being used by creating a EventLoopGroup and passing it through the SetDefaultEventLoopGroup function.

The default EventLoopGroup will be automatically managed and released by the API handle when it's resources are being freed, not requiring any manual memory management.

Returns
EventLoopGroup* A pointer to the static default EventLoopGroup

◆ GetOrCreateStaticDefaultHostResolver()

Io::HostResolver * Aws::Crt::ApiHandle::GetOrCreateStaticDefaultHostResolver ( )
static

Gets the static default HostResolver, creating it if necessary.

This default will be used when a HostResolver is not explicitly passed but is needed to allow the process to function. An example of this would be in the MQTT connection creation workflow.

The HostResolver will be set to have a maximum of 8 entries by default. You can manually adjust the maximum number of entries being used by creating a HostResolver and passing it through the SetDefaultEventLoopGroup function.

The default HostResolver will be automatically managed and released by the API handle when it's resources are being freed, not requiring any manual memory management.

Returns
HostResolver* A pointer to the static default HostResolver

◆ InitializeLogging() [1/2]

void Aws::Crt::ApiHandle::InitializeLogging ( LogLevel  level,
const char *  filename 
)

Initialize logging in awscrt.

Parameters
levelDisplay messages of this importance and higher. LogLevel.NoLogs will disable logging.
filenameLogging destination, a file path from the disk.

◆ InitializeLogging() [2/2]

void Aws::Crt::ApiHandle::InitializeLogging ( LogLevel  level,
FILE *  fp 
)

Initialize logging in awscrt.

Parameters
levelDisplay messages of this importance and higher. LogLevel.NoLogs will disable logging.
fpThe FILE object for logging destination.

◆ operator=() [1/2]

ApiHandle& Aws::Crt::ApiHandle::operator= ( ApiHandle &&  )
delete

◆ operator=() [2/2]

ApiHandle& Aws::Crt::ApiHandle::operator= ( const ApiHandle )
delete

◆ SetBYOCryptoClientTlsCallback()

void Aws::Crt::ApiHandle::SetBYOCryptoClientTlsCallback ( Io::NewClientTlsHandlerCallback &&  callback)

BYO_CRYPTO: set callback for creating a ClientTlsChannelHandler. If using BYO_CRYPTO, you must call this prior to creating any client channels in the application.

◆ SetBYOCryptoNewMD5Callback()

void Aws::Crt::ApiHandle::SetBYOCryptoNewMD5Callback ( Crypto::CreateHashCallback &&  callback)

BYO_CRYPTO: set callback for creating MD5 hashes. If using BYO_CRYPTO, you must call this.

◆ SetBYOCryptoNewSHA1Callback()

void Aws::Crt::ApiHandle::SetBYOCryptoNewSHA1Callback ( Crypto::CreateHashCallback &&  callback)

BYO_CRYPTO: set callback for creating SHA1 hashes. If using BYO_CRYPTO, you must call this.

◆ SetBYOCryptoNewSHA256Callback()

void Aws::Crt::ApiHandle::SetBYOCryptoNewSHA256Callback ( Crypto::CreateHashCallback &&  callback)

BYO_CRYPTO: set callback for creating SHA256 hashes. If using BYO_CRYPTO, you must call this.

◆ SetBYOCryptoNewSHA256HMACCallback()

void Aws::Crt::ApiHandle::SetBYOCryptoNewSHA256HMACCallback ( Crypto::CreateHMACCallback &&  callback)

BYO_CRYPTO: set callback for creating Streaming SHA256 HMAC objects. If using BYO_CRYPTO, you must call this.

◆ SetBYOCryptoTlsContextCallbacks()

void Aws::Crt::ApiHandle::SetBYOCryptoTlsContextCallbacks ( Io::NewTlsContextImplCallback &&  newCallback,
Io::DeleteTlsContextImplCallback &&  deleteCallback,
Io::IsTlsAlpnSupportedCallback &&  alpnCallback 
)

BYO_CRYPTO: set callbacks for the TlsContext. If using BYO_CRYPTO, you need to call this function prior to creating a TlsContext.

Parameters
newCallbackCreate custom implementation object, to be stored inside TlsContext. Return nullptr if failure occurs.
deleteCallbackDestroy object that was created by newCallback.
alpnCallbackReturn whether ALPN is supported.

◆ SetShutdownBehavior()

void Aws::Crt::ApiHandle::SetShutdownBehavior ( ApiHandleShutdownBehavior  behavior)

Configures the shutdown behavior of the api handle instance

Parameters
behaviordesired shutdown behavior

The documentation for this class was generated from the following files: