18#include "./asrt_assert.h"
23#include "./status_to_str.h"
39typedef uint16_t asrt_chann_id;
48static inline char const* asrt_event_to_str(
enum asrt_event_e event )
60typedef void ( *asrt_send_done_cb )(
void* ptr,
enum asrt_status status );
87static inline int32_t asrt_send_is_req_used(
91 return req->
next != NULL || list->
tail == req;
94typedef enum asrt_status ( *asrt_event_callback )(
void* ptr,
enum asrt_event_e event,
void* arg );
125 asrt_event_callback e_cb;
135void asrt_node_unlink(
struct asrt_node* node );
137static inline enum asrt_status asrt_chann_recv(
struct asrt_node* node,
struct asrt_span buff )
140 ASRT_ASSERT( node->e_cb );
141 return node->e_cb( node->e_cb_ptr, ASRT_EVENT_RECV, &buff );
144static inline enum asrt_status asrt_chann_tick(
struct asrt_node* node, uint32_t now )
147 ASRT_ASSERT( node->e_cb );
148 return node->e_cb( node->e_cb_ptr, ASRT_EVENT_TICK, &now );
153void asrt_chann_tick_successors(
struct asrt_node* node, uint32_t now );
164enum asrt_status asrt_chann_cobs_dispatch(
175 asrt_send_done_cb done_cb,
188void asrt_send_req_list_done(
struct asrt_send_req_list* list,
enum asrt_status status );
Input buffer for COBS-encoded data. buff is total capacity, used is occupied region.
Definition: cobs.h:69
A node in a doubly-linked channel chain.
Definition: chann.h:122
Intrusive FIFO of outgoing send requests.
Definition: chann.h:76
struct asrt_send_req * head
Oldest pending request (next to transmit).
Definition: chann.h:77
struct asrt_send_req * tail
Newest pending request.
Definition: chann.h:78
An outgoing message request placed in a module's send queue.
Definition: chann.h:64
asrt_send_done_cb done_cb
Completion callback, may be NULL.
Definition: chann.h:67
struct asrt_span_span buff
Message payload (scatter-gather).
Definition: chann.h:65
void * done_ptr
Opaque context forwarded to done_cb.
Definition: chann.h:68
asrt_chann_id chid
Target channel ID, set by asrt_send_enque().
Definition: chann.h:66
struct asrt_send_req * next
Intrusive linked-list link.
Definition: chann.h:70
Scatter-gather buffer: a primary byte range [b, e) followed by rest_count additional spans.
Definition: span.h:37
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: span.h:23