Change in libosmocore[master]: tlv: Add TLVP_VAL_MINLEN() to obtain value _if_ length is >= minimum

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Jun 2 14:41:32 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9421 )

Change subject: tlv: Add TLVP_VAL_MINLEN() to obtain value _if_ length is >= minimum
......................................................................

tlv: Add TLVP_VAL_MINLEN() to obtain value _if_ length is >= minimum

This is a combination of TLVP_VAP() and TLVP_GET_MINLEN()

Change-Id: Ic5a177941219ebc3a3bceb3f68bdb3b2cacb934b
---
M include/osmocom/gsm/tlv.h
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/gsm/tlv.h b/include/osmocom/gsm/tlv.h
index a130dc8..84fd511 100644
--- a/include/osmocom/gsm/tlv.h
+++ b/include/osmocom/gsm/tlv.h
@@ -467,6 +467,16 @@
 #define TLVP_GET_MINLEN(_tp, tag, min_len) \
 	(TLVP_PRES_LEN(_tp, tag, min_len)? &(_tp)->lv[tag] : NULL)
 
+/*! Like TLVP_VAL(), but enforcing a minimum val length.
+ * \param[in] _tp  pointer to \ref tlv_parsed.
+ * \param[in] tag  IE tag to return.
+ * \param[in] min_len  Minimum value length in bytes.
+ * \returns struct tlv_p_entry pointer, or NULL if not present or too short.
+ */
+#define TLVP_VAL_MINLEN(_tp, tag, min_len) \
+	(TLVP_PRES_LEN(_tp, tag, min_len)? (_tp)->lv[tag].val : NULL)
+
+
 /*! Align given TLV element with 16 bit value to an even address
  *  \param[in] tp pointer to \ref tlv_parsed
  *  \param[in] pos element to return

-- 
To view, visit https://gerrit.osmocom.org/9421
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5a177941219ebc3a3bceb3f68bdb3b2cacb934b
Gerrit-Change-Number: 9421
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180602/9bfa340b/attachment.htm>


More information about the gerrit-log mailing list