|
static int | accept4 (int fd, struct sockaddr *sockaddr, socklen_t *salen, UNUSED int flags) |
|
int | fr_bio_fd_accept (TALLOC_CTX *ctx, fr_bio_t **out_p, fr_bio_t *bio) |
| Accept a new connection on a socket.
|
|
static int | fr_bio_fd_accept_stream (fr_bio_fd_t *my, fr_bio_fd_t const *parent) |
| Accept a stream socket and initialize its flags.
|
|
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.
|
|
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()
|
|
static void | fr_bio_fd_el_connect (NDEBUG_UNUSED fr_event_list_t *el, NDEBUG_UNUSED int fd, NDEBUG_UNUSED int flags, void *uctx) |
| Connect callback for when the socket is writable.
|
|
static void | fr_bio_fd_el_error (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, int fd_errno, void *uctx) |
| FD error when trying to connect, give up on the BIO.
|
|
static void | fr_bio_fd_el_timeout (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *uctx) |
| We have a timeout on the conenction.
|
|
static int | fr_bio_fd_eof (fr_bio_t *bio) |
|
fr_bio_fd_info_t const * | fr_bio_fd_info (fr_bio_t *bio) |
| Returns a pointer to the bio-specific information.
|
|
int | fr_bio_fd_init_common (fr_bio_fd_t *my) |
|
int | fr_bio_fd_init_connected (fr_bio_fd_t *my) |
|
static int | fr_bio_fd_init_file (fr_bio_fd_t *my) |
| Files are a special case of connected sockets.
|
|
int | fr_bio_fd_init_listen (fr_bio_fd_t *my) |
|
static ssize_t | fr_bio_fd_read_connected_datagram (fr_bio_t *bio, UNUSED void *packet_ctx, void *buffer, size_t size) |
| Connected datagram read.
|
|
static ssize_t | fr_bio_fd_read_discard_datagram (fr_bio_t *bio, UNUSED void *packet_ctx, void *buffer, size_t size) |
| Discard all reads from a UDP socket.
|
|
static ssize_t | fr_bio_fd_read_discard_stream (fr_bio_t *bio, UNUSED void *packet_ctx, void *buffer, size_t size) |
| Discard all reads from a TCP socket.
|
|
static ssize_t | fr_bio_fd_read_stream (fr_bio_t *bio, UNUSED void *packet_ctx, void *buffer, size_t size) |
| Stream read.
|
|
static ssize_t | fr_bio_fd_recvfrom (fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size) |
| Read from a UDP socket where we know our IP.
|
|
static ssize_t | fr_bio_fd_sendto (fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size) |
| Write to a UDP socket where we know our IP.
|
|
static void | fr_bio_fd_set_open (fr_bio_fd_t *my) |
|
static int | fr_bio_fd_shutdown (fr_bio_t *bio) |
| Orderly shutdown.
|
|
int | fr_bio_fd_socket_name (fr_bio_fd_t *my) |
|
static ssize_t | fr_bio_fd_try_connect (fr_bio_fd_t *my) |
| Try to connect().
|
|
static ssize_t | fr_bio_fd_write (fr_bio_t *bio, UNUSED void *packet_ctx, const void *buffer, size_t size) |
| Write to fd.
|
|
int | fr_bio_fd_write_only (fr_bio_t *bio) |
| Mark up a bio as write-only.
|
|
static int | fr_bio_fd_write_resume (fr_bio_t *bio) |
|
int | fr_filename_to_sockaddr (struct sockaddr_un *sun, socklen_t *sunlen, char const *filename) |
|
BIO abstractions for file descriptors.
- Id
- 5dabcca8387414b8993bc3fcc08d0072042e30a2
- Copyright
- 2024 Network RADIUS SAS (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file fd.c.
Allocate a FD bio.
The caller is responsible for tracking the FD, and all associated management of it. The bio API is intended to be simple, and does not provide wrapper functions for various ioctls. The caller should instead do that work.
Once the FD is give to the bio, its lifetime is "owned" by the bio. Calling talloc_free(bio) will close the FD.
The caller can still manage the FD for being readable / writeable. However, the caller should not call this bio directly (unless it is the only one). Instead, the caller should read from / write to the previous bio which will then eventually call this one.
Before updating any event handler readable / writeable callbacks, the caller should check fr_bio_fd_at_eof(). If true, then the handlers should not be inserted. The previous bios should still be called to process any pending data, until they return EOF.
The main purpose of an FD bio is to wrap the FD in a bio container. That, and handling retries on read / write, along with returning EOF as an error instead of zero.
Note that the read / write functions can return partial data. It is the callers responsibility to ensure that any writes continue from where they left off (otherwise dat awill be missing). And any partial reads should go to a memory bio.
If a read returns EOF, then the FD remains open until talloc_free(bio) or fr_bio_fd_close() is called.
- Parameters
-
ctx | the talloc ctx |
cfg | structure holding configuration information |
offset | only for unconnected datagram sockets, where fr_bio_fd_packet_ctx_t is stored |
- Returns
- NULL on error, memory allocation failed
- !NULL the bio
Definition at line 968 of file fd.c.