summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-01-02 14:43:35 +0100
committerMax <msuraev@sysmocom.de>2017-01-06 18:05:49 +0100
commitecbcdf52ec7c165c7933346441c02030833aba78 (patch)
treee8939107701f6f5e490901a0ea6cd6a818e5b74b /src
parent07352fee098758431ae1434c47c054d94887a6d4 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/gsm/abis_nm.c38
-rw-r--r--src/gsm/libosmogsm.map1
2 files changed, 39 insertions, 0 deletions
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index 87d05ab0..2de49411 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -517,6 +517,44 @@ static const enum abis_nm_chan_comb chcomb4pchan[] = {
/* 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;
+ }
+ if (len)
+ 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 c876d2b4..0c37d1cf 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -4,6 +4,7 @@ global:
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;