diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-02-12 11:54:04 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-03-03 16:19:10 +0100 |
commit | c6794eed1dbe726b23c60e96e214ec1a1fbf6b51 (patch) | |
tree | de72e07b02072e41153982212e2691d85dbb0f45 /openbsc/src/osmo-cscn | |
parent | 7a70a4f52a837bde0f7fa5f435e302939a2e3d74 (diff) |
cscn: some file moves/renames
Diffstat (limited to 'openbsc/src/osmo-cscn')
-rw-r--r-- | openbsc/src/osmo-cscn/Makefile.am | 5 | ||||
-rw-r--r-- | openbsc/src/osmo-cscn/cscn_main.c | 2 | ||||
-rw-r--r-- | openbsc/src/osmo-cscn/iu_cs.c | 119 |
3 files changed, 2 insertions, 124 deletions
diff --git a/openbsc/src/osmo-cscn/Makefile.am b/openbsc/src/osmo-cscn/Makefile.am index 2c4cff7c3..3a1021304 100644 --- a/openbsc/src/osmo-cscn/Makefile.am +++ b/openbsc/src/osmo-cscn/Makefile.am @@ -6,12 +6,9 @@ AM_CFLAGS=-Wall $(COVERAGE_CFLAGS) \ AM_LDFLAGS = $(COVERAGE_LDFLAGS) -noinst_HEADERS = iu_cs.h - bin_PROGRAMS = osmo-cscn -osmo_cscn_SOURCES = cscn_main.c \ - iu_cs.c +osmo_cscn_SOURCES = cscn_main.c osmo_cscn_LDADD = \ $(top_builddir)/src/libbsc/libbsc.a \ diff --git a/openbsc/src/osmo-cscn/cscn_main.c b/openbsc/src/osmo-cscn/cscn_main.c index 4d9109a59..005c8cf6a 100644 --- a/openbsc/src/osmo-cscn/cscn_main.c +++ b/openbsc/src/osmo-cscn/cscn_main.c @@ -65,7 +65,7 @@ #include "../../bscconfig.h" -#include "iu_cs.h" +#include <openbsc/iu_cs.h> static const char * const osmocscn_copyright = "OsmoCSCN - Osmocom Circuit-Switched Core Network implementation\r\n" diff --git a/openbsc/src/osmo-cscn/iu_cs.c b/openbsc/src/osmo-cscn/iu_cs.c deleted file mode 100644 index e321c15a1..000000000 --- a/openbsc/src/osmo-cscn/iu_cs.c +++ /dev/null @@ -1,119 +0,0 @@ -#include <inttypes.h> - -#include <osmocom/core/logging.h> -#include <openbsc/debug.h> - -#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, - struct ue_conn_ctx *ue) -{ - struct gsm_subscriber_connection *conn; - - DEBUGP(DIUCS, "Allocating IuCS subscriber conn: link_id %p, conn_id %" PRIx32 "\n", - ue->link, ue->conn_id); - - conn = talloc_zero(network, struct gsm_subscriber_connection); - if (!conn) - return NULL; - - conn->network = network; - conn->via_iface = IFACE_IUCS; - conn->iu.ue_ctx = ue; - - llist_add_tail(&conn->entry, &network->subscr_conns); - return conn; -} - -static int same_ue_conn(struct ue_conn_ctx *a, struct ue_conn_ctx *b) -{ - if (a == b) - return 1; - return (a->link == b->link) - && (a->conn_id != b->conn_id); -} - -/* Return an existing IuCS 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, - struct ue_conn_ctx *ue) -{ - struct gsm_subscriber_connection *conn; - - llist_for_each_entry(conn, &network->subscr_conns, entry) { - if (conn->via_iface != IFACE_IUCS) - continue; - if (!same_ue_conn(conn->iu.ue_ctx, ue)) - continue; - DEBUGP(DIUCS, "Found IuCS subscriber for link_id %p, conn_id %" PRIx32 "\n", - ue->link, ue->conn_id); - return conn; - } - DEBUGP(DIUCS, "No IuCS subscriber found for link_id %p, conn_id %" PRIx32 "\n", - ue->link, ue->conn_id); - return NULL; -} - -/* Receive MM/CC/... message from IuCS (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) -{ - 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, ue_ctx); - - if (conn) { - /* if we already have a connection, handle DTAP. - gsm0408_dispatch() is aka msc_dtap() */ - - /* Make sure we don't receive RR over IuCS; 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); - - rc = gsm0408_dispatch(conn, msg); - } else { - /* allocate a new connection */ - - conn = subscr_conn_allocate_iu(network, ue_ctx); - if (!conn) - abort(); - - rc = msc_compl_l3(conn, msg, 0); - if (rc != BSC_API_CONN_POL_ACCEPT) { - subscr_con_free(conn); - rc = -1; - } - else - rc = 0; - } - - return rc; -} - - -int iucs_submit_dtap(struct gsm_subscriber_connection *conn, - struct msgb *msg) -{ - OSMO_ASSERT(conn->via_iface == IFACE_IUCS); - msg->dst = conn->iu.ue_ctx; - return iu_tx(msg, 0); -} - |