Lines Matching defs:handlep

381 	struct pcap_linux *handlep = handle->priv;
382 handlep->poll_breakloop_fd = -1;
542 struct pcap_linux *handlep = handle->priv;
623 handlep->mondevice = strdup(mondevice);
624 if (handlep->mondevice == NULL) {
792 struct pcap_linux *handlep = handle->priv;
798 if (handlep->must_do_on_close != 0) {
804 if (handlep->must_do_on_close & MUST_DELETE_MONIF) {
805 ret = nl80211_init(handle, &nlstate, handlep->device);
808 handlep->device, handlep->mondevice);
815 handlep->mondevice, handle->errbuf);
835 if (handlep->oneshot_buffer != NULL) {
836 free(handlep->oneshot_buffer);
837 handlep->oneshot_buffer = NULL;
840 if (handlep->mondevice != NULL) {
841 free(handlep->mondevice);
842 handlep->mondevice = NULL;
844 if (handlep->device != NULL) {
845 free(handlep->device);
846 handlep->device = NULL;
849 if (handlep->poll_breakloop_fd != -1) {
850 close(handlep->poll_breakloop_fd);
851 handlep->poll_breakloop_fd = -1;
898 set_poll_timeout(struct pcap_linux *handlep)
903 if (handlep->timeout == 0) {
917 if (handlep->tp_version == TPACKET_V3 && broken_tpacket_v3)
918 handlep->poll_timeout = 1; /* don't block for very long */
921 handlep->poll_timeout = -1; /* block forever */
922 } else if (handlep->timeout > 0) {
929 if (handlep->tp_version == TPACKET_V3 && !broken_tpacket_v3)
930 handlep->poll_timeout = -1; /* block forever, let TPACKET_V3 wake us up */
933 handlep->poll_timeout = handlep->timeout; /* block for that amount of time */
940 handlep->poll_timeout = 0;
947 struct pcap_linux *handlep = handle->priv;
951 if (handlep->poll_breakloop_fd != -1) {
957 (void)write(handlep->poll_breakloop_fd, &value, sizeof(value));
969 struct pcap_linux *handlep = handle->priv;
978 handlep->vlan_offset = 2 * ETH_ALEN;
986 handlep->vlan_offset = SLL_HDR_LEN - 2;
990 handlep->vlan_offset = -1; /* unknown */
1006 struct pcap_linux *handlep = handle->priv;
1052 handlep->device = strdup(device);
1053 if (handlep->device == NULL) {
1077 handlep->timeout = handle->opt.timeout;
1086 handlep->sysfs_dropped = linux_if_drops(handlep->device);
1117 handlep->poll_breakloop_fd = eventfd(0, EFD_NONBLOCK);
1118 if (handlep->poll_breakloop_fd == -1) {
1162 if ((ret = iface_bind(handle->fd, handlep->ifindex,
1178 switch (handlep->tp_version) {
1221 struct pcap_linux *handlep = handle->priv;
1230 if (sll->sll_ifindex == handlep->lo_ifindex)
1277 struct pcap_linux *handlep = handle->priv;
1282 * If handlep->ifindex is -1, the socket isn't bound, meaning
1287 if (handlep->ifindex == -1)
1318 struct pcap_linux *handlep = handle->priv;
1321 if (handlep->ifindex == -1) {
1331 if (handlep->cooked) {
1360 struct pcap_linux *handlep = handle->priv;
1418 if_dropped = handlep->sysfs_dropped;
1419 handlep->sysfs_dropped = linux_if_drops(handlep->device);
1420 handlep->stat.ps_ifdrop += (u_int)(handlep->sysfs_dropped - if_dropped);
1472 handlep->stat.ps_recv += kstats.tp_packets;
1473 handlep->stat.ps_drop += kstats.tp_drops;
1474 *stats = handlep->stat;
2259 /* handlep->cooked = 1; */
2302 /* handlep->cooked = 1; */
2327 struct pcap_linux *handlep = handle->priv;
2386 * "handlep->lo_ifindex" to -1.
2394 handlep->lo_ifindex = iface_get_id(sock_fd, "lo", handle->errbuf);
2409 handlep->cooked = 0;
2440 if (handlep->mondevice != NULL)
2441 device = handlep->mondevice;
2493 handlep->cooked = 1;
2533 handlep->ifindex = iface_get_id(sock_fd, device,
2535 if (handlep->ifindex == -1) {
2540 if ((err = iface_bind(sock_fd, handlep->ifindex,
2561 handlep->cooked = 1;
2580 handlep->ifindex = -1;
2607 mr.mr_ifindex = handlep->ifindex;
2647 if (handlep->cooked) {
2705 struct pcap_linux *handlep = handle->priv;
2712 handlep->oneshot_buffer = malloc(handle->snapshot);
2713 if (handlep->oneshot_buffer == NULL) {
2725 free(handlep->oneshot_buffer);
2726 handlep->oneshot_buffer = NULL;
2735 free(handlep->oneshot_buffer);
2736 handlep->oneshot_buffer = NULL;
2751 set_poll_timeout(handlep);
2766 struct pcap_linux *handlep = handle->priv;
2810 handlep->tp_hdrlen = val;
2819 handlep->tp_version = version;
2911 struct pcap_linux *handlep = handle->priv;
2953 if (handlep->cooked)
2969 switch (handlep->tp_version) {
3051 tp_hdrlen = TPACKET_ALIGN(handlep->tp_hdrlen) + sizeof(struct sockaddr_ll) ;
3098 handlep->tp_version);
3234 if (handlep->timeout > 0) {
3236 req.tp_retire_blk_tov = handlep->timeout;
3237 } else if (handlep->timeout == 0) {
3284 handlep->mmapbuflen = req.tp_block_nr * req.tp_block_size;
3285 handlep->mmapbuf = mmap(0, handlep->mmapbuflen,
3287 if (handlep->mmapbuf == MAP_FAILED) {
3310 u_char *base = &handlep->mmapbuf[i*req.tp_block_size];
3326 struct pcap_linux *handlep = handle->priv;
3340 if (handlep->mmapbuf) {
3342 (void)munmap(handlep->mmapbuf, handlep->mmapbuflen);
3343 handlep->mmapbuf = NULL;
3370 struct pcap_linux *handlep = handle->priv;
3373 memcpy(handlep->oneshot_buffer, bytes, h->caplen);
3374 *sp->pkt = handlep->oneshot_buffer;
3380 struct pcap_linux *handlep = handle->priv;
3383 return (handlep->timeout<0);
3389 struct pcap_linux *handlep = handle->priv;
3406 if (handlep->timeout >= 0) {
3411 handlep->timeout = ~handlep->timeout;
3413 if (handlep->poll_breakloop_fd != -1) {
3415 close(handlep->poll_breakloop_fd);
3416 handlep->poll_breakloop_fd = -1;
3422 if (handlep->poll_breakloop_fd == -1) {
3424 if ( ( handlep->poll_breakloop_fd = eventfd(0, EFD_NONBLOCK) ) == -1 ) {
3431 if (handlep->timeout < 0) {
3432 handlep->timeout = ~handlep->timeout;
3436 set_poll_timeout(handlep);
3446 struct pcap_linux *handlep = handle->priv;
3450 switch (handlep->tp_version) {
3469 struct pcap_linux *handlep = handle->priv;
3477 if ( handlep->poll_breakloop_fd == -1 ) {
3488 pollinfo[1].fd = handlep->poll_breakloop_fd;
3541 timeout = handlep->poll_timeout;
3552 if (handlep->netdown) {
3651 handlep->netdown = 1;
3683 nread = read(handlep->poll_breakloop_fd, &value,
3752 if (handlep->netdown) {
3773 pcapint_strlcpy(ifr.ifr_name, handlep->device,
3790 handlep->device);
3803 handlep->netdown = 0;
3813 if (handlep->poll_timeout == 0)
3834 struct pcap_linux *handlep = handle->priv;
3875 sll = (void *)(frame + TPACKET_ALIGN(handlep->tp_hdrlen));
3876 if (handlep->cooked) {
3897 TPACKET_ALIGN(handlep->tp_hdrlen) +
3937 TPACKET_ALIGN(handlep->tp_hdrlen) +
4137 if (handlep->filter_in_userland && handle->fcode.bf_insns) {
4161 if (handlep->cooked) {
4173 handlep->vlan_offset != -1 &&
4174 tp_snaplen >= (unsigned int) handlep->vlan_offset)
4184 memmove(bp, bp + VLAN_TAG_LEN, handlep->vlan_offset);
4189 tag = (struct vlan_tag *)(bp + handlep->vlan_offset);
4229 struct pcap_linux *handlep = handle->priv;
4297 if (handlep->blocks_to_filter_in_userland > 0) {
4298 handlep->blocks_to_filter_in_userland--;
4299 if (handlep->blocks_to_filter_in_userland == 0) {
4304 handlep->filter_in_userland = 0;
4326 struct pcap_linux *handlep = handle->priv;
4332 if (handlep->current_packet == NULL) {
4348 if (pkts == 0 && handlep->timeout == 0) {
4373 if (handlep->current_packet == NULL) {
4378 handlep->current_packet = h.raw + h.h3->hdr.bh1.offset_to_first_pkt;
4379 handlep->packets_left = h.h3->hdr.bh1.num_pkts;
4381 packets_to_read = handlep->packets_left;
4395 struct tpacket3_hdr* tp3_hdr = (struct tpacket3_hdr*) handlep->current_packet;
4400 handlep->current_packet,
4412 handlep->current_packet = NULL;
4415 handlep->current_packet += tp3_hdr->tp_next_offset;
4416 handlep->packets_left--;
4419 if (handlep->packets_left <= 0) {
4428 if (handlep->blocks_to_filter_in_userland > 0) {
4429 handlep->blocks_to_filter_in_userland--;
4430 if (handlep->blocks_to_filter_in_userland == 0) {
4435 handlep->filter_in_userland = 0;
4443 handlep->current_packet = NULL;
4452 if (pkts == 0 && handlep->timeout == 0) {
4466 struct pcap_linux *handlep;
4480 handlep = handle->priv;
4492 handlep->filter_in_userland = 1;
4584 handlep->filter_in_userland = 0;
4620 if (handlep->filter_in_userland) {
4643 if (handlep->filter_in_userland)
4693 handlep->blocks_to_filter_in_userland = handle->cc - n;
4694 handlep->filter_in_userland = 1;
4797 struct pcap_linux *handlep = handle->priv;
4876 handlep->mondevice);
4885 pcapint_strlcpy(ifr.ifr_name, handlep->mondevice, sizeof(ifr.ifr_name));
4889 handlep->mondevice);
4891 handlep->mondevice);
4899 handlep->mondevice);
4901 handlep->mondevice);
4915 handlep->must_do_on_close |= MUST_DELETE_MONIF;
5411 struct pcap_linux *handlep = handle->priv;
5455 if (handlep->cooked) {