Lines Matching defs:pcap
5 * pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
37 #include "pcap.h"
38 #include "pcap-dos.h"
39 #include "pcap-int.h"
110 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf);
113 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
168 static int pcap_activate_dos (pcap_t *pcap)
170 struct pcap_dos *pcapd = pcap->priv;
172 if (pcap->opt.rfmon) {
179 if (pcap->snapshot < ETH_MIN+8)
180 pcap->snapshot = ETH_MIN+8;
182 if (pcap->snapshot > ETH_MAX) /* silently accept and truncate large MTUs */
183 pcap->snapshot = ETH_MAX;
185 pcap->linktype = DLT_EN10MB; /* !! */
186 pcap->cleanup_op = pcap_cleanup_dos;
187 pcap->read_op = pcap_read_dos;
188 pcap->stats_op = pcap_stats_dos;
189 pcap->inject_op = pcap_sendpacket_dos;
190 pcap->setfilter_op = pcap_setfilter_dos;
191 pcap->setdirection_op = NULL; /* Not implemented.*/
192 pcap->fd = ++ref_count;
194 if (pcap->fd == 1) /* first time we're called */
196 if (!init_watt32(pcap, pcap->opt.source, pcap->errbuf) ||
197 !first_init(pcap->opt.source, pcap->errbuf, pcap->opt.promisc))
203 else if (stricmp(active_dev->name,pcap->opt.source))
205 snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
207 "(`%s' vs. `%s')", active_dev->name, pcap->opt.source);
210 handle_to_device [pcap->fd-1] = active_dev;
215 * Poll the receiver queue and call the pcap callback-handler
222 struct pcap_pkthdr pcap;
271 pcap.caplen = min (rx_len, p->snapshot);
272 pcap.len = rx_len;
275 (!p->fcode.bf_insns || bpf_filter(p->fcode.bf_insns, rx_buf, pcap.len, pcap.caplen)))
282 gettimeofday2 (&pcap.ts, NULL);
283 (*callback) (data, &pcap, rx_buf);
361 strcpy (p->errbuf, "illegal pcap handle");
439 * Close pcap device. Not called for offline captures.
765 * Open the pcap device for the first client calling pcap_activate()
835 * Hook functions for using Watt-32 together with pcap
841 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
847 memcpy (rxbuf, buf, pcap->caplen);
922 * make Watt-32 and pcap co-operate.
924 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
955 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we
996 memcpy (&pcap_save, pcap, sizeof(pcap_save));
1201 * Search & probe for supported 32-bit (pmode) pcap devices