Change in libosmocore[master]: ns2: add value strings for ns2_affecting_cause_prim_str & ns2_prim_str

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
Tue Oct 27 00:26:33 UTC 2020


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


Change subject: ns2: add value strings for ns2_affecting_cause_prim_str & ns2_prim_str
......................................................................

ns2: add value strings for ns2_affecting_cause_prim_str & ns2_prim_str

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



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/20926/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index fddc896..4e26278 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -36,6 +36,8 @@
 	PRIM_NS_STATUS,
 };
 
+const char *gprs_ns2_prim_str(unsigned int cause);
+
 /*! Osmocom NS primitives according to 48.016 5.2.2.4 Service primitves */
 enum gprs_ns2_congestion_cause {
 	NS_CONG_CAUSE_BACKWARD_BEGIN,
@@ -55,6 +57,8 @@
 	NS_AFF_CAUSE_SNS_FAILURE,
 };
 
+const char *gprs_ns2_aff_cause_prim_str(unsigned int cause);
+
 /*! Osmocom NS primitives according to 48.016 5.2.2.7 Service primitves */
 enum gprs_ns2_change_ip_endpoint {
 	NS_ENDPOINT_NO_CHANGE,
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index f65bea7..930c2da 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -203,6 +203,35 @@
 	.class_id = OSMO_STATS_CLASS_PEER,
 };
 
+static const struct value_string ns2_affecting_cause_prim_str[] = {
+	{ NS_AFF_CAUSE_VC_FAILURE,	"Virtual-Circuit failure" },
+	{ NS_AFF_CAUSE_VC_RECOVERY,	"Virtual-Circuit recovery" },
+	{ NS_AFF_CAUSE_FAILURE,		"NSE failure" },
+	{ NS_AFF_CAUSE_RECOVERY,	"NSE recovery" },
+	{ NS_AFF_CAUSE_SNS_CONFIGURED,	"NSE SNS configured" },
+	{ NS_AFF_CAUSE_SNS_FAILURE,	"NSE SNS failure" },
+};
+
+/*! Obtain a human-readable string for NS affective cause in primitives */
+const char *gprs_ns2_aff_cause_prim_str(unsigned int cause)
+{
+	enum ns_cause _cause = cause;
+	return get_value_string(ns2_affecting_cause_prim_str, _cause);
+}
+
+static const struct value_string ns2_prim_str[] = {
+	{ PRIM_NS_UNIT_DATA,	"UNIT DATA" },
+	{ PRIM_NS_CONGESTION,	"CONGESTION" },
+	{ PRIM_NS_STATUS,	"STATUS" },
+};
+
+/*! Obtain a human-readable string for NS primitives */
+const char *gprs_ns2_prim_str(unsigned int cause)
+{
+	enum ns_cause _cause = cause;
+	return get_value_string(ns2_prim_str, _cause);
+}
+
 /*! string-format a given NS-VC into a user-supplied buffer.
  *  \param[in] buf user-allocated output buffer
  *  \param[in] buf_len size of user-allocated output buffer in bytes
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index c9ba012..55b9a3a 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -72,6 +72,7 @@
 gprs_ns_ll_clear;
 gprs_ns_msgb_alloc;
 
+gprs_ns2_aff_cause_prim_str;
 gprs_ns2_bind_set_mode;
 gprs_ns2_cause_str;
 gprs_ns2_create_nse;
@@ -107,6 +108,7 @@
 gprs_ns2_nse_sns_remote;
 gprs_ns2_nsvc_by_nsvci;
 gprs_ns2_nsvc_by_sockaddr;
+gprs_ns2_prim_str;
 gprs_ns2_recv_prim;
 gprs_ns2_reset_persistent_nsvcs;
 gprs_ns2_start_alive_all_nsvcs;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibf610fbd929dddc4a4e235152447caff522d4eb2
Gerrit-Change-Number: 20926
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/20201027/1899b62a/attachment.htm>


More information about the gerrit-log mailing list