pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/33377 )
Change subject: Add osmo_ss7_asp getters for name and proto ......................................................................
Add osmo_ss7_asp getters for name and proto
Some apps such as osmo-bsc are accessing some of those fields, so better add a getter API to make it easier to update the struct contents.
Change-Id: If9acfca1abc9ab7eb6d2388f548d7ee577b9c5ac --- M TODO-RELEASE M include/osmocom/sigtran/osmo_ss7.h M src/osmo_ss7.c 3 files changed, 33 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved
diff --git a/TODO-RELEASE b/TODO-RELEASE index ede41b5..5406d05 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,4 +8,5 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmocore >1.8.0 uses new osmo_prim_operation_name() +libosmo-sccp add API osmo_ss7_asp_get_name(), osmo_ss7_asp_get_proto() osmo_sccp_simple_client_on_ss7_id() behavior change: ASPs asp-clnt-* defined through VTY must explicitly configure "role" and "sctp-role" \ No newline at end of file diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index f413983..3c72394 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -471,6 +471,8 @@ int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level); bool osmo_ss7_asp_active(const struct osmo_ss7_asp *asp); int osmo_ss7_asp_get_log_subsys(const struct osmo_ss7_asp *asp); +const char *osmo_ss7_asp_get_name(const struct osmo_ss7_asp *asp); +enum osmo_ss7_asp_protocol osmo_ss7_asp_get_proto(const struct osmo_ss7_asp *asp);
/*! Weak function to handle payload for unknown/unsupported PPID or IPA StreamID. * This function can be overridden by application code to implement whatever handling diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 3dc0d51..aba14b3 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -2432,6 +2432,24 @@ } }
+/*! \brief Get the name of a given ASP + * \param[in] asp The ASP for which the name is requested + * \returns The name of the ASP, or NULL if not set + */ +const char *osmo_ss7_asp_get_name(const struct osmo_ss7_asp *asp) +{ + return asp->cfg.name; +} + +/*! \brief Get the proto of a given ASP + * \param[in] asp The ASP for which the proto is requested + * \returns The proto of the ASP + */ +enum osmo_ss7_asp_protocol osmo_ss7_asp_get_proto(const struct osmo_ss7_asp *asp) +{ + return asp->cfg.proto; +} + /*! Register a call-back function for unknown SCTP PPID / IPA Stream ID */ void osmo_ss7_register_rx_unknown_cb(osmo_ss7_asp_rx_unknown_cb *cb) {