---
name: "pcap_datalink_val_to_description"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/pcap_datalink_val_to_description"
---

# pcap\_datalink\_val\_to\_description(3)

get a name or description for a link-layer header type value

## NAME

pcap\_datalink\_val\_to\_name, pcap\_datalink\_val\_to\_description, pcap\_datalink\_val\_to\_description\_or\_dlt - get a name or description for a link-layer header type value

## SYNOPSIS

```
#include <pcap.h>
```

**const char \*pcap\_datalink\_val\_to\_name(int dlt);** **const char \*pcap\_datalink\_val\_to\_description(int dlt);** **const char \*pcap\_datalink\_val\_to\_description\_or\_dlt(int dlt);**

## DESCRIPTION

**pcap\_datalink\_val\_to\_name**() translates a link-layer header type value to the corresponding link-layer header type name, which is the **DLT\_** name for the link-layer header type value with the **DLT\_** removed. **NULL** is returned if the type value does not correspond to a known **DLT\_** value.

**pcap\_datalink\_val\_to\_description**() translates a link-layer header type value to a short description of that link-layer header type. **NULL** is returned if the type value does not correspond to a known **DLT\_** value.

**pcap\_datalink\_val\_to\_description\_or\_dlt**() translates a link-layer header type value to a short description of that link-layer header type just like **pcap\_datalink\_val\_to\_description**(). If the type value does not correspond to a known **DLT\_** value, the string "DLT n" is returned, where n is the value of the dlt argument.

## BACKWARD COMPATIBILITY

The **pcap\_datalink\_val\_to\_description\_or\_dlt**() function first became available in libpcap release 1.9.1.  In previous releases, **pcap\_datalink\_val\_to\_description**() would have to be called and, if it returned **NULL**, a default string would have to be constructed.

## SEE ALSO

[**pcap**(3)](/pcap/3.md)
