1BIO_set_callback(3)                 OpenSSL                BIO_set_callback(3)
2
3
4

NAME

6       BIO_set_callback, BIO_get_callback, BIO_set_callback_arg,
7       BIO_get_callback_arg, BIO_debug_callback - BIO callback functions
8

SYNOPSIS

10        #include <openssl/bio.h>
11
12        #define BIO_set_callback(b,cb)         ((b)->callback=(cb))
13        #define BIO_get_callback(b)            ((b)->callback)
14        #define BIO_set_callback_arg(b,arg)    ((b)->cb_arg=(char *)(arg))
15        #define BIO_get_callback_arg(b)                ((b)->cb_arg)
16
17        long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
18               long argl,long ret);
19
20        typedef long (*callback)(BIO *b, int oper, const char *argp,
21                               int argi, long argl, long retvalue);
22

DESCRIPTION

24       BIO_set_callback() and BIO_get_callback() set and retrieve the BIO
25       callback, they are both macros. The callback is called during most high
26       level BIO operations. It can be used for debugging purposes to trace
27       operations on a BIO or to modify its operation.
28
29       BIO_set_callback_arg() and BIO_get_callback_arg() are macros which can
30       be used to set and retrieve an argument for use in the callback.
31
32       BIO_debug_callback() is a standard debugging callback which prints out
33       information relating to each BIO operation. If the callback argument is
34       set if is interpreted as a BIO to send the information to, otherwise
35       stderr is used.
36
37       callback() is the callback function itself. The meaning of each
38       argument is described below.
39
40       The BIO the callback is attached to is passed in b.
41
42       oper is set to the operation being performed. For some operations the
43       callback is called twice, once before and once after the actual
44       operation, the latter case has oper or'ed with BIO_CB_RETURN.
45
46       The meaning of the arguments argp, argi and argl depends on the value
47       of oper, that is the operation being performed.
48
49       retvalue is the return value that would be returned to the application
50       if no callback were present. The actual value returned is the return
51       value of the callback itself. In the case of callbacks called before
52       the actual BIO operation 1 is placed in retvalue, if the return value
53       is not positive it will be immediately returned to the application and
54       the BIO operation will not be performed.
55
56       The callback should normally simply return retvalue when it has
57       finished processing, unless if specifically wishes to modify the value
58       returned to the application.
59

CALLBACK OPERATIONS

61       BIO_free(b)
62           callback(b, BIO_CB_FREE, NULL, 0L, 0L, 1L) is called before the
63           free operation.
64
65       BIO_read(b, out, outl)
66           callback(b, BIO_CB_READ, out, outl, 0L, 1L) is called before the
67           read and callback(b, BIO_CB_READ|BIO_CB_RETURN, out, outl, 0L,
68           retvalue) after.
69
70       BIO_write(b, in, inl)
71           callback(b, BIO_CB_WRITE, in, inl, 0L, 1L) is called before the
72           write and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, inl, 0L,
73           retvalue) after.
74
75       BIO_gets(b, out, outl)
76           callback(b, BIO_CB_GETS, out, outl, 0L, 1L) is called before the
77           operation and callback(b, BIO_CB_GETS|BIO_CB_RETURN, out, outl, 0L,
78           retvalue) after.
79
80       BIO_puts(b, in)
81           callback(b, BIO_CB_WRITE, in, 0, 0L, 1L) is called before the
82           operation and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, 0, 0L,
83           retvalue) after.
84
85       BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
86           callback(b,BIO_CB_CTRL,parg,cmd,larg,1L) is called before the call
87           and callback(b,BIO_CB_CTRL|BIO_CB_RETURN,parg,cmd, larg,ret) after.
88

EXAMPLE

90       The BIO_debug_callback() function is a good example, its source is in
91       crypto/bio/bio_cb.c
92

SEE ALSO

94       TBA
95
96
97
981.0.2o                            2019-09-10               BIO_set_callback(3)
Impressum