aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bsc_subscriber.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bsc/bsc_subscriber.c')
-rw-r--r--src/osmo-bsc/bsc_subscriber.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/osmo-bsc/bsc_subscriber.c b/src/osmo-bsc/bsc_subscriber.c
index 65a660b..2541883 100644
--- a/src/osmo-bsc/bsc_subscriber.c
+++ b/src/osmo-bsc/bsc_subscriber.c
@@ -118,6 +118,20 @@ const char *bsc_subscr_name(struct bsc_subscr *bsub)
return buf;
}
+/* Like bsc_subscr_name() but returns only characters approved by osmo_identifier_valid(), useful for
+ * osmo_fsm_inst IDs. */
+const char *bsc_subscr_id(struct bsc_subscr *bsub)
+{
+ static char buf[32];
+ if (!bsub)
+ return "unknown";
+ if (bsub->imsi[0])
+ snprintf(buf, sizeof(buf), "IMSI%s", bsub->imsi);
+ else
+ snprintf(buf, sizeof(buf), "TMSI%08x", bsub->tmsi);
+ return buf;
+}
+
static void bsc_subscr_free(struct bsc_subscr *bsub)
{
llist_del(&bsub->entry);