Blame pcap_datalink.3pcap.in

Packit Service c0f7c7
.\" Copyright (c) 1994, 1996, 1997
Packit Service c0f7c7
.\"	The Regents of the University of California.  All rights reserved.
Packit Service c0f7c7
.\"
Packit Service c0f7c7
.\" Redistribution and use in source and binary forms, with or without
Packit Service c0f7c7
.\" modification, are permitted provided that: (1) source code distributions
Packit Service c0f7c7
.\" retain the above copyright notice and this paragraph in its entirety, (2)
Packit Service c0f7c7
.\" distributions including binary code include the above copyright notice and
Packit Service c0f7c7
.\" this paragraph in its entirety in the documentation or other materials
Packit Service c0f7c7
.\" provided with the distribution, and (3) all advertising materials mentioning
Packit Service c0f7c7
.\" features or use of this software display the following acknowledgement:
Packit Service c0f7c7
.\" ``This product includes software developed by the University of California,
Packit Service c0f7c7
.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
Packit Service c0f7c7
.\" the University nor the names of its contributors may be used to endorse
Packit Service c0f7c7
.\" or promote products derived from this software without specific prior
Packit Service c0f7c7
.\" written permission.
Packit Service c0f7c7
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
Packit Service c0f7c7
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
Packit Service c0f7c7
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Packit Service c0f7c7
.\"
Packit Service c0f7c7
.TH PCAP_DATALINK 3PCAP "7 April 2014"
Packit Service c0f7c7
.SH NAME
Packit Service c0f7c7
pcap_datalink \- get the link-layer header type
Packit Service c0f7c7
.SH SYNOPSIS
Packit Service c0f7c7
.nf
Packit Service c0f7c7
.ft B
Packit Service c0f7c7
#include <pcap/pcap.h>
Packit Service c0f7c7
.ft
Packit Service c0f7c7
.LP
Packit Service c0f7c7
.ft B
Packit Service c0f7c7
int pcap_datalink(pcap_t *p);
Packit Service c0f7c7
.ft
Packit Service c0f7c7
.fi
Packit Service c0f7c7
.SH DESCRIPTION
Packit Service c0f7c7
.B pcap_datalink()
Packit Service c0f7c7
returns the link-layer header type for the live capture or ``savefile''
Packit Service c0f7c7
specified by
Packit Service c0f7c7
.IR p .
Packit Service c0f7c7
.PP
Packit Service c0f7c7
It must not be called on a pcap descriptor created by
Packit Service c0f7c7
.B \%pcap_create(3PCAP)
Packit Service c0f7c7
that has not yet been activated by
Packit Service c0f7c7
.BR \%pcap_activate(3PCAP) .
Packit Service c0f7c7
.PP
Packit Service c0f7c7
.I https://www.tcpdump.org/linktypes.html
Packit Service c0f7c7
lists the values
Packit Service c0f7c7
.B pcap_datalink()
Packit Service c0f7c7
can return and describes the packet formats that
Packit Service c0f7c7
correspond to those values.
Packit Service c0f7c7
.PP
Packit Service c0f7c7
Do
Packit Service c0f7c7
.B NOT
Packit Service c0f7c7
assume that the packets for a given capture or ``savefile`` will have
Packit Service c0f7c7
any given link-layer header type, such as
Packit Service c0f7c7
.B DLT_EN10MB
Packit Service c0f7c7
for Ethernet.  For example, the "any" device on Linux will have a
Packit Service c0f7c7
link-layer header type of
Packit Service c0f7c7
.B DLT_LINUX_SLL
Packit Service c0f7c7
even if all devices on the system at the time the "any" device is opened
Packit Service c0f7c7
have some other data link type, such as
Packit Service c0f7c7
.B DLT_EN10MB
Packit Service c0f7c7
for Ethernet.
Packit Service c0f7c7
.SH RETURN VALUE
Packit Service c0f7c7
.B pcap_datalink()
Packit Service c0f7c7
returns the link-layer header type on success and
Packit Service c0f7c7
.B PCAP_ERROR_NOT_ACTIVATED
Packit Service c0f7c7
if called on a capture handle that has been created but not activated.
Packit Service c0f7c7
.SH SEE ALSO
Packit Service c0f7c7
pcap(3PCAP), pcap-linktype(@MAN_MISC_INFO@)