Current Path : /usr/opt/openssl11/share/doc/openssl/html/man3/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/openssl11/share/doc/openssl/html/man3/BIO_set_buffer_read_data.html |
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>BIO_f_buffer</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:root@hsxx.drive.ne.jp" /> </head> <body style="background-color: white"> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#notes">NOTES</a></li> <li><a href="#return_values">RETURN VALUES</a></li> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#copyright">COPYRIGHT</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <hr /> <h1><a name="name">NAME</a></h1> <p>BIO_get_buffer_num_lines, BIO_set_read_buffer_size, BIO_set_write_buffer_size, BIO_set_buffer_size, BIO_set_buffer_read_data, BIO_f_buffer - buffering BIO</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> #include <openssl/bio.h></pre> <pre> const BIO_METHOD *BIO_f_buffer(void);</pre> <pre> long BIO_get_buffer_num_lines(BIO *b); long BIO_set_read_buffer_size(BIO *b, long size); long BIO_set_write_buffer_size(BIO *b, long size); long BIO_set_buffer_size(BIO *b, long size); long BIO_set_buffer_read_data(BIO *b, void *buf, long num);</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p><code>BIO_f_buffer()</code> returns the buffering BIO method.</p> <p>Data written to a buffering BIO is buffered and periodically written to the next BIO in the chain. Data read from a buffering BIO comes from an internal buffer which is filled from the next BIO in the chain. Both <code>BIO_gets()</code> and <code>BIO_puts()</code> are supported.</p> <p>Calling <code>BIO_reset()</code> on a buffering BIO clears any buffered data.</p> <p><code>BIO_get_buffer_num_lines()</code> returns the number of lines currently buffered.</p> <p><code>BIO_set_read_buffer_size()</code>, <code>BIO_set_write_buffer_size()</code> and <code>BIO_set_buffer_size()</code> set the read, write or both read and write buffer sizes to <strong>size</strong>. The initial buffer size is DEFAULT_BUFFER_SIZE, currently 4096. Any attempt to reduce the buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared when the buffer is resized.</p> <p><code>BIO_set_buffer_read_data()</code> clears the read buffer and fills it with <strong>num</strong> bytes of <strong>buf</strong>. If <strong>num</strong> is larger than the current buffer size the buffer is expanded.</p> <p> </p> <hr /> <h1><a name="notes">NOTES</a></h1> <p>These functions, other than <code>BIO_f_buffer()</code>, are implemented as macros.</p> <p>Buffering BIOs implement <code>BIO_read_ex()</code> and <code>BIO_gets()</code> by using <code>BIO_read_ex()</code> operations on the next BIO in the chain and storing the result in an internal buffer, from which bytes are given back to the caller as appropriate for the call; a <code>BIO_gets()</code> is guaranteed to give the caller a whole line, and <code>BIO_read_ex()</code> is guaranteed to give the caller the number of bytes it asks for, unless there's an error or end of communication is reached in the next BIO. By prepending a buffering BIO to a chain it is therefore possible to provide <code>BIO_gets()</code> or exact size <code>BIO_read_ex()</code> functionality if the following BIOs do not support it.</p> <p>Do not add more than one <code>BIO_f_buffer()</code> to a BIO chain. The result of doing so will force a full read of the size of the internal buffer of the top <code>BIO_f_buffer()</code>, which is 4 KiB at a minimum.</p> <p>Data is only written to the next BIO in the chain when the write buffer fills or when <code>BIO_flush()</code> is called. It is therefore important to call <code>BIO_flush()</code> whenever any pending data should be written such as when removing a buffering BIO using <code>BIO_pop()</code>. <code>BIO_flush()</code> may need to be retried if the ultimate source/sink BIO is non blocking.</p> <p> </p> <hr /> <h1><a name="return_values">RETURN VALUES</a></h1> <p><code>BIO_f_buffer()</code> returns the buffering BIO method.</p> <p><code>BIO_get_buffer_num_lines()</code> returns the number of lines buffered (may be 0).</p> <p><code>BIO_set_read_buffer_size()</code>, <code>BIO_set_write_buffer_size()</code> and <code>BIO_set_buffer_size()</code> return 1 if the buffer was successfully resized or 0 for failure.</p> <p><code>BIO_set_buffer_read_data()</code> returns 1 if the data was set correctly or 0 if there was an error.</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><em>bio(7)</em>, <em>BIO_reset(3)</em>, <em>BIO_flush(3)</em>, <em>BIO_pop(3)</em>, <em>BIO_ctrl(3)</em>.</p> <p> </p> <hr /> <h1><a name="copyright">COPYRIGHT</a></h1> <p>Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.</p> <p>Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p> </body> </html>