ssl_cache.h

Go to the documentation of this file.
00001 
00023 #ifndef MBEDTLS_SSL_CACHE_H
00024 #define MBEDTLS_SSL_CACHE_H
00025 
00026 #include "ssl.h"
00027 
00028 #if defined(MBEDTLS_THREADING_C)
00029 #include "threading.h"
00030 #endif
00031 
00040 #if !defined(MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT)
00041 #define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT       86400   
00042 #endif
00043 
00044 #if !defined(MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES)
00045 #define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES      50   
00046 #endif
00047 
00048 /* \} name SECTION: Module settings */
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053 
00054 typedef struct mbedtls_ssl_cache_context mbedtls_ssl_cache_context;
00055 typedef struct mbedtls_ssl_cache_entry mbedtls_ssl_cache_entry;
00056 
00060 struct mbedtls_ssl_cache_entry
00061 {
00062 #if defined(MBEDTLS_HAVE_TIME)
00063     mbedtls_time_t timestamp;           
00064 #endif
00065     mbedtls_ssl_session session;        
00066 #if defined(MBEDTLS_X509_CRT_PARSE_C)
00067     mbedtls_x509_buf peer_cert;         
00068 #endif
00069     mbedtls_ssl_cache_entry *next;      
00070 };
00071 
00075 struct mbedtls_ssl_cache_context
00076 {
00077     mbedtls_ssl_cache_entry *chain;     
00078     int timeout;                
00079     int max_entries;            
00080 #if defined(MBEDTLS_THREADING_C)
00081     mbedtls_threading_mutex_t mutex;    
00082 #endif
00083 };
00084 
00090 void mbedtls_ssl_cache_init( mbedtls_ssl_cache_context *cache );
00091 
00099 int mbedtls_ssl_cache_get( void *data, mbedtls_ssl_session *session );
00100 
00108 int mbedtls_ssl_cache_set( void *data, const mbedtls_ssl_session *session );
00109 
00110 #if defined(MBEDTLS_HAVE_TIME)
00111 
00120 void mbedtls_ssl_cache_set_timeout( mbedtls_ssl_cache_context *cache, int timeout );
00121 #endif /* MBEDTLS_HAVE_TIME */
00122 
00130 void mbedtls_ssl_cache_set_max_entries( mbedtls_ssl_cache_context *cache, int max );
00131 
00137 void mbedtls_ssl_cache_free( mbedtls_ssl_cache_context *cache );
00138 
00139 #ifdef __cplusplus
00140 }
00141 #endif
00142 
00143 #endif /* ssl_cache.h */

Generated on 11 Mar 2017 for mbed TLS v2.4.2 by  doxygen 1.4.7