static int pcap_stats_acn(pcap_t *handle, struct pcap_stat *ps) { unsigned char buf[12]; send_to_fd(handle->fd, 1, (unsigned char *)"S"); /* send the get_stats command to the IOP */ if (read_client_nbytes(handle->fd, sizeof(buf), buf) == -1) return -1; /* try reading the required bytes */ ps->ps_recv = ntohl(*(uint32_t *)&buf[0]); /* break the buffer into its three 32 bit components */ ps->ps_drop = ntohl(*(uint32_t *)&buf[4]); ps->ps_ifdrop = ntohl(*(uint32_t *)&buf[8]); return 0; }
static void acn_start_monitor(int fd, int snaplen, int timeout, int promiscuous, int direction) { unsigned char buf[8]; unit_t *u; //printf("acn_start_monitor()\n"); // fulko find_unit_by_fd(fd, NULL, NULL, &u); if (u->first_time == 0) { buf[0] = 'M'; *(uint32_t *)&buf[1] = htonl(snaplen); buf[5] = timeout; buf[6] = promiscuous; buf[7] = direction; //printf("acn_start_monitor() first time\n"); // fulko send_to_fd(fd, 8, buf); /* send the start monitor command with its parameters to the IOP */ u->first_time = 1; } //printf("acn_start_monitor() complete\n"); // fulko }