20#ifndef IOTMI_PAL_NETWORK_TRANSPORT_H_
21#define IOTMI_PAL_NETWORK_TRANSPORT_H_
27#include "core_pkcs11.h"
28#include "transport_interface.h"
37#define IOTMI_PSK_TOKEN_SIZE 32
42#define IOTMI_PSK_IDENTITY_SIZE 32
119 void* pBuffer,
size_t bytesToRecv);
128 const void* pBuffer,
size_t bytesToSend);
147 void* pCallbackContext);
149#if IOTMI_USE_WSS_PROVISIONEE == 1
160int32_t iotmiPal_tcpTransportConnect(
172 void* pBuffer,
size_t bytesToRecv);
182 const void* pBuffer,
size_t bytesToSend);
193int32_t iotmiPal_establishTLSWithSessionToken(
204uint32_t iotmiPal_htonl(uint32_t hostlong);
213uint32_t iotmiPal_ntohl(uint32_t netlong);
222uint16_t iotmiPal_ntohs(uint16_t netshort);
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....
void(* iotmiPal_TransportReceiveCallback_t)(void *pCallbackContext)
Callback function to be called when transport data is ready.
Definition iotmi_pal_NetworkTransport.h:86
int32_t iotmiPal_transportRecv(NetworkContextHandle_t networkContextHandle, void *pBuffer, size_t bytesToRecv)
Transport interface receive function implementation.
struct iotmiPal_SessionToken iotmiPal_SessionToken_t
Structure to hold session token information.
int32_t iotmiPal_transportSend(NetworkContextHandle_t networkContextHandle, const void *pBuffer, size_t bytesToSend)
Transport interface send function implementation.
int32_t iotmiPal_transportConnectPKCS11(NetworkContextHandle_t networkContextHandle, const char *pHostName, uint16_t port, const iotmiPal_TransportPkcs11Credentials_t *pTransportPkcs11Credentials)
Setup a mutual authenticated TLS connection.
#define IOTMI_PSK_TOKEN_SIZE
PSK token size in bytes (64 hex chars = 32 bytes)
Definition iotmi_pal_NetworkTransport.h:37
struct NetworkContext * NetworkContextHandle_t
Definition iotmi_pal_NetworkTransport.h:62
struct iotmiPal_TransportPkcs11Credentials iotmiPal_TransportPkcs11Credentials_t
Contains the credentials necessary for TLS connection setup.
#define IOTMI_PSK_IDENTITY_SIZE
PSK identity size (32 hex chars)
Definition iotmi_pal_NetworkTransport.h:42
void iotmiPal_transportDisconnect(NetworkContextHandle_t networkContextHandle)
Disconnect TLS connection.
Structure to hold session token information.
Definition iotmi_pal_NetworkTransport.h:47
uint8_t token[IOTMI_PSK_TOKEN_SIZE]
Authentication token as 32-byte PSK key.
Definition iotmi_pal_NetworkTransport.h:49
size_t tokenIdLength
Length of the token ID.
Definition iotmi_pal_NetworkTransport.h:55
size_t tokenLength
Length of the token (always 32 for PSK)
Definition iotmi_pal_NetworkTransport.h:53
char tokenId[IOTMI_PSK_IDENTITY_SIZE+1U]
Token ID string.
Definition iotmi_pal_NetworkTransport.h:51
Contains the credentials necessary for TLS connection setup.
Definition iotmi_pal_NetworkTransport.h:67
char * pPrivateKeyLabel
String representing the PKCS #11 label for the private key.
Definition iotmi_pal_NetworkTransport.h:76
CK_SESSION_HANDLE p11Session
PKCS #11 session handle.
Definition iotmi_pal_NetworkTransport.h:71
char * pRootCaLabel
String representing the PKCS #11 label for the trusted server root certificate.
Definition iotmi_pal_NetworkTransport.h:72
char ** pAlpnProtos
ALPN protocol to use. If not NULL, alpn protocols are provided in a null terminated array of null ter...
Definition iotmi_pal_NetworkTransport.h:69
char * pClientCertLabel
String representing the PKCS #11 label for the client certificate.
Definition iotmi_pal_NetworkTransport.h:74