factorize qpacketsniffer code for linux