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>
Go to the source code of this file.
|
| 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.
|
| |
| int | fr_control_callback_delete (fr_control_t *c, uint32_t id) |
| | Delete a callback for an ID.
|
| |
| fr_control_t * | fr_control_create (TALLOC_CTX *ctx, fr_event_list_t *el, fr_atomic_queue_t *aq, size_t num_callbacks)) |
| | Create a control-plane signaling path.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| int | fr_control_open (fr_control_t *c) |
| | Open the control-plane signalling path.
|
| |
| int | fr_control_same_thread (fr_control_t *c) |
| |
| void | fr_control_wait (fr_control_t *c) |
| | Wait for a plane control to become readable.
|
| |
control-plane signaling
- Id
- 19c5b4e784addbcd824fd837832fbb90ff190a4a
- Copyright
- 2016 Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg)
Definition in file control.h.
◆ FR_CONTROL_MAX_MESSAGES
| #define FR_CONTROL_MAX_MESSAGES (1024) |
◆ FR_CONTROL_MAX_SIZE
| #define FR_CONTROL_MAX_SIZE (64) |
◆ fr_control_callback_t
| typedef void(* fr_control_callback_t) (void *ctx, void const *data, size_t data_size, fr_time_t now) |
◆ fr_control_t
A one-way control plane signal.
Multiple-producer, single consumer.
Definition at line 44 of file control.h.
◆ fr_control_callback_add()
Register a callback for an ID.
- Parameters
-
| [in] | c | the control structure |
| [in] | id | the ident of this message. |
| [in] | ctx | the context for the callback |
| [in] | callback | the callback function |
- Returns
-
Definition at line 443 of file control.c.
◆ fr_control_callback_delete()
Delete a callback for an ID.
- Parameters
-
| [in] | c | the control structure |
| [in] | id | the ident of this message. |
- Returns
-
Definition at line 502 of file control.c.
◆ fr_control_create()
Create a control-plane signaling path.
- Parameters
-
| [in] | ctx | the talloc context |
| [in] | el | the event list for the control socket |
| [in] | aq | the atomic queue where we will be pushing message data |
| [in] | num_callbacks | the initial number of callback entries to allocate. |
- Returns
- NULL on error
- fr_control_t on success
Definition at line 152 of file control.c.
◆ fr_control_gc()
◆ fr_control_message_pop()
Pop control-plane message.
This function is called ONLY from the receiving thread.
- Parameters
-
| [in] | aq | the recipients atomic queue for control-plane messages |
| [out] | p_id | the ident of this message. |
| [in,out] | data | where the data is stored |
| [in] | data_size | the 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 403 of file control.c.
◆ fr_control_message_push()
Push a control-plane message.
This function is called ONLY from the originating threads.
- Parameters
-
| [in] | c | the control structure |
| [in] | rb | the callers ring buffer for message allocation. |
| [in] | id | the ident of this message. |
| [in] | data | the data to write to the control plane |
| [in] | data_size | the 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 315 of file control.c.
◆ fr_control_message_send()
Send a control-plane message.
This function is called ONLY from the originating threads.
- Parameters
-
| [in] | c | the control structure |
| [in] | rb | the callers ring buffer for message allocation. |
| [in] | id | the ident of this message. |
| [in] | data | the data to write to the control plane |
| [in] | data_size | the size of the data to write to the control plane. |
- Returns
-
Definition at line 355 of file control.c.
◆ fr_control_open()
Open the control-plane signalling path.
- Parameters
-
| [in] | c | the control-plane to open |
- Returns
- 0 on success
- -1 on failure
Definition at line 176 of file control.c.
◆ fr_control_same_thread()
◆ fr_control_wait()
Wait for a plane control to become readable.
This is a blocking function so only to be used in rare cases such as waiting for another thread to complete a task before proceeding.
- Parameters
-
| [in] | c | the control structure. |
Definition at line 542 of file control.c.