27 RCSIDH(lib_bio_fd_h,
"$Id: de40208e60fb7631c9c520dca58c311ecbeb4dd9 $")
29 #include <freeradius-devel/bio/base.h>
30 #include <freeradius-devel/util/socket.h>
31 #include <freeradius-devel/util/event.h>
38 #define AF_FILE_BIO (INT_MAX)
134 #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)
static fr_time_delta_t timeout
fr_socket_t socket
as connected socket
uint16_t src_port
our port
fr_bio_fd_info_t const * fr_bio_fd_info(fr_bio_t *bio)
Returns a pointer to the bio-specific information.
@ FR_BIO_FD_ACCEPTED
temporarily until it's connected.
@ FR_BIO_FD_CONNECTED
connected client sockets (UDP or TCP)
@ 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.
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?
gid_t gid
who owns the socket
char const * interface
for binding to an interface
mode_t perm
permissions for domain sockets
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.
fr_socket_t socket
socket information, including FD.
fr_bio_t * fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_fd_config_t const *cfg, size_t offset))
Allocate a FD bio.
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 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