3.3.0.0R11
Software Development Kit
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
SSL Client

Functions

void ltrx_ssl_client_close (uint32_t sslSessionIdentifier)
 Close the SSL layer. More...
 
bool ltrx_ssl_client_connect (struct ltrx_ip_socket *ipSocket, uint32_t *sslSessionIdentifier)
 Open an SSL connection. More...
 
bool ltrx_ssl_client_receive (uint32_t sslSessionIdentifier, void *buffer, size_t bufferLength, size_t *bytesReceived, uint32_t blockTimeMsec)
 Receive data. More...
 
bool ltrx_ssl_client_send (uint32_t sslSessionIdentifier, const void *data, size_t length)
 Send the specified bytes of data. More...
 

Detailed Description

SSL Client is compliant with SSLv3, TLS 1.0, TLS 1.1, and TLS 1.2. Due to severe memory limitations, only a single connection instance is provided.

To use this API, follow these steps:

(1) Include the header file:

#include "ssl_client_module_libs.h"

(2) Declare the global pointer:

const struct ssl_client_external_functions *
    g_ssl_clientExternalFunctionEntry_pointer = 0;

(3) Initialize the pointer in your _module_startup routine:

void <your_module>_module_startup(void)
{
    g_ssl_clientExternalFunctionEntry_pointer =
        ltrx_module_functions_lookup("ssl_client");
    // Your module startup goes here.
}

Function Documentation

void ltrx_ssl_client_close ( uint32_t  sslSessionIdentifier)

Close the SSL layer.

This function blocks until completed. After this call, you must still close the TCP socket connection that was originally passed in to ltrx_ssl_client_connect().

Parameters
[in]sslSessionIdentifierSession identifier from your earlier call to ltrx_ssl_client_connect().
bool ltrx_ssl_client_connect ( struct ltrx_ip_socket *  ipSocket,
uint32_t *  sslSessionIdentifier 
)

Open an SSL connection.

First you must establish a TCP connection to the desired SSL Server; see the documentation for ltrx_tcp_connect().

Return values
trueSuccessful.
falseFailed.
Parameters
[in]ipSocketSocket for the TCP connection already established.
[out]sslSessionIdentifierSession identifier to be used with subsequent API calls.
bool ltrx_ssl_client_receive ( uint32_t  sslSessionIdentifier,
void *  buffer,
size_t  bufferLength,
size_t *  bytesReceived,
uint32_t  blockTimeMsec 
)

Receive data.

This function blocks until the timeout expires or at least one byte was received.

Return values
trueSuccess; see bytesReceived.
falseFailure; either bad parameters or the connection was lost.
Parameters
[in]sslSessionIdentifierSession identifier from your earlier call to ltrx_ssl_client_connect().
[out]bufferPoints to buffer that will receive data.
[in]bufferLengthMaximum number of bytes that buffer may hold; must be at least one.
[out]bytesReceivedThe number of bytes that were copied to buffer; possibly zero.
[in]blockTimeMsecMaximum time to wait in milliseconds.
bool ltrx_ssl_client_send ( uint32_t  sslSessionIdentifier,
const void *  data,
size_t  length 
)

Send the specified bytes of data.

This function blocks until completed.

Return values
trueAll of the data was sent.
falseThe connection was lost.
Parameters
[in]sslSessionIdentifierSession identifier from your earlier call to ltrx_ssl_client_connect().
[in]dataPoints to the data to be sent.
[in]lengthSpecifies how many bytes are to be sent.