aboutsummaryrefslogtreecommitdiff
path: root/contrib/libpcap
diff options
context:
space:
mode:
authorBill Fenner <fenner@FreeBSD.org>2003-01-26 01:21:53 +0000
committerBill Fenner <fenner@FreeBSD.org>2003-01-26 01:21:53 +0000
commit6121e7f0d23a9833908cad36208dc20871008d6e (patch)
treec3d9775a4050dac5b69fcd191fe0c0410ff29e7c /contrib/libpcap
parenta63efadcf17e7b8d37537946db77f55579a9da79 (diff)
downloadsrc-6121e7f0d23a9833908cad36208dc20871008d6e.tar.gz
src-6121e7f0d23a9833908cad36208dc20871008d6e.zip
Merge multi-DLT support.
Notes
Notes: svn path=/head/; revision=109841
Diffstat (limited to 'contrib/libpcap')
-rw-r--r--contrib/libpcap/gencode.c7
-rw-r--r--contrib/libpcap/pcap-int.h2
-rw-r--r--contrib/libpcap/pcap.330
-rw-r--r--contrib/libpcap/pcap.h2
4 files changed, 41 insertions, 0 deletions
diff --git a/contrib/libpcap/gencode.c b/contrib/libpcap/gencode.c
index ea622dec8d44..211e8632567b 100644
--- a/contrib/libpcap/gencode.c
+++ b/contrib/libpcap/gencode.c
@@ -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:
/*
diff --git a/contrib/libpcap/pcap-int.h b/contrib/libpcap/pcap-int.h
index dbac5886ab03..7e5405269618 100644
--- a/contrib/libpcap/pcap-int.h
+++ b/contrib/libpcap/pcap-int.h
@@ -106,6 +106,8 @@ struct pcap {
struct bpf_program fcode;
char errbuf[PCAP_ERRBUF_SIZE];
+ int dlt_count;
+ int *dlt_list;
};
/*
diff --git a/contrib/libpcap/pcap.3 b/contrib/libpcap/pcap.3
index 76a8855ec468..6ee773de6253 100644
--- a/contrib/libpcap/pcap.3
+++ b/contrib/libpcap/pcap.3
@@ -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
diff --git a/contrib/libpcap/pcap.h b/contrib/libpcap/pcap.h
index e4ea023ffc24..aeaae49099c9 100644
--- a/contrib/libpcap/pcap.h
+++ b/contrib/libpcap/pcap.h
@@ -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 *);