Make CRYPTO_num_locks() return 1
[openssl.git] / doc / crypto / BIO_f_buffer.pod
1 =pod
2
3 =head1 NAME
4
5 BIO_get_buffer_num_lines,
6 BIO_set_read_buffer_size,
7 BIO_set_write_buffer_size,
8 BIO_set_buffer_size,
9 BIO_set_buffer_read_data,
10 BIO_f_buffer - buffering BIO
11
12 =head1 SYNOPSIS
13
14  #include <openssl/bio.h>
15
16  const BIO_METHOD * BIO_f_buffer(void);
17
18  #define BIO_get_buffer_num_lines(b)
19  #define BIO_set_read_buffer_size(b,size)
20  #define BIO_set_write_buffer_size(b,size)
21  #define BIO_set_buffer_size(b,size)
22  #define BIO_set_buffer_read_data(b,buf,num)
23
24 =head1 DESCRIPTION
25
26 BIO_f_buffer() returns the buffering BIO method.
27
28 Data written to a buffering BIO is buffered and periodically written
29 to the next BIO in the chain. Data read from a buffering BIO comes from
30 an internal buffer which is filled from the next BIO in the chain.
31 Both BIO_gets() and BIO_puts() are supported.
32
33 Calling BIO_reset() on a buffering BIO clears any buffered data.
34
35 BIO_get_buffer_num_lines() returns the number of lines currently buffered.
36
37 BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size()
38 set the read, write or both read and write buffer sizes to B<size>. The initial
39 buffer size is DEFAULT_BUFFER_SIZE, currently 4096. Any attempt to reduce the
40 buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared
41 when the buffer is resized.
42
43 BIO_set_buffer_read_data() clears the read buffer and fills it with B<num>
44 bytes of B<buf>. If B<num> is larger than the current buffer size the buffer
45 is expanded.
46
47 =head1 NOTES
48
49 Buffering BIOs implement BIO_gets() by using BIO_read() operations on the
50 next BIO in the chain. By prepending a buffering BIO to a chain it is therefore
51 possible to provide BIO_gets() functionality if the following BIOs do not
52 support it (for example SSL BIOs).
53
54 Data is only written to the next BIO in the chain when the write buffer fills
55 or when BIO_flush() is called. It is therefore important to call BIO_flush()
56 whenever any pending data should be written such as when removing a buffering
57 BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate
58 source/sink BIO is non blocking.
59
60 =head1 RETURN VALUES
61
62 BIO_f_buffer() returns the buffering BIO method.
63
64 BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0).
65
66 BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size()
67 return 1 if the buffer was successfully resized or 0 for failure.
68
69 BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0 if
70 there was an error.
71
72 =head1 SEE ALSO
73
74 L<BIO(3)>,
75 L<BIO_reset(3)>,
76 L<BIO_flush(3)>,
77 L<BIO_pop(3)>,
78 L<BIO_ctrl(3)>.
79
80 =head1 COPYRIGHT
81
82 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
83
84 Licensed under the OpenSSL license (the "License").  You may not use
85 this file except in compliance with the License.  You can obtain a copy
86 in the file LICENSE in the source distribution or at
87 L<https://www.openssl.org/source/license.html>.
88
89 =cut