diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2018-02-15 10:33:26 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-02-16 08:09:33 +0000 |
commit | 4e825b6a68090b472ffed4c14153e38132e48b6c (patch) | |
tree | ca7217d434048fc190435c8fd14dbde127be6d85 | |
parent | 6fbd3bf732d4676ebb50718b198e20c4ed273f50 (diff) |
libmsc: Add a function to return a unique ID of the subscriber conn
The ID will include the type of connection (GERAN_A, UTRAN_IU) followed
by the SCCP conn_id.
This can be used for the fsm instance ID before we know the IMSI.
Change-Id: I4b875772e3994ad3458ee60dbf880604486d9afd
-rw-r--r-- | include/osmocom/msc/osmo_msc.h | 1 | ||||
-rw-r--r-- | src/libmsc/subscr_conn.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/include/osmocom/msc/osmo_msc.h b/include/osmocom/msc/osmo_msc.h index 2b019e1bc..70e381882 100644 --- a/include/osmocom/msc/osmo_msc.h +++ b/include/osmocom/msc/osmo_msc.h @@ -54,6 +54,7 @@ enum msc_compl_l3_rc { MSC_CONN_REJECT = 1, }; +char *msc_subscr_conn_get_conn_id(struct gsm_subscriber_connection *conn); int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id); int msc_vlr_alloc(struct gsm_network *net); diff --git a/src/libmsc/subscr_conn.c b/src/libmsc/subscr_conn.c index 124e46bfa..512f5128e 100644 --- a/src/libmsc/subscr_conn.c +++ b/src/libmsc/subscr_conn.c @@ -31,6 +31,7 @@ #include <osmocom/msc/transaction.h> #include <osmocom/msc/signal.h> #include <osmocom/msc/a_iface.h> +#include <osmocom/msc/iucs.h> #define SUBSCR_CONN_TIMEOUT 5 /* seconds */ @@ -303,6 +304,25 @@ static struct osmo_fsm subscr_conn_fsm = { .timer_cb = subscr_conn_fsm_timeout, }; +char *msc_subscr_conn_get_conn_id(struct gsm_subscriber_connection *conn) +{ + char *id; + + switch (conn->via_ran) { + case RAN_GERAN_A: + id = talloc_asprintf(conn, "GERAN_A-%08x", conn->a.conn_id); + break; + case RAN_UTRAN_IU: + id = talloc_asprintf(conn, "UTRAN_IU-%08x", iu_get_conn_id(conn->iu.ue_ctx)); + break; + default: + LOGP(DMM, LOGL_ERROR, "RAN of conn %p unknown!\n", conn); + return NULL; + } + + return id; +} + int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id) { struct osmo_fsm_inst *fi; |