TLV(3)
π TLV(3) β Library Functions Manual π
okay bestie, sit down, we're learning about TLV manipulation and it's genuinely not that deep, i promise π«Ά
β¨ NAME β¨
tlv_encode, tlv_decode β TLV Manipulation Functions
π LIBRARY π
Mifare card manipulation library (libfreefare, -lfreefare)
πΈ SYNOPSIS πΈ
#include <freefare.h>
uint8_t *
tlv_encode(const uint8_t type, const uint8_t *istream, uint16_t isize,
size_t *osize);
uint8_t *
tlv_decode(const uint8_t *istream, uint8_t *type, uint16_t *size);
π DESCRIPTION π
so tlv_encode() and tlv_decode() are your little helper besties for messing with TLV (Text-Length-Value) data. no cap, that's literally it. they're the duo. the dynamic duo. π€
The tlv_encode() function takes your istream message β which is isize bytes long, okay, remember that β and converts it into a TLV stream of type type, and then sets the value of osize to the length of the returned stream. she's giving glow-up transformation β¨
The tlv_decode() function does the opposite vibe entirely: it takes the istream TLV stream, sets the type argument according to the type of the stream, and sets the size argument to the length of the returned stream. reverse uno card, iconic behaviour, we love to see it π₯
π RETURN VALUES π
both functions return memory allocated usingmalloc(3), and bestie, you GOTTA reclaim that memory withfree(3)after usage. this is not optional, this is not a suggestion, this is the law π
π SEE ALSO π
freefare(3), malloc(3), free(3)
π¦ AUTHORS π¦
- Romain Tartiere
<romain@blogreen.org> - Romuald Conty
<romuald@libnfc.org>
π SIGN-OFF π
that's the whole page, babes! this one's from Debian, dated March 30, 2010 β yes she's an elder but she still ate π go free your malloc'd memory and hydrate, mwah ππ§
π¦ where this page comes from
- debian bookworm: libfreefare-doc 0.4.0-2.1 Β· LGPL-3.0-or-later
- debian trixie: libfreefare-doc 0.4.0-2.3 Β· LGPL-3.0-or-later
- nixos 26.05: libfreefare 0.4.0
- nixpkgs unstable: libfreefare 0.4.0
- ubuntu jammy: libfreefare-doc 0.4.0-2.1build1 Β· LGPL-3.0-or-later
- ubuntu noble: libfreefare-doc 0.4.0-2.3build2 Β· LGPL-3.0-or-later
- ubuntu questing: libfreefare-doc 0.4.0-2.3build2
- ubuntu resolute: libfreefare-doc 0.4.0-2.3build3 Β· LGPL-3.0-or-later
- ubuntu stonking: libfreefare-doc 0.4.0-2.4build1 Β· LGPL-3.0-or-later
- Copyright (C) 2010 Romain Tartiere
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms