aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/configure.ac1
-rw-r--r--openbsc/include/openbsc/Makefile.am2
-rw-r--r--openbsc/include/openbsc/iu_cs.h5
-rw-r--r--openbsc/src/Makefile.am2
-rw-r--r--openbsc/src/gprs/Makefile.am4
-rw-r--r--openbsc/src/libiu/Makefile.am10
-rw-r--r--openbsc/src/libiu/iu.c (renamed from openbsc/src/gprs/iu.c)93
-rw-r--r--openbsc/src/osmo-cscn/Makefile.am4
-rw-r--r--openbsc/src/osmo-cscn/iu_cs.c93
-rw-r--r--openbsc/tests/sgsn/Makefile.am2
10 files changed, 117 insertions, 99 deletions
diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index 6d8323285..c77dd0728 100644
--- a/openbsc/configure.ac
+++ b/openbsc/configure.ac
@@ -194,6 +194,7 @@ AC_OUTPUT(
src/libmgcp/Makefile
src/libcommon/Makefile
src/libfilter/Makefile
+ src/libiu/Makefile
src/osmo-nitb/Makefile
src/osmo-cscn/Makefile
src/osmo-bsc/Makefile
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 5f7de1aef..c163a6c2c 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -19,7 +19,7 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
gprs_gsup_client.h bsc_msg_filter.h \
oap.h oap_messages.h \
gtphub.h \
- iu.h
+ iu.h iu_cs.h
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
openbscdir = $(includedir)/openbsc
diff --git a/openbsc/include/openbsc/iu_cs.h b/openbsc/include/openbsc/iu_cs.h
new file mode 100644
index 000000000..4be2ae96a
--- /dev/null
+++ b/openbsc/include/openbsc/iu_cs.h
@@ -0,0 +1,5 @@
+#pragma once
+
+int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg, uint8_t link_id);
+struct gsm_subscriber_connection *subscr_conn_allocate_iu(struct gsm_bts *bts);
+ /* TODO "bts"? this is an hNodeB, really. */
diff --git a/openbsc/src/Makefile.am b/openbsc/src/Makefile.am
index 914157340..13681ebab 100644
--- a/openbsc/src/Makefile.am
+++ b/openbsc/src/Makefile.am
@@ -2,7 +2,7 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(COVERAGE_LDFLAGS)
-SUBDIRS = libcommon libmgcp libbsc libmsc libtrau libfilter osmo-nitb osmo-cscn osmo-bsc_mgcp utils ipaccess gprs
+SUBDIRS = libcommon libmgcp libbsc libiu libmsc libtrau libfilter osmo-nitb osmo-cscn osmo-bsc_mgcp utils ipaccess gprs
# Conditional modules
if BUILD_NAT
diff --git a/openbsc/src/gprs/Makefile.am b/openbsc/src/gprs/Makefile.am
index fb26272fc..187b07ed9 100644
--- a/openbsc/src/gprs/Makefile.am
+++ b/openbsc/src/gprs/Makefile.am
@@ -32,11 +32,11 @@ osmo_sgsn_SOURCES = gprs_gmm.c gprs_sgsn.c gprs_sndcp.c gprs_sndcp_vty.c \
sgsn_ctrl.c sgsn_auth.c gprs_subscriber.c \
gprs_gsup_messages.c gprs_utils.c gprs_gsup_client.c \
gsm_04_08_gprs.c sgsn_cdr.c sgsn_ares.c \
- oap.c oap_messages.c \
- iu.c
+ oap.c oap_messages.c
osmo_sgsn_LDADD = \
$(top_builddir)/src/libcommon/libcommon.a \
+ $(top_builddir)/src/libiu/libiu.a \
-lgtp $(OSMO_LIBS) $(LIBOSMOABIS_LIBS) $(LIBCARES_LIBS) \
$(LIBCRYPTO_LIBS) -lrt \
$(LIBOSMOSIGTRAN_LIBS) $(LIBOSMORANAP_LIBS) $(LIBASN1C_LIBS)
diff --git a/openbsc/src/libiu/Makefile.am b/openbsc/src/libiu/Makefile.am
new file mode 100644
index 000000000..8e52049a1
--- /dev/null
+++ b/openbsc/src/libiu/Makefile.am
@@ -0,0 +1,10 @@
+AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
+AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) \
+ $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS) $(LIBCRYPTO_CFLAGS) \
+ $(LIBASN1C_CFLAGS) \
+ $(LIBOSMOSIGTRAN_CFLAGS) $(LIBOSMORANAP_CFLAGS)
+
+noinst_LIBRARIES = libiu.a
+
+libiu_a_SOURCES = iu.c
+
diff --git a/openbsc/src/gprs/iu.c b/openbsc/src/libiu/iu.c
index 43056bbc3..c1898d0c6 100644
--- a/openbsc/src/gprs/iu.c
+++ b/openbsc/src/libiu/iu.c
@@ -461,96 +461,3 @@ int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port,
return osmo_sua_server_listen(user, listen_addr, listen_port);
}
-/* Return an existing Iu-CS subscriber connection record for the given link and
- * connection IDs, or return NULL if not found. */
-/* TODO wrong file */
-static struct gsm_subscriber_connection *subscr_conn_lookup_iu(struct gsm_network *network,
- uint8_t link_id,
- uint32_t conn_id)
-{
- struct gsm_subscriber_connection *conn;
- llist_for_each_entry(conn, &network->subscr_conns, entry) {
- if (conn->via_iface != IFACE_IUCS)
- continue;
- if (conn->iu.link_id != link_id)
- continue;
- if (conn->iu.conn_id != conn_id)
- continue;
- return conn;
- }
- return NULL;
-}
-
-/* Receive MM/CC/... message from Iu-CS (SCCP user SAP).
- * msg->dst must reference a struct ue_conn_ctx. link_id identifies the SCTP
- * peer that sent the msg.
- *
- * For A-interface see libbsc/bsc_api.c gsm0408_rcvmsg(). */
-/* TODO wrong file */
-int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg, uint8_t link_id)
-{
- int rc;
- struct ue_conn_ctx *ue_ctx;
- struct gsm_subscriber_connection *conn;
-
- ue_ctx = (struct ue_conn_ctx*)msg->dst;
-
- /* TODO: are there message types that could allow us to skip this
- * search? */
- conn = subscr_conn_lookup_iu(network, link_id, ue_ctx->conn_id);
-
- if (conn) {
- /* if we already have a connection, handle DTAP.
- gsm0408_dispatch() is aka msc_dtap() */
-
- /* Make sure we don't receive RR over Iu-CS; otherwise all
- * messages handled by gsm0408_dispatch() are of interest (CC,
- * MM, SMS, NS_SS, maybe even MM_GPRS and SM_GPRS). */
- struct gsm48_hdr *gh = msgb_l3(msg);
- uint8_t pdisc = gh->proto_discr & 0x0f;
- OSMO_ASSERT(pdisc != GSM48_PDISC_RR);
-
- gsm0408_dispatch(conn, msg);
- } else {
- /* allocate a new connection */
-
- /* TODO */
-
-#if 0
- rc = BSC_API_CONN_POL_REJECT;
- conn = subscr_conn_allocate_iu(msg->lchan);
- if (!lchan->conn) {
- lchan_release(lchan, 1, RSL_REL_NORMAL);
- return -1;
- }
-
- /* fwd via bsc_api to send COMPLETE L3 INFO to MSC */
- rc = api->compl_l3(lchan->conn, msg, 0);
-
- if (rc != BSC_API_CONN_POL_ACCEPT) {
- lchan->conn->lchan = NULL;
- subscr_con_free(lchan->conn);
- lchan_release(lchan, 1, RSL_REL_NORMAL);
- }
-#endif
- }
-
- return 0;
-}
-
-/* For A-interface see libbsc/bsc_api.c subscr_con_allocate() */
-/* TODO wrong file */
-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;
-}
diff --git a/openbsc/src/osmo-cscn/Makefile.am b/openbsc/src/osmo-cscn/Makefile.am
index 889d3f83a..f7ed7b0ed 100644
--- a/openbsc/src/osmo-cscn/Makefile.am
+++ b/openbsc/src/osmo-cscn/Makefile.am
@@ -9,9 +9,11 @@ AM_LDFLAGS = $(COVERAGE_LDFLAGS)
bin_PROGRAMS = osmo-cscn
osmo_cscn_SOURCES = cscn_main.c \
- $(top_builddir)/src/gprs/iu.c
+ iu_cs.c
+
osmo_cscn_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/libiu/libiu.a \
$(top_builddir)/src/libmsc/libmsc.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libtrau/libtrau.a \
diff --git a/openbsc/src/osmo-cscn/iu_cs.c b/openbsc/src/osmo-cscn/iu_cs.c
new file mode 100644
index 000000000..c8a36f47b
--- /dev/null
+++ b/openbsc/src/osmo-cscn/iu_cs.c
@@ -0,0 +1,93 @@
+#include <openbsc/gsm_data.h>
+#include <openbsc/iu.h>
+
+/* 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,
+ uint8_t link_id,
+ uint32_t conn_id)
+{
+ struct gsm_subscriber_connection *conn;
+ llist_for_each_entry(conn, &network->subscr_conns, entry) {
+ if (conn->via_iface != IFACE_IUCS)
+ continue;
+ if (conn->iu.link_id != link_id)
+ continue;
+ if (conn->iu.conn_id != conn_id)
+ continue;
+ return conn;
+ }
+ return NULL;
+}
+
+/* Receive MM/CC/... message from Iu-CS (SCCP user SAP).
+ * msg->dst must reference a struct ue_conn_ctx. link_id identifies the SCTP
+ * peer that sent the msg.
+ *
+ * For A-interface see libbsc/bsc_api.c gsm0408_rcvmsg(). */
+int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg, uint8_t link_id)
+{
+ int rc;
+ struct ue_conn_ctx *ue_ctx;
+ struct gsm_subscriber_connection *conn;
+
+ ue_ctx = (struct ue_conn_ctx*)msg->dst;
+
+ /* TODO: are there message types that could allow us to skip this
+ * search? */
+ conn = subscr_conn_lookup_iu(network, link_id, ue_ctx->conn_id);
+
+ if (conn) {
+ /* if we already have a connection, handle DTAP.
+ gsm0408_dispatch() is aka msc_dtap() */
+
+ /* Make sure we don't receive RR over Iu-CS; otherwise all
+ * messages handled by gsm0408_dispatch() are of interest (CC,
+ * MM, SMS, NS_SS, maybe even MM_GPRS and SM_GPRS). */
+ struct gsm48_hdr *gh = msgb_l3(msg);
+ uint8_t pdisc = gh->proto_discr & 0x0f;
+ OSMO_ASSERT(pdisc != GSM48_PDISC_RR);
+
+ gsm0408_dispatch(conn, msg);
+ } else {
+ /* allocate a new connection */
+
+ /* TODO */
+
+#if 0
+ rc = BSC_API_CONN_POL_REJECT;
+ conn = subscr_conn_allocate_iu(msg->lchan);
+ if (!lchan->conn) {
+ lchan_release(lchan, 1, RSL_REL_NORMAL);
+ return -1;
+ }
+
+ /* fwd via bsc_api to send COMPLETE L3 INFO to MSC */
+ rc = api->compl_l3(lchan->conn, msg, 0);
+
+ if (rc != BSC_API_CONN_POL_ACCEPT) {
+ lchan->conn->lchan = NULL;
+ subscr_con_free(lchan->conn);
+ lchan_release(lchan, 1, RSL_REL_NORMAL);
+ }
+#endif
+ }
+
+ 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;
+}
diff --git a/openbsc/tests/sgsn/Makefile.am b/openbsc/tests/sgsn/Makefile.am
index 34cd0aa32..2a37db3b8 100644
--- a/openbsc/tests/sgsn/Makefile.am
+++ b/openbsc/tests/sgsn/Makefile.am
@@ -30,9 +30,9 @@ sgsn_test_LDADD = \
$(top_builddir)/src/gprs/gsm_04_08_gprs.o \
$(top_builddir)/src/gprs/gprs_gb_parse.o \
$(top_builddir)/src/gprs/oap.o \
- $(top_builddir)/src/gprs/iu.o \
$(top_builddir)/src/gprs/oap_messages.o \
$(top_builddir)/src/libcommon/libcommon.a \
+ $(top_builddir)/src/libiu/libiu.a \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \