SharkSSL™ Embedded SSL/TLS Stack
|
Simplifies SSL client session management when connectiong to an arbitrary number of servers.
The SharkSSL Session Cache Manager (SharkSslSCMgr) is an optional plugin that simplifies SSL resumption for clients that are designed to connect to an arbitrary number of servers. An instance of the SharkSslSCMgr class maintains a time limited database of servers that have previously been connected and automatically resumes the SSL session for new connections when the server address is found in the database.
The following example illustrates how to use the SharkSslSCMgr. The example below is a code snippet from the sessioncache.c example, where error checking has been removed:
SharkSslSCMgr requires that the following SharkSSL features are enabled: SHARKSSL_SSL_CLIENT_CODE and SHARKSSL_ENABLE_SESSION_CACHE
Data Structures | |
struct | SharkSslSCMgrNode |
The handle returned by SharkSslSCMgr_get and passed into SharkSslSCMgr_save. More... | |
struct | SharkSslSCMgr |
See SharkSslSCMgr_constructor for details. More... | |
Functions | |
SHARKSSL_API void | SharkSslSCMgr_constructor (SharkSslSCMgr *o, SharkSsl *ssl, U32 maxTime) |
SharkSslSCMgr simplifies using the session API for TLS clients; the constructor initializes a SharkSslSCMgr instance. More... | |
SHARKSSL_API SharkSslSCMgrNode * | SharkSslSCMgr_get (SharkSslSCMgr *o, SharkSslCon *scon, const char *host, U16 port) |
Resume a session. More... | |
SHARKSSL_API int | SharkSslSCMgr_save (SharkSslSCMgr *o, SharkSslCon *scon, const char *host, U16 port) |
Save the session when SharkSslSCMgr_get returns NULL. More... | |
SHARKSSL_API void SharkSslSCMgr_constructor | ( | SharkSslSCMgr * | o, |
SharkSsl * | ssl, | ||
U32 | maxTime | ||
) |
SharkSslSCMgr simplifies using the session API for TLS clients; the constructor initializes a SharkSslSCMgr instance.
o | an uninitialized static object or dynamically allocated object. |
ssl | an initialized SharkSsl instance. |
maxTime | the maximum time for stored sessions in seconds. A good value would be 60*60. |
SHARKSSL_API SharkSslSCMgrNode * SharkSslSCMgr_get | ( | SharkSslSCMgr * | o, |
SharkSslCon * | scon, | ||
const char * | host, | ||
U16 | port | ||
) |
Resume a session.
The returned value is a handle and should not be modified by the client. The method returns NULL if no session could be resumed. The method must be called just after SharkSslCon_isHandshakeComplete() returns true.
SHARKSSL_API int SharkSslSCMgr_save | ( | SharkSslSCMgr * | o, |
SharkSslCon * | scon, | ||
const char * | host, | ||
U16 | port | ||
) |
Save the session when SharkSslSCMgr_get returns NULL.
It is an error calling this method if SharkSslSCMgr_get returns a handle. The method should be called when closing the connection and just before terminating the SharkSslCon object.
o | an initialized SharkSslSCMgrNode object |
scon | a valid SharkSslCon object. |
host | the server's domain name |
port | the server's port number e.g. 443 |