Harald Welte has submitted this change and it was merged.

Change subject: add osmo_sccp_inst_addr_name(), a variant of 
osmo_sccp_addr_name()
......................................................................


add osmo_sccp_inst_addr_name(), a variant of osmo_sccp_addr_name()

It can be cumbersome to derive the ss7 instance needed to pass to
sccp_addr_name(), because struct osmo_sccp_instance is opaque and only
available in sccp_internal.h, within libosmo-sccp.

Add osmo_sccp_inst_addr_name() which derives the ss7 instance from the internal
knowledge of the osmo_sccp_instance struct. This can save calls to
osmo_ss7_instance_find() just to do some logging of an sccp address.

Naming: first I thought to pick osmo_sccp_addr_name2(), but for some of the
string composing functions, adding a 2 already means that it is identical but
using a second static buffer (to be used twice within the same printf).

Change-Id: I70ec5c8b42682a23f11a5820431c7e34e225709b
---
M include/osmocom/sigtran/sccp_helpers.h
M src/sccp_helpers.c
2 files changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/sigtran/sccp_helpers.h 
b/include/osmocom/sigtran/sccp_helpers.h
index c2175f4..3ef7740 100644
--- a/include/osmocom/sigtran/sccp_helpers.h
+++ b/include/osmocom/sigtran/sccp_helpers.h
@@ -55,3 +55,4 @@
 char *osmo_sccp_gt_dump(const struct osmo_sccp_gt *gt);
 char *osmo_sccp_addr_dump(const struct osmo_sccp_addr *addr);
 char *osmo_sccp_addr_name(const struct osmo_ss7_instance *ss7, const struct 
osmo_sccp_addr *addr);
+char *osmo_sccp_inst_addr_name(const struct osmo_sccp_instance *sccp, const 
struct osmo_sccp_addr *addr);
diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index 4b24392..f752e2a 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -324,3 +324,10 @@
 
        return buf;
 }
+
+/* Derive ss7 from the sccp instance and call osmo_sccp_addr_name() with that.
+ * If sccp is passed as NULL, simply use the default point code format. */
+char *osmo_sccp_inst_addr_name(const struct osmo_sccp_instance *sccp, const 
struct osmo_sccp_addr *addr)
+{
+       return osmo_sccp_addr_name(sccp? sccp->ss7 : NULL, addr);
+}

-- 
To view, visit https://gerrit.osmocom.org/4722
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I70ec5c8b42682a23f11a5820431c7e34e225709b
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to