A method, applied to a parsing component, wherein the parsing component comprises m parsing units, at least one parsing unit in the m parsing units comprises a fixed parsing module and a configurable parsing module, the fixed parsing module stores fixed protocol content, the configurable parsing module is configured with protocol content, and m is a positive integer;
- and
- the method comprises:
- separately parsing, by a target parsing unit in the m parsing units by using a fixed parsing module in the target parsing unit and a configurable parsing module in the target parsing unit, a packet input into the target parsing unit, wherein the target parsing unit is any parsing unit that is in the m parsing units and that comprises a fixed parsing module and a configurable parsing module, wherein
- the separately parsing, by a fixed parsing module in the target parsing unit and a configurable parsing module in the target parsing unit, a packet input into the target parsing unit comprises:
- parsing, by the fixed parsing module, the packet based on protocol content in the fixed parsing module;
- and
- parsing, by the configurable parsing module, the packet based on protocol content in the configurable parsing module;
- wherein a fixed parsing module in the m parsing units corresponds to n protocol layers, a fixed parsing module corresponding to each protocol layer stores fixed protocol content of the protocol layer, and n is a positive integer;
- and
- the configuring, by the configurable parsing module, the protocol content in the configurable parsing module based on obtained content configuration information comprises:
- configuring, by the configurable parsing module, protocol content of a target protocol layer in the configurable parsing module based on obtained content configuration information of the target protocol layer, wherein the target protocol layer is one of the n protocol layers, or the target protocol layer is a protocol layer inserted into the n protocol layers;
- the m parsing units are sequentially connected, the m parsing units each comprise a configurable parsing module and a fixed parsing module, fixed parsing modules in the m parsing units form w fixed parsing groups, each fixed parsing group comprises n fixed parsing modules, the n fixed parsing modules are in a one-to-one correspondence with the n protocol layers, an ith fixed parsing module in the n fixed parsing modules stores fixed protocol content of an ith protocol layer in the n protocol layers, and an (i−1)th fixed parsing module in the n fixed parsing modules stores a fixed protocol type of the ith protocol layer, wherein the ith fixed parsing module corresponds to the ith protocol layer, 1<i≤n, and both w and i are positive integers;
- in the m parsing units, a ith parsing unit comprises a jth configurable parsing module and an ith fixed parsing module in a kth fixed parsing group, and a (j−1)th parsing unit comprises a (j−1)th configurable parsing module and an (i−1)th fixed parsing module in the kth fixed parsing group, wherein 1≤k≤w, 1<j≤m, and both k and j are integers;
- the configuring, by the configurable parsing module, protocol content of a target protocol layer in the configurable parsing module based on obtained content configuration information of the target protocol layer comprises:
- configuring, by the jth configurable parsing module, the protocol content of the target protocol layer in the jth configurable parsing module based on the obtained content configuration information of the target protocol layer;
- and
- the method further comprises:
- configuring, by the (j−1)th configurable parsing module, a protocol type of the target protocol layer in the (i−1)th configurable parsing module based on obtained type configuration information of the target protocol layer, wherein
- the target protocol layer is the ith protocol layer, or the target protocol layer is a protocol layer inserted between the ith protocol layer and an (i+1)th protocol layer in the n protocol layers.