aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-09 23:28:33 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 20:06:49 +0100
commit3485feb49b9d87a84cacb9cad824b655d484e1d2 (patch)
treecb52b81d21b9b8e7ca8a4bf78847d65e6246a493 /openbsc
parentcf256d678f0a76055f7820cce16293e13c1b914c (diff)
bsc: Add module for handling BSSAP input
The current implementation is a stub. The code from bssap.c of on-waves/bsc-master will be migrated into this new structure
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/osmo_bsc.h3
-rw-r--r--openbsc/src/bsc/Makefile.am2
-rw-r--r--openbsc/src/bsc/osmo_bsc_bssap.c60
-rw-r--r--openbsc/src/bsc/osmo_bsc_sccp.c31
4 files changed, 71 insertions, 25 deletions
diff --git a/openbsc/include/openbsc/osmo_bsc.h b/openbsc/include/openbsc/osmo_bsc.h
index 5657c01ce..b94fc0409 100644
--- a/openbsc/include/openbsc/osmo_bsc.h
+++ b/openbsc/include/openbsc/osmo_bsc.h
@@ -30,5 +30,8 @@ int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp);
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
+int bsc_handle_udt(struct gsm_network *net, struct bsc_msc_connection *conn, struct msgb *msg, unsigned int length);
+int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);
+
#endif
diff --git a/openbsc/src/bsc/Makefile.am b/openbsc/src/bsc/Makefile.am
index 168c7215f..fe2dff0a1 100644
--- a/openbsc/src/bsc/Makefile.am
+++ b/openbsc/src/bsc/Makefile.am
@@ -7,7 +7,7 @@ bin_PROGRAMS = osmo-bsc
osmo_bsc_SOURCES = osmo_bsc_main.c osmo_bsc_rf.c osmo_bsc_vty.c osmo_bsc_api.c \
osmo_bsc_grace.c osmo_bsc_msc.c osmo_bsc_sccp.c \
- osmo_bsc_filter.c \
+ osmo_bsc_filter.c osmo_bsc_bssap.c \
$(top_srcdir)/src/debug.c $(top_srcdir)/src/bsc_msc.c \
$(top_srcdir)/src/bsc_init.c
osmo_bsc_LDADD = $(top_builddir)/src/libvty.a \
diff --git a/openbsc/src/bsc/osmo_bsc_bssap.c b/openbsc/src/bsc/osmo_bsc_bssap.c
new file mode 100644
index 000000000..44c652bbd
--- /dev/null
+++ b/openbsc/src/bsc/osmo_bsc_bssap.c
@@ -0,0 +1,60 @@
+/* GSM 08.08 BSSMAP handling */
+/* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2009-2010 by On-Waves
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <openbsc/osmo_bsc.h>
+#include <openbsc/debug.h>
+
+#include <osmocore/protocol/gsm_08_08.h>
+
+int bsc_handle_udt(struct gsm_network *network,
+ struct bsc_msc_connection *conn,
+ struct msgb *msgb, unsigned int length)
+{
+ struct bssmap_header *bs;
+
+ LOGP(DMSC, LOGL_DEBUG, "Incoming SCCP message ftom MSC: %s\n",
+ hexdump(msgb->l3h, length));
+
+ if (length < sizeof(*bs)) {
+ LOGP(DMSC, LOGL_ERROR, "The header is too short.\n");
+ return -1;
+ }
+
+ bs = (struct bssmap_header *) msgb->l3h;
+ if (bs->length < length - sizeof(*bs))
+ return -1;
+
+ switch (bs->type) {
+ case BSSAP_MSG_BSS_MANAGEMENT:
+ LOGP(DMSC, LOGL_ERROR, "BSS management not implemented.\n");
+ break;
+ default:
+ LOGP(DMSC, LOGL_ERROR, "Unimplemented msg type: %d\n", bs->type);
+ }
+
+ return 0;
+}
+
+int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn,
+ struct msgb *msg, unsigned int len)
+{
+ return -1;
+}
diff --git a/openbsc/src/bsc/osmo_bsc_sccp.c b/openbsc/src/bsc/osmo_bsc_sccp.c
index a30708b98..ad2ee5177 100644
--- a/openbsc/src/bsc/osmo_bsc_sccp.c
+++ b/openbsc/src/bsc/osmo_bsc_sccp.c
@@ -42,6 +42,10 @@ static LLIST_HEAD(active_connections);
static void msc_outgoing_sccp_data(struct sccp_connection *conn,
struct msgb *msg, unsigned int len)
{
+ struct osmo_bsc_sccp_con *bsc_con =
+ (struct osmo_bsc_sccp_con *) conn->data_ctx;
+
+ bsc_handle_dt1(bsc_con, msg, len);
}
static void msc_outgoing_sccp_state(struct sccp_connection *conn, int old_state)
@@ -118,29 +122,8 @@ static int msc_sccp_accept(struct sccp_connection *connection, void *data)
static int msc_sccp_read(struct msgb *msgb, unsigned int length, void *data)
{
- struct bssmap_header *bs;
-
- LOGP(DMSC, LOGL_DEBUG, "Incoming SCCP message ftom MSC: %s\n",
- hexdump(msgb->l3h, length));
-
- if (length < sizeof(*bs)) {
- LOGP(DMSC, LOGL_ERROR, "The header is too short.\n");
- return -1;
- }
-
- bs = (struct bssmap_header *) msgb->l3h;
- if (bs->length < length - sizeof(*bs))
- return -1;
-
- switch (bs->type) {
- case BSSAP_MSG_BSS_MANAGEMENT:
- LOGP(DMSC, LOGL_ERROR, "BSS management not implemented.\n");
- break;
- default:
- LOGP(DMSC, LOGL_ERROR, "Unimplemented msg type: %d\n", bs->type);
- }
-
- return 0;
+ struct gsm_network *net = (struct gsm_network *) data;
+ return bsc_handle_udt(net, net->msc_data->msc_con, msgb, length);
}
int bsc_queue_for_msc(struct gsm_subscriber_connection *conn, struct msgb *msg)
@@ -258,7 +241,7 @@ int osmo_bsc_sccp_init(struct gsm_network *gsmnet)
sccp_set_log_area(DSCCP);
sccp_system_init(msc_sccp_write_ipa, gsmnet);
sccp_connection_set_incoming(&sccp_ssn_bssap, msc_sccp_accept, NULL);
- sccp_set_read(&sccp_ssn_bssap, msc_sccp_read, NULL);
+ sccp_set_read(&sccp_ssn_bssap, msc_sccp_read, gsmnet);
register_signal_handler(SS_MSC, handle_msc_signal, gsmnet);