/* Advance from the current 1-byte tag/1-byte length/variable-length value triple, to the next, returning a pointer to the next. If the current or next TLV is invalid (does not fit in given buffer length), NULL is returned. *buflen is not modified if the TLV elt parameter is invalid, or is decremented by the TLV parameter's length if it is valid.  */
bcm_tlv_t* bcm_next_tlv(bcm_tlv_t *elt, int *buflen)
/* Advance from the current 1-byte tag/1-byte length/variable-length value triple, to the next, returning a pointer to the next. If the current or next TLV is invalid (does not fit in given buffer length), NULL is returned. *buflen is not modified if the TLV elt parameter is invalid, or is decremented by the TLV parameter's length if it is valid.  */
bcm_tlv_t* bcm_next_tlv(bcm_tlv_t *elt, int *buflen)
{
	int len;
	if (!bcm_valid_tlv(elt, *buflen))
		return NULL;
	len = elt->len;
	elt = (bcm_tlv_t*)(elt->data + len);
	*buflen -= (TLV_HDR_LEN + len);
	if (!bcm_valid_tlv(elt, *buflen))
		return NULL;
	return elt;
}