- * SOURCE
- */
-typedef enum {
- SILC_FSM_CONTINUE, /* Continue immediately to next state */
- SILC_FSM_YIELD, /* Continue to next state through scheduler */
- SILC_FSM_WAIT, /* Wait for some async call or timeout */
- SILC_FSM_FINISH, /* Finish state machine and call destructor
- through scheduler */
-} SilcFSMStatus;
-/***/
+ * EXAMPLE
+ *
+ * SILC_FSM_STATE(silc_foo_state)
+ * {
+ * ...
+ *
+ * // Move to next state now
+ * silc_fsm_next(fsm, silc_foo_next_state);
+ * return SILC_FSM_CONTINUE;
+ * }
+ *
+ ***/
+#if defined(SILC_DEBUG)
+#define SILC_FSM_CONTINUE \
+ fsm->next_state(fsm, fsm->fsm_context, fsm->state_context);
+#else
+#define SILC_FSM_CONTINUE SILC_FSM_ST_CONTINUE;
+#endif /* SILC_DEBUG */
+
+/****d* silcutil/SilcFSMAPI/SILC_FSM_YIELD
+ *
+ * NAME
+ *
+ * #define SILC_FSM_YIELD ...
+ *
+ * DESCRIPTION
+ *
+ * Moves to next state through the machine scheduler. Other threads
+ * running in the machine will get running time with SILC_FSM_YIELD.
+ * When using real threads, using SILC_FSM_YIELD is usually unnecessary.
+ * This type is returned in the state function.
+ *
+ ***/
+#define SILC_FSM_YIELD SILC_FSM_ST_YIELD;
+
+/****d* silcutil/SilcFSMAPI/SILC_FSM_WAIT
+ *
+ * NAME
+ *
+ * #define SILC_FSM_WAIT ...
+ *
+ * DESCRIPTION
+ *
+ * Suspends the machine or thread until it is awaken. This is used
+ * when asynchronous call is made or timer is set, or something else
+ * that requires waiting. This type is returned in the state function.
+ *
+ ***/
+#define SILC_FSM_WAIT SILC_FSM_ST_WAIT
+
+/****d* silcutil/SilcFSMAPI/SILC_FSM_FINISH
+ *
+ * NAME
+ *
+ * #define SILC_FSM_FINISH ...
+ *
+ * DESCRIPTION
+ *
+ * Finishes the machine or thread and calls its destructor, if defined.
+ * If the machine is finished when it has running threads the machine
+ * will fatally fail. User must always finish the threads before
+ * finishing the machine. This type is returned in the state function.
+ *
+ ***/
+#define SILC_FSM_FINISH SILC_FSM_ST_FINISH