aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/protocol/gsm_12_21.h5
-rw-r--r--src/gsm/abis_nm.c21
2 files changed, 22 insertions, 4 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h
index 1a953119..5daab42b 100644
--- a/include/osmocom/gsm/protocol/gsm_12_21.h
+++ b/include/osmocom/gsm/protocol/gsm_12_21.h
@@ -790,4 +790,9 @@ 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, ...);
+struct msgb *abis_nm_fail_evt_vrep(enum abis_nm_event_type t,
+ enum abis_nm_severity s,
+ enum abis_nm_pcause_type ct,
+ uint16_t cause_value, const char *fmt,
+ va_list ap);
/*! @} */
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index f50a54fa..73e3c7e5 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -530,9 +530,25 @@ struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t,
enum abis_nm_pcause_type ct,
uint16_t cause_value, const char *fmt, ...)
{
+ va_list ap;
+ struct msgb *nmsg;
+
+ va_start(ap, fmt);
+ nmsg = abis_nm_fail_evt_vrep(t, s, ct, cause_value, fmt, ap);
+ va_end(ap);
+
+ return nmsg;
+}
+
+/*! \brief Pack 3GPP TS 12.21 ยง 8.8.2 Failure Event Report into msgb */
+struct msgb *abis_nm_fail_evt_vrep(enum abis_nm_event_type t,
+ enum abis_nm_severity s,
+ enum abis_nm_pcause_type ct,
+ uint16_t cause_value, const char *fmt,
+ va_list ap)
+{
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,
@@ -548,10 +564,7 @@ struct msgb *abis_nm_fail_evt_rep(enum abis_nm_event_type t,
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;