pespin has submitted this change. ( 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 I8f09aff41666822f759f99fa91c13e3b9d89d530 Change-Id: I3549ff3ace641f0b0574a9ddec14120299446434 --- M TODO-RELEASE M include/osmocom/hnbgw/hnbgw.h M src/osmo-hnbgw/context_map.c M src/osmo-hnbgw/hnbgw_cn.c 4 files changed, 23 insertions(+), 16 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE index 86d4f2c..4256c4a 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(), osmo_ss7_get_sccp() diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index afceca8..fc110c0 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -333,7 +333,7 @@ return NULL; if (!cnlink->hnbgw_sccp_user->ss7) return NULL; - return cnlink->hnbgw_sccp_user->ss7->sccp; + return osmo_ss7_get_sccp(cnlink->hnbgw_sccp_user->ss7); }
/* The lifecycle of the hnb_context object is the same as its conn */ diff --git a/src/osmo-hnbgw/context_map.c b/src/osmo-hnbgw/context_map.c index 08d6a39..6146e6c 100644 --- a/src/osmo-hnbgw/context_map.c +++ b/src/osmo-hnbgw/context_map.c @@ -111,7 +111,7 @@ return -EIO; }
- new_scu_conn_id = osmo_sccp_instance_next_conn_id(hsu->ss7->sccp); + new_scu_conn_id = osmo_sccp_instance_next_conn_id(osmo_ss7_get_sccp(hsu->ss7)); if (new_scu_conn_id < 0) { LOG_MAP(map, DCN, LOGL_ERROR, "Unable to allocate SCCP conn ID on %s\n", hsu->name); return new_scu_conn_id; diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c index a74b6d7..e7df788 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -436,7 +436,7 @@ cnlink = hnbgw_cnlink_find_by_addr(hsu, calling_addr); if (!cnlink) { LOG_HSI(hsu, DRANAP, LOGL_ERROR, "Rx from unknown SCCP peer: %s: %s\n", - osmo_sccp_inst_addr_name(hsu->ss7->sccp, calling_addr), + osmo_sccp_inst_addr_name(osmo_ss7_get_sccp(hsu->ss7), calling_addr), osmo_scu_prim_hdr_name_c(OTC_SELECT, oph)); return NULL; } @@ -798,7 +798,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), @@ -844,7 +844,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); @@ -864,35 +864,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) { @@ -902,7 +908,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, };