[PATCH] libosmo-sccp[master]: add osmo_sccp_inst_addr_name(), a variant of osmo_sccp_addr_...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Nov 8 01:36:03 UTC 2017


Review at  https://gerrit.osmocom.org/4722

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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/22/4722/1

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: newchange
Gerrit-Change-Id: I70ec5c8b42682a23f11a5820431c7e34e225709b
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list