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