1325326Sjkim=pod
2325326Sjkim
3325326Sjkim=head1 NAME
4325326Sjkim
5325326SjkimSSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg,
6325326SjkimSSL_get_servername_type, SSL_get_servername - handle server name indication
7325326Sjkim(SNI)
8325326Sjkim
9325326Sjkim=head1 SYNOPSIS
10325326Sjkim
11325326Sjkim #include <openssl/ssl.h>
12325326Sjkim
13325326Sjkim long SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,
14325326Sjkim                                   int (*cb)(SSL *, int *, void *));
15325326Sjkim long SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);
16325326Sjkim
17325326Sjkim const char *SSL_get_servername(const SSL *s, const int type);
18325326Sjkim int SSL_get_servername_type(const SSL *s);
19325326Sjkim
20325326Sjkim=head1 DESCRIPTION
21325326Sjkim
22325326SjkimSSL_CTX_set_tlsext_servername_callback() sets the application callback B<cb>
23325326Sjkimused by a server to perform any actions or configuration required based on
24325326Sjkimthe servername extension received in the incoming connection. When B<cb>
25325326Sjkimis NULL, SNI is not used. The B<arg> value is a pointer which is passed to
26325326Sjkimthe application callback.
27325326Sjkim
28325326SjkimSSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to be
29325326Sjkimpassed into the callback for this B<SSL_CTX>.
30325326Sjkim
31325326SjkimSSL_get_servername() returns a servername extension value of the specified
32325326Sjkimtype if provided in the Client Hello or NULL.
33325326Sjkim
34325326SjkimSSL_get_servername_type() returns the servername type or -1 if no servername
35325326Sjkimis present. Currently the only supported type (defined in RFC3546) is
36325326SjkimB<TLSEXT_NAMETYPE_host_name>.
37325326Sjkim
38325326Sjkim=head1 NOTES
39325326Sjkim
40325326SjkimThe ALPN and SNI callbacks are both executed during Client Hello processing.
41325326SjkimThe servername callback is executed first, followed by the ALPN callback.
42325326Sjkim
43325326Sjkim=head1 RETURN VALUES
44325326Sjkim
45325326SjkimSSL_CTX_set_tlsext_servername_callback() and
46325326SjkimSSL_CTX_set_tlsext_servername_arg() both always return 1 indicating success.
47325326Sjkim
48325326Sjkim=head1 SEE ALSO
49325326Sjkim
50325326SjkimL<ssl(7)>, L<SSL_CTX_set_alpn_select_cb(3)>,
51325326SjkimL<SSL_get0_alpn_selected(3)>
52325326Sjkim
53325326Sjkim=head1 COPYRIGHT
54325326Sjkim
55325326SjkimCopyright 2017 The OpenSSL Project Authors. All Rights Reserved.
56325326Sjkim
57325326SjkimLicensed under the OpenSSL license (the "License").  You may not use
58325326Sjkimthis file except in compliance with the License.  You can obtain a copy
59325326Sjkimin the file LICENSE in the source distribution or at
60325326SjkimL<https://www.openssl.org/source/license.html>.
61325326Sjkim
62325326Sjkim=cut
63