Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
NAME
BIO_callback_fn_ex, BIO_set_callback_ex, BIO_get_callback_ex, BIO_callback_fn, BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg, BIO_debug_callback — BIO callback functionsSYNOPSIS
#include <openssl/bio.h>(*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, size_t len, int argi, long argl, int ret, size_t *processed);
BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex cb_ex);
BIO_get_callback_ex(const BIO *b);
(*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, long argl, long ret);
BIO_set_callback(BIO *b, BIO_callback_fn cb);
BIO_get_callback(BIO *b);
BIO_set_callback_arg(BIO *b, char *pointer);
BIO_get_callback_arg(const BIO *b);
BIO_debug_callback(BIO *bio, int oper, const char *argp, int argi, long argl, long ret);
DESCRIPTION
BIO_set_callback_ex() and BIO_get_callback_ex() set and retrieve the BIO callback. The callback is called during most high-level BIO operations. It can be used for debugging purposes to trace operations on a BIO or to modify its operation.- b
- The BIO the callback is attached to.
- oper
- The operation being performed, which is one of BIO_CB_CTRL, BIO_CB_FREE, BIO_CB_GETS, BIO_CB_PUTS, BIO_CB_READ, or BIO_CB_WRITE. For some operations, the callback is called twice, once before and once after the actual operation. The latter case has oper OR'ed with BIO_CB_RETURN.
- argp, argi, argl
- The meaning of these three arguments depends on the value of oper, that is on the operation being performed.
- len
- The length of the data requested to be read or written. This is only useful if oper is BIO_CB_READ, BIO_CB_WRITE, or BIO_CB_GETS.
- ret
-
When oper does not include BIO_CB_RETURN, i.e. when the callback is invoked before an operation, the value passed into the callback via ret is always 1. In this case, if the callback returns a negative value, the library aborts the requested operation and instead returns the negative return value from the callback to the application. If the callback returns a non-negative value, that return value is ignored by the library, and the operation is performed normally.
- processed
- The location pointed to is updated with the number of bytes actually read or written. Only used for BIO_CB_READ, BIO_CB_WRITE, BIO_CB_GETS, and BIO_CB_PUTS.
- In BIO_free(BIO *b):
-
before the free operation: cb_ex(b, BIO_CB_FREE, NULL, 0, 0, 0, 1, NULL) or cb(b, BIO_CB_FREE, NULL, 0, 0, 1)
- In BIO_read(BIO *b, void *out, int outl):
-
before the read operation: cb_ex(b, BIO_CB_READ, out, outl, 0, 0, 1, NULL) or cb(b, BIO_CB_READ, out, outl, 0, 1) after the read operation: cb_ex(b, BIO_CB_READ|BIO_CB_RETURN, out, outl, 0, 0, ret, &bytes) or cb(b, BIO_CB_READ|BIO_CB_RETURN, out, outl, 0, ret)
- In BIO_write(BIO *b, const void *in, int inl):
-
before the write operation: cb_ex(b, BIO_CB_WRITE, in, inl, 0, 0, 1, NULL) or cb(b, BIO_CB_WRITE, in, inl, 0, 1) after the write operation: cb_ex(b, BIO_CB_WRITE|BIO_CB_RETURN, in, inl, 0, 0, ret, &bytes) or cb(b, BIO_CB_WRITE|BIO_CB_RETURN, in, inl, 0, ret)
- In BIO_gets(BIO *b, char *out, int outl):
-
before the read operation: cb_ex(b, BIO_CB_GETS, out, outl, 0, 0, 1, NULL) or cb(b, BIO_CB_GETS, out, outl, 0, 1) after the read operation: cb_ex(b, BIO_CB_GETS|BIO_CB_RETURN, out, outl, 0, 0, ret, &bytes) or cb(b, BIO_CB_GETS|BIO_CB_RETURN, out, outl, 0, ret)
- In BIO_puts(BIO *b, const char *in):
-
before the write operation: cb_ex(b, BIO_CB_PUTS, in, 0, 0, 0, 1, NULL) or cb(b, BIO_CB_PUTS, in, 0, 0, 1) after the write operation: cb_ex(b, BIO_CB_PUTS|BIO_CB_RETURN, in, 0, 0, 0, ret, &bytes) or cb(b, BIO_CB_PUTS|BIO_CB_RETURN, in, 0, 0, ret)
- In BIO_ctrl(BIO *b, int cmd, long larg, void *parg):
-
before the control operation: cb_ex(b, BIO_CB_CTRL, parg, 0, cmd, larg, 1, NULL) or cb(b, BIO_CB_CTRL, parg, cmd, larg, 1) after the control operation: cb_ex(b, BIO_CB_CTRL|BIO_CB_RETURN, parg, 0, cmd, larg, ret, NULL) or cb(b, BIO_CB_CTRL|BIO_CB_RETURN, parg, cmd, larg, ret)
- In BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp):
-
before the control operation: cb_ex(b, BIO_CB_CTRL, fp, 0, cmd, 0, 1, NULL) or cb(b, BIO_CB_CTRL, fp, cmd, 0, 1) after the control operation: cb_ex(b, BIO_CB_CTRL|BIO_CB_RETURN, fp, 0, cmd, 0, ret, NULL) or cb(b, BIO_CB_CTRL|BIO_CB_RETURN, fp, cmd, 0, ret)