Change in libosmo-sccp[master]: add osmo_ss7_instance_asp_find_by_proto()

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 gerrit-no-reply at lists.osmocom.org
Thu Jun 25 17:55:08 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/19012 )


Change subject: add osmo_ss7_instance_asp_find_by_proto()
......................................................................

add osmo_ss7_instance_asp_find_by_proto()

For 'cs7' auto configuration, we want to pick up an ASP that is not associated
with an AS yet. For that, we need API that looks in the entire ss7 instance,
not only for already present AS.

(Before this, the auto configuration detected "floating" ASP only if they had a
specific name, which is changed by upcoming patch
I2954e0167729fd0b1a7d0144a5b5775fc1c44c35)

Related: OS#4635
Change-Id: Ib204c6906eb02fe64b43b75375e1b69e2a8abd30
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7.c
2 files changed, 25 insertions(+), 0 deletions(-)



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

diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 2502407..06cc43c 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -439,6 +439,9 @@
 *osmo_ss7_asp_find_by_proto(struct osmo_ss7_as *as,
 			    enum osmo_ss7_asp_protocol proto);
 struct osmo_ss7_asp *
+osmo_ss7_instance_asp_find_by_proto(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto,
+				    unsigned int match_idx);
+struct osmo_ss7_asp *
 osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
 		  uint16_t remote_port, uint16_t local_port,
 		  enum osmo_ss7_asp_protocol proto);
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index cdac27a..ad6f171 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1285,6 +1285,28 @@
 	return NULL;
 }
 
+/*! \brief Find an ASP that matches the given protocol anywhere in the SS7 instance.
+ *  \param[in] inst  SS7 instance to look for ASP in.
+ *  \param[in] match_idx  return Nth matching ASP, 0 to return first match.
+ *  \returns SS7  ASP in case a matching one is found; NULL otherwise */
+struct osmo_ss7_asp *
+osmo_ss7_instance_asp_find_by_proto(struct osmo_ss7_instance *inst, enum osmo_ss7_asp_protocol proto,
+				    unsigned int match_idx)
+{
+	struct osmo_ss7_asp *asp;
+	OSMO_ASSERT(ss7_initialized);
+	llist_for_each_entry(asp, &inst->asp_list, list) {
+		if (asp->cfg.proto != proto)
+			continue;
+		if (match_idx) {
+			match_idx--;
+			continue;
+		}
+		return asp;
+	}
+	return NULL;
+}
+
 struct osmo_ss7_asp *
 osmo_ss7_asp_find(struct osmo_ss7_instance *inst, const char *name,
 		  uint16_t remote_port, uint16_t local_port,

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/19012
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ib204c6906eb02fe64b43b75375e1b69e2a8abd30
Gerrit-Change-Number: 19012
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200625/cbe11ef4/attachment.htm>


More information about the gerrit-log mailing list