PolarSSL v1.3.4
ssl_cache.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SSL_CACHE_H
28 #define POLARSSL_SSL_CACHE_H
29 
30 #include "ssl.h"
31 
32 #if defined(POLARSSL_THREADING_C)
33 #include "threading.h"
34 #endif
35 
36 #if !defined(POLARSSL_CONFIG_OPTIONS)
37 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
38 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
39 #endif /* !POLARSSL_CONFIG_OPTIONS */
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
47 
52 {
53 #if defined(POLARSSL_HAVE_TIME)
54  time_t timestamp;
55 #endif
57 #if defined(POLARSSL_X509_CRT_PARSE_C)
59 #endif
61 };
62 
67 {
69  int timeout;
71 #if defined(POLARSSL_THREADING_C)
72  threading_mutex_t mutex;
73 #endif
74 };
75 
81 void ssl_cache_init( ssl_cache_context *cache );
82 
90 int ssl_cache_get( void *data, ssl_session *session );
91 
99 int ssl_cache_set( void *data, const ssl_session *session );
100 
101 #if defined(POLARSSL_HAVE_TIME)
102 
111 void ssl_cache_set_timeout( ssl_cache_context *cache, int timeout );
112 #endif /* POLARSSL_HAVE_TIME */
113 
121 void ssl_cache_set_max_entries( ssl_cache_context *cache, int max );
122 
128 void ssl_cache_free( ssl_cache_context *cache );
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* ssl_cache.h */
void ssl_cache_init(ssl_cache_context *cache)
Initialize an SSL cache context.
ssl_cache_entry * next
Definition: ssl_cache.h:60
ssl_cache_entry * chain
Definition: ssl_cache.h:68
int ssl_cache_get(void *data, ssl_session *session)
Cache get callback implementation (Thread-safe if POLARSSL_THREADING_C is enabled) ...
x509_buf peer_cert
Definition: ssl_cache.h:58
void ssl_cache_free(ssl_cache_context *cache)
Free referenced items in a cache context and clear memory.
Cache context.
Definition: ssl_cache.h:66
This structure is used for storing cache entries.
Definition: ssl_cache.h:51
Threading abstraction layer.
ssl_session session
Definition: ssl_cache.h:56
void ssl_cache_set_timeout(ssl_cache_context *cache, int timeout)
Set the cache timeout (Default: SSL_CACHE_DEFAULT_TIMEOUT (1 day))
Type-length-value structure that allows for ASN1 using DER.
Definition: asn1.h:116
void ssl_cache_set_max_entries(ssl_cache_context *cache, int max)
Set the cache timeout (Default: SSL_CACHE_DEFAULT_MAX_ENTRIES (50))
time_t timestamp
Definition: ssl_cache.h:54
SSL/TLS functions.
int ssl_cache_set(void *data, const ssl_session *session)
Cache set callback implementation (Thread-safe if POLARSSL_THREADING_C is enabled) ...