Lines Matching refs:BIO

74 /* BIO abstracts over a file-descriptor like interface. */
79 /* BIO_new creates a new BIO with the given type and a reference count of one.
80 * It returns the fresh |BIO|, or NULL on error. */
81 OPENSSL_EXPORT BIO *BIO_new(const BIO_METHOD *type);
84 * drops to zero, it (optionally) calls the BIO's callback with |BIO_CB_FREE|,
85 * frees the ex_data and then, if the BIO has a destroy callback for the
87 * the next BIO in the chain, if any.
90 OPENSSL_EXPORT int BIO_free(BIO *bio);
96 OPENSSL_EXPORT void BIO_vfree(BIO *bio);
99 OPENSSL_EXPORT BIO *BIO_up_ref(BIO *bio);
106 OPENSSL_EXPORT int BIO_read(BIO *bio, void *data, int len);
111 * exact operation depends on the BIO's method. For example, a digest BIO will
116 OPENSSL_EXPORT int BIO_gets(BIO *bio, char *buf, int size);
118 /* BIO_write writes |len| bytes from |data| to BIO. It returns the number of
120 OPENSSL_EXPORT int BIO_write(BIO *bio, const void *data, int len);
124 OPENSSL_EXPORT int BIO_puts(BIO *bio, const char *buf);
128 OPENSSL_EXPORT int BIO_flush(BIO *bio);
133 * These are generic functions for sending control requests to a BIO. In
138 OPENSSL_EXPORT long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg);
143 OPENSSL_EXPORT char *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
147 OPENSSL_EXPORT long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
152 OPENSSL_EXPORT int BIO_reset(BIO *bio);
155 OPENSSL_EXPORT void BIO_set_flags(BIO *bio, int flags);
158 OPENSSL_EXPORT int BIO_test_flags(const BIO *bio, int flags);
163 OPENSSL_EXPORT int BIO_should_read(const BIO *bio);
168 OPENSSL_EXPORT int BIO_should_write(const BIO *bio);
173 OPENSSL_EXPORT int BIO_should_retry(const BIO *bio);
179 OPENSSL_EXPORT int BIO_should_io_special(const BIO *bio);
181 /* BIO_RR_SSL_X509_LOOKUP indicates that an SSL BIO blocked because the SSL
199 OPENSSL_EXPORT int BIO_get_retry_reason(const BIO *bio);
202 OPENSSL_EXPORT void BIO_clear_flags(BIO *bio, int flags);
206 OPENSSL_EXPORT void BIO_set_retry_read(BIO *bio);
210 OPENSSL_EXPORT void BIO_set_retry_write(BIO *bio);
214 OPENSSL_EXPORT int BIO_get_retry_flags(BIO *bio);
218 OPENSSL_EXPORT void BIO_clear_retry_flags(BIO *bio);
222 OPENSSL_EXPORT int BIO_method_type(const BIO *bio);
225 * BIO operations. The |event| argument is one of |BIO_CB_*| and can be ORed
229 typedef long (*bio_info_cb)(BIO *bio, int event, const char *parg, int cmd,
234 * can be interpreted by the |BIO|. */
235 OPENSSL_EXPORT long BIO_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp);
238 OPENSSL_EXPORT size_t BIO_pending(const BIO *bio);
242 OPENSSL_EXPORT size_t BIO_ctrl_pending(const BIO *bio);
245 OPENSSL_EXPORT size_t BIO_wpending(const BIO *bio);
248 * the type of |bio| but, for example, a memory BIO interprets the close flag
251 OPENSSL_EXPORT int BIO_set_close(BIO *bio, int close_flag);
255 OPENSSL_EXPORT void BIO_set_callback(BIO *bio, bio_info_cb callback_func);
259 OPENSSL_EXPORT void BIO_set_callback_arg(BIO *bio, char *arg);
263 OPENSSL_EXPORT char *BIO_get_callback_arg(const BIO *bio);
267 OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio);
271 OPENSSL_EXPORT size_t BIO_number_written(const BIO *bio);
277 * the next etc. The most common case is a buffering BIO, which accepts and
278 * buffers writes until flushed into the next BIO in the chain. */
285 OPENSSL_EXPORT BIO *BIO_push(BIO *bio, BIO *appended_bio);
287 /* BIO_pop removes |bio| from the head of a chain and returns the next BIO in
288 * the chain, or NULL if there is no next BIO.
291 OPENSSL_EXPORT BIO *BIO_pop(BIO *bio);
293 /* BIO_next returns the next BIO in the chain after |bio|, or NULL if there is
294 * no such BIO. */
295 OPENSSL_EXPORT BIO *BIO_next(BIO *bio);
300 OPENSSL_EXPORT void BIO_free_all(BIO *bio);
304 OPENSSL_EXPORT BIO *BIO_find_type(BIO *bio, int type);
307 * the next BIO in the chain. */
308 OPENSSL_EXPORT void BIO_copy_next_retry(BIO *bio);
313 * These functions are versions of printf functions that output to a BIO rather
320 OPENSSL_EXPORT int BIO_printf(BIO *bio, const char *format, ...)
329 OPENSSL_EXPORT int BIO_indent(BIO *bio, unsigned indent, unsigned max_indent);
333 OPENSSL_EXPORT int BIO_hexdump(BIO *bio, const uint8_t *data, size_t len,
338 OPENSSL_EXPORT void BIO_print_errors(BIO *bio);
352 OPENSSL_EXPORT int BIO_read_asn1(BIO *bio, uint8_t **out, size_t *out_len,
360 * written to a writable, memory BIO can be recalled by reading from it.
362 * Calling |BIO_reset| on a read-only BIO resets it to the original contents.
363 * On a writable BIO, it clears any data.
366 * underlying |BUF_MEM| will not be freed when the |BIO| is freed.
370 * |BIO_eof| is true if no data is in the BIO.
377 /* BIO_new_mem_buf creates BIO that reads and writes from |len| bytes at |buf|.
378 * It does not take ownership of |buf|. It returns the BIO or NULL on error.
382 OPENSSL_EXPORT BIO *BIO_new_mem_buf(void *buf, int len);
387 OPENSSL_EXPORT int BIO_mem_contents(const BIO *bio,
397 OPENSSL_EXPORT long BIO_get_mem_data(BIO *bio, char **contents);
401 OPENSSL_EXPORT int BIO_get_mem_ptr(BIO *bio, BUF_MEM **out);
406 OPENSSL_EXPORT int BIO_set_mem_buf(BIO *bio, BUF_MEM *b, int take_ownership);
409 * |bio| when empty. If |eof_value| is zero then an empty memory BIO will
416 * For a read-only BIO, the default is zero (EOF). For a writable BIO, the
418 OPENSSL_EXPORT int BIO_set_mem_eof_return(BIO *bio, int eof_value);
425 * underlying file descriptor when the BIO is freed.
438 /* BIO_new_fd creates a new file descriptor BIO wrapping |fd|. If |close_flag|
439 * is non-zero, then |fd| will be closed when the BIO is. */
440 OPENSSL_EXPORT BIO *BIO_new_fd(int fd, int close_flag);
445 OPENSSL_EXPORT int BIO_set_fd(BIO *bio, int fd, int close_flag);
450 OPENSSL_EXPORT int BIO_get_fd(BIO *bio, int *out_fd);
457 * |BIO_flush| on a file BIO calls |fflush| on the wrapped stream.
468 * BIO is freed. */
473 /* BIO_new_file creates a file BIO by opening |filename| with the given mode.
475 OPENSSL_EXPORT BIO *BIO_new_file(const char *filename, const char *mode);
477 /* BIO_new_fp creates a new file BIO that wraps the given |FILE|. If
479 * the BIO is closed. */
480 OPENSSL_EXPORT BIO *BIO_new_fp(FILE *stream, int close_flag);
484 OPENSSL_EXPORT int BIO_get_fp(BIO *bio, FILE **out_file);
489 OPENSSL_EXPORT int BIO_set_fp(BIO *bio, FILE *file, int close_flag);
494 OPENSSL_EXPORT int BIO_read_filename(BIO *bio, const char *filename);
499 OPENSSL_EXPORT int BIO_write_filename(BIO *bio, const char *filename);
504 OPENSSL_EXPORT int BIO_append_filename(BIO *bio, const char *filename);
509 OPENSSL_EXPORT int BIO_rw_filename(BIO *bio, const char *filename);
514 * Buffer BIOs are a filter-type BIO, i.e. they are designed to be used in a
522 OPENSSL_EXPORT int BIO_set_read_buffer_size(BIO *bio, int buffer_size);
526 OPENSSL_EXPORT int BIO_set_write_buffer_size(BIO *bio, int buffer_size);
533 /* BIO_new_socket allocates and initialises a fresh BIO which will read and
535 * BIO will close |fd|. It returns the fresh |BIO| or NULL on error. */
536 OPENSSL_EXPORT BIO *BIO_new_socket(int fd, int close_flag);
541 * A connection BIO creates a network connection and transfers data over the
546 /* BIO_new_connect returns a BIO that connects to the given hostname and port.
551 * It returns the new BIO on success, or NULL on error. */
552 OPENSSL_EXPORT BIO *BIO_new_connect(const char *host_and_optional_port);
559 OPENSSL_EXPORT int BIO_set_conn_hostname(BIO *bio,
564 OPENSSL_EXPORT int BIO_set_conn_port(BIO *bio, const char *port_str);
568 OPENSSL_EXPORT int BIO_set_nbio(BIO *bio, int on);
591 /* BIO Pairs.
593 * BIO pairs provide a "loopback" like system: a pair of BIOs where data
600 OPENSSL_EXPORT int BIO_new_bio_pair(BIO **out1, size_t writebuf1, BIO **out2,
607 * outlive the BIO pairs. It returns one on success and zero on error. */
608 OPENSSL_EXPORT int BIO_new_bio_pair_external_buf(BIO** bio1_p,
611 BIO** bio2_p,
617 OPENSSL_EXPORT size_t BIO_ctrl_get_read_request(BIO *bio);
622 OPENSSL_EXPORT size_t BIO_ctrl_get_write_guarantee(BIO *bio);
627 OPENSSL_EXPORT int BIO_shutdown_wr(BIO *bio);
630 /* Zero copy versions of BIO_read and BIO_write for BIO pairs. */
645 OPENSSL_EXPORT int BIO_zero_copy_get_read_buf(BIO* bio,
650 /* BIO_zero_copy_get_read_buf_done must be called after reading from a BIO using
656 OPENSSL_EXPORT int BIO_zero_copy_get_read_buf_done(BIO* bio, size_t bytes_read);
672 OPENSSL_EXPORT int BIO_zero_copy_get_write_buf(BIO* bio,
677 /* BIO_zero_copy_get_write_buf_done must be called after writing to a BIO using
683 OPENSSL_EXPORT int BIO_zero_copy_get_write_buf_done(BIO* bio,
688 * flag" is passed to a BIO function. */
692 /* These are passed to the BIO callback */
715 /* callback is int cb(BIO *bio,state,ret); */
731 /* BIO_f_base64 returns a filter |BIO| that base64-encodes data written into
739 OPENSSL_EXPORT void ERR_print_errors(BIO *bio);
768 #define BIO_TYPE_PROXY_CLIENT (14 | 0x0200) /* client proxy BIO */
769 #define BIO_TYPE_PROXY_SERVER (15 | 0x0200) /* server proxy BIO */
770 #define BIO_TYPE_NBIO_TEST (16 | 0x0200) /* server proxy BIO */
773 #define BIO_TYPE_BIO (19 | 0x0400) /* (half a) BIO pair */
786 int (*bwrite)(BIO *, const char *, int);
787 int (*bread)(BIO *, char *, int);
789 int (*bputs)(BIO *, const char *);
790 int (*bgets)(BIO *, char *, int);
791 long (*ctrl)(BIO *, int, long, void *);
792 int (*create)(BIO *);
793 int (*destroy)(BIO *);
794 long (*callback_ctrl)(BIO *, int, bio_info_cb);
800 long (*callback)(BIO *, int, const char *, int, long, long);
803 /* init is non-zero if this |BIO| has been initialised. */
807 * |BIO_set_close|. For example, whether an fd BIO closes the underlying fd
812 /* num is a BIO-specific value. For example, in fd BIOs it's used to store a
817 /* next_bio points to the next |BIO| in a chain. This |BIO| owns a reference
819 BIO *next_bio; /* used by filter BIOs */