/* Function for reading a pointer to the value field of a TLV block from the p_raw_data buffer. 
This function reads a pointer to the value field of a TLV block and inserts it into a structure pointed by the p_tlv_buf pointer. If there is no value field present in the TLV block, NULL is inserted. */
static ret_code_t type_2_tag_value_ptr_extract(type_2_tag_t *p_type_2_tag, uint8_t *p_raw_data, uint16_t *p_v_offset, tlv_block_t *p_tlv_buf)
/* Function for reading a pointer to the value field of a TLV block from the p_raw_data buffer. 
This function reads a pointer to the value field of a TLV block and inserts it into a structure pointed by the p_tlv_buf pointer. If there is no value field present in the TLV block, NULL is inserted. */
static ret_code_t type_2_tag_value_ptr_extract(type_2_tag_t *p_type_2_tag, uint8_t *p_raw_data, uint16_t *p_v_offset, tlv_block_t *p_tlv_buf)
{
    if (p_tlv_buf->length == 0)
    {
        p_tlv_buf->p_value = NULL;
    }
    else
    {
        if (!type_2_tag_is_field_within_data_range(p_type_2_tag, *p_v_offset, p_tlv_buf->length))
        {
            return NRF_ERROR_INVALID_DATA;
        }
        p_tlv_buf->p_value = p_raw_data + *p_v_offset;
        *p_v_offset += p_tlv_buf->length;
    }
    return NRF_SUCCESS;
}