Provided by: liblcrq0.0_0.1.2-1_amd64 bug

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);

       Compile and link with -llcrq.

DESCRIPTION

       Bitshifting macros for getting and setting the SBN and ESI bits of rq_pid_t.

       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  (Source Block Number) is an 8 bit unsigned integer. The Encoding Symbol ID (ESI) is a
       24 bit unsigned integer in network byte order.

RETURN VALUE

       rq_pid2sbn()  and  rq_pid2esi()  return  the  uint8_t  SBN  and   uint32_t   ESI   numbers
       respectively.  rq_pidsetsbn() and rq_pidsetesi() both return rq_pid_t with the appropriate
       bits set.

ERRORS

       These macros do not return errors.

EXAMPLE

   Program source

       #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;
       }

SEE ALSO

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