RQ_K(3)
β¨ NAME β¨
rq_query β the RaptorQ Query Functions, straight out of the Librecast Programmer's Manual π
π SYNOPSIS π
#include <lcrq.h>
uint8_t rq_Al(const rq_t * const rq);
uint64_t rq_F(const rq_t * const rq);
uint16_t rq_K(const rq_t * const rq);
uint16_t rq_KP(const rq_t * const rq);
uint16_t rq_T(const rq_t * const rq);
uint16_t rq_N(const rq_t * const rq);
uint8_t rq_Z(const rq_t * const rq);
Compile and link with -llcrq. that's the whole vibe check right there π«Ά
π DESCRIPTION π
okay so bestie, these functions are literally just getters β¨ β each RaptorQ query function hands you back the value of its own RaptorQ parameter. no side quests, no surprises, just vibes.
here's the cast of characters π:
- F β Transfer Length (
F): a 40-bit unsigned integer. it's a non-negative integer that is at most946270874880. this is the transfer length of the object, measured in units of octets. - T β Symbol Size (
T): a 16-bit unsigned integer. it's a positive integer that is less than2^^16. this is the size of a symbol, in units of octets. it MUST be a multiple ofAlβ like, non-negotiable, bestie π¨ - Al β A symbol alignment parameter (
Al): an 8-bit unsigned integer. - Z β The number of source blocks (
Z): a 16-bit unsigned integer. - K β The number of source symbols.
- KP β (
K') The number of source and padding symbols.
the parameterrqhas to be a pointer to a RaptorQ context that was initialized withrq_init(3)β no uninitialized chaos allowed π
π RETURN VALUE π
these functions return the RQ parameters as unsigned integers. that's it, that's the tea β
π ERRORS π
these functions do not return errors. not one. they simply cannot fail, and honestly? iconic.
π¦ EXAMPLE π¦
πΈ Program source πΈ
/* params - example program to create RaptorQ context and print derived parameters */
#include <lcrq.h>
#include <stdio.h>
#include <stdlib.h>
int usage(const char *progname)
{
fprintf(stderr, "usage: `%s F T` (F = object size, T = symbol size)0, progname);
}
int main(int argc, char *argv[])
{
rq_t *rq;
uint64_t F;
uint16_t T, K, KP, N, Z;
uint8_t Al;
if (argc != 3) return usage(argv[0]);
F = atoll(argv[1]);
T = atoll(argv[2]);
/* initialize RaptorQ context */
rq = rq_init(F, T);
/* Query parameters */
K = rq_K(rq);
KP = rq_KP(rq);
N = rq_N(rq);
Z = rq_Z(rq);
/* free RaptorQ context */
rq_free(rq);
printf("F %12lusize of object to encode (40 bits)0, F);
printf("T %12usymbol (payload) size0, T);
printf("K %12unumber of original symbols0, K);
printf("K' %12unumber of symbols, including padding symbols0, KP);
printf("N %12unumber of sub-blocks0, N);
printf("Z %12unumber of blocks0, Z);
return 0;
}
and then, one last time, because cleaning up after yourself is main character energy β¨:
rq_free(rq); /* free context when done */
so the flow is: make the context with rq_init, peek at the parameters with the query functions, print them all pretty, then rq_free it before you dip. N shows up in that printout as the number of sub-blocks, just so you know what you're looking at π
β SEE ALSO β
rq_init(3), rq_free(3), rq_decode(3), rq_encode(3), rq_symbol(3), lcrq(7)
and that's the page, bestie π this one came out of the <b>LCRQ</b> corner of the Librecast Programmer's Manual, dated <b>2022-07-07</b> β go forth and query your parameters, you absolute legend πβ¨
π¦ 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