unify allocation of gsm_subscriber_connection
The current msc_subscr_con_allocate() was in fact only used by msc_vlr_tests,
while both a_iface_bssap.c and iucs.c did their own duplicate code of
allocating the gsm_subscriber_connection struct. Unify.
Drop the old msc_subscr_con_allocate(), instead add msc_subscr_conn_alloc().
The new function also takes via_ran and lac arguments directly.
The conn allocation will soon be closely tied to the subscr_conn_fsm instance
allocation, so place the new function definition alongside the other
subscr_conn_fsm API, and match its naming ("conn").
Related: OS#3122
Change-Id: Ia57b42a149a43f9c370b1310e2e1f512183993ea
diff --git a/src/libmsc/subscr_conn.c b/src/libmsc/subscr_conn.c
index fc89a66..5629d26 100644
--- a/src/libmsc/subscr_conn.c
+++ b/src/libmsc/subscr_conn.c
@@ -369,6 +369,26 @@
osmo_fsm_register(&subscr_conn_fsm);
}
+/* Allocate a new subscriber conn. */
+struct gsm_subscriber_connection *msc_subscr_conn_alloc(struct gsm_network *network,
+ enum ran_type via_ran, uint16_t lac)
+{
+ struct gsm_subscriber_connection *conn;
+
+ conn = talloc_zero(network, struct gsm_subscriber_connection);
+ if (!conn)
+ return NULL;
+
+ *conn = (struct gsm_subscriber_connection){
+ .network = network,
+ .via_ran = via_ran,
+ .lac = lac,
+ };
+
+ llist_add_tail(&conn->entry, &network->subscr_conns);
+ return conn;
+}
+
const struct value_string complete_layer3_type_names[] = {
{ COMPLETE_LAYER3_NONE, "NONE" },
{ COMPLETE_LAYER3_LU, "LU" },