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