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)
86 bio->ptr = b;
90 static int bio_free(BIO *bio)
94 if (bio == NULL)
96 b = bio->ptr;
101 bio_destroy_pair(bio);
109 static int bio_read(BIO *bio, char *buf, int size_)
115 BIO_clear_retry_flags(bio);
117 if (!bio->init)
120 b = bio->ptr;
136 BIO_set_retry_read(bio); /* buffer is empty */
200 static ossl_ssize_t bio_nread0(BIO *bio, char **buf)
205 BIO_clear_retry_flags(bio);
207 if (!bio->init)
210 b = bio->ptr;
223 return bio_read(bio, &dummy, 1); /* returns 0 or -1 */
237 static ossl_ssize_t bio_nread(BIO *bio, char **buf, size_t num_)
247 available = bio_nread0(bio, buf);
253 b = bio->ptr;
268 static int bio_write(BIO *bio, const char *buf, int num_)
274 BIO_clear_retry_flags(bio);
276 if (!bio->init || buf == NULL || num == 0)
279 b = bio->ptr;
294 BIO_set_retry_write(bio); /* buffer is full */
345 static ossl_ssize_t bio_nwrite0(BIO *bio, char **buf)
351 BIO_clear_retry_flags(bio);
353 if (!bio->init)
356 b = bio->ptr;
370 BIO_set_retry_write(bio);
393 static ossl_ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_)
403 space = bio_nwrite0(bio, buf);
408 b = bio->ptr;
416 static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
419 struct bio_bio_st *b = bio->ptr;
453 if (bio_make_pair(bio, other_bio))
465 bio_destroy_pair(bio);
507 ret = (long)bio_nread0(bio, ptr);
512 ret = (long)bio_nread(bio, ptr, (size_t)num);
517 ret = (long)bio_nwrite0(bio, ptr);
522 ret = (long)bio_nwrite(bio, ptr, (size_t)num);
536 ret = bio->shutdown;
540 bio->shutdown = (int)num;
601 static int bio_puts(BIO *bio, const char *str)
603 return bio_write(bio, str, strlen(str));
654 static void bio_destroy_pair(BIO *bio)
656 struct bio_bio_st *b = bio->ptr;
665 assert(peer_b->peer == bio);
674 bio->init = 0;
726 size_t BIO_ctrl_get_write_guarantee(BIO *bio)
728 return BIO_ctrl(bio, BIO_C_GET_WRITE_GUARANTEE, 0, NULL);
731 size_t BIO_ctrl_get_read_request(BIO *bio)
733 return BIO_ctrl(bio, BIO_C_GET_READ_REQUEST, 0, NULL);
736 int BIO_ctrl_reset_read_request(BIO *bio)
738 return (BIO_ctrl(bio, BIO_C_RESET_READ_REQUEST, 0, NULL) != 0);
746 int BIO_nread0(BIO *bio, char **buf)
750 if (!bio->init) {
755 ret = BIO_ctrl(bio, BIO_C_NREAD0, 0, buf);
762 int BIO_nread(BIO *bio, char **buf, int num)
766 if (!bio->init) {
771 ret = (int)BIO_ctrl(bio, BIO_C_NREAD, num, buf);
773 bio->num_read += ret;
777 int BIO_nwrite0(BIO *bio, char **buf)
781 if (!bio->init) {
786 ret = BIO_ctrl(bio, BIO_C_NWRITE0, 0, buf);
793 int BIO_nwrite(BIO *bio, char **buf, int num)
797 if (!bio->init) {
802 ret = BIO_ctrl(bio, BIO_C_NWRITE, num, buf);
804 bio->num_write += ret;