SSL_CTX_add_session.pod 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_add_session, SSL_add_session, SSL_CTX_remove_session, SSL_remove_session - manipulate session cache
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
  7. int SSL_add_session(SSL_CTX *ctx, SSL_SESSION *c);
  8. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
  9. int SSL_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
  10. =head1 DESCRIPTION
  11. SSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The
  12. reference count for session B<c> is incremented by 1. If a session with
  13. the same session id already exists, the old session is removed by calling
  14. L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>.
  15. SSL_CTX_remove_session() removes the session B<c> from the context B<ctx>.
  16. L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> is called once for B<c>.
  17. SSL_add_session() and SSL_remove_session() are synonyms for their
  18. SSL_CTX_*() counterparts.
  19. =head1 NOTES
  20. When adding a new session to the internal session cache, it is examined
  21. whether a session with the same session id already exists. In this case
  22. it is assumed that both sessions are identical. If the same session is
  23. stored in a different SSL_SESSION object, The old session is
  24. removed and replaced by the new session. If the session is actually
  25. identical (the SSL_SESSION object is identical), SSL_CTX_add_session()
  26. is a no-op, and the return value is 0.
  27. If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE
  28. flag then the internal cache will not be populated automatically by new
  29. sessions negotiated by the SSL/TLS implementation, even though the internal
  30. cache will be searched automatically for session-resume requests (the
  31. latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the
  32. application can use SSL_CTX_add_session() directly to have full control
  33. over the sessions that can be resumed if desired.
  34. =head1 RETURN VALUES
  35. The following values are returned by all functions:
  36. =over 4
  37. =item Z<>0
  38. The operation failed. In case of the add operation, it was tried to add
  39. the same (identical) session twice. In case of the remove operation, the
  40. session was not found in the cache.
  41. =item Z<>1
  42. The operation succeeded.
  43. =back
  44. =head1 SEE ALSO
  45. L<ssl(3)|ssl(3)>,
  46. L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>,
  47. L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>
  48. =cut