diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-05-02 19:49:58 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-05-02 19:49:58 +0200 |
commit | a9791df3b90e7458d0356a486df795a1226b046a (patch) | |
tree | eaa384932e2b8af4e76e5ee76e49166ed8535781 | |
parent | d9202b342c996c56a7e10dbc744e50d56a933b2c (diff) |
add enum iu_event_type to string conversion
-rw-r--r-- | openbsc/include/openbsc/iu.h | 6 | ||||
-rw-r--r-- | openbsc/src/libiu/iu.c | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h index fc1a89130..9cc095849 100644 --- a/openbsc/include/openbsc/iu.h +++ b/openbsc/include/openbsc/iu.h @@ -26,6 +26,12 @@ enum iu_event_type { * ue_conn_ctx should no longer be used, for whatever reason. */ }; +extern const struct value_string iu_event_type_names[]; +static inline const char *iu_event_type_str(enum iu_event_type e) +{ + return get_value_string(iu_event_type_names, e); +} + /* Implementations of iu_recv_cb_t shall find the ue_conn_ctx in msg->dst. */ typedef int (* iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id, /* TODO "gprs_" in generic CS+PS domain ^ */ diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c index 757b2ca79..e22015c14 100644 --- a/openbsc/src/libiu/iu.c +++ b/openbsc/src/libiu/iu.c @@ -68,6 +68,15 @@ iu_event_cb_t global_iu_event_cb = NULL; static LLIST_HEAD(ue_conn_ctx_list); static LLIST_HEAD(rnc_list); +const struct value_string iu_event_type_names[] = { +#define IU_EVT_STR(X) { X, #X } + IU_EVT_STR(IU_EVENT_RAB_ASSIGN), + IU_EVT_STR(IU_EVENT_SECURITY_MODE_COMPLETE), + IU_EVT_STR(IU_EVENT_IU_RELEASE), + IU_EVT_STR(IU_EVENT_LINK_INVALIDATED), +#undef IU_EVT_STR +}; + struct ue_conn_ctx *ue_conn_ctx_alloc(struct osmo_sua_link *link, uint32_t conn_id) { struct ue_conn_ctx *ctx = talloc_zero(talloc_iu_ctx, struct ue_conn_ctx); |