27RCSIDH(lib_bio_fd_h,
"$Id: fc945a89844d2930c1f5a5133c5ce0f0f921f1cd $")
29#include <freeradius-devel/bio/base.h>
30#include <freeradius-devel/util/socket.h>
31#include <freeradius-devel/util/event.h>
33#include <freeradius-devel/server/cf_parse.h>
40#define AF_FILE_BIO (INT_MAX)
149#define fr_bio_fd_connect(_x) fr_bio_fd_connect_full(_x, NULL, NULL, NULL, NULL, NULL)
void(* fr_bio_callback_t)(fr_bio_t *bio)
Defines a CONF_PAIR to C data type mapping.
const conf_parser_t fr_bio_fd_server_config[]
char const * transport
name of the transport protocol
fr_socket_t socket
as connected socket
char const * name
printable name of this BIO
uint16_t src_port
our port
@ FR_BIO_FD_ACCEPTED
temporarily until it's connected.
@ FR_BIO_FD_CONNECTED
connected client sockets (UDP or TCP)
@ FR_BIO_FD_INVALID
not set
@ FR_BIO_FD_UNCONNECTED
unconnected UDP / datagram only
@ FR_BIO_FD_LISTEN
returns new fd in buffer on fr_bio_read() or fr_bio_fd_accept()
fr_bio_fd_type_t type
type of the socket
fr_bio_fd_state_t state
connecting, open, closed, etc.
uint32_t recv_buff
How big the kernel's receive buffer should be.
bool mkdir
make intermediate directories
int fr_bio_fd_reopen(fr_bio_t *bio)
Reopen a file BIO.
@ FR_BIO_FD_STATE_INVALID
@ FR_BIO_FD_STATE_CONNECTING
@ FR_BIO_FD_STATE_OPEN
error states must be before this
int connect_errno
from connect() or other APIs
fr_ipaddr_t dst_ipaddr
their IP address
fr_bio_fd_type_t type
accept, connected, unconnected, etc.
const conf_parser_t fr_bio_fd_client_config[]
bool recv_buff_is_set
Whether we were provided with a recv_buf.
char const * path
for Unix domain sockets
uint32_t send_buff
How big the kernel's send buffer should be.
char const * filename
for files
uid_t uid
who owns the socket
fr_bio_fd_config_t const * cfg
so we know what was asked, vs what was granted.
bool read_blocked
did we block on read?
bool server
is this a client or a server?
gid_t gid
who owns the socket
char const * interface
for binding to an interface
mode_t perm
permissions for domain sockets
fr_bio_fd_info_t const * fr_bio_fd_info(fr_bio_t *bio)
Returns a pointer to the bio-specific information.
int socket_type
SOCK_STREAM or SOCK_DGRAM.
uint16_t dst_port
their port
bool tcp_delay
We do tcp_nodelay by default.
int fr_bio_fd_write_only(fr_bio_t *bio)
Mark up a bio as write-only.
int fr_bio_fd_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg)
Opens a socket and updates sock->fd.
int fr_bio_fd_connect_full(fr_bio_t *bio, fr_event_list_t *el, fr_bio_callback_t connected_cb, fr_bio_callback_t error_cb, fr_time_delta_t *timeout, fr_bio_callback_t timeout_cb))
Finalize a connect()
int fr_bio_fd_accept(TALLOC_CTX *ctx, fr_bio_t **out, fr_bio_t *bio)
Alternative to calling fr_bio_read() on new socket.
int fr_bio_fd_check_config(fr_bio_fd_config_t const *cfg)
Checks the configuration without modifying anything.
fr_socket_t socket
socket information, including FD.
int fr_bio_fd_close(fr_bio_t *bio)
Close the FD, but leave the bio allocated and alive.
fr_time_t when
when the packet was received
bool send_buff_is_set
Whether we were provided with a send_buf.
fr_bio_t * fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_fd_config_t const *cfg, size_t offset))
Allocate a FD bio.
bool write_blocked
did we block on write?
fr_ipaddr_t src_ipaddr
our IP address
Configuration for sockets.
Run-time status of the socket.
Stores all information relating to an event list.
A time delta, a difference in time measured in nanoseconds.
static fr_event_list_t * el
Holds information necessary for binding or connecting to a socket.
static size_t char ** out