---
name: "rq_pidset"
section: "3"
platform: "linux"
package: "liblcrq0.0"
version: "0.2.3-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rq_pid2sbn"
---

# rq\_pidset(3)

get/set SBN,ESI in rq\_pid\_t

Part of [rq\_pid2sbn(3)](/rq_pid2sbn/3.md).

## 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_init/3.md), [**rq\_free**(3)](/rq_free/3.md), [**rq\_decode**(3)](/rq_decode/3.md), [**rq\_encode**(3)](/rq_encode/3.md), [**rq\_symbol**(3)](/rq_symbol/3.md), [**lcrq**(7)](/lcrq/7.md)
