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

# rq\_query(3)

RaptorQ Query Functions

## NAME

rq\_query - RaptorQ Query Functions

## 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*.

## DESCRIPTION

The RaptorQ query functions return the value of their respective RaptorQ parameters.

**F** Transfer Length (F): 40-bit unsigned integer.  A non-negative integer that is at most 946270874880.  This is the transfer length of the object in units of octets.

**T** Symbol Size (T): 16-bit unsigned integer.  A positive integer that is less than 2^^16.  This is the size of a symbol in units of octets. This MUST be a multiple of Al.

**Al** A symbol alignment parameter (Al): 8-bit unsigned integer.

**Z** The number of source blocks (Z): 16-bit unsigned integer.

**K** The number of source symbols.

**KP (K')** The number of source and padding symbols.

The parameter *rq* must be a pointer to RaptorQ context initialized with *[rq\_init(3)](/rq_init/3.md)*

## RETURN VALUE

These functions return the RQ parameters as unsigned integers.

## ERRORS

These functions do not return errors.

## 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  %12lu size of object to encode (40 bits)0, F);
        printf("T  %12u symbol (payload) size0, T);
        printf("K  %12u number of original symbols0, K);
        printf("K' %12u number of symbols, including padding symbols0, KP);
        printf("N  %12u number of sub-blocks0, N);
        printf("Z  %12u number of blocks0, Z);
        return 0;
}
rq_free(rq); /* free context when done */
```

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