Add functions for setting a BIO callback and arg.

These were omitted, but are needed by Chromium now.

Change-Id: I17e1672674311c8dc2ede21539c82b8e2e50f376
Reviewed-on: https://boringssl-review.googlesource.com/1201
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2014-07-15 16:26:34 -07:00 committed by Adam Langley
parent 449f16b947
commit 0cc81ff04f
2 changed files with 24 additions and 0 deletions

View File

@ -359,6 +359,18 @@ int BIO_set_close(BIO *bio, int close_flag) {
return BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL); return BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL);
} }
void BIO_set_callback(BIO *bio, bio_info_cb callback_func) {
bio->callback = callback_func;
}
void BIO_set_callback_arg(BIO *bio, char *arg) {
bio->cb_arg = arg;
}
char *BIO_get_callback_arg(const BIO *bio) {
return bio->cb_arg;
}
BIO *BIO_push(BIO *bio, BIO *appended_bio) { BIO *BIO_push(BIO *bio, BIO *appended_bio) {
BIO *last_bio; BIO *last_bio;

View File

@ -244,6 +244,18 @@ size_t BIO_wpending(const BIO *bio);
* otherwise. */ * otherwise. */
int BIO_set_close(BIO *bio, int close_flag); int BIO_set_close(BIO *bio, int close_flag);
/* BIO_set_callback sets a callback function that will be called before and
* after most operations. See the comment above |bio_info_cb|. */
void BIO_set_callback(BIO *bio, bio_info_cb callback_func);
/* BIO_set_callback_arg sets the opaque pointer value that can be read within a
* callback with |BIO_get_callback_arg|. */
void BIO_set_callback_arg(BIO *bio, char *arg);
/* BIO_get_callback_arg returns the last value of the opaque callback pointer
* set by |BIO_set_callback_arg|. */
char *BIO_get_callback_arg(const BIO *bio);
/* Managing chains of BIOs. /* Managing chains of BIOs.
* *