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.1.2.1 2005/05/03 18:54:35 guy Exp $ (LBL)
39 #include "pcap.h"
40 #include "pcap-dos.h"
41 #include "pcap-int.h"
111 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf);
114 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
152 struct pcap *pcap;
160 pcap = calloc (sizeof(*pcap), 1);
161 if (!pcap)
163 strcpy (errbuf, "Not enough memory (pcap)");
167 pcap->snapshot = max (ETH_MIN+8, snaplen);
168 pcap->linktype = DLT_EN10MB; /* !! */
169 pcap->inter_packet_wait = timeout_ms;
170 pcap->close_op = pcap_close_dos;
171 pcap->read_op = pcap_read_dos;
172 pcap->stats_op = pcap_stats_dos;
173 pcap->inject_op = pcap_sendpacket_dos;
174 pcap->setfilter_op = pcap_setfilter_dos;
175 pcap->setdirection_op = NULL; /* Not implemented.*/
176 pcap->fd = ++ref_count;
178 if (pcap->fd == 1) /* first time we're called */
180 if (!init_watt32(pcap, device_name, errbuf) ||
183 free (pcap);
193 free (pcap);
194 pcap = NULL;
196 handle_to_device [pcap->fd-1] = active_dev;
197 return (pcap);
201 * Poll the receiver queue and call the pcap callback-handler
207 struct pcap_pkthdr pcap;
257 pcap.caplen = min (rx_len, p->snapshot);
258 pcap.len = rx_len;
261 (!fcode || bpf_filter(fcode, rx_buf, pcap.len, pcap.caplen)))
268 gettimeofday2 (&pcap.ts, NULL);
269 (*callback) (data, &pcap, rx_buf);
345 strcpy (p->errbuf, "illegal pcap handle");
422 * Close pcap device. Not called for offline captures.
743 * Open the pcap device for the first client calling pcap_open_live()
813 * Hook functions for using Watt-32 together with pcap
819 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
825 memcpy (rxbuf, buf, pcap->caplen);
900 * make Watt-32 and pcap co-operate.
902 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
933 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we
974 memcpy (&pcap_save, pcap, sizeof(pcap_save));
1179 * Search & probe for supported 32-bit (pmode) pcap devices