summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/prim.h
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-04-08 23:35:24 +0200
committerHarald Welte <laforge@gnumonks.org>2017-04-09 17:54:28 +0000
commitacd08feb8f75827555a9ef38b890870fed3388ea (patch)
tree1f0827f7c04df6f572679153d62c9fb8d731128d /include/osmocom/core/prim.h
parent18a62b04887d8c6f6d338404330391a66c337b69 (diff)
Add struct osmo_prim_event_map and osmo_event_for_prim()
This can be used to map from an osmo_prim to an osmo_fsm event. Change-Id: I52350f4ebe97811b2a692e5a69a2cd39a853583c
Diffstat (limited to 'include/osmocom/core/prim.h')
-rw-r--r--include/osmocom/core/prim.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/osmocom/core/prim.h b/include/osmocom/core/prim.h
index 99a71d5d..f04e15e1 100644
--- a/include/osmocom/core/prim.h
+++ b/include/osmocom/core/prim.h
@@ -57,4 +57,18 @@ osmo_prim_init(struct osmo_prim_hdr *oph, unsigned int sap,
/*! \brief primitive handler callback type */
typedef int (*osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx);
+/*! \brief magic value to be used as final record of \ref
+ * osmo_prim_event_map */
+#define OSMO_NO_EVENT 0xFFFFFFFF
+
+/*! \brief single entry in a SAP/PRIM/OP -> EVENT map */
+struct osmo_prim_event_map {
+ unsigned int sap; /*!< SAP to match */
+ unsigned int primitive; /*!< primtiive to match */
+ enum osmo_prim_operation operation; /*!< operation to match */
+ uint32_t event; /*!< event as result if above match */
+};
+
+uint32_t osmo_event_for_prim(const struct osmo_prim_hdr *oph,
+ const struct osmo_prim_event_map *maps);
/*! @} */