SharkSSL™ Embedded SSL/TLS Stack
Client Session Cache Manager

Detailed Description

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:

const char* servers[]= {"", "", ""};
for(i=0 ; i < sizeof(servers)/sizeof(servers[0]); i++)
SOCKET sock;
se_connect(&sock, servers[i], 443)
SharkSslCon* scon = SharkSsl_createCon(&sharkSsl);
SharkSslSCMgrNode* scn = SharkSslSCMgr_get(&scMgr, scon, servers[i], 443);
SharkSslSCMgr_save(&scMgr, scon, servers[i], 443, scn);
// Secure connection code here, such as HTTPS
SharkSsl_terminateCon(&sharkSsl, scon);

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...


SHARKSSL_API void SharkSslSCMgr_constructor (SharkSslSCMgr *o, SharkSsl *ssl, U32 maxTime)
 Initialize a SharkSslSCMgr instance. More...
SHARKSSL_API SharkSslSCMgrNodeSharkSslSCMgr_get (SharkSslSCMgr *o, SharkSslCon *scon, const char *host, U16 port)
 Get and restore the session, if any.
SHARKSSL_API void SharkSslSCMgr_save (SharkSslSCMgr *o, SharkSslCon *scon, const char *host, U16 port, SharkSslSCMgrNode *n)
 Save the session, if any.

Function Documentation

◆ SharkSslSCMgr_constructor()

SHARKSSL_API void SharkSslSCMgr_constructor ( SharkSslSCMgr o,
SharkSsl ssl,
U32  maxTime 

Initialize a SharkSslSCMgr instance.

oan uninitialized static object or dynamically allocated object.
sslan initialized SharkSsl instance.
maxTimethe maximum time for stored sessions in seconds. A good value would be 60*60.