Binary IO abstractions for retrying packets.
More...
#include <freeradius-devel/bio/bio_priv.h>
#include <freeradius-devel/bio/null.h>
#include <freeradius-devel/bio/buf.h>
#include <freeradius-devel/util/rb.h>
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/bio/retry.h>
Go to the source code of this file.
|
static int8_t | _entry_cmp (void const *one, void const *two) |
|
fr_bio_t * | fr_bio_retry_alloc (TALLOC_CTX *ctx, size_t max_saved, fr_bio_retry_sent_t sent, fr_bio_retry_response_t response, fr_bio_retry_rewrite_t rewrite, fr_bio_retry_release_t release, fr_bio_retry_config_t const *cfg, fr_bio_t *next) |
| Allocate a fr_bio_retry_t. More...
|
|
static ssize_t | fr_bio_retry_blocked (fr_bio_retry_t *my, fr_bio_retry_entry_t *item, ssize_t rcode) |
| The write is blocked. More...
|
|
static int | fr_bio_retry_destructor (fr_bio_retry_t *my) |
| Cancel all outstanding packets. More...
|
|
int | fr_bio_retry_entry_cancel (fr_bio_t *bio, fr_bio_retry_entry_t *item) |
| Cancel one item. More...
|
|
const fr_retry_t * | fr_bio_retry_entry_info (UNUSED fr_bio_t *bio, fr_bio_retry_entry_t *item) |
| Allow the callbacks / application to know when things are being retried. More...
|
|
int | fr_bio_retry_entry_start (UNUSED fr_bio_t *bio, fr_bio_retry_entry_t *item, fr_retry_config_t const *cfg) |
| Set a per-packet retry config. More...
|
|
static ssize_t | fr_bio_retry_read (fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size) |
|
static void | fr_bio_retry_release (fr_bio_retry_t *my, fr_bio_retry_entry_t *item, fr_bio_retry_release_reason_t reason) |
| Release an entry back to the free list. More...
|
|
static int | fr_bio_retry_reset_timer (fr_bio_retry_t *my) |
| Reset the timer after changing the rb tree. More...
|
|
ssize_t | fr_bio_retry_rewrite (fr_bio_t *bio, fr_bio_retry_entry_t *item, const void *buffer, size_t size) |
| Resend a packet. More...
|
|
static void | fr_bio_retry_timer (UNUSED fr_event_list_t *el, fr_time_t now, void *uctx) |
| Run a timer event. More...
|
|
static ssize_t | fr_bio_retry_write (fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size) |
| Write a request, and see if we have a reply. More...
|
|
static int | fr_bio_retry_write_delayed (fr_bio_retry_t *my, fr_time_t now) |
|
static ssize_t | fr_bio_retry_write_fatal (fr_bio_t *bio, UNUSED void *packet_ctx, UNUSED void const *buffer, UNUSED size_t size) |
| A previous timer write had a fatal error, so we forbid further writes. More...
|
|
static int | fr_bio_retry_write_item (fr_bio_retry_t *my, fr_bio_retry_entry_t *item, fr_time_t now) |
| Write one item. More...
|
|
static ssize_t | fr_bio_retry_write_partial (fr_bio_t *bio, void *packet_ctx, const void *buffer, size_t size) |
| There's a partial packet written. More...
|
|
Binary IO abstractions for retrying packets.
- Id
- ecb49797dda4c8796c67e863159892b833e615ca
- Copyright
- 2024 Network RADIUS SAS (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file retry.c.
◆ fr_bio_retry_entry_s
struct fr_bio_retry_entry_s |
Definition at line 42 of file retry.c.
Data Fields |
union fr_bio_retry_entry_s |
__unnamed__ |
|
uint8_t const * |
buffer |
|
bool |
cancelled |
was this item cancelled? |
fr_bio_retry_t * |
my |
so we can get to it from the event timer callback |
void * |
packet_ctx |
packet_ctx from the write() call |
fr_retry_t |
retry |
retry timers and counters |
fr_bio_retry_rewrite_t |
rewrite |
per-packet rewrite callback |
void * |
rewrite_ctx |
context specifically for rewriting this packet |
size_t |
size |
|
void * |
uctx |
user-writable context |
◆ fr_bio_retry_entry_s.__unnamed9__
union fr_bio_retry_entry_s.__unnamed9__ |
◆ fr_bio_retry_s
◆ _BIO_RETRY_PRIVATE
◆ fr_bio_retry_list_t
◆ fr_bio_retry_t
◆ _entry_cmp()
static int8_t _entry_cmp |
( |
void const * |
one, |
|
|
void const * |
two |
|
) |
| |
|
static |
◆ fr_bio_retry_alloc()
◆ fr_bio_retry_blocked()
The write is blocked.
We couldn't write out the entire packet, the bio is blocked. Don't write anything else until we become unblocked!
And free the timer. There's no point in trying to write things if the socket is blocked.
Definition at line 396 of file retry.c.
◆ fr_bio_retry_destructor()
Cancel all outstanding packets.
Definition at line 829 of file retry.c.
◆ fr_bio_retry_entry_cancel()
Cancel one item.
If "item" is NULL, the last entry in the timer tree is cancelled.
- Parameters
-
- Returns
- <0 error
- 0 - didn't cancel
- 1 - did cancel
Definition at line 767 of file retry.c.
◆ fr_bio_retry_entry_info()
Allow the callbacks / application to know when things are being retried.
This is not initialized util after fr_bio_retry_entry_start() has been called.
Definition at line 816 of file retry.c.
◆ fr_bio_retry_entry_start()
Set a per-packet retry config.
This function should be called from the fr_bio_retry_sent_t callback to set a unique retry timer for this packet. If no retry configuration is set, then the main one from the alloc() function is used.
Definition at line 799 of file retry.c.
◆ fr_bio_retry_read()
◆ fr_bio_retry_release()
Release an entry back to the free list.
Definition at line 146 of file retry.c.
◆ fr_bio_retry_reset_timer()
Reset the timer after changing the rb tree.
Definition at line 108 of file retry.c.
◆ fr_bio_retry_rewrite()
Resend a packet.
This function should be called by the rewrite() callback, after (possibly) re-encoding the packet.
- Parameters
-
bio | the binary IO handler |
item | the retry context from fr_bio_retry_sent_t |
buffer | raw data for the packet. May be NULL, in which case the previous packet is retried |
size | size of the raw data |
- Returns
- <0 on error
- 0 for "wrote no data"
- >0 for "wrote data".
Definition at line 447 of file retry.c.
◆ fr_bio_retry_timer()
Run a timer event.
Usually to write out another packet.
Definition at line 519 of file retry.c.
◆ fr_bio_retry_write()
static ssize_t fr_bio_retry_write |
( |
fr_bio_t * |
bio, |
|
|
void * |
packet_ctx, |
|
|
void const * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
Write a request, and see if we have a reply.
Definition at line 563 of file retry.c.
◆ fr_bio_retry_write_delayed()
◆ fr_bio_retry_write_fatal()
A previous timer write had a fatal error, so we forbid further writes.
Definition at line 509 of file retry.c.
◆ fr_bio_retry_write_item()
Write one item.
- Returns
- <0 on error
- 0 for "can't write any more"
- 1 for "wrote a packet"
Definition at line 190 of file retry.c.
◆ fr_bio_retry_write_partial()
static ssize_t fr_bio_retry_write_partial |
( |
fr_bio_t * |
bio, |
|
|
void * |
packet_ctx, |
|
|
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
There's a partial packet written.
Write all of that one first, before writing another packet.
The packet can either be cancelled, or IO blocked. In either case, we must write the full packet before going on to the next one, OR retrying another packet.
Definition at line 298 of file retry.c.