LCRQ(7)
π LCRQ β the glow-up edition π
okay bestie, welcome to the Librecast Programmer's Manual page for LCRQ, aka section 7, aka the vibes page. yes it's LCRQ(7) if you're being formal about it, but we're not. sit down, grab a strawberry π, and let's talk about making multicast not fall apart.
β¨ NAME β¨
LCRQ β a C library implementation of RFC6330 (RaptorQ) for Librecast. that's the whole name, that's the whole job, and honestly? iconic. π
π DESCRIPTION π
so here's the tea. IP Multicast is built on top of UDP, and UDP is inherently unreliable. no cap. packets may show up out of order, or likeβ¦ not show up at all. ghosted. π
meanwhile TCP gives unicast a whole reliable messaging layer stacked on top of that unreliable, connectionless medium. she's doing the work, she's carrying the team, she's got receipts.
but bestie, unicast is one-to-one only. and multicast could, in theory, use all of the same reliability options (ACKs etc.) as TCP β at the cost of not being scalable any more. and like, scalability is the entire point, so that's a no. π
fortunately there are other ways to achieve similar reliability:
- RFC3208 describes Pragmatic General Multicast (PGM) based on NAKs (negative acknowledgements). this too has scaling issues. sad! π
- Forwards Error Correction (FEC) offers us another approach. and this is our girl. this is the one.
here's why FEC gets to be the main character: thanks to parity checking in the network stack, we don't generally need to worry about errors within packets. every packet has a checksum, and if that doesn't match, the packet is dropped before it ever reaches us. our encryption provides further checking of data received. so we need only concern ourselves with erasures β ie. dropped packets. that's it. that's the whole enemy. π―
π¦ RaptorQ, explained while I do my nails π¦
RaptorQ is an implementation of a class of systematic erasure codes called fountain codes.
the data we want to send is split into blocks, and then pre-encoded into a set of intermediate symbols. from these intermediate symbols we can generate both our original source symbols, and also additional repair symbols. two for one, we love a multitasker. π
provided the recipient receives at least a minimum value K' of these symbols β and it can be any unique combination of source and repair β the intermediate symbols can be reconstituted, and the original data recovered. periodt. β¨
RaptorQ is what's called a systematic encoding, because the set of symbols we send includes our original data as plain text. provided all source symbols are received, the original data has been transmitted with no decoding overhead. it is only in the case where we need to supplement the source symbols with repair symbols that we must perform the decoding process. no wasted effort, no extra homework, she's efficient. π₯
π CONFORMING TO π
RFC6330 (IETF) describes the RaptorQ proposed standard, which LCRQ more-or-less follows.
real talk though: the primary focus has been on building a fast, simple and dependency-free FEC implementation for use with Librecast β and not on strict standards compliance. the code does, however, fairly closely follow the RFC. so like, she's not a rule-follower, she's a results girlie. π
π EXAMPLES π
there is example code in the examples/ directory of the source repository. go look, it's right there, it's giving tutorial energy. π«Ά
π BUGS π
if you find one, email bugs@librecast.net
(not me manifesting a bug-free codebase π but if you do catch one, tell us, we wanna know fr fr)
π SEE ALSO π
rq_init(3)rq_free(3)rq_query(3)rq_encode(3)rq_decode(3)rq_symbol(3)rq_pid2sbn(3)rq_pid2esi(3)rq_pidsetsbn(3)rq_pidsetesi(3)
and also, for the lore:
https://datatracker.ietf.org/doc/html/rfc6330
π cute sign-off: this page is brought to you by LCRQ, dated 2022-07-15, living in section 7 of the Librecast Programmer's Manual. go forth and multicast responsibly, bestie. bye!! πΈπ¦β¨
π¦ where this page comes from
- debian bookworm: liblcrq0.0 0.0.1-2 Β· GPL-2.0-only OR GPL-3.0-only
- debian trixie: liblcrq0.0 0.2.3-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: lcrq 0.3.1
- nixpkgs unstable: lcrq 0.4.1
- ubuntu noble: liblcrq0.0 0.1.2-1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblcrq0.0 0.2.3-1
- ubuntu resolute: liblcrq0.0 0.3.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblcrq0.0 0.3.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms