Channels are ways of exchanging data between threads. libfsds (Lock Free Data Structures) are used to form channels and exchange transactions or uni-directional messages.
Resource channel(s) are used to notify DNS query processing threads when a resource has changed. Messages are transactional in nature (request-response).
Query log channel is used to notify DNS query aprocessing threads when to flip query log buffers.
Log channel is used to send uni-directional log messages to application logging thread which in turn logs messages to file (disk).
|
| channel_bss_msg_t * | channel_bss_msg_create (uint64_t id, channel_bss_ops_t op, void *p) |
| |
| void | channel_bss_msg_release (channel_bss_msg_t *msg) |
| |
| int | channel_bss_send (channel_bss_t *ch, channel_bss_msg_t *msg) |
| |
| int | channel_bss_recv (channel_bss_t *ch, channel_bss_msg_t **msg) |
| |
| int | channel_bssvl_send (channel_bss_t *ch, channel_bss_msg_t *msg) |
| |
| int | channel_bssvl_recv (channel_bss_t *ch, channel_bss_msg_t **msg) |
| |
| uint64_t | channel_bss_assign_msg_id (uint64_t *id_base) |
| |
| channel_log_msg_t * | channel_log_msg_create (uint32_t log_msg_id, char *log_msg, bool exit) |
| |
| void | channel_log_msg_release (channel_log_msg_t *msg) |
| |
| int | channel_log_send (channel_log_t *ch, channel_log_msg_t *msg) |
| |
| int | channel_log_recv (channel_log_t *ch, channel_log_msg_t **msg) |
| |
◆ channel_bss_msg_t
Structure describes an bss channel message.
◆ channel_bss_ops_t
Enumerated bss channel operation codes.
◆ channel_bss_queue_t
Structure describes an bss bonded channel queue.
◆ channel_bss_t
Structure describes an bss channel, Channel has two queues. Each queue is unidirectional.
◆ channel_log_msg_t
Structure describes a log channel message.
◆ channel_log_t
Structure describes a log channel.
◆ channel_bss_ops_e
Enumerated bss channel operation codes.
| Enumerator |
|---|
| CH_OP_RES_SET_RESOURCE1 | Op code for resource 1.
|
| CH_OP_RES_SET_RESOURCE2 | Op code for resource 2.
|
| CH_OP_QUERY_LOG_FLIP | Op code for query log flip.
|
◆ channel_bss_assign_msg_id()
| uint64_t channel_bss_assign_msg_id |
( |
uint64_t * |
id_base | ) |
|
Assign a new channel message ID from given base.
Base is incremented and value returned.
- Parameters
-
- Returns
- uint64_t
◆ channel_bss_msg_create()
Create a bss channel message object.
- Parameters
-
| id | Message ID |
| op | Message operation, see channel_bss_ops_t. |
| p | Pointer to data this message applies to. |
- Returns
- On success returns pointer to newly created message. Caller is responsible for releasing the message via channel_bss_msg_release once message is no longer needed.
◆ channel_bss_msg_release()
Release (free memory) a bss message object.
- Parameters
-
◆ channel_bss_recv()
Receive a message from support (bss) part of the channel.
This is used by vectorloop threads to receive message from support thread.
- Parameters
-
| ch | Channel to receive message on. |
| msg | Pointer where to place the received message. |
- Returns
- On success returns 1, otherwise returns 0. 0 could only be returned if there are no messages in the channel.
◆ channel_bss_send()
Send a message on bss part of the channel.
This is used by support (bss) threads to send message to vectorloop thread.
- Parameters
-
| ch | Channel to send message on. |
| msg | Message to send. |
- Returns
- On success returns 1, otherwise returns 0. 0 could only be returned if message could not be enqueued due channel being full.
◆ channel_bssvl_recv()
Receive a message from vectorloop part of the channel.
This is used by support (bss) thread to receive message from vectorloop thread.
- Parameters
-
| ch | Channel to receive message on. |
| msg | Pointer where to place the received message. |
- Returns
- On success returns 1, otherwise returns 0. 0 could only be returned if there are no messages in the channel.
◆ channel_bssvl_send()
Send a message on vectorloop part of the channel.
This is used by vectorloop thread to send message to support (bss) thread.
- Parameters
-
| ch | Channel to send message on. |
| msg | Message to send. |
- Returns
- On success returns 1, otherwise returns 0. 0 could only be returned if message could not be enqueued due channel being full.
◆ channel_log_msg_create()
| channel_log_msg_t * channel_log_msg_create |
( |
uint32_t |
log_msg_id, |
|
|
char * |
log_msg, |
|
|
bool |
exit |
|
) |
| |
Create a new log channel message object.
- Parameters
-
| log_msg_id | Log message ID, see app_log_msg_id_t. |
| log_msg | Log message string, can be NULL. |
| exit | Is this a fatal message, meaning should the application exit once message is logged. |
- Returns
- On success returns pointer to newly created message. Caller is responsible for releasing the message via channel_log_msg_release once message is no longer needed.
◆ channel_log_msg_release()
Release (free memory) a log channel message object.
- Parameters
-
| msg | Message object to release. |
◆ channel_log_recv()
Receive a message from log channel.
This is used by log thread to receive message from other thread.
- Parameters
-
| ch | Channel to receive message on. |
| msg | Pointer where to place the received message. |
- Returns
- On success returns 1, otherwise returns 0. 0 could only be returned if there are no messages in the channel.
◆ channel_log_send()
Send a message on log channel.
This is used by threads threads to send message to log thread.
- Parameters
-
| ch | Channel to send message on. |
| msg | Message to send. |
- Returns
- On success returns 1, otherwise returns 0. 0 could only be returned if message could not be enqueued due channel being full.