Lines Matching refs:bio

28 static int bio_new(BIO *bio);
29 static int bio_free(BIO *bio);
30 static int bio_read(BIO *bio, char *buf, int size);
31 static int bio_write(BIO *bio, const char *buf, int num);
32 static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr);
33 static int bio_puts(BIO *bio, const char *str);
36 static void bio_destroy_pair(BIO *bio);
76 static int bio_new(BIO *bio) in bio_new() argument
86 bio->ptr = b; in bio_new()
90 static int bio_free(BIO *bio) in bio_free() argument
94 if (bio == NULL) in bio_free()
96 b = bio->ptr; in bio_free()
101 bio_destroy_pair(bio); in bio_free()
109 static int bio_read(BIO *bio, char *buf, int size_) in bio_read() argument
115 BIO_clear_retry_flags(bio); in bio_read()
117 if (!bio->init) in bio_read()
120 b = bio->ptr; in bio_read()
136 BIO_set_retry_read(bio); /* buffer is empty */ in bio_read()
200 static ossl_ssize_t bio_nread0(BIO *bio, char **buf) in bio_nread0() argument
205 BIO_clear_retry_flags(bio); in bio_nread0()
207 if (!bio->init) in bio_nread0()
210 b = bio->ptr; in bio_nread0()
223 return bio_read(bio, &dummy, 1); /* returns 0 or -1 */ in bio_nread0()
237 static ossl_ssize_t bio_nread(BIO *bio, char **buf, size_t num_) in bio_nread() argument
247 available = bio_nread0(bio, buf); in bio_nread()
253 b = bio->ptr; in bio_nread()
268 static int bio_write(BIO *bio, const char *buf, int num_) in bio_write() argument
274 BIO_clear_retry_flags(bio); in bio_write()
276 if (!bio->init || buf == NULL || num_ <= 0) in bio_write()
279 b = bio->ptr; in bio_write()
294 BIO_set_retry_write(bio); /* buffer is full */ in bio_write()
345 static ossl_ssize_t bio_nwrite0(BIO *bio, char **buf) in bio_nwrite0() argument
351 BIO_clear_retry_flags(bio); in bio_nwrite0()
353 if (!bio->init) in bio_nwrite0()
356 b = bio->ptr; in bio_nwrite0()
370 BIO_set_retry_write(bio); in bio_nwrite0()
393 static ossl_ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_) in bio_nwrite() argument
403 space = bio_nwrite0(bio, buf); in bio_nwrite()
408 b = bio->ptr; in bio_nwrite()
416 static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr) in bio_ctrl() argument
419 struct bio_bio_st *b = bio->ptr; in bio_ctrl()
453 if (bio_make_pair(bio, other_bio)) in bio_ctrl()
465 bio_destroy_pair(bio); in bio_ctrl()
507 ret = (long)bio_nread0(bio, ptr); in bio_ctrl()
512 ret = (long)bio_nread(bio, ptr, (size_t)num); in bio_ctrl()
517 ret = (long)bio_nwrite0(bio, ptr); in bio_ctrl()
522 ret = (long)bio_nwrite(bio, ptr, (size_t)num); in bio_ctrl()
536 ret = bio->shutdown; in bio_ctrl()
540 bio->shutdown = (int)num; in bio_ctrl()
601 static int bio_puts(BIO *bio, const char *str) in bio_puts() argument
603 return bio_write(bio, str, strlen(str)); in bio_puts()
650 static void bio_destroy_pair(BIO *bio) in bio_destroy_pair() argument
652 struct bio_bio_st *b = bio->ptr; in bio_destroy_pair()
661 assert(peer_b->peer == bio); in bio_destroy_pair()
670 bio->init = 0; in bio_destroy_pair()
722 size_t BIO_ctrl_get_write_guarantee(BIO *bio) in BIO_ctrl_get_write_guarantee() argument
724 return BIO_ctrl(bio, BIO_C_GET_WRITE_GUARANTEE, 0, NULL); in BIO_ctrl_get_write_guarantee()
727 size_t BIO_ctrl_get_read_request(BIO *bio) in BIO_ctrl_get_read_request() argument
729 return BIO_ctrl(bio, BIO_C_GET_READ_REQUEST, 0, NULL); in BIO_ctrl_get_read_request()
732 int BIO_ctrl_reset_read_request(BIO *bio) in BIO_ctrl_reset_read_request() argument
734 return (BIO_ctrl(bio, BIO_C_RESET_READ_REQUEST, 0, NULL) != 0); in BIO_ctrl_reset_read_request()
742 int BIO_nread0(BIO *bio, char **buf) in BIO_nread0() argument
746 if (!bio->init) { in BIO_nread0()
751 ret = BIO_ctrl(bio, BIO_C_NREAD0, 0, buf); in BIO_nread0()
758 int BIO_nread(BIO *bio, char **buf, int num) in BIO_nread() argument
762 if (!bio->init) { in BIO_nread()
767 ret = (int)BIO_ctrl(bio, BIO_C_NREAD, num, buf); in BIO_nread()
769 bio->num_read += ret; in BIO_nread()
773 int BIO_nwrite0(BIO *bio, char **buf) in BIO_nwrite0() argument
777 if (!bio->init) { in BIO_nwrite0()
782 ret = BIO_ctrl(bio, BIO_C_NWRITE0, 0, buf); in BIO_nwrite0()
789 int BIO_nwrite(BIO *bio, char **buf, int num) in BIO_nwrite() argument
793 if (!bio->init) { in BIO_nwrite()
798 ret = BIO_ctrl(bio, BIO_C_NWRITE, num, buf); in BIO_nwrite()
800 bio->num_write += ret; in BIO_nwrite()