Change in libosmocore[master]: gprs_ns2: add gprs_ns2_sns_write_vty()

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Thu Dec 10 14:24:42 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21654 )


Change subject: gprs_ns2: add gprs_ns2_sns_write_vty()
......................................................................

gprs_ns2: add gprs_ns2_sns_write_vty()

Change-Id: I7d0041287f5489db827d989d21efb1def537bdb0
---
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
2 files changed, 23 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/54/21654/1

diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index f47fe10..e030e2f 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -238,6 +238,7 @@
 
 struct msgb *gprs_ns2_msgb_alloc(void);
 
+void gprs_ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse);
 void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats);
 void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
 			 struct gprs_ns2_vc *nsvc,
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 990adac..8e38086 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -46,6 +46,7 @@
 #include <osmocom/core/fsm.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/socket.h>
+#include <osmocom/core/sockaddr_str.h>
 #include <osmocom/gsm/tlv.h>
 #include <osmocom/gprs/gprs_msgb.h>
 #include <osmocom/gprs/gprs_ns2.h>
@@ -1534,6 +1535,27 @@
 	}
 }
 
+/*! write IP-SNS to a vty
+ *  \param[in] vty VTY to which the state shall be printed
+ *  \param[in] nse NS Entity whose IP-SNS state shall be printed
+ *  \param[in] stats Whether or not statistics shall also be printed */
+void gprs_ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse)
+{
+	struct ns2_sns_state *gss;
+	struct osmo_sockaddr_str addr_str;
+	struct sns_endpoint *endpoint;
+
+	if (!nse->bss_sns_fi)
+		return;
+
+	gss = (struct ns2_sns_state *) nse->bss_sns_fi->priv;
+	llist_for_each_entry(endpoint, &gss->sns_endpoints, list) {
+		osmo_sockaddr_str_from_sockaddr(&addr_str, &endpoint->saddr.u.sas);
+		vty_out(vty, "ip-sns %s %s %d%s",
+			"somegroup", addr_str.ip, addr_str.port, VTY_NEWLINE);
+	}
+}
+
 static struct sns_endpoint *ns2_get_sns_endpoint(struct ns2_sns_state *state,
 						 const struct osmo_sockaddr *saddr)
 {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7d0041287f5489db827d989d21efb1def537bdb0
Gerrit-Change-Number: 21654
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201210/c020db07/attachment.htm>


More information about the gerrit-log mailing list