![]() |
TrustCore SDK NanoSSL API reference
version 7.0
|
Synchronous NanoSSL client and server functions. More...
Functions | |
MOC_EXTERN sbyte4 | SSL_checkRehandshakeTimer (sbyte4 connectionInstance) |
Timer check for rehandshaking. More... | |
MOC_EXTERN sbyte4 | SSL_closeConnection (sbyte4 connectionInstance) |
Close an SSL session and release resources. More... | |
MOC_EXTERN sbyte4 | SSL_init (sbyte4 numServerConnections, sbyte4 numClientConnections) |
Initialize NanoSSL client or server internal structures. More... | |
MOC_EXTERN sbyte4 | SSL_negotiateConnection (sbyte4 connectionInstance) |
Establish a secure SSL client-server connection. More... | |
MOC_EXTERN sbyte4 | SSL_recv (sbyte4 connectionInstance, sbyte *pRetBuffer, sbyte4 bufferSize, sbyte4 *pNumBytesReceived, ubyte4 timeout) |
Get data from a connected server/client. More... | |
MOC_EXTERN sbyte4 | SSL_recvPending (sbyte4 connectionInstance, sbyte4 *pRetBooleanIsPending) |
Test if a connection instance's SSL receive buffer contains data. More... | |
MOC_EXTERN sbyte4 | SSL_send (sbyte4 connectionInstance, sbyte *pBuffer, sbyte4 bufferSize) |
Send data to a connected server/client. More... | |
MOC_EXTERN sbyte4 | SSL_sendPending (sbyte4 connectionInstance, sbyte4 *pNumBytesPending) |
Determines whether there is data in a connection instance's SSL send buffer. More... | |
MOC_EXTERN sbyte4 SSL_checkRehandshakeTimer | ( | sbyte4 | connectionInstance | ) |
This function checks whether a rehandshaking request for the server SSL session has timed out, and if so, calls the callback function. If timeout occurs, it will call the callback function to initiate the rehandshake.
To enable this function, the following flag must be defined in moptions.h:
__ENABLE_MOCANA_SSL_REHANDSHAKE__
Additionally, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_closeConnection | ( | sbyte4 | connectionInstance | ) |
This function closes a synchronous SSL session and releases all the resources that are managed by the NanoSSL client/server.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_init | ( | sbyte4 | numServerConnections, |
sbyte4 | numClientConnections | ||
) |
This function initializes NanoSSL client/server internal structures. Your application should call this function before starting the HTTPS and application servers.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
numServerConnections | Maximum number of SSL/TLS server connections to allow. (Each connection requires only a few bytes of memory.) |
numClientConnections | Maximum number of SSL/TLS client connections to allow. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_negotiateConnection | ( | sbyte4 | connectionInstance | ) |
This function performs SSL handshaking, establishing a secure connection between a client and server. Before calling this function, you must first create a connection context (instance) by calling SSL_connect().
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_recv | ( | sbyte4 | connectionInstance, |
sbyte * | pRetBuffer, | ||
sbyte4 | bufferSize, | ||
sbyte4 * | pNumBytesReceived, | ||
ubyte4 | timeout | ||
) |
This function retrieves data from a connected server/client. It should not be called until an SSL connection is established between the client and server.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
pRetBuffer | Pointer to the buffer in which to write the received data. |
bufferSize | Number of bytes in receive data buffer. |
pNumBytesReceived | On return, pointer to the number of bytes received. |
timeout | Number of milliseconds the client/server will wait to receive the message. To specify no timeout (an infinite wait), set this parameter to 0. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_recvPending | ( | sbyte4 | connectionInstance, |
sbyte4 * | pRetBooleanIsPending | ||
) |
This function determines whether there is data in a connection instance's SSL receive buffer, and returns either TRUE
or FALSE
accordingly.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
pRetBooleanIsPending | On return, contains TRUE if there is data to be received, or FALSE if no data is pending receipt. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_send | ( | sbyte4 | connectionInstance, |
sbyte * | pBuffer, | ||
sbyte4 | bufferSize | ||
) |
This function sends data to a connected server/client. It should not be called until a secure SSL connection is established between the client and server. A negative return value indicates that an error has occurred. A return value >= 0 indicates the number of bytes transmitted.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
pBuffer | Pointer to buffer containing the data to send. |
bufferSize | Number of bytes in pBuffer . |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_sendPending | ( | sbyte4 | connectionInstance, |
sbyte4 * | pNumBytesPending | ||
) |
This function determines whether there is data in a connection instance's SSL send buffer. If the send buffer is empty, zero (0) is returned through the pNumBytesPending
parameter. If send data is pending, an attempt is made to send the data, and the subsequent number of bytes remaining to be sent is returned through the pNumBytesPending
parameter. (A function return value of zero (0) indicates that the send was successful and that no data remains in the send buffer.)
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_SERVER__
connectionInstance | Connection instance returned from SSL_acceptconnection() or SSL_connect(). |
pNumBytesPending | On return, the number of bytes remaining in the SSL send buffer. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c