IoT managed integrations End Device SDK
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
iotmi_pal_NetworkTransport.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "core_pkcs11.h"
#include "transport_interface.h"

Go to the source code of this file.

Classes

struct  iotmiPal_SessionToken
 Structure to hold session token information. More...
 
struct  iotmiPal_TransportPkcs11Credentials
 Contains the credentials necessary for TLS connection setup. More...
 

Macros

#define IOTMI_PSK_TOKEN_SIZE   32
 PSK token size in bytes (64 hex chars = 32 bytes)
 
#define IOTMI_PSK_IDENTITY_SIZE   32
 PSK identity size (32 hex chars)
 

Typedefs

typedef struct iotmiPal_SessionToken iotmiPal_SessionToken_t
 Structure to hold session token information.
 
typedef struct NetworkContext * NetworkContextHandle_t
 
typedef struct iotmiPal_TransportPkcs11Credentials iotmiPal_TransportPkcs11Credentials_t
 Contains the credentials necessary for TLS connection setup.
 
typedef void(* iotmiPal_TransportReceiveCallback_t) (void *pCallbackContext)
 Callback function to be called when transport data is ready.
 

Functions

int32_t iotmiPal_transportConnectPKCS11 (NetworkContextHandle_t networkContextHandle, const char *pHostName, uint16_t port, const iotmiPal_TransportPkcs11Credentials_t *pTransportPkcs11Credentials)
 Setup a mutual authenticated TLS connection.
 
void iotmiPal_transportDisconnect (NetworkContextHandle_t networkContextHandle)
 Disconnect TLS connection.
 
int32_t iotmiPal_transportRecv (NetworkContextHandle_t networkContextHandle, void *pBuffer, size_t bytesToRecv)
 Transport interface receive function implementation.
 
int32_t iotmiPal_transportSend (NetworkContextHandle_t networkContextHandle, const void *pBuffer, size_t bytesToSend)
 Transport interface send function implementation.
 
int32_t iotmiPal_transportRegisterReceiveCallback (NetworkContextHandle_t networkContextHandle, iotmiPal_TransportReceiveCallback_t pReceiveCallback, void *pCallbackContext)
 Setup a callback function for receive. This function is called after a connection is setup. The pReceiveCallback receive callback function passed to the API is thread safe.
 

Detailed Description

This file defines network transport platform abstraction interface.

Typedef Documentation

◆ iotmiPal_TransportReceiveCallback_t

typedef void(* iotmiPal_TransportReceiveCallback_t) (void *pCallbackContext)

Callback function to be called when transport data is ready.

Parameters
[in]pCallbackContextThe pCallbackContext parameter passed in iotmiPal_transportRegisterReceiveCallback.

◆ NetworkContextHandle_t

typedef struct NetworkContext* NetworkContextHandle_t

The NetworkContext is an incomplete type. An implementation of this interface must define struct NetworkContext for the system's requirements.

Function Documentation

◆ iotmiPal_transportConnectPKCS11()

int32_t iotmiPal_transportConnectPKCS11 ( NetworkContextHandle_t  networkContextHandle,
const char *  pHostName,
uint16_t  port,
const iotmiPal_TransportPkcs11Credentials_t *  pTransportPkcs11Credentials 
)

Setup a mutual authenticated TLS connection.

Parameters
networkContextHandleport defined network context to setup the TLS connection.
pHostNameMQTT endpoint to connect.
portMQTT port to connect.
pTlsPkcs11CredentialsPKCS11 credentials for the TLS connection.
Returns
Return 0 for success. Return other value to indicate error.

◆ iotmiPal_transportDisconnect()

void iotmiPal_transportDisconnect ( NetworkContextHandle_t  networkContextHandle)

Disconnect TLS connection.

Parameters
networkContextHandleport defined network context to setup the TLS connection.

◆ iotmiPal_transportRecv()

int32_t iotmiPal_transportRecv ( NetworkContextHandle_t  networkContextHandle,
void *  pBuffer,
size_t  bytesToRecv 
)

◆ iotmiPal_transportRegisterReceiveCallback()

int32_t iotmiPal_transportRegisterReceiveCallback ( NetworkContextHandle_t  networkContextHandle,
iotmiPal_TransportReceiveCallback_t  pReceiveCallback,
void *  pCallbackContext 
)

Setup a callback function for receive. This function is called after a connection is setup. The pReceiveCallback receive callback function passed to the API is thread safe.

Parameters
[in]networkContextHandleport defined network context to setup the TLS connection.
[in]pReceiveCallbackReceive callback function to be called when transport data is ready.
[in]pCallbackContextcallback context to be passed in the pReceiveCallback callback function.
Returns
Return 0 for success. Return other value to indicate error.

◆ iotmiPal_transportSend()

int32_t iotmiPal_transportSend ( NetworkContextHandle_t  networkContextHandle,
const void *  pBuffer,
size_t  bytesToSend 
)