1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimSSL_set_connect_state, SSL_set_accept_state, SSL_is_server 6e71b7053SJung-uk Kim- functions for manipulating and examining the client or server mode of an SSL object 7e71b7053SJung-uk Kim 8e71b7053SJung-uk Kim=head1 SYNOPSIS 9e71b7053SJung-uk Kim 10e71b7053SJung-uk Kim #include <openssl/ssl.h> 11e71b7053SJung-uk Kim 12e71b7053SJung-uk Kim void SSL_set_connect_state(SSL *ssl); 13e71b7053SJung-uk Kim 14e71b7053SJung-uk Kim void SSL_set_accept_state(SSL *ssl); 15e71b7053SJung-uk Kim 16e71b7053SJung-uk Kim int SSL_is_server(const SSL *ssl); 17e71b7053SJung-uk Kim 18e71b7053SJung-uk Kim=head1 DESCRIPTION 19e71b7053SJung-uk Kim 20e71b7053SJung-uk KimSSL_set_connect_state() sets B<ssl> to work in client mode. 21e71b7053SJung-uk Kim 22e71b7053SJung-uk KimSSL_set_accept_state() sets B<ssl> to work in server mode. 23e71b7053SJung-uk Kim 24e71b7053SJung-uk KimSSL_is_server() checks if B<ssl> is working in server mode. 25e71b7053SJung-uk Kim 26e71b7053SJung-uk Kim=head1 NOTES 27e71b7053SJung-uk Kim 28e71b7053SJung-uk KimWhen the SSL_CTX object was created with L<SSL_CTX_new(3)>, 29e71b7053SJung-uk Kimit was either assigned a dedicated client method, a dedicated server 30e71b7053SJung-uk Kimmethod, or a generic method, that can be used for both client and 31e71b7053SJung-uk Kimserver connections. (The method might have been changed with 32e71b7053SJung-uk KimL<SSL_CTX_set_ssl_version(3)> or 33e71b7053SJung-uk KimL<SSL_set_ssl_method(3)>.) 34e71b7053SJung-uk Kim 35e71b7053SJung-uk KimWhen beginning a new handshake, the SSL engine must know whether it must 36e71b7053SJung-uk Kimcall the connect (client) or accept (server) routines. Even though it may 37e71b7053SJung-uk Kimbe clear from the method chosen, whether client or server mode was 38e71b7053SJung-uk Kimrequested, the handshake routines must be explicitly set. 39e71b7053SJung-uk Kim 40e71b7053SJung-uk KimWhen using the L<SSL_connect(3)> or 41e71b7053SJung-uk KimL<SSL_accept(3)> routines, the correct handshake 42e71b7053SJung-uk Kimroutines are automatically set. When performing a transparent negotiation 43e71b7053SJung-uk Kimusing L<SSL_write_ex(3)>, L<SSL_write(3)>, L<SSL_read_ex(3)>, or L<SSL_read(3)>, 44e71b7053SJung-uk Kimthe handshake routines must be explicitly set in advance using either 45e71b7053SJung-uk KimSSL_set_connect_state() or SSL_set_accept_state(). 46e71b7053SJung-uk Kim 47e71b7053SJung-uk KimIf SSL_is_server() is called before SSL_set_connect_state() or 48e71b7053SJung-uk KimSSL_set_accept_state() is called (either automatically or explicitly), 49e71b7053SJung-uk Kimthe result depends on what method was used when SSL_CTX was created with 50e71b7053SJung-uk KimL<SSL_CTX_new(3)>. If a generic method or a dedicated server method was 51e71b7053SJung-uk Kimpassed to L<SSL_CTX_new(3)>, SSL_is_server() returns 1; otherwise, it returns 0. 52e71b7053SJung-uk Kim 53e71b7053SJung-uk Kim=head1 RETURN VALUES 54e71b7053SJung-uk Kim 55e71b7053SJung-uk KimSSL_set_connect_state() and SSL_set_accept_state() do not return diagnostic 56e71b7053SJung-uk Kiminformation. 57e71b7053SJung-uk Kim 58e71b7053SJung-uk KimSSL_is_server() returns 1 if B<ssl> is working in server mode or 0 for client mode. 59e71b7053SJung-uk Kim 60e71b7053SJung-uk Kim=head1 SEE ALSO 61e71b7053SJung-uk Kim 62e71b7053SJung-uk KimL<ssl(7)>, L<SSL_new(3)>, L<SSL_CTX_new(3)>, 63e71b7053SJung-uk KimL<SSL_connect(3)>, L<SSL_accept(3)>, 64e71b7053SJung-uk KimL<SSL_write_ex(3)>, L<SSL_write(3)>, L<SSL_read_ex(3)>, L<SSL_read(3)>, 65e71b7053SJung-uk KimL<SSL_do_handshake(3)>, 66e71b7053SJung-uk KimL<SSL_CTX_set_ssl_version(3)> 67e71b7053SJung-uk Kim 68e71b7053SJung-uk Kim=head1 COPYRIGHT 69e71b7053SJung-uk Kim 70e71b7053SJung-uk KimCopyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved. 71e71b7053SJung-uk Kim 72*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 73e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 74e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 75e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 76e71b7053SJung-uk Kim 77e71b7053SJung-uk Kim=cut 78