SSL_CTX_set_tlsext_servername_callback.pod revision 325337
1=pod
2
3=head1 NAME
4
5SSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg,
6SSL_get_servername_type, SSL_get_servername - handle server name indication
7(SNI)
8
9=head1 SYNOPSIS
10
11 #include <openssl/ssl.h>
12
13 long SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,
14                                   int (*cb)(SSL *, int *, void *));
15 long SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);
16
17 const char *SSL_get_servername(const SSL *s, const int type);
18 int SSL_get_servername_type(const SSL *s);
19
20=head1 DESCRIPTION
21
22SSL_CTX_set_tlsext_servername_callback() sets the application callback B<cb>
23used by a server to perform any actions or configuration required based on
24the servername extension received in the incoming connection. When B<cb>
25is NULL, SNI is not used. The B<arg> value is a pointer which is passed to
26the application callback.
27
28SSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to be
29passed into the callback for this B<SSL_CTX>.
30
31SSL_get_servername() returns a servername extension value of the specified
32type if provided in the Client Hello or NULL.
33
34SSL_get_servername_type() returns the servername type or -1 if no servername
35is present. Currently the only supported type (defined in RFC3546) is
36B<TLSEXT_NAMETYPE_host_name>.
37
38=head1 NOTES
39
40The ALPN and SNI callbacks are both executed during Client Hello processing.
41The servername callback is executed first, followed by the ALPN callback.
42
43=head1 RETURN VALUES
44
45SSL_CTX_set_tlsext_servername_callback() and
46SSL_CTX_set_tlsext_servername_arg() both always return 1 indicating success.
47
48=head1 SEE ALSO
49
50L<ssl(7)>, L<SSL_CTX_set_alpn_select_cb(3)>,
51L<SSL_get0_alpn_selected(3)>
52
53=head1 COPYRIGHT
54
55Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
56
57Licensed under the OpenSSL license (the "License").  You may not use
58this file except in compliance with the License.  You can obtain a copy
59in the file LICENSE in the source distribution or at
60L<https://www.openssl.org/source/license.html>.
61
62=cut
63