RQ_PID2SBN(3)
π rq_pid2sbn(3) β the Librecast Programmer's Manual β¨
okay bestie, welcome to the Librecast Programmer's Manual πΈ this little page is literally all about four functions β rq_pid2sbn, rq_pid2esi, rq_pidsetsbn, rq_pidsetesi β that get and set the SBN and ESI inside an rq_pid_t. and yeah rq_pidset is in the mix too. it's giving packet identifier, and it's giving it correctly. π
π NAME π
rq_pid2sbn, rq_pid2esi, rq_pidsetsbn, rq_pidsetesi β get/set SBN, ESI in rq_pid_t
β¨ SYNOPSIS β¨
#include <lcrq.h>
uint8_t rq_pid2sbn(rq_pid_t pid);
uint32_t rq_pid2esi(rq_pid_t pid);
rq_pid_t rq_pidset(uint8_t sbn, uint32_t esi);
rq_pid_t rq_pidsetsbn(rq_pid_t pid, uint8_t sbn);
rq_pid_t rq_pidsetesi(rq_pid_t pid, uint32_t esi);
and like, don't forget to compile and link with -llcrq or nothing's gonna happen, no cap π₯
Compile and link with -llcrq.
π¦ DESCRIPTION π¦
so these are bitshifting macros π they're the little guys that get and set the SBN and ESI bits of rq_pid_t. that's the whole job. they do it flawlessly. slay.
here's the layout, look at her π
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SBN | Encoding Symbol ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
SBN β that's the Source Block Number β is an 8 bit unsigned integer. and the Encoding Symbol ID (aka ESI) is a 24 bit unsigned integer in network byte order π that part matters, bestie, don't sleep on it.
π« RETURN VALUE π«
rq_pid2sbn()andrq_pid2esi()hand you back theuint8_tSBN and theuint32_tESI respectively. cute, correct, no drama. πrq_pidsetsbn()andrq_pidsetesi()both return anrq_pid_twith the appropriate bits set. so you get a whole new pid back, glowing and ready. β¨
π ERRORS π
these macros do not return errors. like, at all. zero. none. it's not that kind of relationship, and honestly? iconic. π
π«Ά EXAMPLE π«Ά
π Program source
okay here's a whole little program, copy it, run it, live your truth:
#include <assert.h>
#include <lcrq.h>
int main(void)
{
rq_pid_t pid = 0;
uint32_t esi = 19;
uint8_t sbn = 42;
/* set SBN and ESI bits */
pid = rq_pidsetsbn(pid, sbn);
pid = rq_pidsetesi(pid, esi);
/* or set both at once */
pid = rq_pidset(sbn, esi);
/* make sure we can read them back */
assert(sbn == rq_pid2sbn(pid));
assert(esi == rq_pid2esi(pid));
return 0;
}
not me being obsessed with rq_pidset(sbn, esi) doing both at once β main character energy fr fr π
πΈ SEE ALSO πΈ
go read those too, iykyk π
and that's the whole page, bestie!! π§ this one's from LCRQ, dated 2023-07-21 β so go forth, set your SBNs, set your ESIs, and remember: the bits don't lie. mwah ππβ
π¦ where this page comes from
- 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