A method and apparatus for performing multi-stage classification of a
plurality of strings extracted from a packet, for example, is disclosed.
The method causes a plurality of hierarchical tables to be searched, each
table having criteria derived from the policies with which the packet is
classified. One of the plurality of the strings is searched at each of
the plurality of tables. Each match identified in one table is used to
retrieve a pointer to a subsequent table. Each of the matches in each of
the hierarchical tables is scored in order to generate a cumulative score
for each policy, a score may be used to select from a plurality of
applicable policies. In a first embodiment, a plurality of policies, as
embodied in the hierarchical tables, are searched and the best policy
selected. In a second embodiment, recursive searching is employed.