1. A method of handling data packets in a network device, said method comprising: receiving an incoming data packet; parsing the incoming data packet to obtain a portion of the incoming data packet; comparing said portion with rules stored in a rule table, where each rule of said rules specifies a set of actions; selecting a match between said portion and a particular rule of said rules; and executing a particular set of actions specified by said particular rule; wherein each rule field of said rules includes a mask and a selection flag used in the comparing said portion with each rule.