Change in libosmocore[master]: Add function gprs_nsvc_state_append

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

daniel gerrit-no-reply at lists.osmocom.org
Thu Jun 14 15:44:36 UTC 2018


daniel has uploaded this change for review. ( https://gerrit.osmocom.org/9631


Change subject: Add function gprs_nsvc_state_append
......................................................................

Add function gprs_nsvc_state_append

A common function to append the nsvc state from osmo-sgsn or osmo-gbproxy

Change-Id: I7f0eaff7329ab98cad792d30b20ab053007aab85
---
M include/osmocom/gprs/gprs_ns.h
M src/gb/gprs_ns.c
M src/gb/libosmogb.map
3 files changed, 25 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/9631/1

diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h
index b368ad9..7b95099 100644
--- a/include/osmocom/gprs/gprs_ns.h
+++ b/include/osmocom/gprs/gprs_ns.h
@@ -226,4 +226,6 @@
 
 void gprs_ns_set_log_ss(int ss);
 
+char *gprs_nsvc_state_append(char *s, struct gprs_nsvc *nsvc);
+
 /*! @} */
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 47d170d..75c3141 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1705,4 +1705,26 @@
 	DNS = ss;
 }
 
+/*! Append the nsvc state to a talloc string
+ * \param s The string to append to (allocated with talloc)
+ * \param[in] nsvc The NS-VC to print the state of
+ * \returns The new string with state information appended to it
+ *
+ * This function will append a comma-separated state of the NS-VC to the
+ * string. The string needs to be allocated with talloc (e.g. talloc_strdup)
+ */
+char *gprs_nsvc_state_append(char *s, struct gprs_nsvc *nsvc)
+{
+	s = talloc_asprintf_append(s,
+		"%u,%u,%s,%s,%s,%s,%s\n",
+		nsvc->nsei, nsvc->nsvci,
+		NS_DESC_A(nsvc->state),
+		NS_DESC_B(nsvc->state),
+		nsvc->remote_end_is_sgsn ? "SGSN" : "BSS",
+		NS_DESC_A(nsvc->remote_state),
+		NS_DESC_B(nsvc->remote_state));
+
+	return s;
+}
+
 /*! @} */
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 83a3621..d56e651 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -70,6 +70,7 @@
 gprs_nsvc_reset;
 gprs_nsvc_by_nsvci;
 gprs_nsvc_by_nsei;
+gprs_nsvc_state_append;
 
 gprs_log_filter_fn;
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f0eaff7329ab98cad792d30b20ab053007aab85
Gerrit-Change-Number: 9631
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180614/82fd79c7/attachment.htm>


More information about the gerrit-log mailing list