---
name: "pcap_datalink_name_to_val"
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_name_to_val"
---

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

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**(3)](/pcap/3.md)
