SSL_SESSION_get0_hostname.pod 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. =pod
  2. =head1 NAME
  3. SSL_SESSION_get0_hostname,
  4. SSL_SESSION_set1_hostname,
  5. SSL_SESSION_get0_alpn_selected,
  6. SSL_SESSION_set1_alpn_selected
  7. - get and set SNI and ALPN data ssociated with a session
  8. =head1 SYNOPSIS
  9. #include <openssl/ssl.h>
  10. const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s);
  11. int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname);
  12. void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s,
  13. const unsigned char **alpn,
  14. size_t *len);
  15. int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, const unsigned char *alpn,
  16. size_t len);
  17. =head1 DESCRIPTION
  18. SSL_SESSION_get0_hostname() retrieves the SNI value that was sent by the
  19. client when the session was created, or NULL if no value was sent.
  20. The value returned is a pointer to memory maintained within B<s> and
  21. should not be free'd.
  22. SSL_SESSION_set1_hostname() sets the SNI value for the hostname to a copy of
  23. the string provided in hostname.
  24. SSL_SESSION_get0_alpn_selected() retrieves the selected ALPN protocol for this
  25. session and its associated length in bytes. The returned value of B<*alpn> is a
  26. pointer to memory maintained within B<s> and should not be free'd.
  27. SSL_SESSION_set1_alpn_selected() sets the ALPN protocol for this session to the
  28. value in B<alpn> which should be of length B<len> bytes. A copy of the input
  29. value is made, and the caller retains ownership of the memory pointed to by
  30. B<alpn>.
  31. =head1 RETURN VALUES
  32. SSL_SESSION_get0_hostname() returns either a string or NULL based on if there
  33. is the SNI value sent by client.
  34. SSL_SESSION_set1_hostname() returns 1 on success or 0 on error.
  35. SSL_SESSION_set1_alpn_selected() returns 1 on success or 0 on error.
  36. =head1 SEE ALSO
  37. L<ssl(7)>,
  38. L<d2i_SSL_SESSION(3)>,
  39. L<SSL_SESSION_get_time(3)>,
  40. L<SSL_SESSION_free(3)>
  41. =head1 HISTORY
  42. SSL_SESSION_set1_hostname(), SSL_SESSION_get0_alpn_selected() and
  43. SSL_SESSION_set1_alpn_selected() were added in OpenSSL 1.1.1.
  44. =head1 COPYRIGHT
  45. Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
  46. Licensed under the OpenSSL license (the "License"). You may not use
  47. this file except in compliance with the License. You can obtain a copy
  48. in the file LICENSE in the source distribution or at
  49. L<https://www.openssl.org/source/license.html>.
  50. =cut