#include #include #include struct pktbuf { uint8_t *pkt; uint16_t pktlen; }; /* first arg is input buffer, second arg is what will be sent as reply */ typedef void (*process_msgfunc_t)(struct pktbuf, struct pktbuf *); enum comm_state { COMMS_WAIT_REQUEST = 1, COMMS_WAIT_CONFIRM, COMMS_PROCESS_MSGS, }; struct comms_state { strobe_s cs_state; enum comm_state cs_comm_state; strobe_s cs_start; /* special starting state cache */ process_msgfunc_t cs_procmsg; }; size_t _strobe_state_size(); void comms_init(struct comms_state *, process_msgfunc_t, struct pktbuf *); void comms_process(struct comms_state *, struct pktbuf, struct pktbuf *);