The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Handle queues of outgoing UDP packets. More...
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/inet.h>
#include <freeradius-devel/util/event.h>
Go to the source code of this file.
Data Structures | |
struct | fr_udp_queue_config_t |
Typedefs | |
typedef void(* | fr_udp_queue_resume_t) (bool written, void *rctx) |
typedef struct fr_udp_queue_s | fr_udp_queue_t |
Functions | |
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. More... | |
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. More... | |
Handle queues of outgoing UDP packets.
Definition in file udp_queue.h.
struct fr_udp_queue_config_t |
Definition at line 36 of file udp_queue.h.
Data Fields | ||
---|---|---|
char const * | interface | Interface to bind to. |
fr_ipaddr_t | ipaddr | socket IP address |
uint32_t | max_queued_packets | maximum queued packets |
fr_time_delta_t | max_queued_time | maximum time a packet can be queued |
uint16_t | port | socket port |
uint32_t | send_buff | How big the kernel's send buffer should be. |
bool | send_buff_is_set | Whether we were provided with a send_buf. |
typedef void(* fr_udp_queue_resume_t) (bool written, void *rctx) |
Definition at line 53 of file udp_queue.h.
typedef struct fr_udp_queue_s fr_udp_queue_t |
Definition at line 1 of file udp_queue.h.
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.
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 |
Definition at line 95 of file udp_queue.c.
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.
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.
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 |
Definition at line 260 of file udp_queue.c.