Lines Matching refs:pcap
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; in pcap_open_live() local
160 pcap = calloc (sizeof(*pcap), 1); in pcap_open_live()
161 if (!pcap) in pcap_open_live()
167 pcap->snapshot = max (ETH_MIN+8, snaplen); in pcap_open_live()
168 pcap->linktype = DLT_EN10MB; /* !! */ in pcap_open_live()
169 pcap->inter_packet_wait = timeout_ms; in pcap_open_live()
170 pcap->close_op = pcap_close_dos; in pcap_open_live()
171 pcap->read_op = pcap_read_dos; in pcap_open_live()
172 pcap->stats_op = pcap_stats_dos; in pcap_open_live()
173 pcap->inject_op = pcap_sendpacket_dos; in pcap_open_live()
174 pcap->setfilter_op = pcap_setfilter_dos; in pcap_open_live()
175 pcap->setdirection_op = NULL; /* Not implemented.*/ in pcap_open_live()
176 pcap->fd = ++ref_count; in pcap_open_live()
178 if (pcap->fd == 1) /* first time we're called */ in pcap_open_live()
180 if (!init_watt32(pcap, device_name, errbuf) || in pcap_open_live()
183 free (pcap); in pcap_open_live()
193 free (pcap); in pcap_open_live()
194 pcap = NULL; in pcap_open_live()
196 handle_to_device [pcap->fd-1] = active_dev; in pcap_open_live()
197 return (pcap); in pcap_open_live()
207 struct pcap_pkthdr pcap; in pcap_read_one() local
257 pcap.caplen = min (rx_len, p->snapshot); in pcap_read_one()
258 pcap.len = rx_len; in pcap_read_one()
261 (!fcode || bpf_filter(fcode, rx_buf, pcap.len, pcap.caplen))) in pcap_read_one()
268 gettimeofday2 (&pcap.ts, NULL); in pcap_read_one()
269 (*callback) (data, &pcap, rx_buf); in pcap_read_one()
819 static void watt32_recv_hook (u_char *dummy, const struct pcap_pkthdr *pcap, in watt32_recv_hook() argument
825 memcpy (rxbuf, buf, pcap->caplen); in watt32_recv_hook()
902 static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf) in init_watt32() argument
974 memcpy (&pcap_save, pcap, sizeof(pcap_save)); in init_watt32()