RQ_INIT(3)

πŸ’– NAME πŸ’–

rq_init, rq_free β€” bestie, these are the ones that make a RaptorQ context and then let it go πŸ’…


✨ SYNOPSIS ✨

#include <lcrq.h>

rq_t *rq_init(const uint64_t F, const uint16_t T);
void rq_free(rq_t *rq);

Compile and link with -llcrq, okurrr? 🫢


🌸 DESCRIPTION 🌸

rq_init() spins up a brand new RaptorQ context and gets the whole environment set up. Like, it's giving main character energy for your encode session. πŸ‘‘

Here's what you're handing it:

  • F β€” the size of the object you wanna encode. This has to be a positive integer, and it maxes out at 946270874880. No cap, that's the ceiling. 🚫
  • T β€” the symbol size. Usually this is literally just the size of the packet payload you're planning to send. And listen: this one must be a multiple of the Alignment parameter, which is 4. Periodt. Don't argue with me on this one. πŸ’…

When you're done-done? Call rq_free(3) β€” she deserves her rest. 😌

rq_free() invalidates and frees a RaptorQ context that you made with rq_init(3). Gone. Poof. πŸ¦‹


πŸŽ€ RETURN VALUE πŸŽ€

rq_init() hands you back a pointer to an rq_t handle. Iconic. ✨ But if things go sideways it returns NULL and sets errno to ENOMEM. πŸ’€

The rq_free() function returns... nothing. No value. It's a void girly. She simply exits. πŸ™ˆ


πŸ”₯ ERRORS πŸ”₯

rq_init() can fail with the following error:

  • ENOMEM β€” Out of memory 😭. Possibly, the application hit the RLIMIT_AS or RLIMIT_DATA limit described in getrlimit(2). Like, it ran out of room bestie, it's not that deep.

🧚 EXAMPLE 🧚

πŸ’œ Program source

rq_t *rq;
rq = rq_init(filesize, 1024);

/* your program here */

rq_free(rq); /* free context when done */

See that? Init, do your lil thing, free. Clean. Tidy. Ate. πŸ“


🌈 SEE ALSO 🌈

rq_encode(3), rq_decode(3), rq_symbol(3), lcrq(7)


okay that's the whole page, you're literally a RaptorQ girlie now πŸ’–βœ¨

this was brought to you by the Librecast Programmer's Manual, LCRQ edition, dated 2022-07-07 β€” mwah, slay, bye πŸŽ€

πŸ“¦ where this page comes from