VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1l/doc/man3/BIO_f_buffer.pod@ 91772

Last change on this file since 91772 was 91772, checked in by vboxsync, 3 years ago

openssl-1.1.1l: Applied and adjusted our OpenSSL changes to 1.1.1l. bugref:10126

File size: 3.5 KB
Line 
1=pod
2
3=head1 NAME
4
5BIO_get_buffer_num_lines,
6BIO_set_read_buffer_size,
7BIO_set_write_buffer_size,
8BIO_set_buffer_size,
9BIO_set_buffer_read_data,
10BIO_f_buffer
11- buffering BIO
12
13=head1 SYNOPSIS
14
15 #include <openssl/bio.h>
16
17 const BIO_METHOD *BIO_f_buffer(void);
18
19 long BIO_get_buffer_num_lines(BIO *b);
20 long BIO_set_read_buffer_size(BIO *b, long size);
21 long BIO_set_write_buffer_size(BIO *b, long size);
22 long BIO_set_buffer_size(BIO *b, long size);
23 long BIO_set_buffer_read_data(BIO *b, void *buf, long num);
24
25=head1 DESCRIPTION
26
27BIO_f_buffer() returns the buffering BIO method.
28
29Data written to a buffering BIO is buffered and periodically written
30to the next BIO in the chain. Data read from a buffering BIO comes from
31an internal buffer which is filled from the next BIO in the chain.
32Both BIO_gets() and BIO_puts() are supported.
33
34Calling BIO_reset() on a buffering BIO clears any buffered data.
35
36BIO_get_buffer_num_lines() returns the number of lines currently buffered.
37
38BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size()
39set the read, write or both read and write buffer sizes to B<size>. The initial
40buffer size is DEFAULT_BUFFER_SIZE, currently 4096. Any attempt to reduce the
41buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared
42when the buffer is resized.
43
44BIO_set_buffer_read_data() clears the read buffer and fills it with B<num>
45bytes of B<buf>. If B<num> is larger than the current buffer size the buffer
46is expanded.
47
48=head1 NOTES
49
50These functions, other than BIO_f_buffer(), are implemented as macros.
51
52Buffering BIOs implement BIO_read_ex() and BIO_gets() by using
53BIO_read_ex() operations on the next BIO in the chain and storing the
54result in an internal buffer, from which bytes are given back to the
55caller as appropriate for the call; a BIO_gets() is guaranteed to give
56the caller a whole line, and BIO_read_ex() is guaranteed to give the
57caller the number of bytes it asks for, unless there's an error or end
58of communication is reached in the next BIO. By prepending a
59buffering BIO to a chain it is therefore possible to provide
60BIO_gets() or exact size BIO_read_ex() functionality if the following
61BIOs do not support it.
62
63Do not add more than one BIO_f_buffer() to a BIO chain. The result of
64doing so will force a full read of the size of the internal buffer of
65the top BIO_f_buffer(), which is 4 KiB at a minimum.
66
67Data is only written to the next BIO in the chain when the write buffer fills
68or when BIO_flush() is called. It is therefore important to call BIO_flush()
69whenever any pending data should be written such as when removing a buffering
70BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate
71source/sink BIO is non blocking.
72
73=head1 RETURN VALUES
74
75BIO_f_buffer() returns the buffering BIO method.
76
77BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0).
78
79BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size()
80return 1 if the buffer was successfully resized or 0 for failure.
81
82BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0 if
83there was an error.
84
85=head1 SEE ALSO
86
87L<bio(7)>,
88L<BIO_reset(3)>,
89L<BIO_flush(3)>,
90L<BIO_pop(3)>,
91L<BIO_ctrl(3)>.
92
93=head1 COPYRIGHT
94
95Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
96
97Licensed under the OpenSSL license (the "License"). You may not use
98this file except in compliance with the License. You can obtain a copy
99in the file LICENSE in the source distribution or at
100L<https://www.openssl.org/source/license.html>.
101
102=cut
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette