Graphviz presentation of SMTP test FSM
[hlafsm.git] / myfsm.h
blob93c6acd95072e851d0acb8f072cd72ba278af3a7
1 /*
2 * Based on output of the cfsm FSM compiler:
3 * http://www.mindrot.org/projects/cfsm/
4 */
6 #ifndef _MYFSM_H
7 #define _MYFSM_H
9 #include <sys/types.h>
11 /* FSM structure */
12 struct myfsm {
13 int current_state;
18 * Allocate a new FSM and set its starting state to STATE_INIT (0)
20 #define MYFSM_INIT() ( (struct myfsm *)(calloc(1, sizeof(struct myfsm))) )
24 * Free a FSM created with MYFSM_INIT
26 #define MYFSM_FREE(fsm) { free(fsm); }
30 * Returns the current state of the FSM.
32 #define MYFSM_CURRENT(fsm) ( fsm->current_state )
35 #endif /* _MYFSM_H */