aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-01-28 14:20:27 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-03 16:19:09 +0100
commit71d1e17e5e0c420cf00ea759743b81aaff72136e (patch)
treea5bad1c6def4bca6f23aee526f29f869c71cf9f7 /openbsc/src
parent2c9e65051c598a42d6a59490b67adb366929ac03 (diff)
cscn: call msc_compl_l3() from subscr_conn_allocate_iu()
Pubish msc_compl_l3() decl in new file libmsc/msc_api.h (but see comment). Call msc_compl_l3() when establishing a subscriber connection for IuCS. Remove bts from subscr_conn_allocate_iu() signature, use network, link_id and conn_id instead. Move subscr_conn_allocate_iu() to the top of the file, because it semantically belongs before subscr_conn_lookup_iu().
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/libmsc/Makefile.am2
-rw-r--r--openbsc/src/libmsc/msc_api.h8
-rw-r--r--openbsc/src/libmsc/osmo_msc.c4
-rw-r--r--openbsc/src/osmo-cscn/iu_cs.c38
4 files changed, 34 insertions, 18 deletions
diff --git a/openbsc/src/libmsc/Makefile.am b/openbsc/src/libmsc/Makefile.am
index 51958905c..b9efee597 100644
--- a/openbsc/src/libmsc/Makefile.am
+++ b/openbsc/src/libmsc/Makefile.am
@@ -2,7 +2,7 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBCRYPTO_CFLAGS) $(LIBSMPP34_CFLAGS)
-noinst_HEADERS = meas_feed.h
+noinst_HEADERS = meas_feed.h msc_api.h
noinst_LIBRARIES = libmsc.a
diff --git a/openbsc/src/libmsc/msc_api.h b/openbsc/src/libmsc/msc_api.h
new file mode 100644
index 000000000..d736b4d98
--- /dev/null
+++ b/openbsc/src/libmsc/msc_api.h
@@ -0,0 +1,8 @@
+#pragma once
+
+#include <osmocom/core/msgb.h>
+#include <openbsc/gsm_data.h>
+
+/* TODO does this belong to openbsc/gsm_04_08.h ?? */
+int msc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg,
+ uint16_t chosen_channel);
diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c
index ae1a35380..0331de552 100644
--- a/openbsc/src/libmsc/osmo_msc.c
+++ b/openbsc/src/libmsc/osmo_msc.c
@@ -42,8 +42,8 @@ static int msc_clear_request(struct gsm_subscriber_connection *conn, uint32_t ca
return 1;
}
-static int msc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg,
- uint16_t chosen_channel)
+int msc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg,
+ uint16_t chosen_channel)
{
gsm0408_new_conn(conn);
gsm0408_dispatch(conn, msg);
diff --git a/openbsc/src/osmo-cscn/iu_cs.c b/openbsc/src/osmo-cscn/iu_cs.c
index c8a36f47b..db9cc1bb1 100644
--- a/openbsc/src/osmo-cscn/iu_cs.c
+++ b/openbsc/src/osmo-cscn/iu_cs.c
@@ -1,6 +1,29 @@
#include <openbsc/gsm_data.h>
#include <openbsc/iu.h>
+#include <openbsc/bsc_api.h> /* for BSC_API_CONN_POL_ACCEPT, TODO move that to libmsc */
+
+#include "../libmsc/msc_api.h"
+
+/* For A-interface see libbsc/bsc_api.c subscr_con_allocate() */
+struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_network *network,
+ uint8_t link_id,
+ uint32_t conn_id)
+{
+ struct gsm_subscriber_connection *conn;
+
+ conn = talloc_zero(network, struct gsm_subscriber_connection);
+ if (!conn)
+ return NULL;
+
+ conn->via_iface = IFACE_IUCS;
+ conn->iu.link_id = link_id;
+ conn->iu.conn_id = conn_id;
+
+ llist_add_tail(&conn->entry, &network->subscr_conns);
+ return conn;
+}
+
/* Return an existing Iu-CS subscriber connection record for the given link and
* connection IDs, or return NULL if not found. */
static struct gsm_subscriber_connection *subscr_conn_lookup_iu(struct gsm_network *network,
@@ -76,18 +99,3 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg, uint8_t l
return 0;
}
-/* For A-interface see libbsc/bsc_api.c subscr_con_allocate() */
-struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_bts *bts)
- /* TODO "bts"? this is an hNodeB, really. */
-{
- struct gsm_subscriber_connection *conn;
-
- conn = talloc_zero(bts->network, struct gsm_subscriber_connection);
- if (!conn)
- return NULL;
-
- conn->via_iface = IFACE_IUCS;
- conn->bts = bts;
- llist_add_tail(&conn->entry, &bts->network->subscr_conns);
- return conn;
-}