diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-03-13 11:19:27 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-03-13 11:20:31 +0100 |
commit | 1e288b961431175f40123dcecba99550fce1e33f (patch) | |
tree | 66e9dc9863e66fed782d2a2ee8a9de2a3a59f72e | |
parent | 253c45307efc0e763b4458dd2420d9861f458d29 (diff) |
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
-rw-r--r-- | include/osmocom/sigtran/sccp_sap.h | 2 | ||||
-rw-r--r-- | src/sccp_user.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h index 607c358..4bcdd38 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 64e2d31..e619c90 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 |