/* Function for reading the tag field of a TLV block from the p_raw_data buffer. 
This function reads the tag field containing a TLV block type and inserts its value into a structure pointed by the p_tlv_buf pointer. */
static ret_code_t type_2_tag_type_extract(type_2_tag_t *p_type_2_tag, uint8_t *p_raw_data, uint16_t *p_t_offset, tlv_block_t *p_tlv_buf)
/* Function for reading the tag field of a TLV block from the p_raw_data buffer. 
This function reads the tag field containing a TLV block type and inserts its value into a structure pointed by the p_tlv_buf pointer. */
static ret_code_t type_2_tag_type_extract(type_2_tag_t *p_type_2_tag, uint8_t *p_raw_data, uint16_t *p_t_offset, tlv_block_t *p_tlv_buf)
{
    if (!type_2_tag_is_field_within_data_range(p_type_2_tag, *p_t_offset, TLV_T_LENGTH))
    {
        return NRF_ERROR_INVALID_DATA;
    }
    p_tlv_buf->tag = p_raw_data[*p_t_offset];
    *p_t_offset   += TLV_T_LENGTH;
    return NRF_SUCCESS;
}