From 1e288b961431175f40123dcecba99550fce1e33f Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 13 Mar 2023 11:19:27 +0100 Subject: [PATCH] sccp: Introduce APIs to get/set osmo_sccp_instance priv data pointer The field already exists in the struct, but it's not really used anywhere internally yet (and was not available externally). Let's make it available to users of the API, similar to osmo_sccp_user_{get,set}_priv(). This way apps can easily store per-sccp-instance state. Change-Id: I5643e6b14590b1478b3c8dabc8a7a619f5505409 --- include/osmocom/sigtran/sccp_sap.h | 2 ++ src/sccp_user.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h index 607c3583..4bcdd383 100644 --- a/include/osmocom/sigtran/sccp_sap.h +++ b/include/osmocom/sigtran/sccp_sap.h @@ -293,6 +293,8 @@ struct osmo_sccp_instance *osmo_sccp_instance_create(struct osmo_ss7_instance *s void osmo_sccp_instance_destroy(struct osmo_sccp_instance *inst); struct osmo_ss7_instance *osmo_sccp_get_ss7(const struct osmo_sccp_instance *sccp); struct osmo_sccp_instance *osmo_sccp_get_sccp(const struct osmo_sccp_user *scu); +void osmo_sccp_set_priv(struct osmo_sccp_instance *sccp, void *priv); +void *osmo_sccp_get_priv(struct osmo_sccp_instance *sccp); void osmo_sccp_user_unbind(struct osmo_sccp_user *scu); void osmo_sccp_user_set_priv(struct osmo_sccp_user *scu, void *priv); diff --git a/src/sccp_user.c b/src/sccp_user.c index 64e2d312..e619c90b 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -264,6 +264,16 @@ void osmo_sccp_instance_destroy(struct osmo_sccp_instance *inst) talloc_free(inst); } +void osmo_sccp_set_priv(struct osmo_sccp_instance *sccp, void *priv) +{ + sccp->priv = priv; +} + +void *osmo_sccp_get_priv(struct osmo_sccp_instance *sccp) +{ + return sccp->priv; +} + /*! \brief derive a basic local SCCP-Address from a given SCCP instance. * \param[out] dest_addr pointer to output address memory * \param[in] inst SCCP instance