26RCSIDH(channel_h,
"$Id: 0117fc4ee8ac04aefeb3a019b47f781a44ff0a45 $")
32#include <freeradius-devel/util/table.h>
54#include <freeradius-devel/io/base.h>
55#include <freeradius-devel/io/atomic_queue.h>
56#include <freeradius-devel/io/control.h>
57#include <freeradius-devel/io/message.h>
58#include <freeradius-devel/util/dlist.h>
59#include <freeradius-devel/util/heap.h>
60#include <freeradius-devel/util/log.h>
156#define PRIORITY_NOW (1 << 16)
157#define PRIORITY_HIGH (1 << 15)
158#define PRIORITY_NORMAL (1 << 14)
159#define PRIORITY_LOW (1 << 13)
static uint8_t request[4]
A full channel, which consists of two ends.
void * fr_channel_requestor_uctx_get(fr_channel_t *ch)
Get network-specific data from a channel.
fr_message_t m
the message header
int fr_channel_service_kevent(fr_channel_t *ch, fr_control_t *c, struct kevent const *kev)
void fr_channel_responder_uctx_add(fr_channel_t *ch, void *ctx)
Add responder-specific data to a channel.
fr_channel_stats_t const * fr_channel_responder_stats(fr_channel_t const *ch)
Statistics for the responder's end of a channel.
fr_table_num_sorted_t const channel_signals[]
void * packet_ctx
Packet specific context for holding client information, and other proto_* specific information that n...
bool fr_channel_recv_reply(fr_channel_t *ch)
Receive a reply message from the channel.
fr_time_delta_t message_interval
Interval between messages.
int fr_channel_send_request(fr_channel_t *ch, fr_channel_data_t *cm)
Send a request message into the channel.
unsigned int fr_channel_responder_discard(fr_channel_t *ch)
Discard any requests the requestor queued but we never received.
size_t channel_signals_len
size_t channel_packet_priority_len
int fr_channel_signal_open(fr_channel_t *ch, fr_message_set_t *reply_ms)
Send a channel to a responder.
void(* fr_channel_close_t)(fr_channel_t *ch, fr_time_t now, void *uctx)
Called on a responder when the requestor closes a channel.
uint64_t packets
Number of actual data packets.
int fr_channel_signal_responder_close(fr_channel_t *ch)
Signal a responder that the channel is closing.
fr_channel_control_event_t
Events channels send, in the FR_CONTROL_EVENTSET_CHANNEL event set.
@ FR_CHANNEL_CONTROL_OPEN
A requestor has opened a channel to the responder.
@ FR_CHANNEL_CONTROL_DATA_TO_REQUESTOR
Replies are queued for the requestor.
@ FR_CHANNEL_CONTROL_DATA_DONE_RESPONDER
The responder has serviced its requests, and says how many it has seen.
@ FR_CHANNEL_CONTROL_CLOSE_ACK
The responder has finished closing it.
@ FR_CHANNEL_CONTROL_CLOSE
The requestor is closing the channel.
@ FR_CHANNEL_CONTROL_DATA_TO_RESPONDER
Requests are queued for the responder.
uint64_t resignals
Number of signals resent.
fr_table_num_sorted_t const channel_packet_priority[]
void fr_channel_requestor_uctx_add(fr_channel_t *ch, void *ctx)
Add network-specific data to a channel.
fr_channel_stats_t const * fr_channel_requestor_stats(fr_channel_t const *ch)
Statistics for the requestor's end of a channel.
int fr_channel_callbacks_add(fr_control_t *c, fr_channel_callbacks_t const *callbacks, void *uctx)
Register the owner's channel callbacks on its control plane.
void(* fr_channel_recv_callback_t)(fr_channel_t *ch, fr_channel_data_t *cd, void *uctx)
uint64_t outstanding
Number of outstanding requests with no reply.
fr_time_t last_sent_signal
The last time when we signaled the other end.
int fr_channel_set_recv_reply(fr_channel_t *ch, fr_channel_recv_callback_t recv_reply, void *uctx))
fr_time_t last_read_other
Last time we successfully read a message from the other the channel.
fr_channel_t * fr_channel_create(TALLOC_CTX *ctx, fr_control_t *frontend, fr_control_t *worker, bool same)
Create a new channel.
void(* fr_channel_open_t)(fr_channel_t *ch, fr_message_set_t *reply_ms, fr_time_t now, void *uctx)
Called on a responder when a requestor opens a channel to it.
fr_channel_closed_t closed
void * fr_channel_responder_uctx_get(fr_channel_t *ch)
Get responder-specific data from a channel.
bool fr_channel_recv_request(fr_channel_t *ch)
Receive a request message from the channel.
int fr_channel_null_reply(fr_channel_t *ch)
Don't send a reply message into the channel.
fr_listen_instance_t * inst
for tracking packet transport, etc.
int fr_channel_set_recv_request(fr_channel_t *ch, fr_channel_recv_callback_t recv_request, void *uctx))
void(* fr_channel_closed_t)(fr_channel_t *ch, fr_time_t now, void *uctx)
Called on a requestor when the responder has finished closing a channel.
int fr_channel_send_reply(fr_channel_t *ch, fr_channel_data_t *cd)
Send a reply message into the channel.
void fr_channel_stats_log(fr_channel_t const *ch, fr_log_t const *log, char const *file, int line)
fr_time_t last_write
Last write to the channel.
uint32_t priority
Priority of this packet.
bool fr_channel_active(fr_channel_t *ch)
Check if a channel is active.
uint64_t kevents
Number of times we've looked at kevents.
int fr_channel_responder_ack_close(fr_channel_t *ch)
Acknowledge that the channel is closing.
uint64_t signals
Number of kevent signals we've sent.
uint64_t spurious
Number of signals we received which found no data waiting.
What the owner of a control plane does with channel lifecycle events.
Channel information which is added to a message.
Statistics for the channel.
unsigned int fr_heap_index_t
A Message set, composed of message headers and ring buffer data.
An element in a lexicographically sorted array of name to num mappings.
A time delta, a difference in time measured in nanoseconds.