---
name: "mnl_cb_run"
section: "3"
platform: "linux"
package: "libmnl-doc"
version: "1.0.5-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mnl_cb_run"
---

# mnl\_cb\_run(3)

Callback helpers

## NAME

callback - Callback helpers

## SYNOPSIS

### Functions

int **mnl\_cb\_run2** (const void \*buf, size\_t numbytes, unsigned int seq, unsigned int portid, mnl\_cb\_t cb\_data, void \*data, const mnl\_cb\_t \*cb\_ctl\_array, unsigned int cb\_ctl\_array\_len)\
 int **mnl\_cb\_run** (const void \*buf, size\_t numbytes, unsigned int seq, unsigned int portid, mnl\_cb\_t cb\_data, void \*data)\

## Detailed Description

## Function Documentation

### int mnl\_cb\_run (const void \* buf, size\_t numbytes, unsigned int seq, unsigned int portid, mnl\_cb\_t cb\_data, void \* data)

mnl\_cb\_run - callback runqueue for netlink messages (simplified version)

**Parameters**

*buf* buffer that contains the netlink messages \
 *numbytes* number of bytes stored in the buffer \
 *seq* sequence number that we expect to receive \
 *portid* Netlink PortID that we expect to receive \
 *cb\_data* callback handler for data messages \
 *data* pointer to data that will be passed to the data callback handler

This function is like **mnl\_cb\_run2()** but it does not allow you to set the control callback handlers.

Your callback may return three possible values:

- •

  MNL\_CB\_ERROR (\<=-1): an error has occurred. Stop callback runqueue.

- •

  MNL\_CB\_STOP (=0): stop callback runqueue.

- •

  MNL\_CB\_OK (\>=1): no problems has occurred.

This function propagates the callback return value.

Definition at line **159** of file **callback.c**.

### int mnl\_cb\_run2 (const void \* buf, size\_t numbytes, unsigned int seq, unsigned int portid, mnl\_cb\_t cb\_data, void \* data, const mnl\_cb\_t \* cb\_ctl\_array, unsigned int cb\_ctl\_array\_len)

mnl\_cb\_run2 - callback runqueue for netlink messages

**Parameters**

*buf* buffer that contains the netlink messages \
 *numbytes* number of bytes stored in the buffer \
 *seq* sequence number that we expect to receive \
 *portid* Netlink PortID that we expect to receive \
 *cb\_data* callback handler for data messages \
 *data* pointer to data that will be passed to the data callback handler \
 *cb\_ctl\_array* array of custom callback handlers from control messages \
 *cb\_ctl\_array\_len* array length of custom control callback handlers

You can set the cb\_ctl\_array to NULL if you want to use the default control callback handlers, in that case, the parameter cb\_ctl\_array\_len is not checked.

Your callback may return three possible values:

- •

  MNL\_CB\_ERROR (\<=-1): an error has occurred. Stop callback runqueue.

- •

  MNL\_CB\_STOP (=0): stop callback runqueue.

- •

  MNL\_CB\_OK (\>=1): no problem has occurred.

This function propagates the callback return value. On error, it returns -1 and errno is explicitly set. If the portID is not the expected, errno is set to ESRCH. If the sequence number is not the expected, errno is set to EPROTO. If the dump was interrupted, errno is set to EINTR and you should request a new fresh dump again.

Definition at line **130** of file **callback.c**.

## Author

Generated automatically by Doxygen for libmnl from the source code.
