---
name: "lc_ctx_coding_set"
section: "3"
platform: "linux"
package: "liblibrecast-dev"
version: "0.9.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/lc_channel_coding_set"
---

# lc\_ctx\_coding\_set(3)

set Librecast channel encoding options

Part of [lc\_channel\_coding\_set(3)](/lc_channel_coding_set/3.md).

## NAME

lc\_ctx\_coding\_set, lc\_channel\_coding\_set - set Librecast channel encoding options

## LIBRARY

Librecast library (*liblibrecast*, *-llibrecast*)

## SYNOPSIS

```
#include <librecast/net.h>
```

**int lc\_ctx\_coding\_set(lc\_ctx\_t \****ctx***, int** *coding***);** **int lc\_channel\_coding\_set(lc\_channel\_t \****chan***, int** *coding***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

**lc\_ctx\_coding\_set**() sets the default encoding options for sockets and channels subsequently created using context *ctx*.

**lc\_channel\_coding\_set**() sets encoding options for a Librecast channel, *chan*, overriding any defaults inherited from the parent Librecast context.

*chan* is a pointer to a Librecast channel.

The *coding* argument can include the bitwise OR of any of the following coding options:

- **LC\_CODE\_SYMM**

  Enable symmetric key encryption. Requires that a symmetric key has been assigned to the Channel with *[lc\_channel\_set\_sym\_key(3)](/lc_channel_set_sym_key/3.md)*

- **LC\_CODE\_FEC\_RQ**

  Enables RaptorQ Forwards Error Correction (FEC). Calling *[lc\_channel\_send(3)](/lc_channel_send/3.md)* as normal encodes the data to be sent. Subsequent calls to *lc\_channel\_send()* with *buf* == NULL will send the next symbol/packet. To receive, call *lc\_channel\_coding\_set (chan, LC\_CODE\_FEC\_RQ)* on the receiver and then *lc\_channel\_recv().* Encodings are per channel, not per socket, so it is necessary to use *lc\_channel\_recv(),* not *lc\_socket\_recv(3).*

- **LC\_CODE\_FEC\_RAND**

  Requires **LC\_CODE\_FEC\_RQ.** Use random symbols instead of sequential ESIs.

## RETURN VALUE

Returns the current value of the channel coding options.

## ERRORS

None.

## SEE ALSO

**lc\_channel\_new**(3), **lc\_channel\_close**(3), [**lc\_channel\_send**(3)](/lc_channel_send/3.md), [**lc\_channel\_set\_sym\_key**(3)](/lc_channel_set_sym_key/3.md), [**lc\_ctx\_new**(3)](/lc_ctx_new/3.md), **lc\_socket\_setopt**(3), **lc\_socket\_recv**(3)
