1. A packet transfer controlling apparatus comprising: a code storage unit that stores, for each of a plurality of comparing units that outputs a comparison result of indicating whether information selected from information included in an input packet as information that belongs to a classification and a comparison value set as a comparison target for the information that belongs to the classification match each other, a plurality of associations of a code and the classification to be compared by the comparing unit when specification of the code is accepted; and a plurality of selecting units that sets, when specification of the code is accepted, the information that belongs to the classification stored in the code storage unit in association with the code for the comparing unit that performs a subsequent process as information to be selected from the information included in the input packet, and selects, when the input of the packet is accepted, the information that belongs to the classification from the information included in the packet, wherein the plurality of comparing units outputs a comparison result of determining whether the information selected by the selecting unit that performs a preceding process and the comparison value set as the comparison target for the selected information match each other, and further comprising a rule searching unit that searches, when the comparison results are output from all of the comparing units, for a plurality of rules that each set a matching relation through logical AND regarding each classification, the matching relation indicating whether the information that belongs to the classification and the comparison value match each other to find which rule corresponds to the input packet, and outputs identification information that identifies the found rule; and a transfer controlling unit that controls transfer of the packet based on the identification information output by the rule searching unit.