pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/38655?usp=email )
Change subject: Use new libosmo-sigtran APIs to access osmo_ss7_instance ......................................................................
Use new libosmo-sigtran APIs to access osmo_ss7_instance
Depends: libsomo-sigtran.git Change-Id I617e58f5f3f5420accbfe8b81ee8b3eb553330bf Change-Id: I3549ff3ace641f0b0574a9ddec14120299446434 --- M TODO-RELEASE M src/osmo-hnbgw/hnbgw_cn.c 2 files changed, 20 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/55/38655/1
diff --git a/TODO-RELEASE b/TODO-RELEASE index 86d4f2c..1f5ded1 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line libosmo-sigtran >2.0.0 use API osmo_sua_sccp_cause_name() libosmo-pfcp >0.4.0 use API osmo_pfcp_cp_peer_set_associated_cb(), osmo_pfcp_cp_peer_get_remote_addr(), osmo_pfcp_cp_peer_next_seid() +libosmo-sigtran >2.0.0 osmo_ss7_instance_get_id(), osmo_ss7_instance_get_primary_pc() \ No newline at end of file diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index b984a8e..5a115ab 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -796,7 +796,7 @@ { struct osmo_ss7_instance *ss7 = cnlink->hnbgw_sccp_user->ss7; LOG_CNLINK(cnlink, DCN, LOGL_NOTICE, "using: cs7-%u %s <-> %s %s %s\n", - ss7->cfg.id, + osmo_ss7_instance_get_id(ss7), /* printing the entire SCCP address is quite long, rather just print the point-code */ osmo_ss7_pointcode_print(ss7, cnlink->hnbgw_sccp_user->local_addr.pc), osmo_ss7_pointcode_print2(ss7, cnlink->remote_addr.pc), @@ -842,7 +842,7 @@ }
LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "remote-addr is '%s', using cs7 instance %u\n", - cnlink->use.remote_addr_name, ss7->cfg.id); + cnlink->use.remote_addr_name, osmo_ss7_instance_get_id(ss7)); } else { /* If no address is configured, use the default remote CN address, according to legacy behavior. */ osmo_sccp_make_addr_pc_ssn(&cnlink->remote_addr, cnlink->pool->default_remote_pc, OSMO_SCCP_SSN_RANAP); @@ -862,35 +862,41 @@ continue; cnlink->hnbgw_sccp_user = hsu; LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "using existing SCCP instance %s on cs7 instance %u\n", - hsu->name, ss7->cfg.id); + hsu->name, osmo_ss7_instance_get_id(ss7)); hnbgw_cnlink_log_self(cnlink); return 0; } /* else cnlink->hnbgw_sccp_user stays NULL and is set up below. */ - LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "cs7 instance %u has no configured SCCP instance yet\n", ss7->cfg.id); + LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "cs7 instance %u has no configured SCCP instance yet\n", osmo_ss7_instance_get_id(ss7)); }
/* No SCCP instance yet for this ss7. Create it. If no address name is given that resolves to a * particular cs7 instance above, use 'cs7 instance 0'. */ - sccp = osmo_sccp_simple_client_on_ss7_id(g_hnbgw, ss7 ? ss7->cfg.id : 0, cnlink->name, DEFAULT_PC_HNBGW, - OSMO_SS7_ASP_PROT_M3UA, 0, "localhost", -1, "localhost"); + sccp = osmo_sccp_simple_client_on_ss7_id(g_hnbgw, + ss7 ? osmo_ss7_instance_get_id(ss7) : 0, + cnlink->name, + DEFAULT_PC_HNBGW, + OSMO_SS7_ASP_PROT_M3UA, + 0, + "localhost", + -1, + "localhost"); if (!sccp) { LOG_CNLINK(cnlink, DCN, LOGL_ERROR, "Failed to configure SCCP on 'cs7 instance %u'\n", - ss7 ? ss7->cfg.id : 0); + ss7 ? osmo_ss7_instance_get_id(ss7) : 0); return -1; } ss7 = osmo_sccp_get_ss7(sccp); - LOG_CNLINK(cnlink, DCN, LOGL_NOTICE, "created SCCP instance on cs7 instance %u\n", ss7->cfg.id); + LOG_CNLINK(cnlink, DCN, LOGL_NOTICE, "created SCCP instance on cs7 instance %u\n", osmo_ss7_instance_get_id(ss7));
/* Bind the SCCP user, using the cs7 instance's default point-code if one is configured, or osmo-hnbgw's default * local PC. */ - if (osmo_ss7_pc_is_valid(ss7->cfg.primary_pc)) - local_pc = ss7->cfg.primary_pc; - else + local_pc = osmo_ss7_instance_get_primary_pc(ss7); + if (!osmo_ss7_pc_is_valid(local_pc)) local_pc = DEFAULT_PC_HNBGW;
LOG_CNLINK(cnlink, DCN, LOGL_DEBUG, "binding OsmoHNBGW user to cs7 instance %u, local PC %u = %s\n", - ss7->cfg.id, local_pc, osmo_ss7_pointcode_print(ss7, local_pc)); + osmo_ss7_instance_get_id(ss7), local_pc, osmo_ss7_pointcode_print(ss7, local_pc));
sccp_user = osmo_sccp_user_bind_pc(sccp, "OsmoHNBGW", sccp_sap_up, OSMO_SCCP_SSN_RANAP, local_pc); if (!sccp_user) { @@ -900,7 +906,7 @@
hsu = talloc_zero(cnlink, struct hnbgw_sccp_user); *hsu = (struct hnbgw_sccp_user){ - .name = talloc_asprintf(hsu, "cs7-%u.sccp", ss7->cfg.id), + .name = talloc_asprintf(hsu, "cs7-%u.sccp", osmo_ss7_instance_get_id(ss7)), .ss7 = ss7, .sccp_user = sccp_user, };