Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
secure

Converts an (insecure) TCP connection with a remote server into a secure TLS-over-TCP connection.

It may be called after both of the following:

Functions

sint8 secure (SOCKET sock)
 

sint8 secure ( SOCKET  sock)
Converts an (insecure) TCP connection with a remote server into a secure TLS-over-TCP connection.
It may be called after both of the following:\n
- a TCP socket has been created by the @ref socket function, with u8Config parameter set to
@ref SOCKET_CONFIG_SSL_DELAY.\n
- a successful connection has been made on the socket via the @ref connect function.
This is an asynchronous API; the application socket callback function is notified of the result
of the attempt to make the connection secure through the event @ref SOCKET_MSG_SECURE, along
with a structure @ref tstrSocketConnectMsg.
If the attempt to make the connection secure fails, the application should call @ref close().
Parameters
[in]sockSocket ID, corresponding to a connected TCP socket.
Precondition
socket and connect must be called to connect a TCP socket before passing the socket ID to this function. Value SOCKET_CONFIG_SSL_DELAY must have been set in the u8Config parameter that was passed to socket.
See Also
socket connect
Returns
The function returns SOCK_ERR_NO_ERROR for successful operations and a negative error value otherwise. The possible error values are:
Parameters
[in]sockSocket ID, corresponding to a connected TCP socket.
Precondition
socket and connect must be called to connect a TCP socket before passing the socket ID to this function. Value SOCKET_CONFIG_SSL_DELAY must have been set in the u8Config parameter that was passed to socket.
See Also
socket connect
Returns
The function returns SOCK_ERR_NO_ERROR for successful operations and a negative error value otherwise. The possible error values are:

References MAX_SOCKET, NULL, tstrConnectCmd::sock, SOCK_ERR_INVALID, SOCK_ERR_INVALID_ARG, SOCK_ERR_NO_ERROR, SOCKET_CMD_SECURE, SOCKET_REQUEST, SSL_FLAGS_ACTIVE, SSL_FLAGS_DELAY, tstrSocket::u16SessionID, tstrConnectCmd::u16SessionID, tstrSocket::u8SSLFlags, and tstrConnectCmd::u8SslFlags.