Merge multi-DLT support.
This commit is contained in:
parent
a63efadcf1
commit
6121e7f0d2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109841
@ -567,6 +567,11 @@ init_linktype(type)
|
||||
off_nl = 6; /* XXX in reality, variable! */
|
||||
return;
|
||||
|
||||
case DLT_IEEE802_11:
|
||||
off_linktype = 30; /* XXX variable */
|
||||
off_nl = 32;
|
||||
return;
|
||||
|
||||
case DLT_EN10MB:
|
||||
off_linktype = 12;
|
||||
off_nl = 14;
|
||||
@ -662,6 +667,7 @@ init_linktype(type)
|
||||
off_nl = 22;
|
||||
return;
|
||||
|
||||
#ifdef notdef
|
||||
case DLT_IEEE802_11:
|
||||
/*
|
||||
* 802.11 doesn't really have a link-level type field.
|
||||
@ -678,6 +684,7 @@ init_linktype(type)
|
||||
off_linktype = 24;
|
||||
off_nl = 30;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case DLT_PRISM_HEADER:
|
||||
/*
|
||||
|
@ -106,6 +106,8 @@ struct pcap {
|
||||
struct bpf_program fcode;
|
||||
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
int dlt_count;
|
||||
int *dlt_list;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -84,6 +84,8 @@ u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h)
|
||||
.LP
|
||||
.ft B
|
||||
int pcap_datalink(pcap_t *p)
|
||||
int pcap_list_datalinks(pcap_t *p, int **dlt_buf);
|
||||
int pcap_set_datalink(pcap_t *p, int dlt);
|
||||
int pcap_snapshot(pcap_t *p)
|
||||
int pcap_is_swapped(pcap_t *p)
|
||||
int pcap_major_version(pcap_t *p)
|
||||
@ -665,6 +667,34 @@ header or 4 for frames beginning with an 802.2 LLC header.
|
||||
Apple LocalTalk; the packet begins with an AppleTalk LLAP header
|
||||
.RE
|
||||
.PP
|
||||
.B pcap_list_datalinks()
|
||||
is used to get a list of the supported data link types of the interface
|
||||
associated with the pcap descriptor.
|
||||
.B pcap_list_datalinks()
|
||||
allocates an array to hold the list and sets
|
||||
.IR *dlt_buf .
|
||||
The caller is responsible for freeing the array.
|
||||
.B \-1
|
||||
is returned on failure;
|
||||
otherwise, the number of data link types in the array is returned.
|
||||
.PP
|
||||
.B pcap_set_datalink()
|
||||
is used to set the current data link type of the pcap descriptor
|
||||
to the type specified by
|
||||
.IR dlt .
|
||||
.B \-1
|
||||
is returned on failure.
|
||||
.PP
|
||||
.B pcap_datalink_name_to_val()
|
||||
translates a data link type name, which is a
|
||||
.B DLT_
|
||||
name with the
|
||||
.B DLT_
|
||||
removed, to the corresponding data link type value. The translation
|
||||
is case-insensitive.
|
||||
is used to set the current data link type of the pcap descriptor
|
||||
NULL is returned on failure.
|
||||
.PP
|
||||
.B pcap_snapshot()
|
||||
returns the snapshot length specified when
|
||||
.B pcap_open_live
|
||||
|
@ -183,6 +183,8 @@ int pcap_compile_nopcap(int, int, struct bpf_program *,
|
||||
char *, int, bpf_u_int32);
|
||||
void pcap_freecode(struct bpf_program *);
|
||||
int pcap_datalink(pcap_t *);
|
||||
int pcap_list_datalinks(pcap_t *, int **);
|
||||
int pcap_set_datalink(pcap_t *, int);
|
||||
int pcap_snapshot(pcap_t *);
|
||||
int pcap_is_swapped(pcap_t *);
|
||||
int pcap_major_version(pcap_t *);
|
||||
|
Loading…
Reference in New Issue
Block a user