1. A computer-implemented method for retrieving access rules, the method comprising: receiving an incoming packet that includes a plurality of fields; forming a key from a plurality of the fields, wherein the formed key includes a plurality of subkeys; selecting one or more subkeys from the key; searching entries stored in one or more subtables for the subkeys, wherein a different subtable is used to search for each of the subkeys; and wherein a next level subkey is selected and a next level subtable is searched when a pointer value is encountered in the previous level subtable; and in response to identifying the rule corresponding to one of the entries that corresponds to the searched subkeys: retrieving a stored key and a stored mask from the entry that identified the rule; masking the key using the stored mask, the masking resulting in a masked key; applying the identified rule in response to the masked key matching the stored key; and applying the default rule in response to the masked key not matching the stored key.