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 14:48:53 UTC 2020


lynxis lazus has submitted this change. ( 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, 31 insertions(+), 0 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index fddc896..975ddcb 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -36,6 +36,12 @@
 	PRIM_NS_STATUS,
 };
 
+extern const struct value_string ns2_prim_strs[];
+
+/*! Obtain a human-readable string for NS primitives */
+static inline const char *gprs_ns2_prim_str(enum gprs_ns2_prim val)
+{ return get_value_string(ns2_prim_strs, val); }
+
 /*! 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 +61,12 @@
 	NS_AFF_CAUSE_SNS_FAILURE,
 };
 
+extern const struct value_string gprs_ns2_aff_cause_prim_strs[];
+
+/*! Obtain a human-readable string for NS affective cause in primitives */
+static inline const char *gprs_ns2_aff_cause_prim_str(enum gprs_ns2_affecting_cause val)
+{ return get_value_string(gprs_ns2_aff_cause_prim_strs, val); }
+
 /*! 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..6401d77 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -203,6 +203,23 @@
 	.class_id = OSMO_STATS_CLASS_PEER,
 };
 
+const struct value_string gprs_ns2_aff_cause_prim_strs[] = {
+	{ NS_AFF_CAUSE_VC_FAILURE,	"NSVC failure" },
+	{ NS_AFF_CAUSE_VC_RECOVERY,	"NSVC 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" },
+	{ 0, NULL }
+};
+
+const struct value_string ns2_prim_str[] = {
+	{ PRIM_NS_UNIT_DATA,	"UNIT DATA" },
+	{ PRIM_NS_CONGESTION,	"CONGESTION" },
+	{ PRIM_NS_STATUS,	"STATUS" },
+	{ 0, NULL }
+};
+
 /*! 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..9c8e685 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_strs;
 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_strs;
 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: 3
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201027/d735bbe8/attachment.htm>


More information about the gerrit-log mailing list