<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9421">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">tlv: Add TLVP_VAL_MINLEN() to obtain value _if_ length is >= minimum<br><br>This is a combination of TLVP_VAP() and TLVP_GET_MINLEN()<br><br>Change-Id: Ic5a177941219ebc3a3bceb3f68bdb3b2cacb934b<br>---<br>M include/osmocom/gsm/tlv.h<br>1 file changed, 10 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/21/9421/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/tlv.h b/include/osmocom/gsm/tlv.h</span><br><span>index a130dc8..84fd511 100644</span><br><span>--- a/include/osmocom/gsm/tlv.h</span><br><span>+++ b/include/osmocom/gsm/tlv.h</span><br><span>@@ -467,6 +467,16 @@</span><br><span> #define TLVP_GET_MINLEN(_tp, tag, min_len) \</span><br><span>         (TLVP_PRES_LEN(_tp, tag, min_len)? &(_tp)->lv[tag] : NULL)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! Like TLVP_VAL(), but enforcing a minimum val length.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] _tp  pointer to \ref tlv_parsed.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] tag  IE tag to return.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] min_len  Minimum value length in bytes.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \returns struct tlv_p_entry pointer, or NULL if not present or too short.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#define TLVP_VAL_MINLEN(_tp, tag, min_len) \</span><br><span style="color: hsl(120, 100%, 40%);">+ (TLVP_PRES_LEN(_tp, tag, min_len)? (_tp)->lv[tag].val : NULL)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! Align given TLV element with 16 bit value to an even address</span><br><span>  *  \param[in] tp pointer to \ref tlv_parsed</span><br><span>  *  \param[in] pos element to return</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9421">change 9421</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9421"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic5a177941219ebc3a3bceb3f68bdb3b2cacb934b </div>
<div style="display:none"> Gerrit-Change-Number: 9421 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>