generate and extract packets