tlv struct decode and encode