The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Binary IO abstractions for deduping of raw packets. More...
#include <freeradius-devel/util/event.h>
Go to the source code of this file.
Data Structures | |
struct | fr_bio_dedup_config_t |
struct | fr_bio_dedup_entry_s |
Typedefs | |
typedef struct fr_bio_dedup_entry_s | fr_bio_dedup_entry_t |
typedef fr_bio_dedup_entry_t *(* | fr_bio_dedup_get_item_t) (fr_bio_t *bio, void *packet_ctx) |
typedef bool(* | fr_bio_dedup_receive_t) (fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, void *packet_ctx) |
Callback on read to see if we should receive the packet. More... | |
typedef void(* | fr_bio_dedup_release_t) (fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, fr_bio_dedup_release_reason_t reason) |
Callback on release the packet (timeout, or cancelled by the application) More... | |
Enumerations | |
enum | fr_bio_dedup_release_reason_t { FR_BIO_DEDUP_EXPIRED = 0 , FR_BIO_DEDUP_CANCELLED , FR_BIO_DEDUP_WRITE_ERROR , FR_BIO_DEDUP_INTERNAL_ERROR } |
Functions | |
fr_bio_t * | fr_bio_dedup_alloc (TALLOC_CTX *ctx, size_t max_saved, fr_bio_dedup_receive_t receive, fr_bio_dedup_release_t release, fr_bio_dedup_get_item_t get_item, fr_bio_dedup_config_t const *cfg, fr_bio_t *next)) |
Allocate a fr_bio_dedup_t. More... | |
void | fr_bio_dedup_entry_cancel (fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx) |
Cancel one item. More... | |
int | fr_bio_dedup_entry_extend (fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, fr_time_t expires) |
Extend the expiry time for an entry. More... | |
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. More... | |
Binary IO abstractions for deduping of raw packets.
Read packets from a dedup bio. Once a packet is read, it is checked against a dedup tree. Duplicate packets are suppressed.
The caller has to manage the actual dedup tree and comparisons. Each protocol has its own requirements for dedup, and it is too awkward to make a generic method which works everywhere.
Definition in file dedup.h.
struct fr_bio_dedup_config_t |
Data Fields | ||
---|---|---|
fr_event_list_t * | el | event list |
fr_time_delta_t | lifetime | default lifetime of dedup entry |
struct fr_bio_dedup_entry_s |
Data Fields | ||
---|---|---|
union fr_bio_dedup_entry_s | __unnamed__ | |
fr_rb_node_t | dedup | user managed dedup node |
fr_time_t | expires | when this entry expires |
fr_bio_dedup_t * | my | so we can get to it from the event timer callback |
uint8_t * | packet |
cached packet data for finding duplicates cached packet data. |
void * | packet_ctx | packet_ctx for dedup purposes |
size_t | packet_size | size of the cached packet data |
uint8_t * | reply | reply cached by the application |
void * | reply_ctx | reply ctx |
size_t | reply_size | size of the cached reply |
fr_bio_dedup_state_t | state | which tree or list this item is in |
void * | uctx | user-writable context |
typedef struct fr_bio_dedup_entry_s fr_bio_dedup_entry_t |
typedef fr_bio_dedup_entry_t*(* fr_bio_dedup_get_item_t) (fr_bio_t *bio, void *packet_ctx) |
typedef bool(* fr_bio_dedup_receive_t) (fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, void *packet_ctx) |
Callback on read to see if we should receive the packet.
The caller should cache dedup_ctx, unless it's a duplicate request.
If it's a duplicate request, the caller should call fr_bio_dedup_respond() to write out the reply.
bio | the binary IO handler |
dedup_ctx | new dedup_ctx assigned to this potential packet |
packet_ctx | per-packet context for the response |
typedef void(* fr_bio_dedup_release_t) (fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, fr_bio_dedup_release_reason_t reason) |
Callback on release the packet (timeout, or cancelled by the application)
The callback function should clean up any resources associated with the packet. The resources MUST NOT be released until the data is either "released" or "cancelled".
The packet will be cancelled after this call returns. The cancellation callback will NOT be run.
bio | the binary IO handler |
dedup_ctx | the dedup ctx to release |
reason | why this packet is being released |
fr_bio_t* fr_bio_dedup_alloc | ( | TALLOC_CTX * | ctx, |
size_t | max_saved, | ||
fr_bio_dedup_receive_t | receive, | ||
fr_bio_dedup_release_t | release, | ||
fr_bio_dedup_get_item_t | get_item, | ||
fr_bio_dedup_config_t const * | cfg, | ||
fr_bio_t * | next | ||
) |
Allocate a fr_bio_dedup_t.
Definition at line 1035 of file dedup.c.
void fr_bio_dedup_entry_cancel | ( | fr_bio_t * | bio, |
fr_bio_dedup_entry_t * | item | ||
) |
int fr_bio_dedup_entry_extend | ( | fr_bio_t * | bio, |
fr_bio_dedup_entry_t * | item, | ||
fr_time_t | expires | ||
) |
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.
This function should be called by the respond() callback to re-send a duplicate reply.
It can also be called by the application when it first has a response to the request.
bio | the binary IO handler |
item | the dedup context from #fr_bio_dedup_sent_t |
Definition at line 213 of file dedup.c.