1. A method for processing packets in a network device, the method comprising: parsing a packet by a programmable processing unit executing computer readable instructions stored in a non-transitory computer readable storage medium, including identifying, by executing instructions stored in the non-transitory computer readable storage memory, respective locations of protocol headers within a header of the packet, the respective locations corresponding to respective one or more protocol layers, and updating values of respective general purpose anchors to indicate the respective locations of the protocol headers, wherein the general purpose anchors do not globally correspond to specific protocol layers; generating, by a hardware key generator block and using the updated values of the respective general purpose anchors, a lookup key corresponding to the packet, including extracting, using an updated value of one of the general purpose anchors, one or more fields from one of the protocol headers, and generating the lookup key to include the one or more fields; providing the lookup key to a lookup engine; and performing, by the lookup engine and based on the lookup key, a lookup operation with respect to the packet.