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 with lc_channel_set_sym_key(3). no key, no encryption, periodt. πŸ”
  • LC_CODE_FEC_RQ β€” enables RaptorQ Forwards Error Correction (FEC). calling lc_channel_send(3) as normal encodes the data to be sent. subsequent calls to lc_channel_send() with buf == NULL will 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 β€” requires LC_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 🫢

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