[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 18:56:26 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1519

to look at the new patch set (#2).

Add OML Failure Event Report support

Add 3GPP TS 12.21 § 8.8.2 Failure Event Report function which pack given
vararg string and parameters 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, 46 insertions(+), 0 deletions(-)


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

diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h
index 6a37392..deca2df 100644
--- a/include/osmocom/gsm/protocol/gsm_12_21.h
+++ b/include/osmocom/gsm/protocol/gsm_12_21.h
@@ -45,6 +45,9 @@
 	uint8_t	data[0];
 } __attribute__ ((packed));
 
+#define ABIS_NM_MSG_SIZE	1024
+#define ABIS_NM_MSG_HEADROOM	128
+
 /*! \brief Message Discriminator for Formatted Object Messages */
 #define ABIS_OM_MDISC_FOM		0x80
 /*! \brief Message Discriminator for Man Machine Interface */
@@ -781,4 +784,8 @@
 	IPAC_BINF_CELL_ALLOC		= (1 << 2),
 };
 
+struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t,
+				  enum abis_nm_severity s,
+				  enum abis_nm_pcause_type ct,
+				  uint16_t cause_value, const char *fmt, ...);
 /*! @} */
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index 87d05ab..7da3bc2 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -517,6 +517,44 @@
 	/* FIXME: bounds check */
 };
 
+/*! \brief Pack 3GPP TS 12.21 § 8.8.2 Failure Event Report into msgb */
+struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t,
+				  enum abis_nm_severity s,
+				  enum abis_nm_pcause_type ct,
+				  uint16_t cause_value, const char *fmt, ...)
+{
+	uint8_t cause[3];
+	int len;
+	va_list ap;
+	char add_text[ABIS_NM_MSG_HEADROOM];
+	struct msgb *nmsg = msgb_alloc_headroom(ABIS_NM_MSG_SIZE,
+						ABIS_NM_MSG_HEADROOM,
+						"OML FAIL EV. REP.");
+	if (!nmsg)
+		return NULL;
+
+	msgb_tv_put(nmsg, NM_ATT_EVENT_TYPE, t);
+	msgb_tv_put(nmsg, NM_ATT_SEVERITY, s);
+
+	cause[0] = ct;
+	osmo_store16be(cause_value, cause + 1);
+
+	msgb_tv_fixed_put(nmsg, NM_ATT_PROB_CAUSE, 3, cause);
+
+	va_start(ap, fmt);
+	len = vsnprintf(add_text, ABIS_NM_MSG_HEADROOM, fmt, ap);
+	va_end(ap);
+
+	if (len < 0) {
+		msgb_free(nmsg);
+		return NULL;
+	}
+
+	msgb_tl16v_put(nmsg, NM_ATT_ADD_TEXT, len, 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 c876d2b..0c37d1c 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_rep;
 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: newpatchset
Gerrit-Change-Id: I58c198d8ea588432c62520928b08f0b2a7035e93
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list