|
asrt
Automated System Runtime Testing library
|
A node in a doubly-linked channel chain. More...
#include <chann.h>
Public Attributes | |
| asrt_chann_id | chid |
| asrt_event_callback | e_cb |
| void * | e_cb_ptr |
| struct asrt_node * | next |
| struct asrt_node * | prev |
| struct asrt_send_req_list * | send_queue |
A node in a doubly-linked channel chain.
Each protocol module (reactor, diag client, param client, …) embeds one asrt_node as its first member. Modules are connected into a chain with asrt_node_link(); the chain is the runtime representation of the protocol stack for one side of the connection.
Events flow through the chain via two mechanisms:
RECV — asrt_chann_cobs_dispatch() decodes incoming bytes from the transport, extracts a channel ID from each frame header, and calls asrt_chann_dispatch() which walks the chain to find the node whose chid matches and delivers the payload to its e_cb. Each node therefore only sees frames addressed to its own channel.
TICK — asrt_chann_tick_successors() calls e_cb(ASRT_EVENT_TICK) on every node after the head. Modules use the tick to advance state machines, check timeouts, and drain their send queue.
The send_queue pointer is shared across all nodes in the chain. Any module that wants to transmit calls asrt_send_enque(), which appends to the shared queue; the transport layer drains it independently.
chid must be unique within a chain — asrt_chann_find() and the dispatch path rely on this to route frames correctly.