diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-12-18 18:44:25 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-12-23 00:23:08 +0100 |
commit | 148ee361b35cd942327049f7abf37aaad818fb70 (patch) | |
tree | 50f802cc5bf53ef625ce35ac2880a7fc12a5f3b2 /src | |
parent | 9f7b1955d15c84e60cbc2c05cddc083993b140f3 (diff) |
cosmetic: Hide all accesses to conn->bts behind conn_get_bts()
This is a new inline function that hides all accesses to conn->bts.
A follow-up patch will then point this to conn->lchan->ts->trx->bts
to get rid of the bts field.
Change-Id: Ib6cf7097ced34eebe80441c29ab1534f21956a33
Diffstat (limited to 'src')
-rw-r--r-- | src/libbsc/bsc_api.c | 4 | ||||
-rw-r--r-- | src/libbsc/bsc_vty.c | 2 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_api.c | 14 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_audio.c | 2 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_bssap.c | 2 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_filter.c | 18 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_sigtran.c | 5 |
7 files changed, 25 insertions, 22 deletions
diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c index 9ec51af03..bd55dfc5c 100644 --- a/src/libbsc/bsc_api.c +++ b/src/libbsc/bsc_api.c @@ -214,7 +214,7 @@ static int handle_new_assignment(struct gsm_subscriber_connection *conn, int cha chan_type = full_rate ? GSM_LCHAN_TCH_F : GSM_LCHAN_TCH_H; - new_lchan = lchan_alloc(conn->bts, chan_type, 0); + new_lchan = lchan_alloc(conn_get_bts(conn), chan_type, 0); if (!new_lchan) { LOGP(DMSC, LOGL_NOTICE, "No free channel.\n"); @@ -451,7 +451,7 @@ static void handle_ass_compl(struct gsm_subscriber_connection *conn, conn->lchan = conn->secondary_lchan; conn->secondary_lchan = NULL; - if (is_ipaccess_bts(conn->bts) && conn->lchan->tch_mode != GSM48_CMODE_SIGN) + if (is_ipaccess_bts(conn_get_bts(conn)) && conn->lchan->tch_mode != GSM48_CMODE_SIGN) rsl_ipacc_crcx(conn->lchan); api->assign_compl(conn, gh->data[0], diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index 7612edaac..6d0110996 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -1378,7 +1378,7 @@ DEFUN(handover_subscr_conn, /* Find the connection/lchan that we want to handover */ llist_for_each_entry(conn, &net->subscr_conns, entry) { - if (conn->bts->nr == bts_nr && + if (conn_get_bts(conn)->nr == bts_nr && conn->lchan->ts->trx->nr == trx_nr && conn->lchan->ts->nr == ts_nr && conn->lchan->nr == ss_nr) { vty_out(vty, "starting handover for lchan %s...%s", diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c index a2a863068..1caaeee7c 100644 --- a/src/osmo-bsc/osmo_bsc_api.c +++ b/src/osmo-bsc/osmo_bsc_api.c @@ -115,7 +115,7 @@ static int bsc_filter_initial(struct osmo_bsc_data *bsc, req.black_list = NULL; req.access_lists = bsc_access_lists(); req.local_lst_name = msc->acc_lst_name; - req.global_lst_name = conn->bts->network->bsc_data->acc_lst_name; + req.global_lst_name = conn_get_bts(conn)->network->bsc_data->acc_lst_name; req.bsc_nr = 0; rc = bsc_msg_filter_initial(gh, msgb_l3len(msg), &req, @@ -136,7 +136,7 @@ static int bsc_filter_data(struct gsm_subscriber_connection *conn, req.black_list = NULL; req.access_lists = bsc_access_lists(); req.local_lst_name = conn->sccp_con->msc->acc_lst_name; - req.global_lst_name = conn->bts->network->bsc_data->acc_lst_name; + req.global_lst_name = conn_get_bts(conn)->network->bsc_data->acc_lst_name; req.bsc_nr = 0; rc = bsc_msg_filter_data(gh, msgb_l3len(msg), &req, @@ -228,7 +228,7 @@ static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg if (!msc) { LOGP(DMSC, LOGL_ERROR, "Failed to find a MSC for a connection.\n"); bsc_send_ussd_no_srv(conn, msg, - conn->bts->network->bsc_data->ussd_no_msc_txt); + conn_get_bts(conn)->network->bsc_data->ussd_no_msc_txt); return -1; } @@ -287,8 +287,8 @@ static int complete_layer3(struct gsm_subscriber_connection *conn, network_code = get_network_code_for_msc(conn->sccp_con->msc); country_code = get_country_code_for_msc(conn->sccp_con->msc); - lac = get_lac_for_msc(conn->sccp_con->msc, conn->bts); - ci = get_ci_for_msc(conn->sccp_con->msc, conn->bts); + lac = get_lac_for_msc(conn->sccp_con->msc, conn_get_bts(conn)); + ci = get_ci_for_msc(conn->sccp_con->msc, conn_get_bts(conn)); bsc_scan_bts_msg(conn, msg); @@ -383,7 +383,7 @@ static int handle_cc_setup(struct gsm_subscriber_connection *conn, /* * Check if the connection should be moved... */ - llist_for_each_entry(msc, &conn->bts->network->bsc_data->mscs, entry) { + llist_for_each_entry(msc, &conn_get_bts(conn)->network->bsc_data->mscs, entry) { if (msc->type != MSC_CON_TYPE_LOCAL) continue; if (!msc->local_pref) @@ -435,7 +435,7 @@ static void bsc_assign_compl(struct gsm_subscriber_connection *conn, uint8_t rr_ struct msgb *resp; return_when_not_connected(conn); - if (is_ipaccess_bts(conn->bts) && conn->sccp_con->user_plane.rtp_ip) { + if (is_ipaccess_bts(conn_get_bts(conn)) && conn->sccp_con->user_plane.rtp_ip) { /* NOTE: In a network that makes use of an IPA base station * and AoIP, we have to wait until the BTS reports its RTP * IP/Port combination back to BSC via RSL. Unfortunately, the diff --git a/src/osmo-bsc/osmo_bsc_audio.c b/src/osmo-bsc/osmo_bsc_audio.c index 82367f074..433dc6c5f 100644 --- a/src/osmo-bsc/osmo_bsc_audio.c +++ b/src/osmo-bsc/osmo_bsc_audio.c @@ -85,7 +85,7 @@ static int handle_abisip_signal(unsigned int subsys, unsigned int signal, * connection info */ LOGP(DMSC, LOGL_INFO,"RTP connection handover initiated...\n"); mgcp_handover(con->sccp_con->user_plane.mgcp_ctx, con->ho_lchan); - } else if (is_ipaccess_bts(con->bts) && con->sccp_con->user_plane.rtp_ip) { + } else if (is_ipaccess_bts(conn_get_bts(con)) && con->sccp_con->user_plane.rtp_ip) { /* NOTE: This is only relevant on AoIP networks with * IPA based base stations. See also osmo_bsc_api.c, * function bsc_assign_compl() */ diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 5a4031c78..45861ccce 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -436,7 +436,7 @@ static int bssmap_handle_cipher_mode(struct osmo_bsc_sccp_con *conn, goto reject; } - network = conn->conn->bts->network; + network = conn_get_bts(conn->conn)->network; data = TLVP_VAL(&tp, GSM0808_IE_ENCRYPTION_INFORMATION); enc_bits_msc = data[0]; enc_key = &data[1]; diff --git a/src/osmo-bsc/osmo_bsc_filter.c b/src/osmo-bsc/osmo_bsc_filter.c index 17dddf8ea..56c0a9c33 100644 --- a/src/osmo-bsc/osmo_bsc_filter.c +++ b/src/osmo-bsc/osmo_bsc_filter.c @@ -35,19 +35,20 @@ static void handle_lu_request(struct gsm_subscriber_connection *conn, struct gsm48_loc_upd_req *lu; struct gsm48_loc_area_id lai; struct gsm_network *net; + struct gsm_bts *bts = conn_get_bts(conn); if (msgb_l3len(msg) < sizeof(*gh) + sizeof(*lu)) { LOGP(DMSC, LOGL_ERROR, "LU too small to look at: %u\n", msgb_l3len(msg)); return; } - net = conn->bts->network; + net = bts->network; gh = msgb_l3(msg); lu = (struct gsm48_loc_upd_req *) gh->data; gsm48_generate_lai(&lai, net->country_code, net->network_code, - conn->bts->location_area_code); + bts->location_area_code); if (memcmp(&lai, &lu->lai, sizeof(lai)) != 0) { LOGP(DMSC, LOGL_DEBUG, "Marking con for welcome USSD.\n"); @@ -105,7 +106,7 @@ static int handle_page_resp(struct gsm_subscriber_connection *conn, struct msgb return -1; } - paging_request_stop(&conn->network->bts_list, conn->bts, subscr, conn, + paging_request_stop(&conn->network->bts_list, conn_get_bts(conn), subscr, conn, msg); bsc_subscr_put(subscr); return 0; @@ -136,7 +137,7 @@ struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn, struct bsc_subscr *subscr; int is_emerg = 0; - bsc = conn->bts->network->bsc_data; + bsc = conn->network->bsc_data; if (msgb_l3len(msg) < sizeof(*gh)) { LOGP(DMSC, LOGL_ERROR, "There is no GSM48 header here.\n"); @@ -185,7 +186,7 @@ paging: return NULL; } - pag_msc = paging_get_msc(conn->bts, subscr); + pag_msc = paging_get_msc(conn_get_bts(conn), subscr); bsc_subscr_put(subscr); llist_for_each_entry(msc, &bsc->mscs, entry) { @@ -260,7 +261,7 @@ static int bsc_patch_mm_info(struct gsm_subscriber_connection *conn, { struct tlv_parsed tp; int parse_res; - struct gsm_bts *bts = conn->bts; + struct gsm_bts *bts = conn_get_bts(conn); int tzunits; uint8_t tzbsd = 0; uint8_t dst = 0; @@ -337,6 +338,7 @@ static int has_core_identity(struct bsc_msc_data *msc) int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg) { struct bsc_msc_data *msc; + struct gsm_bts *bts = conn_get_bts(conn); struct gsm_network *net; struct gsm48_loc_area_id *lai; struct gsm48_hdr *gh; @@ -357,7 +359,7 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg) return 0; mtype = gsm48_hdr_msg_type(gh); - net = conn->bts->network; + net = bts->network; msc = conn->sccp_con->msc; if (mtype == GSM48_MT_MM_LOC_UPD_ACCEPT) { @@ -367,7 +369,7 @@ int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg) lai = (struct gsm48_loc_area_id *) &gh->data[0]; gsm48_generate_lai(lai, net->country_code, net->network_code, - conn->bts->location_area_code); + bts->location_area_code); } } diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 67f870378..19a36da47 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -244,6 +244,7 @@ enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, s { struct osmo_ss7_instance *ss7; struct osmo_bsc_sccp_con *bsc_con; + struct gsm_bts *bts = conn_get_bts(conn); int conn_id; OSMO_ASSERT(conn); @@ -259,12 +260,12 @@ enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, s return BSC_CON_REJECT_NO_LINK; } - if (!bsc_grace_allow_new_connection(conn->bts->network, conn->bts)) { + if (!bsc_grace_allow_new_connection(bts->network, bts)) { LOGP(DMSC, LOGL_NOTICE, "BSC in grace period. No new connections.\n"); return BSC_CON_REJECT_RF_GRACE; } - bsc_con = talloc_zero(conn->bts, struct osmo_bsc_sccp_con); + bsc_con = talloc_zero(bts, struct osmo_bsc_sccp_con); if (!bsc_con) { LOGP(DMSC, LOGL_ERROR, "Failed to allocate new SIGTRAN connection.\n"); return BSC_CON_NO_MEM; |