summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/pcap-int.h
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2008-09-16 20:32:29 +0000
committercsjp <csjp@FreeBSD.org>2008-09-16 20:32:29 +0000
commit2f23d207d357f79e49e932907ea9ff2d2b6aa7d1 (patch)
tree0b2822d2cf6a1a621cb81787b37bcfb6c5e1e30d /contrib/libpcap/pcap-int.h
parent9e9bb2f7eb64da2f1acfd2795dd88fe38360d3d7 (diff)
downloadFreeBSD-src-2f23d207d357f79e49e932907ea9ff2d2b6aa7d1.zip
FreeBSD-src-2f23d207d357f79e49e932907ea9ff2d2b6aa7d1.tar.gz
Implement zero-copy bpf(4) buffer or "zbuf" support for libpcap. A slightly
different version has been committed upstream in the libpcap vendor branch. This will allow people to experiment with zero-copy bpf(4) without requiring external patches. Note to enable this functionality: sysctl net.bpf.zerocopy_enable=1 By default, libpcap will use the legacy buffering method unless this sysctl variable is set to 1. For the details about zero-copy bpf(4) implementation see svn change r177548. Requested by: many Discussed with: sam In collaboration with: rwatson
Diffstat (limited to 'contrib/libpcap/pcap-int.h')
-rw-r--r--contrib/libpcap/pcap-int.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/contrib/libpcap/pcap-int.h b/contrib/libpcap/pcap-int.h
index fbab8e9..aad7369 100644
--- a/contrib/libpcap/pcap-int.h
+++ b/contrib/libpcap/pcap-int.h
@@ -167,12 +167,36 @@ struct pcap {
struct pcap_md md;
/*
- * Read buffer.
+ * Read buffer -- for file descriptor read buffer model.
*/
int bufsize;
u_char *buffer;
u_char *bp;
int cc;
+ int to_ms;
+
+ /*
+ * Zero-copy read buffer -- for zero-copy BPF. 'buffer' above will
+ * alternative between these two actual mmap'd buffers as required.
+ * As there is a header on the front size of the mmap'd buffer, only
+ * some of the buffer is exposed to libpcap as a whole via bufsize;
+ * zbufsize is the true size. zbuffer tracks the current zbuf
+ * assocated with buffer so that it can be used to decide which the
+ * next buffer to read will be.
+ */
+ u_char *zbuf1, *zbuf2, *zbuffer;
+ u_int zbufsize;
+ u_int timeout;
+ u_int zerocopy;
+ u_int interrupted;
+ struct timespec firstsel;
+
+ /*
+ * If there's currently a buffer being actively processed, then it is
+ * referenced here; 'buffer' is also pointed at it, but offset by the
+ * size of the header.
+ */
+ struct bpf_zbuf_header *bzh;
/*
* Place holder for pcap_next().
OpenPOWER on IntegriCloud