The user-defined callback enables the application to trace the I/O statement execution for:
The following table details the callback argument descriptions.
The supplied values indicate which function is making the call. This value is supplied to both the before and after calls. The after call value is combined with BIO_CB_RETURN to indicate it is after the method call.
Typedefs |
| typedef long R_CDECL | BIO_CB_FUNC_T (BIO *bio, int cmd, char *argp, int argi, long argl, long ret) |
| | Used for creating user-defined debugging routines or surrender functions. More...
|
|
typedef long R_CDECL | R_BIO_CB_FUNC_T (BIO *bio, int cmd, char *argp, int argi, long argl, long ret) |
| | Deprecated name for the BIO callback type.
|
| typedef int R_CDECL | BIO_STATE_CB_FUNC_T (BIO *bio, int type, int state, int ret, int flag, char *cb_arg) |
| | The type of callback function that reports on the BIO state. More...
|
|
typedef struct bio_state_cb_st | BIO_STATE_CB |
| | The type used to hold the state callback and its user-defined argument for transportation.
|
Functions |
| void R_CDECL | BIO_set_cb (BIO *bio, BIO_CB_FUNC_T *cb) |
| | Sets a user-defined callback for the BIO bio. More...
|
| void R_CDECL | BIO_set_cb_arg (BIO *bio, char *arg) |
| | Sets an extra user-defined argument against the BIO bio that developers may use in the callback. More...
|
| void R_CDECL | BIO_set_bio_cb (BIO *bio, BIO_CB_FUNC_T *cb, char *arg) |
| | Sets the BIO callback and an argument against the BIO bio. More...
|
| char* R_CDECL | BIO_get_cb_arg (BIO *bio) |
| | Returns a pointer to the user-defined data for the user-defined callback that exists within the BIO bio. More...
|
| BIO_CB_FUNC_T* R_CDECL | BIO_get_cb (BIO *bio) |
| | Returns the user-defined callback function for the BIO bio if a callback function is defined. More...
|
| void R_CDECL | BIO_set_state_cb (BIO *bio, BIO_STATE_CB_FUNC_T *cb, char *arg) |
| | Sets the BIO state callback and an argument against the BIO bio. More...
|
| int R_CDECL | BIO_state_to_string (BIO *bio, int state, unsigned int len, char *str) |
| | Converts the state value of the internal state machine of the BIO into a string. More...
|
| char* R_CDECL | BIO_get_state_cb_arg (BIO *bio) |
| | Returns a pointer to the user-defined data for the user-defined state callback that exists within the BIO bio. More...
|
| BIO_STATE_CB_FUNC_T* R_CDECL | BIO_get_state_cb (BIO *bio) |
| | Returns the user-defined state callback function for the BIO bio if a state callback function is defined. More...
|
| int R_CDECL | BIO_set_cb_recursive (BIO *bio, int type, void *cb, char *arg) |
| | Sets the BIO state callback and an argument against all the BIO objects in the stack. More...
|
| int R_CDECL | BIO_flags_to_string (int flags, char sep, unsigned int len, char *str) |
| | Converts the flags of a BIO into a string. More...
|
| int R_CDECL | BIO_cb_cmd_to_string (int cmd, unsigned int len, char *str) |
| | Converts the information callback cmd for a BIO into a string. More...
|
|
|
Sets a user-defined callback for the BIO bio. If NULL, any previous callback is removed from the BIO. -
Parameters:
-
| bio |
[In, Out] A reference to the BIO. |
| cb |
[In] The user-defined callback. |
-
-
The callback is called both before and after the majority of BIO method calls, including the functions BIO_read(), BIO_write(), BIO_puts(), BIO_gets() and BIO_ctrl(). However, it is only called before the BIO_free() method call.
The callback is often used for debugging BIO operations.-
See also:
-
BIO_get_cb(), BIO_set_cb_arg(), BIO_set_bio_cb(), BIO_CB_FUNC_T and BIO_get_cb_arg().
-
Example:
-
int cb_count = 0;
BIO_set_cb(bio, my_debug);
BIO_set_cb_arg(bio, (char *)&cb_count);
BIO_free(bio);
printf("the number of times the callback was made = %d\n", cb_count);
long my_debug(BIO *b, int cmd, char *argp, int argi, long argl, long ret)
{
int *arg_ptr;
arg_ptr = (int *)BIO_get_cb_arg(b);
(*arg_ptr)++;
return(ret);
}
-
Samples:
-
bio_client.c, bio_server.c, cache_server.c, nbio_client.c, nbio_server.c, p7ssl_client.c, p7ssl_server.c, sock_client.c, sock_server.c, ssl_client.c, and ssl_server.c.
|