摘要 |
<p>A method and apparatus for protocol parsing are disclosed, solving the following problem: when protocol parsing is performed by scanning bytes one by one according to the prior art, parsing of new rules requires a large amount of time, which is complicated, and does not facilitate extension of new rules. The method includes: performing flow table matching on a received packet to recognize a protocol of the packet; and when a protocol type of the packet is recognized and it is determined that the protocol type of the packet is a text-based protocol type, performing keyword matching on the packet according to a keyword matching rule in a keyword library corresponding to the protocol type of the packet, and extracting content of a keyword to be parsed in the packet; wherein, the keyword matching rule in the keyword library includes a keyword to be parsed that is expressed by using a regular expression and content of the keyword. The present invention applies to a device that parses a protocol of a packet.</p> |