Lines Matching refs:b

26 # define HAS_CALLBACK(b) ((b)->callback != NULL || (b)->callback_ex != NULL)  argument
28 # define HAS_CALLBACK(b) ((b)->callback_ex != NULL) argument
37 static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len, in bio_call_callback() argument
45 if (b->callback_ex != NULL) in bio_call_callback()
47 return b->callback_ex(b, oper, argp, len, argi, argl, inret, processed); in bio_call_callback()
71 ret = b->callback(b, oper, argp, argi, argl, inret); in bio_call_callback()
199 void BIO_clear_flags(BIO *b, int flags) in BIO_clear_flags() argument
201 b->flags &= ~flags; in BIO_clear_flags()
204 int BIO_test_flags(const BIO *b, int flags) in BIO_test_flags() argument
206 return (b->flags & flags); in BIO_test_flags()
209 void BIO_set_flags(BIO *b, int flags) in BIO_set_flags() argument
211 b->flags |= flags; in BIO_set_flags()
215 BIO_callback_fn BIO_get_callback(const BIO *b) in BIO_get_callback() argument
217 return b->callback; in BIO_get_callback()
220 void BIO_set_callback(BIO *b, BIO_callback_fn cb) in BIO_set_callback() argument
222 b->callback = cb; in BIO_set_callback()
226 BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b) in BIO_get_callback_ex() argument
228 return b->callback_ex; in BIO_get_callback_ex()
231 void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex cb) in BIO_set_callback_ex() argument
233 b->callback_ex = cb; in BIO_set_callback_ex()
236 void BIO_set_callback_arg(BIO *b, char *arg) in BIO_set_callback_arg() argument
238 b->cb_arg = arg; in BIO_set_callback_arg()
241 char *BIO_get_callback_arg(const BIO *b) in BIO_get_callback_arg() argument
243 return b->cb_arg; in BIO_get_callback_arg()
246 const char *BIO_method_name(const BIO *b) in BIO_method_name() argument
248 return b->method->name; in BIO_method_name()
251 int BIO_method_type(const BIO *b) in BIO_method_type() argument
253 return b->method->type; in BIO_method_type()
262 static int bio_read_intern(BIO *b, void *data, size_t dlen, size_t *readbytes) in bio_read_intern() argument
266 if (b == NULL) { in bio_read_intern()
270 if (b->method == NULL || b->method->bread == NULL) { in bio_read_intern()
275 if (HAS_CALLBACK(b) && in bio_read_intern()
276 ((ret = (int)bio_call_callback(b, BIO_CB_READ, data, dlen, 0, 0L, 1L, in bio_read_intern()
280 if (!b->init) { in bio_read_intern()
285 ret = b->method->bread(b, data, dlen, readbytes); in bio_read_intern()
288 b->num_read += (uint64_t)*readbytes; in bio_read_intern()
290 if (HAS_CALLBACK(b)) in bio_read_intern()
291 ret = (int)bio_call_callback(b, BIO_CB_READ | BIO_CB_RETURN, data, in bio_read_intern()
303 int BIO_read(BIO *b, void *data, int dlen) in BIO_read() argument
311 ret = bio_read_intern(b, data, (size_t)dlen, &readbytes); in BIO_read()
321 int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes) in BIO_read_ex() argument
323 return bio_read_intern(b, data, dlen, readbytes) > 0; in BIO_read_ex()
326 static int bio_write_intern(BIO *b, const void *data, size_t dlen, in bio_write_intern() argument
338 if (b == NULL) in bio_write_intern()
341 if (b->method == NULL || b->method->bwrite == NULL) { in bio_write_intern()
346 if (HAS_CALLBACK(b) && in bio_write_intern()
347 ((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L, in bio_write_intern()
351 if (!b->init) { in bio_write_intern()
356 ret = b->method->bwrite(b, data, dlen, &local_written); in bio_write_intern()
359 b->num_write += (uint64_t)local_written; in bio_write_intern()
361 if (HAS_CALLBACK(b)) in bio_write_intern()
362 ret = (int)bio_call_callback(b, BIO_CB_WRITE | BIO_CB_RETURN, data, in bio_write_intern()
370 int BIO_write(BIO *b, const void *data, int dlen) in BIO_write() argument
378 ret = bio_write_intern(b, data, (size_t)dlen, &written); in BIO_write()
388 int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written) in BIO_write_ex() argument
390 return bio_write_intern(b, data, dlen, written) > 0 in BIO_write_ex()
391 || (b != NULL && dlen == 0); /* order is important for *written */ in BIO_write_ex()
394 int BIO_sendmmsg(BIO *b, BIO_MSG *msg, in BIO_sendmmsg() argument
401 if (b == NULL) { in BIO_sendmmsg()
407 if (b->method == NULL || b->method->bsendmmsg == NULL) { in BIO_sendmmsg()
413 if (HAS_CALLBACK(b)) { in BIO_sendmmsg()
420 ret = (size_t)bio_call_callback(b, BIO_CB_SENDMMSG, (void *)&args, in BIO_sendmmsg()
426 if (!b->init) { in BIO_sendmmsg()
432 ret = b->method->bsendmmsg(b, msg, stride, num_msg, flags, msgs_processed); in BIO_sendmmsg()
434 if (HAS_CALLBACK(b)) in BIO_sendmmsg()
435 ret = (size_t)bio_call_callback(b, BIO_CB_SENDMMSG | BIO_CB_RETURN, in BIO_sendmmsg()
441 int BIO_recvmmsg(BIO *b, BIO_MSG *msg, in BIO_recvmmsg() argument
448 if (b == NULL) { in BIO_recvmmsg()
454 if (b->method == NULL || b->method->brecvmmsg == NULL) { in BIO_recvmmsg()
460 if (HAS_CALLBACK(b)) { in BIO_recvmmsg()
467 ret = bio_call_callback(b, BIO_CB_RECVMMSG, (void *)&args, in BIO_recvmmsg()
473 if (!b->init) { in BIO_recvmmsg()
479 ret = b->method->brecvmmsg(b, msg, stride, num_msg, flags, msgs_processed); in BIO_recvmmsg()
481 if (HAS_CALLBACK(b)) in BIO_recvmmsg()
482 ret = (size_t)bio_call_callback(b, BIO_CB_RECVMMSG | BIO_CB_RETURN, in BIO_recvmmsg()
488 int BIO_get_rpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc) in BIO_get_rpoll_descriptor() argument
490 return BIO_ctrl(b, BIO_CTRL_GET_RPOLL_DESCRIPTOR, 0, desc); in BIO_get_rpoll_descriptor()
493 int BIO_get_wpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc) in BIO_get_wpoll_descriptor() argument
495 return BIO_ctrl(b, BIO_CTRL_GET_WPOLL_DESCRIPTOR, 0, desc); in BIO_get_wpoll_descriptor()
498 int BIO_puts(BIO *b, const char *buf) in BIO_puts() argument
503 if (b == NULL) { in BIO_puts()
507 if (b->method == NULL || b->method->bputs == NULL) { in BIO_puts()
512 if (HAS_CALLBACK(b)) { in BIO_puts()
513 ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL); in BIO_puts()
518 if (!b->init) { in BIO_puts()
523 ret = b->method->bputs(b, buf); in BIO_puts()
526 b->num_write += (uint64_t)ret; in BIO_puts()
531 if (HAS_CALLBACK(b)) in BIO_puts()
532 ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0, in BIO_puts()
547 int BIO_gets(BIO *b, char *buf, int size) in BIO_gets() argument
552 if (b == NULL) { in BIO_gets()
556 if (b->method == NULL || b->method->bgets == NULL) { in BIO_gets()
566 if (HAS_CALLBACK(b)) { in BIO_gets()
567 ret = (int)bio_call_callback(b, BIO_CB_GETS, buf, size, 0, 0L, 1, NULL); in BIO_gets()
572 if (!b->init) { in BIO_gets()
577 ret = b->method->bgets(b, buf, size); in BIO_gets()
584 if (HAS_CALLBACK(b)) in BIO_gets()
585 ret = (int)bio_call_callback(b, BIO_CB_GETS | BIO_CB_RETURN, buf, size, in BIO_gets()
630 int BIO_indent(BIO *b, int indent, int max) in BIO_indent() argument
637 if (BIO_puts(b, " ") != 1) in BIO_indent()
642 long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) in BIO_int_ctrl() argument
647 return BIO_ctrl(b, cmd, larg, (char *)&i); in BIO_int_ctrl()
650 void *BIO_ptr_ctrl(BIO *b, int cmd, long larg) in BIO_ptr_ctrl() argument
654 if (BIO_ctrl(b, cmd, larg, (char *)&p) <= 0) in BIO_ptr_ctrl()
660 long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) in BIO_ctrl() argument
664 if (b == NULL) in BIO_ctrl()
666 if (b->method == NULL || b->method->ctrl == NULL) { in BIO_ctrl()
671 if (HAS_CALLBACK(b)) { in BIO_ctrl()
672 ret = bio_call_callback(b, BIO_CB_CTRL, parg, 0, cmd, larg, 1L, NULL); in BIO_ctrl()
677 ret = b->method->ctrl(b, cmd, larg, parg); in BIO_ctrl()
679 if (HAS_CALLBACK(b)) in BIO_ctrl()
680 ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd, in BIO_ctrl()
686 long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) in BIO_callback_ctrl() argument
690 if (b == NULL) in BIO_callback_ctrl()
692 if (b->method == NULL || b->method->callback_ctrl == NULL in BIO_callback_ctrl()
698 if (HAS_CALLBACK(b)) { in BIO_callback_ctrl()
699 ret = bio_call_callback(b, BIO_CB_CTRL, (void *)&fp, 0, cmd, 0, 1L, in BIO_callback_ctrl()
705 ret = b->method->callback_ctrl(b, cmd, fp); in BIO_callback_ctrl()
707 if (HAS_CALLBACK(b)) in BIO_callback_ctrl()
708 ret = bio_call_callback(b, BIO_CB_CTRL | BIO_CB_RETURN, (void *)&fp, 0, in BIO_callback_ctrl()
746 BIO *BIO_push(BIO *b, BIO *bio) in BIO_push() argument
750 if (b == NULL) in BIO_push()
752 lb = b; in BIO_push()
759 BIO_ctrl(b, BIO_CTRL_PUSH, 0, lb); in BIO_push()
760 return b; in BIO_push()
764 BIO *BIO_pop(BIO *b) in BIO_pop() argument
768 if (b == NULL) in BIO_pop()
770 ret = b->next_bio; in BIO_pop()
772 BIO_ctrl(b, BIO_CTRL_POP, 0, b); in BIO_pop()
774 if (b->prev_bio != NULL) in BIO_pop()
775 b->prev_bio->next_bio = b->next_bio; in BIO_pop()
776 if (b->next_bio != NULL) in BIO_pop()
777 b->next_bio->prev_bio = b->prev_bio; in BIO_pop()
779 b->next_bio = NULL; in BIO_pop()
780 b->prev_bio = NULL; in BIO_pop()
786 BIO *b, *last; in BIO_get_retry_BIO() local
788 b = last = bio; in BIO_get_retry_BIO()
790 if (!BIO_should_retry(b)) in BIO_get_retry_BIO()
792 last = b; in BIO_get_retry_BIO()
793 b = b->next_bio; in BIO_get_retry_BIO()
794 if (b == NULL) in BIO_get_retry_BIO()
837 BIO *BIO_next(BIO *b) in BIO_next() argument
839 if (b == NULL) in BIO_next()
841 return b->next_bio; in BIO_next()
844 void BIO_set_next(BIO *b, BIO *next) in BIO_set_next() argument
846 b->next_bio = next; in BIO_set_next()
851 BIO *b; in BIO_free_all() local
855 b = bio; in BIO_free_all()
856 CRYPTO_GET_REF(&b->references, &ref); in BIO_free_all()
858 BIO_free(b); in BIO_free_all()
911 void BIO_copy_next_retry(BIO *b) in BIO_copy_next_retry() argument
913 BIO_set_flags(b, BIO_get_retry_flags(b->next_bio)); in BIO_copy_next_retry()
914 b->retry_reason = b->next_bio->retry_reason; in BIO_copy_next_retry()