Efficient pre-filtering techniques for packet inspection