Methods and apparatus are provided for classifying data packets in a data
processing device. In one aspect, packets are classified according to a
plurality of sets of processing rules. Each rule defines a plurality of
rule ranges, each rule range indicating a range of possible values of a
corresponding data item in the packet for which the rule applies, and
rule ranges defined in different rule sets correspond to a common set of
data items. Independent item searches are performed for respective data
items in the packet corresponding to rule ranges defined in the rule
sets. The item search for a data item comprises selecting a range
identifier corresponding to the value of the data item from a
predetermined set of range identifiers for that data item. This set of
range identifiers indicates, for all possible values of the data item,
which of the rule ranges corresponding to the data item in the rule sets
a value intersects. Next, respective final searches are performed for the
rule sets based on range identifiers selected by the item searches. The
final search for each rule set uses the selected range identifier for
each data item corresponding to a rule range defined in that rule set,
and predetermined rule data encoding the rule ranges for rules in that
set, to identify at least one rule of any rules in the set which are
applicable to the data packet. Thus packets can be classified according
to multiple rule sets, but the initial item searches are performed only
once, for all the rule sets.