Lines Matching defs:pcap

5  *  pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
8 * @(#) $Header: /tcpdump/master/libpcap/pcap-dos.c,v 1.7 2008-04-22 17:16:30 guy Exp $ (LBL)
39 #include "pcap.h"
40 #include "pcap-dos.h"
41 #include "pcap-int.h"
112 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf);
115 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
162 static int pcap_activate_dos (pcap_t *pcap)
164 if (pcap->opt.rfmon) {
171 if (pcap->snapshot < ETH_MIN+8)
172 pcap->snapshot = ETH_MIN+8;
174 if (pcap->snapshot > ETH_MAX) /* silently accept and truncate large MTUs */
175 pcap->snapshot = ETH_MAX;
177 pcap->linktype = DLT_EN10MB; /* !! */
178 pcap->cleanup_op = pcap_cleanup_dos;
179 pcap->read_op = pcap_read_dos;
180 pcap->stats_op = pcap_stats_dos;
181 pcap->inject_op = pcap_sendpacket_dos;
182 pcap->setfilter_op = pcap_setfilter_dos;
183 pcap->setdirection_op = NULL; /* Not implemented.*/
184 pcap->fd = ++ref_count;
186 if (pcap->fd == 1) /* first time we're called */
188 if (!init_watt32(pcap, pcap->opt.source, pcap->errbuf) ||
189 !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
195 else if (stricmp(active_dev->name,pcap->opt.source))
197 snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
199 "(`%s' vs. `%s')", active_dev->name, pcap->opt.source);
202 handle_to_device [pcap->fd-1] = active_dev;
207 * Poll the receiver queue and call the pcap callback-handler
213 struct pcap_pkthdr pcap;
262 pcap.caplen = min (rx_len, p->snapshot);
263 pcap.len = rx_len;
266 (!p->fcode.bf_insns || bpf_filter(p->fcode.bf_insns, rx_buf, pcap.len, pcap.caplen)))
273 gettimeofday2 (&pcap.ts, NULL);
274 (*callback) (data, &pcap, rx_buf);
350 strcpy (p->errbuf, "illegal pcap handle");
427 * Close pcap device. Not called for offline captures.
748 * Open the pcap device for the first client calling pcap_activate()
818 * Hook functions for using Watt-32 together with pcap
824 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
830 memcpy (rxbuf, buf, pcap->caplen);
905 * make Watt-32 and pcap co-operate.
907 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
938 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we
979 memcpy (&pcap_save, pcap, sizeof(pcap_save));
1184 * Search & probe for supported 32-bit (pmode) pcap devices