pespin has uploaded this change for review.

View Change

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
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_user.c
2 files changed, 26 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/65/31865/1
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 @@
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 @@
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

To view, visit change 31865. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I5643e6b14590b1478b3c8dabc8a7a619f5505409
Gerrit-Change-Number: 31865
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange