---
name: "pcap_datalink_name_to_val"
section: "3pcap"
platform: "macos"
package: "libpcap"
version: "146"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/pcap_datalink_name_to_val/3pcap"
---

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

get the link-layer header type value corresponding to a header type name

## NAME

pcap\_datalink\_name\_to\_val - get the link-layer header type value corresponding to a header type name

## SYNOPSIS

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

**int pcap\_datalink\_name\_to\_val(const char \*name);**

## DESCRIPTION

**pcap\_datalink\_name\_to\_val**() translates a link-layer header type name, which is a **DLT\_** name with the **DLT\_** removed, to the corresponding link-layer header type value.  The translation is case-insensitive.

## RETURN VALUE

**pcap\_datalink\_name\_to\_val**() returns the type value on success and **PCAP\_ERROR** if the name is not a known type name.

## SEE ALSO

**pcap**(3PCAP)
