RQ_ENCODE(3)

✨ RQ_ENCODE(3) ✨

okay bestie, gather round, it's giving Librecast Programmer's Manual energy and we're about to talk about rq_encode from lcrq πŸ’–


🌸 NAME 🌸

rq_encode β€” encode data with RaptorQ πŸ¦‹


πŸ’… SYNOPSIS πŸ’…

#include <lcrq.h>

int rq_encode(rq_t *rq, void *data, const size_t len);

Compile and link with -llcrq.


πŸŽ€ DESCRIPTION πŸŽ€

so like, this function is the prep step. it gets your data ready so that encoding symbols β€” original ones or repair ones β€” can actually be generated. no cap. ✨

calls to the API functions that generate symbols, like rq_symbol(3) and rq_symbol_random(3), have to be preceded by a call to rq_encode(). it's literally the prerequisite. the way that you cannot skip it. πŸ™ˆ

you call rq_encode with a pointer to a valid rq_t context, rq, plus a pointer to the data you want encoded, which is len bytes long.

the object that data points to gets used to generate RaptorQ intermediate symbols as per RFC6330 πŸ“œ. those intermediate symbols are referenced by the rq context, and they get free()d when rq_free(3) is called β€” along with the context itself. so yeah, the context is holding onto them for you the whole time, main character energy fr fr. πŸ‘‘


⭐ RETURN VALUE ⭐

  • on success, 0 is returned πŸ’š
  • if encoding fails, the function returns -1 πŸ’€

🫢 SEE ALSO 🫢

rq_init(3), rq_free(3), rq_decode(3), rq_symbol(3), lcrq(7)


and that's the whole page, bestie!! this one's from the LCRQ girlies, dated 2022-07-07 🌈 go forth and encode, you've got this πŸ’œπŸŽ€

πŸ“¦ where this page comes from