<p>Neels Hofmeyr <strong>uploaded patch set #7</strong> to this change.</p><p><a href="https://gerrit.osmocom.org/12717">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">add osmo_tdef API, originally adopted from osmo-bsc T_def<br><br>Move T_def from osmo-bsc to libosmocore as osmo_tdef. Adjust naming to be more<br>consistent. Upgrade to first class API:<br>- add timer grouping<br>- add generic vty support<br>- add mising API doc<br>- add C test<br>- add VTY transcript tests, also as examples for using the API<br><br>From osmo_fsm_inst_state_chg() API doc, cross reference to osmo_tdef API.<br><br>The root reason for moving to libosmocore is that I want to use the<br>mgw_endpoint_fsm in osmo-msc for inter-MSC handover, and hence want to move the<br>FSM to libosmo-mgcp-client. This FSM uses the T_def from osmo-bsc. Though the<br>mgw_endpoint_fsm's use of T_def is minimal, I intend to use the osmo_tdef API<br>in osmo-msc (and probably elsewhere) as well. libosmocore is the most sensible<br>place for this.<br><br>osmo_tdef provides:<br><br>- a list of Tnnnn (GSM) timers with description, unit and default value.<br>- vty UI to allow users to configure non-default timeouts.<br>- API to tie T timers to osmo_fsm states and set them on state transitions.<br><br>- a few standard units (minute, second, millisecond) as well as a custom unit<br>  (which relies on the timer's human readable description to indicate the<br>  meaning of the value).<br>- conversion for standard units: for example, some GSM timers are defined in<br>  minutes, while our FSM definitions need timeouts in seconds. Conversion is<br>  for convenience only and can be easily avoided via the custom unit.<br><br>By keeping separate osmo_tdef arrays, several groups of timers can be kept<br>separately. The VTY tests in tests/tdef/ showcase different schemes:<br><br>- tests/vty/tdef_vty_test_config_root.c:<br>  Keep several timer definitions in separately named groups: showcase the<br>  osmo_tdef_vty_groups*() API. Each timer group exists exactly once.<br><br>- tests/vty/tdef_vty_test_config_subnode.c:<br>  Keep a single list of timers without separate grouping.<br>  Put this list on a specific subnode below the CONFIG_NODE.<br>  There could be several separate subnodes with timers like this, i.e.<br>  continuing from this example, sets timers could be separated by placing<br>  timers in specific config subnodes instead of using the global group name.<br><br>- tests/vty/tdef_vty_test_dynamic.c:<br>  Dynamically allocate timer definitions per each new created object.<br>  Thus there can be an arbitrary number of independent timer definitions, one<br>  per allocated object.<br><br>T_def was introduced during the recent osmo-bsc refactoring for inter-BSC<br>handover, and has proven useful:<br><br>- without osmo_tdef, each invocation of osmo_fsm_inst_state_chg() needs to be<br>  programmed with the right timeout value, for all code paths that invoke this<br>  state change. It is a likely source of errors to get one of them wrong.  By<br>  defining a T timer exactly for an FSM state, the caller can merely invoke the<br>  state change and trust on the original state definition to apply the correct<br>  timeout.<br><br>- it is helpful to have a standardized config file UI to provide user<br>  configurable timeouts, instead of inventing new VTY commands for each<br>  separate application of T timer numbers.<br><br>Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5<br>---<br>M include/Makefile.am<br>A include/osmocom/core/tdef.h<br>A include/osmocom/vty/tdef_vty.h<br>M src/Makefile.am<br>M src/fsm.c<br>A src/tdef.c<br>M src/vty/Makefile.am<br>A src/vty/tdef_vty.c<br>M tests/Makefile.am<br>A tests/tdef/tdef_test.c<br>A tests/tdef/tdef_test.ok<br>A tests/tdef/tdef_vty_test_config_root.c<br>A tests/tdef/tdef_vty_test_config_root.vty<br>A tests/tdef/tdef_vty_test_config_subnode.c<br>A tests/tdef/tdef_vty_test_config_subnode.vty<br>A tests/tdef/tdef_vty_test_dynamic.c<br>A tests/tdef/tdef_vty_test_dynamic.vty<br>M tests/testsuite.at<br>18 files changed, 2,998 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/17/12717/7</pre><p>To view, visit <a href="https://gerrit.osmocom.org/12717">change 12717</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/12717"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>
<div style="display:none"> Gerrit-Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5 </div>
<div style="display:none"> Gerrit-Change-Number: 12717 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>