---
name: "pcap_datalink_val_to_name"
section: "3pcap"
platform: "linux"
package: "libpcap"
version: "1.11.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/pcap_datalink_val_to_name/3pcap"
---

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

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. A null pointer 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. A null pointer 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 a null pointer, a default string would have to be constructed.

## SEE ALSO

**pcap**(3PCAP), **pcap\_datalink**(3PCAP), **pcap\_list\_datalinks**(3PCAP), **pcap\_datalink\_name\_to\_val**(3PCAP)
