PolarSSL v1.3.9
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 
44 #if !defined(SSL_CACHE_DEFAULT_TIMEOUT)
45 #define SSL_CACHE_DEFAULT_TIMEOUT 86400
46 #endif
47 
48 #if !defined(SSL_CACHE_DEFAULT_MAX_ENTRIES)
49 #define SSL_CACHE_DEFAULT_MAX_ENTRIES 50
50 #endif
51 
52 /* \} name SECTION: Module settings */
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
59 typedef struct _ssl_cache_entry ssl_cache_entry;
60 
65 {
66 #if defined(POLARSSL_HAVE_TIME)
67  time_t timestamp;
68 #endif
70 #if defined(POLARSSL_X509_CRT_PARSE_C)
72 #endif
74 };
75 
80 {
82  int timeout;
84 #if defined(POLARSSL_THREADING_C)
85  threading_mutex_t mutex;
86 #endif
87 };
88 
95 
103 int ssl_cache_get( void *data, ssl_session *session );
104 
112 int ssl_cache_set( void *data, const ssl_session *session );
113 
114 #if defined(POLARSSL_HAVE_TIME)
124 void ssl_cache_set_timeout( ssl_cache_context *cache, int timeout );
125 #endif /* POLARSSL_HAVE_TIME */
126 
135 
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif /* ssl_cache.h */
SSL/TLS functions.
void ssl_cache_init(ssl_cache_context *cache)
Initialize an SSL cache context.
void ssl_cache_set_max_entries(ssl_cache_context *cache, int max)
Set the cache timeout (Default: SSL_CACHE_DEFAULT_MAX_ENTRIES (50))
void ssl_cache_set_timeout(ssl_cache_context *cache, int timeout)
Set the cache timeout (Default: SSL_CACHE_DEFAULT_TIMEOUT (1 day))
void ssl_cache_free(ssl_cache_context *cache)
Free referenced items in a cache context and clear memory.
int ssl_cache_get(void *data, ssl_session *session)
Cache get callback implementation (Thread-safe if POLARSSL_THREADING_C is enabled)
int ssl_cache_set(void *data, const ssl_session *session)
Cache set callback implementation (Thread-safe if POLARSSL_THREADING_C is enabled)
Type-length-value structure that allows for ASN1 using DER.
Definition: asn1.h:125
Cache context.
Definition: ssl_cache.h:80
ssl_cache_entry * chain
Definition: ssl_cache.h:81
This structure is used for storing cache entries.
Definition: ssl_cache.h:65
ssl_cache_entry * next
Definition: ssl_cache.h:73
x509_buf peer_cert
Definition: ssl_cache.h:71
ssl_session session
Definition: ssl_cache.h:69
time_t timestamp
Definition: ssl_cache.h:67
Threading abstraction layer.