00001
00027 #ifndef STATE_MACHINE_H
00028 #define STATE_MACHINE_H
00029
00040 #define SM_STATE(machine, state) \
00041 static void sm_ ## machine ## _ ## state ## _Enter(STATE_MACHINE_DATA *sm, \
00042 int global)
00043
00055 #define SM_ENTRY(machine, state) \
00056 if (!global || sm->machine ## _state != machine ## _ ## state) { \
00057 sm->changed = TRUE; \
00058 wpa_printf(MSG_DEBUG, STATE_MACHINE_DEBUG_PREFIX ": " #machine \
00059 " entering state " #state); \
00060 } \
00061 sm->machine ## _state = machine ## _ ## state;
00062
00075 #define SM_ENTRY_M(machine, _state, data) \
00076 if (!global || sm->data ## _ ## state != machine ## _ ## _state) { \
00077 sm->changed = TRUE; \
00078 wpa_printf(MSG_DEBUG, STATE_MACHINE_DEBUG_PREFIX ": " \
00079 #machine " entering state " #_state); \
00080 } \
00081 sm->data ## _ ## state = machine ## _ ## _state;
00082
00094 #define SM_ENTRY_MA(machine, _state, data) \
00095 if (!global || sm->data ## _ ## state != machine ## _ ## _state) { \
00096 sm->changed = TRUE; \
00097 wpa_printf(MSG_DEBUG, STATE_MACHINE_DEBUG_PREFIX ": " MACSTR " " \
00098 #machine " entering state " #_state, \
00099 MAC2STR(STATE_MACHINE_ADDR)); \
00100 } \
00101 sm->data ## _ ## state = machine ## _ ## _state;
00102
00113 #define SM_ENTER(machine, state) \
00114 sm_ ## machine ## _ ## state ## _Enter(sm, 0)
00115
00127 #define SM_ENTER_GLOBAL(machine, state) \
00128 sm_ ## machine ## _ ## state ## _Enter(sm, 1)
00129
00140 #define SM_STEP(machine) \
00141 static void sm_ ## machine ## _Step(STATE_MACHINE_DATA *sm)
00142
00151 #define SM_STEP_RUN(machine) sm_ ## machine ## _Step(sm)
00152
00153 #endif
00154