diff options
author | Max <msuraev@sysmocom.de> | 2017-01-11 18:12:32 +0100 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2017-01-11 18:12:32 +0100 |
commit | 1251afe2542417426ffe9a4aace2603f06eb15bd (patch) | |
tree | 9e3f56a1bf799a76fd3d832a0c2060ba26e1d300 /src | |
parent | b632e03f6588636d3ea4f642154754f0aca33988 (diff) |
Add abis_nm_fail_evt_vrep() function
It accept fixed number of arguments including va_list instead of variable
number of arguments in abis_nm_fail_evt_rep() - similar to vprintff() vs
printf().
Related: OS#1615
Change-Id: Ib293dec1c2de9b664584a8456c782ea7b6dd8555
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/abis_nm.c | 21 |
1 files changed, 17 insertions, 4 deletions
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; |