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
This commit is contained in:
Pau Espin 2023-03-13 11:19:27 +01:00
parent 253c45307e
commit 1e288b9614
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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