aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/fsm.h
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-02-21 02:27:48 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2019-03-06 00:51:15 +0100
commit5734bff3b01da2a7369da07f77ad617c3ac32096 (patch)
treecd2885915671d2f4dca4ea5b23cbfb7e02ab3b47 /include/osmocom/core/fsm.h
parent8aa691f30b5f6d77ae05e590e5d3426550ee4452 (diff)
represent negative T-timers as Osmocom-specific X-timers
fi->T values are int, i.e. can be negative. Do not log them as unsigned, but define a distinct timer class "Xnnnn" for negative T values: i.e. for T == -1, print "Timeout of X1" instead of "Timeout of T4294967295". The negative T timer number space is useful to distinguish freely invented timers from proper 3GPP defined T numbers. So far I was using numbers like T993210 or T9999 for invented T, but X1, X2 etc. is a better solution. This way we can make sure to not accidentally define an invented timer number that actually collides with a proper 3GPP specified timer number that the author was not aware of at the time of writing. Add OSMO_T_FMT and OSMO_T_FMT_ARGS() macros as standardized timer number print format. Use that in fsm.c, tdef_vty.c, and adjust vty tests accordingly. Mention the two timer classes in various API docs and VTY online-docs. Change-Id: I3a59457623da9309fbbda235fe18fadd1636bff6
Diffstat (limited to 'include/osmocom/core/fsm.h')
-rw-r--r--include/osmocom/core/fsm.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index ae1c8575..13bfb331 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -194,6 +194,9 @@ void osmo_fsm_log_timeouts(bool log_timeouts);
caller_file, caller_line, \
fmt, ## args)
+#define OSMO_T_FMT "%c%u"
+#define OSMO_T_FMT_ARGS(T) ((T) >= 0 ? 'T' : 'X'), ((T) >= 0 ? T : -T)
+
int osmo_fsm_register(struct osmo_fsm *fsm);
void osmo_fsm_unregister(struct osmo_fsm *fsm);
struct osmo_fsm *osmo_fsm_find_by_name(const char *name);