Lines Matching refs:pcap
33 pcap_t *pcap; member
94 ret = pcap_sendpacket(l2->pcap, buf, len); in l2_packet_send()
110 ret = pcap_sendpacket(l2->pcap, (u8 *) eth, mlen); in l2_packet_send()
126 pcap_t *pcap = sock_ctx; in l2_packet_receive() local
133 packet = pcap_next(pcap, &hdr); in l2_packet_receive()
183 pcap_t *pcap = timeout_ctx; in l2_packet_receive_timeout() local
196 l2, pcap); in l2_packet_receive_timeout()
197 pcap_dispatch(pcap, 10, l2_packet_receive_cb, (u_char *) l2); in l2_packet_receive_timeout()
213 l2->pcap = pcap_open_live(ifname, 2500, 0, 10, pcap_err); in l2_packet_init_libpcap()
214 if (l2->pcap == NULL) { in l2_packet_init_libpcap()
219 if (pcap_setnonblock(l2->pcap, 1, pcap_err) < 0) in l2_packet_init_libpcap()
221 pcap_geterr(l2->pcap)); in l2_packet_init_libpcap()
224 l2->pcap = pcap_open_live(l2->ifname, 2500, 0, 10, pcap_err); in l2_packet_init_libpcap()
225 if (l2->pcap == NULL) { in l2_packet_init_libpcap()
230 if (pcap_datalink(l2->pcap) != DLT_EN10MB && in l2_packet_init_libpcap()
231 pcap_set_datalink(l2->pcap, DLT_EN10MB) < 0) { in l2_packet_init_libpcap()
233 pcap_geterr(l2->pcap)); in l2_packet_init_libpcap()
244 if (pcap_compile(l2->pcap, &pcap_fp, pcap_filter, 1, pcap_netp) < 0) { in l2_packet_init_libpcap()
245 fprintf(stderr, "pcap_compile: %s\n", pcap_geterr(l2->pcap)); in l2_packet_init_libpcap()
249 if (pcap_setfilter(l2->pcap, &pcap_fp) < 0) { in l2_packet_init_libpcap()
250 fprintf(stderr, "pcap_setfilter: %s\n", pcap_geterr(l2->pcap)); in l2_packet_init_libpcap()
263 if (ioctl(pcap_fileno(l2->pcap), BIOCIMMEDIATE, &on) < 0) { in l2_packet_init_libpcap()
274 l2, l2->pcap); in l2_packet_init_libpcap()
276 eloop_register_read_sock(pcap_get_selectable_fd(l2->pcap), in l2_packet_init_libpcap()
277 l2_packet_receive, l2, l2->pcap); in l2_packet_init_libpcap()
326 eloop_cancel_timeout(l2_packet_receive_timeout, l2, l2->pcap); in l2_packet_deinit()
330 eloop_unregister_read_sock(pcap_get_selectable_fd(l2->pcap)); in l2_packet_deinit()
332 if (l2->pcap) in l2_packet_deinit()
333 pcap_close(l2->pcap); in l2_packet_deinit()
382 eloop_cancel_timeout(l2_packet_receive_timeout, l2, l2->pcap); in l2_packet_notify_auth_start()
384 l2, l2->pcap); in l2_packet_notify_auth_start()