For routing packets by rules in a packet network, a system and method in a routing
device for selecting rules to apply to packets having each N fields in a header,
considers rules as entities in N-dimensional space, projects the rules onto N-axes
in the space, marks the beginning and ending of each projection as breakpoints,
numbers intervals between breakpoints in sequential binary numbers, associates
a subset of the set of rules as applicable to each interval between breakpoints
on each axis, then considers a packet as a point in the N-dimensional space according
to its header field values, locates the binary numbered interval into which the
point projects on each axis by performing a search on each axis for the numbered
interval into which the point projects on that axis, thereby determining the subset
of rules applying to the packet for that axis, and determines the second set of
matching rules from the subsets of rules by selecting those rules as matching the
packet that apply to the packet on at least one of the N axes. Optional and enhanced
methods are taught for special circumstances.