44RCSIDH(lib_bio_dedup_h,
"$Id: 7a78269699d3ce70968a517351184de1e6052081 $")
46#include <freeradius-devel/util/event.h>
47#include <freeradius-devel/util/rb.h>
48#include <freeradius-devel/bio/protocol.h>
52#ifndef _BIO_DEDUP_PRIVATE
static int packet_ctx
the tests pass only the address of packet_ctx
int fr_bio_dedup_conflict(fr_bio_t *bio, fr_bio_dedup_entry_t *item)
Mark an entry as conflicting with a newer request.
ssize_t fr_bio_dedup_respond(fr_bio_t *bio, fr_bio_dedup_entry_t *item)
Resend a reply when we receive a duplicate request.
fr_cmp_t duplicate_cmp
returns 0 when two entries with the same key hold the same packet, i.e.
fr_protocol_dedup_ctx_t dedup_ctx
create the dedup context of a packet. It MUST be set.
void * uctx
user-writable context
int fr_bio_dedup_entry_extend(fr_bio_t *bio, fr_bio_dedup_entry_t *item, fr_time_t expires)
Extend the expiry time for an entry.
fr_cmp_t dedup_cmp
compare the dedup contexts of two fr_bio_dedup_entry_t.
bool connected
this BIO is for a connected socket, where all packets have the same address.
fr_bio_dedup_receive_t receive
tell the application which entry the dedup bio created for a new packet.
fr_event_list_t * el
event list
fr_bio_dedup_get_item_t get_item
turn a packet_ctx into a fr_bio_dedup_entry_t.
void fr_bio_dedup_entry_cancel(fr_bio_t *bio, fr_bio_dedup_entry_t *item)
Cancel one item.
int fr_bio_dedup_no_reply(fr_bio_t *bio, fr_bio_dedup_entry_t *item)
uint32_t max_active
maximum number of entries in use.
fr_time_delta_t lifetime
default lifetime of dedup entry
fr_bio_t * fr_bio_dedup_alloc(TALLOC_CTX *ctx, fr_bio_dedup_config_t const *cfg, fr_bio_t *next)
Allocate a fr_bio_dedup_t.
size_t packet_size
size of the cached packet data
void(* fr_bio_dedup_receive_t)(fr_bio_t *bio, fr_bio_dedup_entry_t *item, void *packet_ctx)
Tell the application that the packet of the current read has the entry item
void * dedup_ctx
context for dedup purposes
uint8_t * reply
reply cached by the application
size_t reply_size
size of the cached reply
void * reply_ctx
reply ctx
size_t offset
where fr_bio_fd_packet_ctx_t is stored in packet_ctx.
uint8_t * packet
cached packet data for finding duplicates
fr_rb_node_t dedup
node in fr_bio_dedup_t.dedup
uint32_t max_free
maximum number of entries in the free list.
fr_bio_dedup_entry_t *(* fr_bio_dedup_get_item_t)(fr_bio_t *bio, void *packet_ctx)
fr_bio_dedup_release_reason_t
@ FR_BIO_DEDUP_WRITE_ERROR
IO error.
@ FR_BIO_DEDUP_INTERNAL_ERROR
something something, error.
@ FR_BIO_DEDUP_CANCELLED
it was cancelled
@ FR_BIO_DEDUP_EXPIRED
it's expired, and we have to delete it
@ FR_BIO_DEDUP_NO_REPLY
We're not replying to this item.
fr_bio_dedup_release_t release
called to release a packet. It MUST be set.
void(* fr_bio_dedup_release_t)(fr_bio_t *bio, fr_bio_dedup_entry_t *item, fr_bio_dedup_release_reason_t reason)
Callback on release the packet (timeout, or cancelled by the application)
Stores all information relating to an event list.
static void * item(fr_lst_t const *lst, fr_lst_index_t idx)
fr_cmp_ret_t(* fr_cmp_t)(void const *a, void const *b)
void *(* fr_protocol_dedup_ctx_t)(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, void *uctx)
Create the dedup context of a packet.
A time delta, a difference in time measured in nanoseconds.