63typedef enum xtc_fsm_action {
70typedef struct xtc_fsm_result {
71 xtc_fsm_action_t action;
73 int64_t state_timeout_ns;
77typedef struct xtc_fsm xtc_fsm_t;
78typedef struct xtc_fsm_call xtc_fsm_call_t;
85#define XTC_FSM_IS_STATE_TIMEOUT(msg, len) ((msg) == NULL && (len) == 0)
94#define XTC_FSM_REASON_NORMAL 0
96typedef struct xtc_fsm_callbacks {
101 int (*enter)(
void *state,
int old_state,
int new_state);
109 const void *msg,
size_t len,
110 xtc_fsm_call_t *call);
113 void (*terminate)(
void *state,
int reason);
116typedef struct xtc_fsm_opts {
137int xtc_fsm_start(xtc_loop_t *loop,
147int xtc_fsm_stop(xtc_fsm_t *fsm);
153int xtc_fsm_join(xtc_fsm_t *fsm, int64_t timeout_ns);
156xtc_pid_t xtc_fsm_pid(
const xtc_fsm_t *fsm);
160int xtc_fsm_send(
xtc_pid_t target,
const void *ev,
size_t len);
167 const void *req,
size_t req_size,
168 void **out_reply,
size_t *out_size,
173int xtc_fsm_reply(xtc_fsm_call_t *call,
174 const void *reply,
size_t size);