#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/socket.h>
#include <freeradius-devel/util/udp_queue.h>
Go to the source code of this file.
|
static int | _udp_queue_entry_free (fr_udp_queue_entry_t *entry) |
|
static int | _udp_queue_free (fr_udp_queue_t *uq) |
|
| close (uq->fd) |
|
fr_udp_queue_t * | fr_udp_queue_alloc (TALLOC_CTX *ctx, fr_udp_queue_config_t const *config, fr_event_list_t *el, fr_udp_queue_resume_t resume) |
| Allocate an outbound UDP queue.
|
|
int | fr_udp_queue_write (TALLOC_CTX *ctx, fr_udp_queue_t *uq, uint8_t const *packet, size_t packet_len, fr_ipaddr_t const *ipaddr, int port, void *rctx) |
| Write packet to socket, OR enqueue it if we get EAGAIN.
|
|
| if (fr_dlist_num_elements(&uq->queue)==0) |
|
static void | udp_queue_writable (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx) |
| If the socket is writable, then flush packets until either it returns EWOULDBLOCK, or there are no more packets to write.
|
|
◆ fr_udp_queue_entry_t
struct fr_udp_queue_entry_t |
◆ fr_udp_queue_s
◆ _udp_queue_entry_free()
◆ _udp_queue_free()
◆ close()
◆ fr_udp_queue_alloc()
Allocate an outbound UDP queue.
- Parameters
-
ctx | where the structure will be allocated. |
config | containing the IPs, ports, etc |
el | the event list for adding events to see if the socket is writable |
resume | the function to call after a delayed packet has been written |
- Returns
- NULL on error
- !NULL on success
Definition at line 95 of file udp_queue.c.
◆ fr_udp_queue_write()
Write packet to socket, OR enqueue it if we get EAGAIN.
In most cases, the packet will get written to the socket immediately.
However, if the socket is blocked, then the packet is added to an outbound queue. When the socket becomes unblocked, the packets will be sent.
- Parameters
-
ctx | the talloc context for this packet to be saved in, usually request_t |
uq | the local queue to write it to |
packet | the packet to write |
packet_len | how long the packet is |
ipaddr | the IP address we're sending the packet to |
port | the port we're sending the packet to |
rctx | for resumption, usually request_t, or a structure which holds a request_t |
- Returns
- <0 for error
- 0 for "didn't write it to socket, but added it to the queue, and the caller should yield"
- 1 for "wrote it to the socket, you're good to go".
Definition at line 260 of file udp_queue.c.
◆ if()
◆ udp_queue_writable()
If the socket is writable, then flush packets until either it returns EWOULDBLOCK, or there are no more packets to write.
Definition at line 185 of file udp_queue.c.
◆ return