summaryrefslogtreecommitdiffstats
path: root/src/fsm.c
Commit message (Collapse)AuthorAgeFilesLines
* fsm: Make sure we call 'onenter' of new state, not old stateHarald Welte2016-08-011-0/+1
| | | | Change-Id: I1a0181c25d9debe935e86d97ddffc24675e56a5f
* fsm: delete the timer when changing stateHarald Welte2016-07-101-0/+3
| | | | | | | In osmo_fsm_inst_state_chg(), we need to stop any not-yet-expired timer of the old state before transitioning into the new state. Change-Id: I2558f9a7027a877ea8263785ed3c8d70d2513996
* fsm: talloc + copy the 'id' passed into a FSMHarald Welte2016-07-101-1/+2
| | | | | | | | | | The 'id' is used to generate the human-readable name of the FSM. However, when the FSM creates slave FSMs later, the caller-passed "ID" mgiht long be gone again (e.g. it was on stack memory). So let's copy the 'id' string to a chunk of dynamically-allocated memory at time of FSM start to ensure we have it later when creating child FSMs. Change-Id: Ib88a2c02c5c91f17b4ec1e9db57a06d6d66465fb
* fsm: call 'onenter' as last step of a state changeHarald Welte2016-07-101-3/+4
| | | | | | | This is useful to allow the user to terinate the fsm from the onenter() callback. Change-Id: Ia45a1f3279e702028250e10dc54b2d46a4039905
* fsm: Introduce default time-out handlingHarald Welte2016-06-271-8/+13
| | | | | | | | | | | If a FSM doesn't specify any timer_cb, simply terminate the FSM by default on time-out. This is a reasonable default for most cases, and avoids copy+pasting a one-line timer_cb function in every FSM. Also, even if there is a timer_cb, let it have a return value to decide if the core should terminate after return from timer_cb or not. Change-Id: I0461a9593bfb729c82b7d1d1cf9f30b1079d0212
* Add Finite State Machine abstraction codeHarald Welte2016-06-161-0/+422
This code is supposed to formalize some of the state machine handling in Osmocom code. Change-Id: I0b0965a912598c1f6b84042a99fea9d522642466 Reviewed-on: https://gerrit.osmocom.org/163 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>