based on libpcap