aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-11-08 02:27:36 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2017-11-08 02:33:14 +0100
commit12715e8e995b51e6d904a9dd8f4abf09fadc335c (patch)
tree0077a38b6c44cbf3c37198bfb2c866de97ca377f /src
parent8914a2f0fac5e0f9554076acd6af01f25675a7a3 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/sccp_helpers.c7
1 files changed, 7 insertions, 0 deletions
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 @@ char *osmo_sccp_addr_name(const struct osmo_ss7_instance *ss7, const struct osmo
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);
+}