void MainWindow::createcapthread() { capture = new Capture_thread; connect(capture, SIGNAL(start_cap()), this, SLOT(start_thread())); connect(capture, SIGNAL(show_listdata(const ListData, QString)), this, SLOT(update_show(const ListData, QString)), Qt::QueuedConnection); }
int main(int argc, char **argv) { capdev_t interfaces[32]; int numdev, i; /* Try loading the DLL. */ #ifdef _WIN32 pcap_handle = dynld_module("wpcap.dll", pcap_imports); #else pcap_handle = dynld_module("libpcap.so", pcap_imports); #endif if (pcap_handle == NULL) { #ifdef _WIN32 fprintf(stderr, "Unable to load WinPcap DLL !\n"); #else fprintf(stderr, "Unable to load libpcap.so !\n"); #endif return(1); } /* Get the list. */ numdev = get_devlist(interfaces); if (argc == 1) { /* No arguments, just show the list. */ show_devs(interfaces, numdev); dynld_close(pcap_handle); return(numdev); } /* Assume argument to be the interface number to listen on. */ i = atoi(argv[1]); if (i < 0 || i > numdev) { fprintf(stderr, "Invalid interface number %d !\n", i); dynld_close(pcap_handle); return(1); } /* Looks good, go and listen.. */ i = start_cap(interfaces[i-1].device); dynld_close(pcap_handle); return(i); }