Control-plane signaling.
More...
#include <freeradius-devel/io/control.h>
#include <freeradius-devel/io/ring_buffer.h>
#include <freeradius-devel/util/strerror.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/rand.h>
#include <fcntl.h>
#include <string.h>
#include <sys/event.h>
Go to the source code of this file.
|
| static int | _control_free (fr_control_t *c) |
| | Free a control structure.
|
| |
| 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) |
| | Create a control-plane signaling path.
|
| |
| int | fr_control_gc (UNUSED fr_control_t *c, fr_ring_buffer_t *rb) |
| | Clean up messages in a control-plane buffer.
|
| |
| static fr_control_message_t * | fr_control_message_alloc (fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, void *data, size_t data_size) |
| | Allocate a control message.
|
| |
| 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_same_thread (fr_control_t *c) |
| |
| static void | pipe_read (UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx) |
| |
Control-plane signaling.
- Id
- 86a847ed320c2d4a5a74ddacd168a972935b909c
- Copyright
- 2016 Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg)
Definition in file control.c.
◆ fr_control_ctx_t
◆ fr_control_message_t
| struct fr_control_message_t |
The header for the control message.
Definition at line 62 of file control.c.
◆ fr_control_s
The control structure.
Definition at line 79 of file control.c.
◆ FR_CONTROL_MAX_TYPES
| #define FR_CONTROL_MAX_TYPES (32) |
◆ MPRINT
◆ fr_control_message_status_t
Status of control messages.
◆ fr_control_message_status_t
Status of control messages.
| Enumerator |
|---|
| FR_CONTROL_MESSAGE_FREE | the message is free
|
| FR_CONTROL_MESSAGE_USED | the message is used (set only by originator)
|
| FR_CONTROL_MESSAGE_DONE | the message is done (set only by receiver)
|
Definition at line 52 of file control.c.
◆ _control_free()
Free a control structure.
This function really only calls the underlying "garbage collect".
- Parameters
-
| [in] | c | the control structure |
Definition at line 119 of file control.c.
◆ 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 417 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 454 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 |
- Returns
- NULL on error
- fr_control_t on success
Definition at line 143 of file control.c.
◆ fr_control_gc()
Clean up messages in a control-plane buffer.
Find the oldest messages which are marked FR_CONTROL_MESSAGE_DONE, and mark them FR_CONTROL_MESSAGE_FREE.
- Parameters
-
| [in] | c | the fr_control_t |
| [in] | rb | the callers ring buffer for message allocation. |
- Returns
- <0 there are still messages used
- 0 the control list is empty.
Definition at line 193 of file control.c.
◆ fr_control_message_alloc()
Allocate a control message.
- 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 245 of file control.c.
◆ 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 377 of file control.c.
◆ fr_control_message_push()
Push a control-plane message.
This function is called ONLY from the originating thread.
- 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 292 of file control.c.
◆ fr_control_message_send()
Send a control-plane message.
This function is called ONLY from the originating thread.
- 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 332 of file control.c.
◆ fr_control_same_thread()
◆ pipe_read()