From a9791df3b90e7458d0356a486df795a1226b046a Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 2 May 2016 19:49:58 +0200 Subject: add enum iu_event_type to string conversion --- openbsc/include/openbsc/iu.h | 6 ++++++ openbsc/src/libiu/iu.c | 9 +++++++++ 2 files changed, 15 insertions(+) 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); -- cgit v1.2.3