aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-06-04 14:51:51 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-03-16 11:56:10 +0100
commit4cdb050d132cb4a9f35f0ab1165f58f040132afe (patch)
tree596495072c78472793ff747c383a87f46161267c /openbsc
parentf31a4a48100eaca8f31e511f542c85b5a430baf4 (diff)
bsc: Move away from ->bsc.msc to use the selected MSC
For multiple MSCs we should only have one place where the MSC is selected and the rest will extract it from somewhere.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/osmo_bsc.h4
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_api.c23
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_sccp.c8
3 files changed, 20 insertions, 15 deletions
diff --git a/openbsc/include/openbsc/osmo_bsc.h b/openbsc/include/openbsc/osmo_bsc.h
index 262014759..d8465c9f7 100644
--- a/openbsc/include/openbsc/osmo_bsc.h
+++ b/openbsc/include/openbsc/osmo_bsc.h
@@ -6,6 +6,8 @@
#include "bsc_api.h"
struct sccp_connection;
+struct osmo_msc_data;
+struct bsc_msc_connection;
struct osmo_bsc_sccp_con {
struct llist_head entry;
@@ -15,7 +17,7 @@ struct osmo_bsc_sccp_con {
/* SCCP connection realted */
struct sccp_connection *sccp;
- struct bsc_msc_connection *msc_con;
+ struct osmo_msc_data *msc;
struct osmo_timer_list sccp_it_timeout;
struct osmo_timer_list sccp_cc_timeout;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c
index eb7d38ad5..04305c20f 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_api.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c
@@ -45,18 +45,18 @@
} \
bsc_queue_for_msc(conn->sccp_con, resp);
-static uint16_t get_network_code_for_msc(struct gsm_network *net)
+static uint16_t get_network_code_for_msc(struct osmo_msc_data *msc)
{
- if (net->bsc_data->msc.core_ncc != -1)
- return net->bsc_data->msc.core_ncc;
- return net->network_code;
+ if (msc->core_ncc != -1)
+ return msc->core_ncc;
+ return msc->network->network_code;
}
-static uint16_t get_country_code_for_msc(struct gsm_network *net)
+static uint16_t get_country_code_for_msc(struct osmo_msc_data *msc)
{
- if (net->bsc_data->msc.core_mcc != -1)
- return net->bsc_data->msc.core_mcc;
- return net->country_code;
+ if (msc->core_mcc != -1)
+ return msc->core_mcc;
+ return msc->network->country_code;
}
static void bsc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci)
@@ -89,8 +89,8 @@ static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg
uint16_t chosen_channel)
{
struct msgb *resp;
- uint16_t network_code = get_network_code_for_msc(conn->bts->network);
- uint16_t country_code = get_country_code_for_msc(conn->bts->network);
+ uint16_t network_code;
+ uint16_t country_code;
LOGP(DMSC, LOGL_INFO, "Tx MSC COMPL L3\n");
@@ -98,6 +98,9 @@ static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg
if (bsc_create_new_connection(conn) != 0)
return BSC_API_CONN_POL_REJECT;
+ network_code = get_network_code_for_msc(conn->sccp_con->msc);
+ country_code = get_country_code_for_msc(conn->sccp_con->msc);
+
bsc_scan_bts_msg(conn, msg);
resp = gsm0808_create_layer3(msg, network_code, country_code,
conn->bts->location_area_code,
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
index 30dea0f4f..529b488db 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c
@@ -182,13 +182,13 @@ int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg)
int bsc_create_new_connection(struct gsm_subscriber_connection *conn)
{
struct gsm_network *net;
- struct bsc_msc_connection *msc;
+ struct osmo_msc_data *msc;
struct osmo_bsc_sccp_con *bsc_con;
struct sccp_connection *sccp;
net = conn->bts->network;
- msc = net->bsc_data->msc.msc_con;
- if (!msc->is_authenticated) {
+ msc = &net->bsc_data->msc;
+ if (!msc->msc_con->is_authenticated) {
LOGP(DMSC, LOGL_ERROR, "Not connected to a MSC. Not forwarding data.\n");
return -1;
}
@@ -225,7 +225,7 @@ int bsc_create_new_connection(struct gsm_subscriber_connection *conn)
INIT_LLIST_HEAD(&bsc_con->sccp_queue);
bsc_con->sccp = sccp;
- bsc_con->msc_con = msc;
+ bsc_con->msc = msc;
bsc_con->conn = conn;
llist_add_tail(&bsc_con->entry, &active_connections);
conn->sccp_con = bsc_con;