Lines Matching refs:handlep

727 	struct pcap_linux *handlep = handle->priv;  local
814 handlep->mondevice = strdup(mondevice);
815 if (handlep->mondevice == NULL) {
891 struct pcap_linux *handlep = handle->priv; local
971 handlep->mondevice);
980 strlcpy(ifr.ifr_name, handlep->mondevice, sizeof(ifr.ifr_name));
984 handlep->mondevice);
986 handlep->mondevice);
994 handlep->mondevice);
996 handlep->mondevice);
1010 handlep->must_do_on_close |= MUST_DELETE_MONIF;
1226 struct pcap_linux *handlep = handle->priv; local
1237 if (handlep->must_do_on_close != 0) {
1242 if (handlep->must_do_on_close & MUST_CLEAR_PROMISC) {
1253 strlcpy(ifr.ifr_name, handlep->device,
1260 handlep->device, strerror(errno));
1274 handlep->device,
1282 if (handlep->must_do_on_close & MUST_DELETE_MONIF) {
1283 ret = nl80211_init(handle, &nlstate, handlep->device);
1286 handlep->device, handlep->mondevice);
1293 handlep->mondevice, handle->errbuf);
1299 if (handlep->must_do_on_close & MUST_CLEAR_RFMON) {
1317 strlcpy(ifr.ifr_name, handlep->device,
1331 strlcpy(ireq.ifr_ifrn.ifrn_name, handlep->device,
1333 ireq.u.mode = handlep->oldmode;
1341 handlep->device, strerror(errno));
1354 handlep->device, strerror(errno));
1367 if (handlep->mondevice != NULL) {
1368 free(handlep->mondevice);
1369 handlep->mondevice = NULL;
1371 if (handlep->device != NULL) {
1372 free(handlep->device);
1373 handlep->device = NULL;
1382 set_poll_timeout(struct pcap_linux *handlep) argument
1425 if (handlep->timeout == 0) {
1439 if (handlep->tp_version == TPACKET_V3 && broken_tpacket_v3)
1440 handlep->poll_timeout = 1; /* don't block for very long */
1443 handlep->poll_timeout = -1; /* block forever */
1444 } else if (handlep->timeout > 0) {
1451 if (handlep->tp_version == TPACKET_V3 && !broken_tpacket_v3)
1452 handlep->poll_timeout = -1; /* block forever, let TPACKET_V3 wake us up */
1455 handlep->poll_timeout = handlep->timeout; /* block for that amount of time */
1462 handlep->poll_timeout = 0;
1477 struct pcap_linux *handlep = handle->priv; local
1537 handlep->device = strdup(device);
1538 if (handlep->device == NULL) {
1545 handlep->timeout = handle->opt.timeout;
1553 handlep->proc_dropped = linux_if_drops(handlep->device);
1591 set_poll_timeout(handlep);
1696 struct pcap_linux *handlep = handle->priv; local
1705 if (sll->sll_ifindex == handlep->lo_ifindex)
1748 struct pcap_linux *handlep = handle->priv; local
1777 if (handlep->cooked)
1872 if (!handlep->sock_packet) {
1885 if (handlep->ifindex != -1 &&
1886 from.sll_ifindex != handlep->ifindex)
1904 if (handlep->cooked) {
1928 if (handlep->vlan_offset != -1) {
1954 if (len < (u_int)handlep->vlan_offset)
1964 memmove(bp, bp + VLAN_TAG_LEN, handlep->vlan_offset);
1969 tag = (struct vlan_tag *)(bp + handlep->vlan_offset);
2028 if (handlep->filter_in_userland && handle->fcode.bf_insns) {
2103 handlep->packets_read++;
2114 struct pcap_linux *handlep = handle->priv; local
2118 if (!handlep->sock_packet) {
2120 if (handlep->ifindex == -1) {
2130 if (handlep->cooked) {
2166 struct pcap_linux *handlep = handle->priv; local
2197 if_dropped = handlep->proc_dropped;
2198 handlep->proc_dropped = linux_if_drops(handlep->device);
2199 handlep->stat.ps_ifdrop += (handlep->proc_dropped - if_dropped);
2255 handlep->stat.ps_recv += kstats.tp_packets;
2256 handlep->stat.ps_drop += kstats.tp_drops;
2257 *stats = handlep->stat;
2301 stats->ps_recv = handlep->packets_read;
2303 stats->ps_ifdrop = handlep->stat.ps_ifdrop;
2829 struct pcap_linux *handlep; local
2844 handlep = handle->priv;
2856 handlep->filter_in_userland = 1;
2949 handlep->filter_in_userland = 0;
2974 if (handlep->filter_in_userland) {
3012 struct pcap_linux *handlep = handle->priv; local
3014 if (!handlep->sock_packet) {
3572 struct pcap_linux *handlep = handle->priv; local
3623 handlep->sock_packet = 0;
3636 handlep->lo_ifindex = iface_get_id(sock_fd, "lo", handle->errbuf);
3651 handlep->cooked = 0;
3681 if (handlep->mondevice != NULL)
3682 device = handlep->mondevice;
3729 handlep->cooked = 1;
3768 handlep->ifindex = iface_get_id(sock_fd, device,
3770 if (handlep->ifindex == -1) {
3775 if ((err = iface_bind(sock_fd, handlep->ifindex,
3798 handlep->cooked = 1;
3808 handlep->ifindex = -1;
3835 mr.mr_ifindex = handlep->ifindex;
3874 if (handlep->cooked) {
3891 handlep->vlan_offset = 2 * ETH_ALEN;
3899 handlep->vlan_offset = SLL_HDR_LEN - 2;
3903 handlep->vlan_offset = -1; /* unknown */
3966 struct pcap_linux *handlep = handle->priv; local
3973 handlep->oneshot_buffer = malloc(handle->snapshot);
3974 if (handlep->oneshot_buffer == NULL) {
3987 free(handlep->oneshot_buffer);
3997 free(handlep->oneshot_buffer);
4005 free(handlep->oneshot_buffer);
4019 switch (handlep->tp_version) {
4066 struct pcap_linux *handlep = handle->priv; local
4084 handlep->tp_hdrlen = val;
4093 handlep->tp_version = version;
4150 struct pcap_linux *handlep = handle->priv; local
4208 handlep->tp_version = TPACKET_V1;
4209 handlep->tp_hdrlen = sizeof(struct tpacket_hdr);
4243 handlep->tp_version = TPACKET_V1_64;
4244 handlep->tp_hdrlen = sizeof(struct tpacket_hdr_64);
4269 struct pcap_linux *handlep = handle->priv; local
4290 switch (handlep->tp_version) {
4401 tp_hdrlen = TPACKET_ALIGN(handlep->tp_hdrlen) + sizeof(struct sockaddr_ll) ;
4448 handlep->tp_version);
4583 req.tp_retire_blk_tov = (handlep->timeout>=0)?handlep->timeout:0;
4621 handlep->mmapbuflen = req.tp_block_nr * req.tp_block_size;
4622 handlep->mmapbuf = mmap(0, handlep->mmapbuflen,
4624 if (handlep->mmapbuf == MAP_FAILED) {
4649 void *base = &handlep->mmapbuf[i*req.tp_block_size];
4665 struct pcap_linux *handlep = handle->priv; local
4675 if (handlep->mmapbuf) {
4677 (void)munmap(handlep->mmapbuf, handlep->mmapbuflen);
4678 handlep->mmapbuf = NULL;
4705 struct pcap_linux *handlep = handle->priv; local
4708 memcpy(handlep->oneshot_buffer, bytes, h->caplen);
4709 *sp->pkt = handlep->oneshot_buffer;
4715 struct pcap_linux *handlep = handle->priv; local
4718 if (handlep->oneshot_buffer != NULL) {
4719 free(handlep->oneshot_buffer);
4720 handlep->oneshot_buffer = NULL;
4729 struct pcap_linux *handlep = handle->priv; local
4732 return (handlep->timeout<0);
4738 struct pcap_linux *handlep = handle->priv; local
4752 if (handlep->timeout >= 0) {
4757 handlep->timeout = ~handlep->timeout;
4760 if (handlep->timeout < 0) {
4761 handlep->timeout = ~handlep->timeout;
4765 set_poll_timeout(handlep);
4775 struct pcap_linux *handlep = handle->priv; local
4779 switch (handlep->tp_version) {
4810 struct pcap_linux *handlep = handle->priv; local
4827 ret = poll(&pollinfo, 1, handlep->poll_timeout);
4906 struct pcap_linux *handlep = handle->priv; local
4933 sll = (void *)frame + TPACKET_ALIGN(handlep->tp_hdrlen);
4934 if (handlep->cooked) {
4954 TPACKET_ALIGN(handlep->tp_hdrlen) +
4975 if (handlep->filter_in_userland && handle->fcode.bf_insns) {
4999 if (handlep->cooked) {
5007 handlep->vlan_offset != -1 &&
5008 tp_snaplen >= (unsigned int) handlep->vlan_offset)
5018 memmove(bp, bp + VLAN_TAG_LEN, handlep->vlan_offset);
5023 tag = (struct vlan_tag *)(bp + handlep->vlan_offset);
5057 struct pcap_linux *handlep = handle->priv; local
5101 handlep->packets_read++;
5113 if (handlep->blocks_to_filter_in_userland > 0) {
5114 handlep->blocks_to_filter_in_userland--;
5115 if (handlep->blocks_to_filter_in_userland == 0) {
5120 handlep->filter_in_userland = 0;
5141 struct pcap_linux *handlep = handle->priv; local
5185 handlep->packets_read++;
5197 if (handlep->blocks_to_filter_in_userland > 0) {
5198 handlep->blocks_to_filter_in_userland--;
5199 if (handlep->blocks_to_filter_in_userland == 0) {
5204 handlep->filter_in_userland = 0;
5226 struct pcap_linux *handlep = handle->priv; local
5270 handlep->packets_read++;
5282 if (handlep->blocks_to_filter_in_userland > 0) {
5283 handlep->blocks_to_filter_in_userland--;
5284 if (handlep->blocks_to_filter_in_userland == 0) {
5289 handlep->filter_in_userland = 0;
5312 struct pcap_linux *handlep = handle->priv; local
5318 if (handlep->current_packet == NULL) {
5334 if (pkts == 0 && handlep->timeout == 0) {
5346 if (handlep->current_packet == NULL) {
5351 handlep->current_packet = h.raw + h.h3->hdr.bh1.offset_to_first_pkt;
5352 handlep->packets_left = h.h3->hdr.bh1.num_pkts;
5354 packets_to_read = handlep->packets_left;
5368 struct tpacket3_hdr* tp3_hdr = (struct tpacket3_hdr*) handlep->current_packet;
5373 handlep->current_packet,
5384 handlep->packets_read++;
5386 handlep->current_packet = NULL;
5389 handlep->current_packet += tp3_hdr->tp_next_offset;
5390 handlep->packets_left--;
5393 if (handlep->packets_left <= 0) {
5402 if (handlep->blocks_to_filter_in_userland > 0) {
5403 handlep->blocks_to_filter_in_userland--;
5404 if (handlep->blocks_to_filter_in_userland == 0) {
5409 handlep->filter_in_userland = 0;
5417 handlep->current_packet = NULL;
5426 if (pkts == 0 && handlep->timeout == 0) {
5437 struct pcap_linux *handlep = handle->priv; local
5455 if (handlep->filter_in_userland)
5505 handlep->blocks_to_filter_in_userland = handle->cc - n;
5506 handlep->filter_in_userland = 1;
5710 struct pcap_linux *handlep = handle->priv; local
5987 handlep->oldmode = ireq.u.mode;
6013 handlep->must_do_on_close |= MUST_CLEAR_RFMON;
6251 handlep->must_do_on_close |= MUST_CLEAR_RFMON;
6587 struct pcap_linux *handlep = handle->priv; local
6617 handlep->sock_packet = 1;
6620 handlep->cooked = 0;
6688 handlep->must_do_on_close |= MUST_CLEAR_PROMISC;
6774 handlep->vlan_offset = -1; /* unknown */
6871 struct pcap_linux *handlep = handle->priv; local
6948 if (handlep->cooked) {