From f9bac02f78d85a9d794bb76c3d3da84e2d72a08b Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 30 Jun 2017 16:38:42 +0200 Subject: osmo-bsc: change calling/called_addr variable names "calling_address" and "called_address" is not very expressive. change the respective struct memeber names of bsc_msc_data to bsc_addr and msc_addr to increase readability of the code. Change-Id: I63b2e810b97131c690edd5a9cc5c7b3b54ec5e12 --- include/openbsc/bsc_msc_data.h | 15 +++++++++++++-- src/osmo-bsc/osmo_bsc_sigtran.c | 24 ++++++++++++------------ src/osmo-bsc/osmo_bsc_vty.c | 8 ++++---- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/include/openbsc/bsc_msc_data.h b/include/openbsc/bsc_msc_data.h index e97ab13fc..f5815171e 100644 --- a/include/openbsc/bsc_msc_data.h +++ b/include/openbsc/bsc_msc_data.h @@ -117,8 +117,19 @@ struct bsc_msc_data { struct osmo_ss7_instance *ss7; struct osmo_sccp_instance *sccp; struct osmo_sccp_user *sccp_user; - struct osmo_sccp_addr g_calling_addr; - struct osmo_sccp_addr g_called_addr; + + /* Holds a copy of the our local MSC address, + * this will be the sccp-address that is associated + * with the A interface of this particular BSC, + * this address is filled up by the VTY interface */ + struct osmo_sccp_addr bsc_addr; + + /* Holds a copy of the MSC address. This is the + * address of the MSC that handles the calls of + * this BSC. The address is configured via the + * VTY interface */ + struct osmo_sccp_addr msc_addr; + struct a_reset_ctx *reset; } a; }; diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 62f151dd6..7ae2f362b 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -88,8 +88,8 @@ static void osmo_bsc_sigtran_tx_reset(struct bsc_msc_data *msc) struct msgb *msg; LOGP(DMSC, LOGL_NOTICE, "Sending RESET to MSC No.: %i\n", msc->nr); msg = gsm0808_create_reset(); - osmo_sccp_tx_unitdata_msg(msc->a.sccp_user, &msc->a.g_calling_addr, - &msc->a.g_called_addr, msg); + osmo_sccp_tx_unitdata_msg(msc->a.sccp_user, &msc->a.bsc_addr, + &msc->a.msc_addr, msg); } /* Send reset-ack to MSC */ @@ -98,8 +98,8 @@ void osmo_bsc_sigtran_tx_reset_ack(struct bsc_msc_data *msc) struct msgb *msg; LOGP(DMSC, LOGL_NOTICE, "Sending RESET ACK to MSC No.: %i\n", msc->nr); msg = gsm0808_create_reset_ack(); - osmo_sccp_tx_unitdata_msg(msc->a.sccp_user, &msc->a.g_calling_addr, - &msc->a.g_called_addr, msg); + osmo_sccp_tx_unitdata_msg(msc->a.sccp_user, &msc->a.bsc_addr, + &msc->a.msc_addr, msg); } /* Find an MSC by its sigtran point code */ @@ -107,7 +107,7 @@ static struct bsc_msc_data *get_msc_by_addr(struct osmo_sccp_addr *calling_addr) { struct bsc_msc_data *msc; llist_for_each_entry(msc, msc_list, entry) { - if (memcmp(calling_addr, &msc->a.g_called_addr, sizeof(*calling_addr)) == 0) + if (memcmp(calling_addr, &msc->a.msc_addr, sizeof(*calling_addr)) == 0) return msc; } @@ -286,8 +286,8 @@ int osmo_bsc_sigtran_open_conn(struct osmo_bsc_sccp_con *conn, struct msgb *msg) conn_id = conn->conn_id; LOGP(DMSC, LOGL_NOTICE, "Opening new SIGTRAN connection (id=%i) to MSC No.: %i...\n", conn_id, msc->nr); - rc = osmo_sccp_tx_conn_req_msg(msc->a.sccp_user, conn_id, &msc->a.g_calling_addr, - &msc->a.g_called_addr, msg); + rc = osmo_sccp_tx_conn_req_msg(msc->a.sccp_user, conn_id, &msc->a.bsc_addr, + &msc->a.msc_addr, msg); return rc; } @@ -385,7 +385,7 @@ void osmo_bsc_sigtran_reset(struct bsc_msc_data *msc) gsm0808_clear(conn->conn); /* Disconnect all Sigtran connections */ - osmo_sccp_tx_disconn(msc->a.sccp_user, conn->conn_id, &msc->a.g_calling_addr, 0); + osmo_sccp_tx_disconn(msc->a.sccp_user, conn->conn_id, &msc->a.bsc_addr, 0); /* Delete subscriber connection */ osmo_bsc_sigtran_del_conn(conn); @@ -434,12 +434,12 @@ int osmo_bsc_sigtran_init(struct llist_head *mscs) LOGP(DMSC, LOGL_NOTICE, "Initalizing SCCP connection to %s\n", msc_name); /* Check if the sccp-address */ - if (test_addr(&msc->a.g_calling_addr) < 0) { + if (test_addr(&msc->a.bsc_addr) < 0) { LOGP(DMSC, LOGL_ERROR, "Insufficient local address (calling-address) configuration, check VTY-Config\n"); return -EINVAL; } - if (test_addr(&msc->a.g_called_addr) < 0) { + if (test_addr(&msc->a.msc_addr) < 0) { LOGP(DMSC, LOGL_ERROR, "Insufficient remote address (called-address) configuration, check VTY-Config\n"); return -EINVAL; @@ -447,9 +447,9 @@ int osmo_bsc_sigtran_init(struct llist_head *mscs) /* SCCP Protocol stack */ msc->a.sccp = - osmo_sccp_simple_client(NULL, msc_name, msc->a.g_calling_addr.pc, + osmo_sccp_simple_client(NULL, msc_name, msc->a.bsc_addr.pc, OSMO_SS7_ASP_PROT_M3UA, 0, NULL, M3UA_PORT, "127.0.0.1"); - msc->a.sccp_user = osmo_sccp_user_bind(msc->a.sccp, msc_name, sccp_sap_up, msc->a.g_calling_addr.ssn); + msc->a.sccp_user = osmo_sccp_user_bind(msc->a.sccp, msc_name, sccp_sap_up, msc->a.bsc_addr.ssn); /* Start MSC reset procedure */ msc->a.reset = a_reset_alloc(msc, msc_name, osmo_bsc_sigtran_reset_cb, msc); diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c index 17764e85b..ff5c314dc 100644 --- a/src/osmo-bsc/osmo_bsc_vty.c +++ b/src/osmo-bsc/osmo_bsc_vty.c @@ -191,10 +191,10 @@ static void write_msc(struct vty *vty, struct bsc_msc_data *msc) vty_out(vty, " cs7-instance %u%s", msc->a.ss7->cfg.id, VTY_NEWLINE); vty_out(vty, " calling-addr %s%s", - osmo_sccp_name_by_addr(&msc->a.g_calling_addr, + osmo_sccp_name_by_addr(&msc->a.bsc_addr, msc->a.ss7), VTY_NEWLINE); vty_out(vty, " called-addr %s%s", - osmo_sccp_name_by_addr(&msc->a.g_called_addr, + osmo_sccp_name_by_addr(&msc->a.msc_addr, msc->a.ss7), VTY_NEWLINE); } } @@ -757,7 +757,7 @@ DEFUN(cfg_msc_cs7_calling_addr, enforce_standard_ssn(vty, calling_addr); - memcpy(&msc->a.g_calling_addr, calling_addr, sizeof(*calling_addr)); + memcpy(&msc->a.bsc_addr, calling_addr, sizeof(*calling_addr)); return CMD_SUCCESS; } @@ -785,7 +785,7 @@ DEFUN(cfg_msc_cs7_called_addr, enforce_standard_ssn(vty, called_addr); - memcpy(&msc->a.g_called_addr, called_addr, sizeof(*called_addr)); + memcpy(&msc->a.msc_addr, called_addr, sizeof(*called_addr)); return CMD_SUCCESS; } -- cgit v1.2.3