1. A computer-readable storage device storing program instructions for managing a plurality of multi-field classification rules used by a network switch to classify packets being transmitted via a network, the computer-readable storage device comprising: program instructions for providing a first table, the first table including a plurality of entries, each of the plurality of entries in the first table corresponding to a plurality of ingress rules relating to an ingress context and defining a tree structure to distinguish between the plurality of ingress rules related to the ingress context, wherein each ingress context refers to one or more session identification parameters of a packet that are used to determine whether any of the plurality of ingress rules related to the respective ingress context is applicable to the packet; program instructions for providing a second table separate from the first table, the second table including a plurality of entries each of the plurality of entries in the second table corresponding to a plurality of rules relating to an egress context and defining a tree structure to distinguish between the plurality of egress rules related to the egress context, wherein each egress context refers to one or more session identification parameters of a packet that are used to determine whether any of the plurality of egress rules related to the respective egress context is applicable to the packet; and program instructions for storing the first table and the second table in a storage of the network switch.