TLV parser in c