winpcap handle problem
-
:suss:In the code below packet_handler function is not the member of the class I want to display the data generating from this function to be displayed on the list box. But handle to the list box is not there as is not the member of the class. Is there any way I can get handle of listbox into the function p_h below. It is important the funtion declaration of "paket_handler" is defined in the library file so the return type or parameter cannot change. //defined in winpcap library void sniff::OnButton1() { pcap_loop(adhandle, 0, packet_handler, NULL);//call to the call back //packet_handler function } void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data) { ih = (ip_header *) (pkt_data + 14); //length of ethernet header ip_len = (ih->ver_ihl & 0xf) * 4; ......//more code ...... /* print ip addresses and udp ports */ printf("%d.%d.%d.%d -> %d.%d.%d.%d\n", ih->saddr.byte1,ih->saddr.byte2,ih->saddr.byte3,ih->saddr.byte4, ih->daddr.byte1,ih->daddr.byte2,ih->daddr.byte3,ih->daddr.byte4); } Reply me soon