NAME
BIOfbuffer - buffering BIO
SYNOPSIS
#include
BIOMETHOD * BIOfbuffer(void);#define BIOgetbuffernumlines(b) BIOctrl(b,BIOCGETBUFFNUMLINES,0,NULL)
#define BIOsetreadbuffersize(b,size) BIOintctrl(b,BIOCSETBUFFSIZE,size,0)
#define BIOsetwritebuffersize(b,size) BIOintctrl(b,BIOCSETBUFFSIZE,size,1)
#define BIOsetbuffersize(b,size) BIOctrl(b,BIOCSETBUFFSIZE,size,NULL)
#define BIOsetbufferreaddata(b,buf,num) BIOctrl(b,BIOCSETBUFFREADDATA,num,buf)
DESCRIPTION
BIOfbuffer() returns the buffering BIO method. 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 BIOgets() and BIOputs() are supported. Calling BIOreset() on a buffering BIO clears any buffered data. BIOgetbuffernumlines() returns the number of lines currently buffered. BIOsetreadbuffersize(), BIOsetwritebuffersize() and BIOsetbuffersize() set the read, write or both read and write buffer sizes to ssiizzee. The initial buffer size is DEFAULTBUFFERSIZE, currently 1024. Any attempt to reduce the buffer size below DEFAULTBUFFERSIZE is ignored. Any buffered data is cleared when the buffer is resized. BIOsetbufferreaddata() clears the read buffer and fills it with nnuumm bytes of bbuuff. If nnuumm is larger than the current buffer size the buffer is expanded. NNOOTTEESS Buffering BIOs implement BIOgets() by using BIOread() operations on the next BIO in the chain. By prepending a buffering BIO to a chain it is therefore possible to provide BIOgets() functionality if the following BIOs do not support it (for example SSL BIOs). Data is only written to the next BIO in the chain when the write buffer fills or when BIOflush() is called. It is therefore important to call BIOflush() whenever any pending data should be written such as when removing a buffering BIO using BIOpop(). BIOflush() may need to be retried if the ultimate source/sink BIO is non blocking.RETURN VALUES
BIOfbuffer() returns the buffering BIO method. BIOgetbuffernumlines() returns the number of lines buffered (may be 0). BIOsetreadbuffersize(), BIOsetwritebuffersize() and BIOsetbuffersize() return 1 if the buffer was successfully resized or 0 for failure. BIOsetbufferreaddata() returns 1 if the data was set correctly or 0 if there was an error.SEE ALSO
TBA0.9.7l 2000-09-18 BIOfbuffer(3)