Home | History | Annotate | Download | only in libpcap

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,
170 static int pcap_activate_dos (pcap_t *pcap)
172 struct pcap_dos *pcapd = pcap->priv;
174 if (pcap->opt.rfmon) {
181 if (pcap->snapshot < ETH_MIN+8)
182 pcap->snapshot = ETH_MIN+8;
184 if (pcap->snapshot > ETH_MAX) /* silently accept and truncate large MTUs */
185 pcap->snapshot = ETH_MAX;
187 pcap->linktype = DLT_EN10MB; /* !! */
188 pcap->cleanup_op = pcap_cleanup_dos;
189 pcap->read_op = pcap_read_dos;
190 pcap->stats_op = pcap_stats_dos;
191 pcap->inject_op = pcap_sendpacket_dos;
192 pcap->setfilter_op = pcap_setfilter_dos;
193 pcap->setdirection_op = NULL; /* Not implemented.*/
194 pcap->fd = ++ref_count;
196 if (pcap->fd == 1) /* first time we're called */
198 if (!init_watt32(pcap, pcap->opt.source, pcap->errbuf) ||
199 !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
205 else if (stricmp(active_dev->name,pcap->opt.source))
207 snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
209 "(`%s' vs. `%s')", active_dev->name, pcap->opt.source);
212 handle_to_device [pcap->fd-1] = active_dev;
217 * Poll the receiver queue and call the pcap callback-handler
224 struct pcap_pkthdr pcap;
273 pcap.caplen = min (rx_len, p->snapshot);
274 pcap.len = rx_len;
277 (!p->fcode.bf_insns || bpf_filter(p->fcode.bf_insns, rx_buf, pcap.len, pcap.caplen)))
284 gettimeofday2 (&pcap.ts, NULL);
285 (*callback) (data, &pcap, rx_buf);
363 strcpy (p->errbuf, "illegal pcap handle");
441 * Close pcap device. Not called for offline captures.
767 * Open the pcap device for the first client calling pcap_activate()
837 * Hook functions for using Watt-32 together with pcap
843 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
849 memcpy (rxbuf, buf, pcap->caplen);
924 * make Watt-32 and pcap co-operate.
926 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
957 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we
998 memcpy (&pcap_save, pcap, sizeof(pcap_save));
1203 * Search & probe for supported 32-bit (pmode) pcap devices