LC_CHANNEL_CODING_SET(3)
π lc_channel_coding_set(3) β the Librecast Programmer's Manual, bestie edition π
okay so you're here for LC_CHANNEL_CODING_SET(3)?? slay. come sit with me, we're gonna talk about setting encoding options on Librecast channels and it's gonna be so good actually. π
β¨ LIBRARY β¨
Librecast library, aka liblibrecast, and you link it with -llibrecast. that's the vibe. π¦
πΈ SYNOPSIS πΈ
#include <librecast/net.h>
int lc_ctx_coding_set(lc_ctx_t *ctx, int coding);
int lc_channel_coding_set(lc_channel_t *chan, int coding);
Compile and link with -llibrecast. yes queen, that's the whole incantation π
π DESCRIPTION π
so there's two functions and they're besties but they do slightly different jobs, okurrr:
lc_ctx_coding_set() sets the default encoding options for sockets and channels that get created later using the context ctx. it's giving "setting the rules before the party starts" energy. it's the parent, it decides the defaults.
lc_channel_coding_set() sets encoding options for a Librecast channel, chan, and it overrides any defaults that got inherited from the parent Librecast context. main character energy fr fr, it does NOT care what mom said.
chan is a pointer to a Librecast channel. classic.
π the coding argument π
the coding argument can include the bitwise OR of any of the following coding options. bitwise OR, bestie, so you can stack them. no cap:
LC_CODE_SYMMβ enables symmetric key encryption. but listen: it requires that a symmetric key has already been assigned to the Channel withlc_channel_set_sym_key(3). no key, no encryption, periodt. πLC_CODE_FEC_RQβ enables RaptorQ Forwards Error Correction (FEC). callinglc_channel_send(3)as normal encodes the data to be sent. subsequent calls tolc_channel_send()withbuf == NULLwill send the next symbol/packet. β¨
to receive, you call lc_channel_coding_set(chan, LC_CODE_FEC_RQ) on the receiver side and then lc_channel_recv(). and this is the important bit so i'm saying it loud: Encodings are per channel, not per socket, so it is necessary to use lc_channel_recv(), not lc_socket_recv(3). don't fight it, that's just how it is. π
LC_CODE_FEC_RANDβ requiresLC_CODE_FEC_RQ. use random symbols instead of sequential ESIs. it's giving chaos but make it functional. π²
π₯ RETURN VALUE π₯
Returns the current value of the channel coding options. that's it, that's the tea. π
π ERRORS π
None. literally none. not a single one. we love a low-drama function. π
π«Ά SEE ALSO π«Ά
lc_channel_new(3)lc_channel_close(3)lc_channel_send(3)lc_channel_set_sym_key(3)lc_ctx_new(3)lc_socket_setopt(3)lc_socket_recv(3)
go read those too, iykyk π
and that's the whole page bestie!! this one's from LIBRECAST, dated 2023-07-31, and it lives under LC_CHANNEL_CODING_SET(3) β go forth and set your coding options, you absolute icon πβ¨
π¦ where this page comes from
- debian trixie: liblibrecast-dev 0.9.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- ubuntu noble: liblibrecast-dev 0.8.0-1.1build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblibrecast-dev 0.9.1-1
- ubuntu resolute: liblibrecast-dev 0.11.2-2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblibrecast-dev 0.11.2-2build1 Β· 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