1BIO_f_buffer(3)                     OpenSSL                    BIO_f_buffer(3)
2
3
4

NAME

6       BIO_f_buffer - buffering BIO
7

SYNOPSIS

9        #include <openssl/bio.h>
10
11        BIO_METHOD * BIO_f_buffer(void);
12
13        #define BIO_get_buffer_num_lines(b)    BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
14        #define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
15        #define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
16        #define BIO_set_buffer_size(b,size)    BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
17        #define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
18

DESCRIPTION

20       BIO_f_buffer() returns the buffering BIO method.
21
22       Data written to a buffering BIO is buffered and periodically written to
23       the next BIO in the chain. Data read from a buffering BIO comes from an
24       internal buffer which is filled from the next BIO in the chain.  Both
25       BIO_gets() and BIO_puts() are supported.
26
27       Calling BIO_reset() on a buffering BIO clears any buffered data.
28
29       BIO_get_buffer_num_lines() returns the number of lines currently
30       buffered.
31
32       BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and
33       BIO_set_buffer_size() set the read, write or both read and write buffer
34       sizes to size. The initial buffer size is DEFAULT_BUFFER_SIZE,
35       currently 4096. Any attempt to reduce the buffer size below
36       DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared when the
37       buffer is resized.
38
39       BIO_set_buffer_read_data() clears the read buffer and fills it with num
40       bytes of buf. If num is larger than the current buffer size the buffer
41       is expanded.
42

NOTES

44       Buffering BIOs implement BIO_gets() by using BIO_read() operations on
45       the next BIO in the chain. By prepending a buffering BIO to a chain it
46       is therefore possible to provide BIO_gets() functionality if the
47       following BIOs do not support it (for example SSL BIOs).
48
49       Data is only written to the next BIO in the chain when the write buffer
50       fills or when BIO_flush() is called. It is therefore important to call
51       BIO_flush() whenever any pending data should be written such as when
52       removing a buffering BIO using BIO_pop(). BIO_flush() may need to be
53       retried if the ultimate source/sink BIO is non blocking.
54

RETURN VALUES

56       BIO_f_buffer() returns the buffering BIO method.
57
58       BIO_get_buffer_num_lines() returns the number of lines buffered (may be
59       0).
60
61       BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and
62       BIO_set_buffer_size() return 1 if the buffer was successfully resized
63       or 0 for failure.
64
65       BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0
66       if there was an error.
67

SEE ALSO

69       BIO(3), BIO_reset(3), BIO_flush(3), BIO_pop(3), BIO_ctrl(3),
70       BIO_int_ctrl(3)
71
72
73
741.0.2o                            2020-01-28                   BIO_f_buffer(3)
Impressum