[PATCH] libosmocore[master]: Add abis_nm_fail_evt_vrep() function

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
Wed Jan 11 17:14:24 UTC 2017


Hello Neels Hofmeyr, Jenkins Builder,

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

    https://gerrit.osmocom.org/1569

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

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
---
M include/osmocom/gsm/protocol/gsm_12_21.h
M src/gsm/abis_nm.c
2 files changed, 22 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/69/1569/2

diff --git a/include/osmocom/gsm/protocol/gsm_12_21.h b/include/osmocom/gsm/protocol/gsm_12_21.h
index 1a95311..5daab42 100644
--- a/include/osmocom/gsm/protocol/gsm_12_21.h
+++ b/include/osmocom/gsm/protocol/gsm_12_21.h
@@ -790,4 +790,9 @@
 				  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 f50a54f..73e3c7e 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -530,9 +530,25 @@
 				  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 @@
 
 	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;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib293dec1c2de9b664584a8456c782ea7b6dd8555
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list