BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO
const BIO_METHOD *BIO_s_fd(void);
int BIO_set_fd(BIO *b, int fd, int c);
int BIO_get_fd(BIO *b, int *c);
BIO *BIO_new_fd(int fd, int close_flag);
returns the file descriptor BIO method. This is a wrapper
round the platforms file descriptor routines such as read()
read or write the underlying
is supported but BIO_gets()
If the close flag is set then close()
is called on the underlying file
descriptor when the BIO is freed.
attempts to change the file pointer to the start of file such
as by using lseek(fd, 0, 0)
sets the file pointer to position ofs
from start of
file such as by using lseek(fd, ofs, 0)
returns the current file position such as by calling
lseek(fd, 0, 1)
sets the file descriptor of BIO b
the close flag to c
places the file descriptor in c
if it is not NULL, it
also returns the file descriptor.
returns a file descriptor BIO using fd
The behaviour of BIO_read()
depends on the
behavior of the platforms read()
calls on the
descriptor. If the underlying file descriptor is in a non blocking mode then
the BIO will behave in the manner described in the BIO_read
(3) manual pages.
File descriptor BIOs should not be used for socket I/O. Use socket BIOs instead.
are implemented as macros.
returns the file descriptor BIO method.
always returns 1.
returns the file descriptor or -1 if the BIO has not been
returns the newly allocated BIO or NULL is an error
This is a file descriptor BIO version of "Hello World":
out = BIO_new_fd(fileno(stdout), BIO_NOCLOSE);
BIO_printf(out, "Hello World\n");
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the OpenSSL license (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy in the
file LICENSE in the source distribution or at