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) {
185 if (pcap->snapshot <= 0 || pcap->snapshot > MAXIMUM_SNAPLEN)
186 pcap->snapshot = MAXIMUM_SNAPLEN;
188 if (pcap->snapshot < ETH_MIN+8)
189 pcap->snapshot = ETH_MIN+8;
191 if (pcap->snapshot > ETH_MAX) /* silently accept and truncate large MTUs */
192 pcap->snapshot = ETH_MAX;
194 pcap->linktype = DLT_EN10MB; /* !! */
195 pcap->cleanup_op = pcap_cleanup_dos;
196 pcap->read_op = pcap_read_dos;
197 pcap->stats_op = pcap_stats_dos;
198 pcap->inject_op = pcap_sendpacket_dos;
199 pcap->setfilter_op = pcap_setfilter_dos;
200 pcap->setdirection_op = NULL; /* Not implemented.*/
201 pcap->fd = ++ref_count;
203 pcap->bufsize = ETH_MAX+100; /* add some margin */
204 pcap->buffer = calloc (pcap->bufsize, 1);
206 if (pcap->fd == 1) /* first time we're called */
208 if (!init_watt32(pcap, pcap->opt.device, pcap->errbuf) ||
209 !first_init(pcap->opt.device, pcap->errbuf, pcap->opt.promisc))
211 /* XXX - free pcap->buffer? */
216 else if (stricmp(active_dev->name,pcap->opt.device))
218 pcap_snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
220 "(`%s' vs. `%s')", active_dev->name, pcap->opt.device);
221 /* XXX - free pcap->buffer? */
224 handle_to_device [pcap->fd-1] = active_dev;
229 * Poll the receiver queue and call the pcap callback-handler
236 struct pcap_pkthdr pcap;
282 pcap.caplen = min (rx_len, p->snapshot);
283 pcap.len = rx_len;
286 (!p->fcode.bf_insns || bpf_filter(p->fcode.bf_insns, p->buffer, pcap.len, pcap.caplen)))
293 gettimeofday2 (&pcap.ts, NULL);
294 (*callback) (data, &pcap, p->buffer);
383 strcpy (p->errbuf, "illegal pcap handle");
461 * Close pcap device. Not called for offline captures.
797 * Open the pcap device for the first client calling pcap_activate()
867 * Hook functions for using Watt-32 together with pcap
873 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap,
879 memcpy (rxbuf, buf, pcap->caplen);
954 * make Watt-32 and pcap co-operate.
956 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
987 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we
1028 memcpy (&pcap_save, pcap, sizeof(pcap_save));
1233 * Search & probe for supported 32-bit (pmode) pcap devices