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

# mdex\_put(3)

insert an entry into a multicast index

## NAME

mdex\_put - insert an entry into a multicast index

## LIBRARY

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

## SYNOPSIS

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

**int mdex\_put(mdex\_t** *\*mdex***, unsigned char** *\*hash***, size\_t** *hashlen***, mdex\_entry\_t** *\*entry***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

The **mdex\_put** function stores the value of *entry* in the multicast index *mdex*, using *hash* (of length *hashlen*) as the key.

*entry* may be NULL, and an entry will still be created.

## RETURN VALUE

**mdex\_put**() returns zero on success. On error, -1 is returned, and *errno* is set to indicate the error.

## ERRORS

- **EINVAL**

  Invalid argument. Both *mdex* and *hash* are required (not NULL), and *hashlen* \> 0.

**ENOMEM** Not enough space/cannot allocate memory (POSIX.1-2001).

## SEE ALSO

[**mdex\_init**(3)](/mdex_init/3.md), [**mdex\_free**(3)](/mdex_free/3.md), [**mdex\_get**(3)](/mdex_get/3.md), [**mdex\_del**(3)](/mdex_del/3.md), [**lc\_share**(3)](/lc_share/3.md)
