1. A method for heuristics-based adaptive protocol parsing, the method comprising: receiving, at a hardware communications interface, a message of a first protocol, wherein the first protocol defines a plurality of valid message formats; parsing the received message using a protocol tree for determining whether the received message is in one of the plurality of valid message formats; and while parsing the received message, using heuristics to optimize the protocol tree.