---
name: "ngatmbase"
section: "4"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/ngatmbase"
---

# ngatmbase(4)

netgraph ATM utility module

## NAME

**ngatmbase** – netgraph ATM utility module

## SYNOPSIS

**#include \<netnatm/unimsg.h\>**

**#include \<netgraph/atm/ngatmbase.h\>**

*struct mbuf \**\

**uni\_msg\_pack\_mbuf**(*struct uni\_msg \*msg*, *void \*hdr*, *size\_t len*);

*struct uni\_msg \**\

**uni\_msg\_alloc**(*size\_t len*);

*struct uni\_msg \**\

**uni\_msg\_build**(*void \*buf*, *...*);

*void*\

**uni\_msg\_destroy**(*struct uni\_msg \*msg*);

*int*\

**uni\_msg\_unpack\_mbuf**(*struct mbuf \*m*, *struct uni\_msg \*msgp*);

## DESCRIPTION

This module provides utility functions for the handling of signalling messages to the NgATM modules.

The **uni\_msg\_pack\_mbuf**() function packs a message into one or several *mbuf*s optionally prepending a header. The header is given by its address *hdr* and length *len*. If *hdr* is NULL or *len* equals 0, no header is prepended. Either *msg* or *hdr* may be NULL but not both. The **uni\_msg\_pack\_mbuf**() function returns a pointer to the allocated *mbuf* chain or NULL in the case of an error.

The **uni\_msg\_alloc**() function allocates a new message with space for at least *len* bytes. In the case of an error NULL is returned.

The **uni\_msg\_build**() function constructs a message from pieces. Each piece is given by a pair of arguments, the first of type *void \** and the second a *size\_t*. The list of pieces must be terminated by (*void \**)NULL.

The **uni\_msg\_destroy**() function destroyes the messages and frees all the messages's memory.

The **uni\_msg\_unpack\_mbuf**() function unpacks an *mbuf* chain info a *uni\_msg*. A pointer to the newly allocated message is stored in *msgp* and 0 is returned. In the case of an error (either when no packet header is found in the first mbuf or memory cannot be allocated) the function returns an appropriate error code.

## SEE ALSO

[ng\_ccatm(4)](/ng_ccatm/4.md), [ng\_sscfu(4)](/ng_sscfu/4.md), [ng\_sscop(4)](/ng_sscop/4.md), [ng\_uni(4)](/ng_uni/4.md)

## AUTHORS

Harti Brandt ⟨harti@FreeBSD.org⟩
