Difference between revisions of "BIO"

From OpenSSLWiki
Jump to navigationJump to search
(Modified manual links to point to the wiki manual pages)
Line 25: Line 25:
 
* [[Manual:BIO_s_null(3)]]
 
* [[Manual:BIO_s_null(3)]]
 
* [[Manual:BIO_s_socket(3)]]
 
* [[Manual:BIO_s_socket(3)]]
 +
 +
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink
 +
 +
== Combining Filters and Source Sink BIOS ==
 +
 +
* [[Manual:BIO_push(2)]]
 +
 +
new_head = BIO_push(BIO * local_head, BIO * tail)
 +
 +
will connect tail at end of local_head chain.
 +
 +
WARNING BIO_push will never fail, but can  create totaly invalid chains.

Revision as of 21:16, 31 October 2014

A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's FILE *. OpenSSL comes with a number of useful BIO types predefined, or you can create your own.

BIOs come in two flavors: source/sink, or filter. BIOs can be chained together. Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.

Reading from a BIO can be done with Manual:BIO_read(3) and BIO_gets.

Writing to a BIO can be done with BIO_write, BIO_puts, BIO_printf, and BIO_vprintf.

Filter BIOs

Source/sink BIOs

implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink

Combining Filters and Source Sink BIOS

new_head = BIO_push(BIO * local_head, BIO * tail)

will connect tail at end of local_head chain.

WARNING BIO_push will never fail, but can create totaly invalid chains.