• Home
  • Raw
  • Download

Lines Matching full:pcap

5  *  pcap-dos.c: Interface to PKTDRVR, NDIS2 and 32-bit pmode
38 #include "pcap.h"
39 #include "pcap-dos.h"
40 #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,
169 static int pcap_activate_dos (pcap_t *pcap) in pcap_activate_dos() argument
171 if (pcap->opt.rfmon) { in pcap_activate_dos()
186 if (pcap->snapshot <= 0 || pcap->snapshot > MAXIMUM_SNAPLEN) in pcap_activate_dos()
187 pcap->snapshot = MAXIMUM_SNAPLEN; in pcap_activate_dos()
189 if (pcap->snapshot < ETH_MIN+8) in pcap_activate_dos()
190 pcap->snapshot = ETH_MIN+8; in pcap_activate_dos()
192 if (pcap->snapshot > ETH_MAX) /* silently accept and truncate large MTUs */ in pcap_activate_dos()
193 pcap->snapshot = ETH_MAX; in pcap_activate_dos()
195 pcap->linktype = DLT_EN10MB; /* !! */ in pcap_activate_dos()
196 pcap->cleanup_op = pcap_cleanup_dos; in pcap_activate_dos()
197 pcap->read_op = pcap_read_dos; in pcap_activate_dos()
198 pcap->stats_op = pcap_stats_dos; in pcap_activate_dos()
199 pcap->inject_op = pcap_sendpacket_dos; in pcap_activate_dos()
200 pcap->setfilter_op = pcap_setfilter_dos; in pcap_activate_dos()
201 pcap->setdirection_op = NULL; /* Not implemented.*/ in pcap_activate_dos()
202 pcap->fd = ++ref_count; in pcap_activate_dos()
204 pcap->bufsize = ETH_MAX+100; /* add some margin */ in pcap_activate_dos()
205 pcap->buffer = calloc (pcap->bufsize, 1); in pcap_activate_dos()
207 if (pcap->fd == 1) /* first time we're called */ in pcap_activate_dos()
209 if (!init_watt32(pcap, pcap->opt.device, pcap->errbuf) || in pcap_activate_dos()
210 !first_init(pcap->opt.device, pcap->errbuf, pcap->opt.promisc)) in pcap_activate_dos()
212 /* XXX - free pcap->buffer? */ in pcap_activate_dos()
217 else if (stricmp(active_dev->name,pcap->opt.device)) in pcap_activate_dos()
219 snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE, in pcap_activate_dos()
221 "(`%s' vs. `%s')", active_dev->name, pcap->opt.device); in pcap_activate_dos()
222 /* XXX - free pcap->buffer? */ in pcap_activate_dos()
225 handle_to_device [pcap->fd-1] = active_dev; in pcap_activate_dos()
230 * Poll the receiver queue and call the pcap callback-handler
237 struct pcap_pkthdr pcap; in pcap_read_one() local
283 pcap.caplen = min (rx_len, p->snapshot); in pcap_read_one()
284 pcap.len = rx_len; in pcap_read_one()
287 (!p->fcode.bf_insns || pcap_filter(p->fcode.bf_insns, p->buffer, pcap.len, pcap.caplen))) in pcap_read_one()
294 gettimeofday2 (&pcap.ts, NULL); in pcap_read_one()
295 (*callback) (data, &pcap, p->buffer); in pcap_read_one()
399 strcpy (p->errbuf, "illegal pcap handle"); in pcap_stats_dos()
477 * Close pcap device. Not called for offline captures.
813 * Open the pcap device for the first client calling pcap_activate()
883 * Hook functions for using Watt-32 together with pcap
889 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap, in watt32_recv_hook() argument
895 memcpy (rxbuf, buf, pcap->caplen); in watt32_recv_hook()
970 * make Watt-32 and pcap co-operate.
972 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf) in init_watt32() argument
1003 /* if pcap is using a 32-bit driver w/o a pktdrvr loaded, we in init_watt32()
1044 memcpy (&pcap_save, pcap, sizeof(pcap_save)); in init_watt32()
1247 * Search & probe for supported 32-bit (pmode) pcap devices