The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Typedefs | Functions
control.h File Reference

control-plane signaling More...

#include <freeradius-devel/io/atomic_queue.h>
#include <freeradius-devel/io/ring_buffer.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/event.h>
#include <sys/types.h>
+ Include dependency graph for control.h:

Go to the source code of this file.

Macros

#define FR_CONTROL_ID_CHANNEL   (1)
 
#define FR_CONTROL_ID_DIRECTORY   (4)
 
#define FR_CONTROL_ID_INJECT   (5)
 
#define FR_CONTROL_ID_LISTEN   (2)
 
#define FR_CONTROL_ID_LISTEN_DEAD   (6)
 
#define FR_CONTROL_ID_WORKER   (3)
 
#define FR_CONTROL_MAX_MESSAGES   (1024)
 
#define FR_CONTROL_MAX_SIZE   (64)
 

Typedefs

typedef void(* fr_control_callback_t) (void *ctx, void const *data, size_t data_size, fr_time_t now)
 
typedef struct fr_control_s fr_control_t
 A one-way control plane signal. More...
 

Functions

int fr_control_callback_add (fr_control_t *c, uint32_t id, void *ctx, fr_control_callback_t callback))
 Register a callback for an ID. More...
 
int fr_control_callback_delete (fr_control_t *c, uint32_t id)
 Delete a callback for an ID. More...
 
fr_control_tfr_control_create (TALLOC_CTX *ctx, fr_event_list_t *el, fr_atomic_queue_t *aq))
 Create a control-plane signaling path. More...
 
int fr_control_gc (fr_control_t *c, fr_ring_buffer_t *rb)
 
ssize_t fr_control_message_pop (fr_atomic_queue_t *aq, uint32_t *p_id, void *data, size_t data_size)
 Pop control-plane message. More...
 
int fr_control_message_push (fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, void *data, size_t data_size)
 Push a control-plane message. More...
 
int fr_control_message_send (fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, void *data, size_t data_size)
 Send a control-plane message. More...
 
int fr_control_same_thread (fr_control_t *c)
 

Detailed Description

control-plane signaling

Id
c82782bbbfad0f10cf1b9db838006f90bb8cc4c3

Definition in file control.h.

Macro Definition Documentation

◆ FR_CONTROL_ID_CHANNEL

#define FR_CONTROL_ID_CHANNEL   (1)

Definition at line 56 of file control.h.

◆ FR_CONTROL_ID_DIRECTORY

#define FR_CONTROL_ID_DIRECTORY   (4)

Definition at line 59 of file control.h.

◆ FR_CONTROL_ID_INJECT

#define FR_CONTROL_ID_INJECT   (5)

Definition at line 60 of file control.h.

◆ FR_CONTROL_ID_LISTEN

#define FR_CONTROL_ID_LISTEN   (2)

Definition at line 57 of file control.h.

◆ FR_CONTROL_ID_LISTEN_DEAD

#define FR_CONTROL_ID_LISTEN_DEAD   (6)

Definition at line 61 of file control.h.

◆ FR_CONTROL_ID_WORKER

#define FR_CONTROL_ID_WORKER   (3)

Definition at line 58 of file control.h.

◆ FR_CONTROL_MAX_MESSAGES

#define FR_CONTROL_MAX_MESSAGES   (1024)

Definition at line 50 of file control.h.

◆ FR_CONTROL_MAX_SIZE

#define FR_CONTROL_MAX_SIZE   (64)

Definition at line 51 of file control.h.

Typedef Documentation

◆ fr_control_callback_t

typedef void(* fr_control_callback_t) (void *ctx, void const *data, size_t data_size, fr_time_t now)

Definition at line 45 of file control.h.

◆ fr_control_t

typedef struct fr_control_s fr_control_t

A one-way control plane signal.

Multiple-producer, single consumer.

Definition at line 1 of file control.h.

Function Documentation

◆ fr_control_callback_add()

int fr_control_callback_add ( fr_control_t c,
uint32_t  id,
void *  ctx,
fr_control_callback_t  callback 
)

Register a callback for an ID.

Parameters
[in]cthe control structure
[in]idthe ident of this message.
[in]ctxthe context for the callback
[in]callbackthe callback function
Returns
  • <0 on error
  • 0 on success

Definition at line 417 of file control.c.

+ Here is the caller graph for this function:

◆ fr_control_callback_delete()

int fr_control_callback_delete ( fr_control_t c,
uint32_t  id 
)

Delete a callback for an ID.

Parameters
[in]cthe control structure
[in]idthe ident of this message.
Returns
  • <0 on error
  • 0 on success

Definition at line 454 of file control.c.

◆ fr_control_create()

fr_control_t* fr_control_create ( TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_atomic_queue_t aq 
)

Create a control-plane signaling path.

Parameters
[in]ctxthe talloc context
[in]elthe event list for the control socket
[in]aqthe atomic queue where we will be pushing message data
Returns
  • NULL on error
  • fr_control_t on success

Definition at line 149 of file control.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_control_gc()

int fr_control_gc ( fr_control_t c,
fr_ring_buffer_t rb 
)

◆ fr_control_message_pop()

ssize_t fr_control_message_pop ( fr_atomic_queue_t aq,
uint32_t p_id,
void *  data,
size_t  data_size 
)

Pop control-plane message.

This function is called ONLY from the receiving thread.

Parameters
[in]aqthe recipients atomic queue for control-plane messages
[out]p_idthe ident of this message.
[in,out]datawhere the data is stored
[in]data_sizethe size of the buffer where we store the data.
Returns
  • <0 the size of the data we need to read the next message
  • 0 this kevent is not for us.
  • >0 the amount of data we've read

Definition at line 377 of file control.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_control_message_push()

int fr_control_message_push ( fr_control_t c,
fr_ring_buffer_t rb,
uint32_t  id,
void *  data,
size_t  data_size 
)

Push a control-plane message.

This function is called ONLY from the originating thread.

Parameters
[in]cthe control structure
[in]rbthe callers ring buffer for message allocation.
[in]idthe ident of this message.
[in]datathe data to write to the control plane
[in]data_sizethe size of the data to write to the control plane.
Returns
  • -2 on ring buffer full
  • <0 on error
  • 0 on success

Definition at line 298 of file control.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_control_message_send()

int fr_control_message_send ( fr_control_t c,
fr_ring_buffer_t rb,
uint32_t  id,
void *  data,
size_t  data_size 
)

Send a control-plane message.

This function is called ONLY from the originating thread.

Parameters
[in]cthe control structure
[in]rbthe callers ring buffer for message allocation.
[in]idthe ident of this message.
[in]datathe data to write to the control plane
[in]data_sizethe size of the data to write to the control plane.
Returns
  • <0 on error
  • 0 on success

Definition at line 343 of file control.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_control_same_thread()

int fr_control_same_thread ( fr_control_t c)

Definition at line 472 of file control.c.

+ Here is the call graph for this function: