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
This commit is contained in:
Daniel Willmann 2018-02-15 10:33:26 +01:00 committed by Harald Welte
parent 6fbd3bf732
commit 4e825b6a68
2 changed files with 21 additions and 0 deletions

View File

@ -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);

View File

@ -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;