[PATCH] libosmocore[master]: Add OML Failure Event Report support

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

Max gerrit-no-reply at lists.osmocom.org
Mon Jan 2 13:45:22 UTC 2017


Review at  https://gerrit.osmocom.org/1519

Add OML Failure Event Report support

Add structure representing 3GPP TS 12.21 § 8.8.2 Failure Event Report
and function to pack it into msgb.

Change-Id: I58c198d8ea588432c62520928b08f0b2a7035e93
Related: OS#1615
---
M include/osmocom/gsm/protocol/gsm_12_21.h
M src/gsm/abis_nm.c
M src/gsm/libosmogsm.map
3 files changed, 34 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/19/1519/1

diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h
index ed53dc6..1d014c8 100644
--- a/include/osmocom/gsm/protocol/gsm_12_21.h
+++ b/include/osmocom/gsm/protocol/gsm_12_21.h
@@ -492,6 +492,15 @@
 };
 #define NM_ATT_BS11_FILE_DATA	NM_ATT_EVENT_TYPE
 
+/*! \brief OML Failure Event Report (Section 8.8.2) */
+struct abis_nm_fail_evt_rep {
+	uint8_t type; /* Event Type (Section 9.4.16) */
+	uint8_t severity; /* Perceived Severity (Section 9.4.63) */
+	uint8_t cause_type; /* Probable Cause (Section 9.4.43) type */
+	uint16_t cause_value; /* Probable Cause (Section 9.4.43) value */
+	char *add_text; /* Additional Text (Section 9.4.3) */
+};
+
 /*! \brief OML Administrative State (Section 9.4.4) */
 enum abis_nm_adm_state {
 	NM_STATE_LOCKED		= 0x01,
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index c085e06..015919a 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -502,6 +502,30 @@
 	/* FIXME: bounds check */
 };
 
+/*! \brief Pack 3GPP TS 12.21 § 8.8.2 Failure Event Report into msgb */
+struct msgb *abis_nm_fail_evt_rep2msgb(const struct abis_nm_fail_evt_rep fail)
+{
+	uint8_t cause[3];
+	size_t len;
+	struct msgb *nmsg = msgb_alloc_headroom(1024, 128, "OML FAIL EV REP");
+	if (!nmsg)
+		return NULL;
+
+	msgb_tv_put(nmsg, NM_ATT_EVENT_TYPE, fail.type);
+	msgb_tv_put(nmsg, NM_ATT_SEVERITY, fail.severity);
+
+	cause[0] = fail.cause_type;
+	osmo_store16be(fail.cause_value, cause + 1);
+
+	msgb_tv_fixed_put(nmsg, NM_ATT_PROB_CAUSE, 3, cause);
+
+	len = strlen(fail.add_text);
+	if (len)
+		msgb_tl16v_put(nmsg, NM_ATT_ADD_TEXT, len, fail.add_text);
+
+	return nmsg;
+}
+
 /*! \brief Obtain OML Channel Combination for phnsical channel config */
 int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan)
 {
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index b84f859..11e264c 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -4,6 +4,7 @@
 abis_nm_adm_state_names;
 abis_nm_att_settable;
 abis_nm_avail_name;
+abis_nm_fail_evt_rep2msgb;
 abis_nm_chcomb4pchan;
 abis_nm_debugp_foh;
 abis_nm_event_type_name;

-- 
To view, visit https://gerrit.osmocom.org/1519
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58c198d8ea588432c62520928b08f0b2a7035e93
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list