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
This commit is contained in:
Philipp Maier 2017-06-30 16:38:42 +02:00 committed by Neels Hofmeyr
parent 9181421441
commit f9bac02f78
3 changed files with 29 additions and 18 deletions

View File

@ -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;
};

View File

@ -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);

View File

@ -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;
}