SSL_CTX_set_mode.pod revision 238405
1296403Sbdrewery=pod
2296403Sbdrewery
3296403Sbdrewery=head1 NAME
4296403Sbdrewery
5296403SbdrewerySSL_CTX_set_mode, SSL_set_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode
6296403Sbdrewery
7296403Sbdrewery=head1 SYNOPSIS
8296403Sbdrewery
9296403Sbdrewery #include <openssl/ssl.h>
10296403Sbdrewery
11296403Sbdrewery long SSL_CTX_set_mode(SSL_CTX *ctx, long mode);
12296403Sbdrewery long SSL_set_mode(SSL *ssl, long mode);
13296403Sbdrewery
14296403Sbdrewery long SSL_CTX_get_mode(SSL_CTX *ctx);
15296403Sbdrewery long SSL_get_mode(SSL *ssl);
16296403Sbdrewery
17296403Sbdrewery=head1 DESCRIPTION
18296403Sbdrewery
19296403SbdrewerySSL_CTX_set_mode() adds the mode set via bitmask in B<mode> to B<ctx>.
20296403SbdreweryOptions already set before are not cleared.
21296403Sbdrewery
22SSL_set_mode() adds the mode set via bitmask in B<mode> to B<ssl>.
23Options already set before are not cleared.
24
25SSL_CTX_get_mode() returns the mode set for B<ctx>.
26
27SSL_get_mode() returns the mode set for B<ssl>.
28
29=head1 NOTES
30
31The following mode changes are available:
32
33=over 4
34
35=item SSL_MODE_ENABLE_PARTIAL_WRITE
36
37Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
38when just a single record has been written). When not set (the default),
39SSL_write() will only report success once the complete chunk was written.
40Once SSL_write() returns with r, r bytes have been successfully written
41and the next call to SSL_write() must only send the n-r bytes left,
42imitating the behaviour of write().
43
44=item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
45
46Make it possible to retry SSL_write() with changed buffer location
47(the buffer contents must stay the same). This is not the default to avoid
48the misconception that non-blocking SSL_write() behaves like
49non-blocking write().
50
51=item SSL_MODE_AUTO_RETRY
52
53Never bother the application with retries if the transport is blocking.
54If a renegotiation take place during normal operation, a
55L<SSL_read(3)|SSL_read(3)> or L<SSL_write(3)|SSL_write(3)> would return
56with -1 and indicate the need to retry with SSL_ERROR_WANT_READ.
57In a non-blocking environment applications must be prepared to handle
58incomplete read/write operations.
59In a blocking environment, applications are not always prepared to
60deal with read/write operations returning without success report. The
61flag SSL_MODE_AUTO_RETRY will cause read/write operations to only
62return after the handshake and successful completion.
63
64=item SSL_MODE_RELEASE_BUFFERS
65
66When we no longer need a read buffer or a write buffer for a given SSL,
67then release the memory we were using to hold it.  Released memory is
68either appended to a list of unused RAM chunks on the SSL_CTX, or simply
69freed if the list of unused chunks would become longer than 
70SSL_CTX->freelist_max_len, which defaults to 32.  Using this flag can
71save around 34k per idle SSL connection.
72This flag has no effect on SSL v2 connections, or on DTLS connections.
73
74=back
75
76=head1 RETURN VALUES
77
78SSL_CTX_set_mode() and SSL_set_mode() return the new mode bitmask
79after adding B<mode>.
80
81SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask.
82
83=head1 SEE ALSO
84
85L<ssl(3)|ssl(3)>, L<SSL_read(3)|SSL_read(3)>, L<SSL_write(3)|SSL_write(3)>
86
87=head1 HISTORY
88
89SSL_MODE_AUTO_RETRY as been added in OpenSSL 0.9.6.
90
91=cut
92