SSL_CTX_sess_set_get_cb.pod 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_sess_set_new_cb, SSL_CTX_sess_set_remove_cb, SSL_CTX_sess_set_get_cb, SSL_CTX_sess_get_new_cb, SSL_CTX_sess_get_remove_cb, SSL_CTX_sess_get_get_cb - provide callback functions for server side external session caching
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
  7. int (*new_session_cb)(SSL *, SSL_SESSION *));
  8. void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
  9. void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *));
  10. void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
  11. SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *));
  12. int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess);
  13. void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
  14. SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *data, int len, int *copy);
  15. int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess);
  16. void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
  17. SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,
  18. int len, int *copy);
  19. =head1 DESCRIPTION
  20. SSL_CTX_sess_set_new_cb() sets the callback function, which is automatically
  21. called whenever a new session was negotiated.
  22. SSL_CTX_sess_set_remove_cb() sets the callback function, which is
  23. automatically called whenever a session is removed by the SSL engine,
  24. because it is considered faulty or the session has become obsolete because
  25. of exceeding the timeout value.
  26. SSL_CTX_sess_set_get_cb() sets the callback function which is called,
  27. whenever a SSL/TLS client proposed to resume a session but the session
  28. could not be found in the internal session cache (see
  29. L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>).
  30. (SSL/TLS server only.)
  31. SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb(), and
  32. SSL_CTX_sess_get_get_cb() allow to retrieve the function pointers of the
  33. provided callback functions. If a callback function has not been set,
  34. the NULL pointer is returned.
  35. =head1 NOTES
  36. In order to allow external session caching, synchronization with the internal
  37. session cache is realized via callback functions. Inside these callback
  38. functions, session can be saved to disk or put into a database using the
  39. L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> interface.
  40. The new_session_cb() is called, whenever a new session has been negotiated
  41. and session caching is enabled (see
  42. L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>).
  43. The new_session_cb() is passed the B<ssl> connection and the ssl session
  44. B<sess>. If the callback returns B<0>, the session will be immediately
  45. removed again.
  46. The remove_session_cb() is called, whenever the SSL engine removes a session
  47. from the internal cache. This happens when the session is removed because
  48. it is expired or when a connection was not shutdown cleanly. It also happens
  49. for all sessions in the internal session cache when
  50. L<SSL_CTX_free(3)|SSL_CTX_free(3)> is called. The remove_session_cb() is passed
  51. the B<ctx> and the ssl session B<sess>. It does not provide any feedback.
  52. The get_session_cb() is only called on SSL/TLS servers with the session id
  53. proposed by the client. The get_session_cb() is always called, also when
  54. session caching was disabled. The get_session_cb() is passed the
  55. B<ssl> connection, the session id of length B<length> at the memory location
  56. B<data>. With the parameter B<copy> the callback can require the
  57. SSL engine to increment the reference count of the SSL_SESSION object,
  58. Normally the reference count is not incremented and therefore the
  59. session must not be explicitly freed with
  60. L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>.
  61. =head1 SEE ALSO
  62. L<ssl(3)|ssl(3)>, L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>,
  63. L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>,
  64. L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>,
  65. L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>,
  66. L<SSL_CTX_free(3)|SSL_CTX_free(3)>
  67. =cut