Home | History | Annotate | Download | only in libpcap

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 if (pcap->opt.rfmon) {
177 if (pcap->snapshot < ETH_MIN+8)
178 pcap->snapshot = ETH_MIN+8;
180 if (pcap->snapshot > ETH_MAX) /* silently accept and truncate large MTUs */
181 pcap->snapshot = ETH_MAX;
183 pcap->linktype = DLT_EN10MB; /* !! */
184 pcap->cleanup_op = pcap_cleanup_dos;
185 pcap->read_op = pcap_read_dos;
186 pcap->stats_op = pcap_stats_dos;
187 pcap->inject_op = pcap_sendpacket_dos;
188 pcap->setfilter_op = pcap_setfilter_dos;
189 pcap->setdirection_op = NULL; /* Not implemented.*/
190 pcap->fd = ++ref_count;
192 pcap->bufsize = ETH_MAX+100; /* add some margin */
193 pcap->buffer = calloc (pcap->bufsize, 1);
195 if (pcap->fd == 1) /* first time we're called */
197 if (!init_watt32(pcap, pcap->opt.device, pcap->errbuf) ||
198 !first_init(pcap->opt.device, pcap->errbuf, pcap->opt.promisc))
204 else if (stricmp(active_dev->name,pcap->opt.device))
206 pcap_snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
208 "(`%s' vs. `%s')", active_dev->name, pcap->opt.device);
211 handle_to_device [pcap->fd-1] = active_dev;
216 * Poll the receiver queue and call the pcap callback-handler
223 struct pcap_pkthdr pcap;
269 pcap.caplen = min (rx_len, p->snapshot);
270 pcap.len = rx_len;
273 (!p->fcode.bf_insns || bpf_filter(p->fcode.bf_insns, p->buffer, pcap.len, pcap.caplen)))
280 gettimeofday2 (&pcap.ts, NULL);
281 (*callback) (data, &pcap, p->buffer);
370 strcpy (p->errbuf, "illegal pcap handle");
448 * Close pcap device. Not called for offline captures.
781 * Open the pcap device for the first client calling pcap_activate()
851 * Hook functions for using Watt-32 together with pcap
857 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
863 memcpy (rxbuf, buf, pcap->caplen);
938 * make Watt-32 and pcap co-operate.
940 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
971 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we
1012 memcpy (&pcap_save, pcap, sizeof(pcap_save));
1217 * Search & probe for supported 32-bit (pmode) pcap devices