this is fork and i will modify for STM32

Fork of AWS-test by Pierre-Marie Ancèle

Embed: (wiki syntax)

« Back to documentation index

network_interface.h File Reference

network_interface.h File Reference

Network interface definition for MQTT client. More...

Go to the source code of this file.

Data Structures

struct  TLSConnectParams
 TLS Connection Parameters. More...
struct  Network
 Network Structure. More...

Typedefs

typedef struct Network Network
 Network Type.

Functions

IoT_Error_t iot_tls_init (Network *pNetwork, char *pRootCALocation, char *pDeviceCertLocation, char *pDevicePrivateKeyLocation, char *pDestinationURL, uint16_t DestinationPort, uint32_t timeout_ms, bool ServerVerificationFlag)
 Initialize the TLS implementation.
IoT_Error_t iot_tls_connect (Network *pNetwork, TLSConnectParams *TLSParams)
 Create a TLS socket and open the connection.
IoT_Error_t iot_tls_write (Network *, unsigned char *, size_t, TimerAWS *, size_t *)
 Write bytes to the network socket.
IoT_Error_t iot_tls_read (Network *, unsigned char *, size_t, TimerAWS *, size_t *)
 Read bytes from the network socket.
IoT_Error_t iot_tls_disconnect (Network *pNetwork)
 Disconnect from network socket.
IoT_Error_t iot_tls_destroy (Network *pNetwork)
 Perform any tear-down or cleanup of TLS layer.
IoT_Error_t iot_tls_is_connected (Network *pNetwork)
 Check if TLS layer is still connected.

Detailed Description

Network interface definition for MQTT client.

Defines an interface to the TLS layer to be used by the MQTT client. Starting point for porting the SDK to the networking layer of a new platform.

Definition in file network_interface.h.


Typedef Documentation

typedef struct Network Network

Network Type.

Defines a type for the network struct. See structure definition below.

Definition at line 42 of file network_interface.h.


Function Documentation

IoT_Error_t iot_tls_connect ( Network pNetwork,
TLSConnectParams TLSParams 
)

Create a TLS socket and open the connection.

Creates an open socket connection including TLS handshake.

Parameters:
pNetwork- Pointer to a Network struct defining the network interface.
TLSParams- TLSConnectParams defines the properties of the TLS connection.
Returns:
IoT_Error_t - successful connection or TLS error

Definition at line 92 of file network_mbedtls_wrapper.cpp.

IoT_Error_t iot_tls_destroy ( Network pNetwork )

Perform any tear-down or cleanup of TLS layer.

Called to cleanup any resources required for the TLS layer.

Parameters:
Network- Pointer to a Network struct defining the network interface
Returns:
IoT_Error_t - successful cleanup or TLS error code

Definition at line 347 of file network_mbedtls_wrapper.cpp.

IoT_Error_t iot_tls_disconnect ( Network pNetwork )

Disconnect from network socket.

Parameters:
Network- Pointer to a Network struct defining the network interface.
Returns:
IoT_Error_t - successful read or TLS error code

Definition at line 334 of file network_mbedtls_wrapper.cpp.

IoT_Error_t iot_tls_init ( Network pNetwork,
char *  pRootCALocation,
char *  pDeviceCertLocation,
char *  pDevicePrivateKeyLocation,
char *  pDestinationURL,
uint16_t  DestinationPort,
uint32_t  timeout_ms,
bool  ServerVerificationFlag 
)

Initialize the TLS implementation.

Perform any initialization required by the TLS layer. Connects the interface to implementation by setting up the network layer function pointers to platform implementations.

Parameters:
pNetwork- Pointer to a Network struct defining the network interface.
pRootCALocation- Path of the location of the Root CA
pDeviceCertLocation- Path to the location of the Device Cert
pDevicyPrivateKeyLocation- Path to the location of the device private key file
pDestinationURL- The target endpoint to connect to
DestinationPort- The port on the target to connect to
timeout_ms- The value to use for timeout of operation
ServerVerificationFlag- used to decide whether server verification is needed or not
Returns:
IoT_Error_t - successful initialization or TLS error

Definition at line 69 of file network_mbedtls_wrapper.cpp.

IoT_Error_t iot_tls_is_connected ( Network pNetwork )

Check if TLS layer is still connected.

Called to check if the TLS layer is still connected or not.

Parameters:
Network- Pointer to a Network struct defining the network interface
Returns:
IoT_Error_t - TLS error code indicating status of network physical layer connection

Definition at line 87 of file network_mbedtls_wrapper.cpp.

IoT_Error_t iot_tls_read ( Network ,
unsigned char *  ,
size_t  ,
TimerAWS ,
size_t *   
)

Read bytes from the network socket.

Parameters:
Network- Pointer to a Network struct defining the network interface.
unsignedchar pointer - pointer to buffer where read bytes should be copied
size_t- number of bytes to read
Timer* - operation timer
size_t- pointer to store number of bytes read
Returns:
IoT_Error_t - successful read or TLS error code

Definition at line 300 of file network_mbedtls_wrapper.cpp.

IoT_Error_t iot_tls_write ( Network ,
unsigned char *  ,
size_t  ,
TimerAWS ,
size_t *   
)

Write bytes to the network socket.

Parameters:
Network- Pointer to a Network struct defining the network interface.
unsignedchar pointer - buffer to write to socket
integer- number of bytes to write
Timer* - operation timer
Returns:
integer - number of bytes written or TLS error
IoT_Error_t - successful write or TLS error code

Definition at line 266 of file network_mbedtls_wrapper.cpp.