CN115714825A - Message processing method, device, equipment and storage medium - Google Patents

Message processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115714825A
CN115714825A CN202211379645.1A CN202211379645A CN115714825A CN 115714825 A CN115714825 A CN 115714825A CN 202211379645 A CN202211379645 A CN 202211379645A CN 115714825 A CN115714825 A CN 115714825A
Authority
CN
China
Prior art keywords
message
information
type information
processed
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211379645.1A
Other languages
Chinese (zh)
Inventor
李京河
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Armyfly Technology Co Ltd
Original Assignee
Beijing Armyfly Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Armyfly Technology Co Ltd filed Critical Beijing Armyfly Technology Co Ltd
Priority to CN202211379645.1A priority Critical patent/CN115714825A/en
Publication of CN115714825A publication Critical patent/CN115714825A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a message processing method, a message processing device, message processing equipment and a storage medium. The message processing method comprises the following steps: determining first message type information of a message to be processed and first service type information of message processing equipment; determining a target processing template corresponding to the first message type information and the first service type information in the message processing template set; and acquiring target data indicated by the message extraction information from the message to be processed according to one or more message extraction information included in the target processing template. According to the technical scheme, the target processing template is determined in the message processing template set through the first message type information of the message to be processed and the first service type information of the message processing equipment, then the information is extracted through one or more messages included in the target processing template, the target data are obtained from the message to be processed, the message processing equipment does not need to repeatedly read data from an external memory, and the forwarding performance of the message processing equipment during message processing is improved.

Description

Message processing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a packet.
Background
The basic process of processing a message in the existing message processing device, such as a forwarding chip, a network processor or a switching chip, is that the message processing device pre-reads the first 64 bytes of the message from an external memory to an internal cache, so as to facilitate subsequent table item lookup and message editing processing. However, since the internal cache of the message processing device is very small, generally, several sets of registers are used, if data after 64 bytes of the message needs to be continuously accessed, the data needs to be repeatedly read from the external memory to the internal cache, which increases the interaction flow between the message processing device and the external memory, and further affects the forwarding performance of the message processing device, and cannot meet the scenario of line speed forwarding. Therefore, how to improve the forwarding performance of the message processing device when processing the message is a technical problem to be solved urgently at present.
Disclosure of Invention
The invention provides a message processing method, a message processing device, message processing equipment and a storage medium, which can extract required data from a message to be processed through a message processing template without repeatedly reading the data from an external memory by the message processing equipment, thereby improving the forwarding performance of the message processing equipment when processing the message.
In a first aspect, an embodiment of the present invention provides a packet processing method, which is applied to a packet processing device, and the method includes:
determining first message type information of a message to be processed and first service type information of the message processing equipment;
determining a target processing template corresponding to the first message type information and the first service type information in a message processing template set;
and acquiring target data indicated by the message extraction information from the message to be processed according to one or more message extraction information included in the target processing template.
In a second aspect, an embodiment of the present invention provides a packet processing apparatus, including:
the first determining module is used for determining first message type information of a message to be processed and first service type information of the message processing equipment;
a second determining module, configured to determine, in a packet processing template set, a target processing template corresponding to the first packet type information and the first service type information;
and the acquisition module is used for acquiring target data indicated by the message extraction information from the message to be processed according to one or more message extraction information included in the target processing template.
In a third aspect, an embodiment of the present invention provides a packet processing device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method according to the first aspect.
According to the technical scheme of the embodiment of the invention, the target processing template is determined in the message processing template in a centralized manner through the first message type information of the message to be processed and the first service type information of the message processing equipment, and then the target data is obtained from the message to be processed through one or more message extraction information included in the target processing template, so that the message processing equipment does not need to repeatedly read data from an external memory, and the forwarding performance of the message processing equipment during message processing is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a message processing method according to an embodiment of the present invention;
fig. 2 is a flowchart of a message processing method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an IP packet according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an MPLS packet according to a third embodiment of the present invention;
fig. 5 is a flowchart of determining a target processing template in a message processing template set according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of a message processing apparatus according to a fourth embodiment of the present invention;
fig. 7 shows a schematic structural diagram of a message processing device that can be used to implement an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It can be understood that, before the technical solutions disclosed in the embodiments of the present invention are used, the type, the use range, the use scenario, etc. of the personal information related to the present disclosure should be informed to the user and authorized by the user in a proper manner according to relevant laws and regulations.
Example one
Fig. 1 is a flowchart of a message processing method according to an embodiment of the present invention, where the message processing method is applied to a message processing device, and this embodiment is applicable to a case of processing a message, and the method may be executed by a message processing apparatus, and the message processing apparatus may be implemented in a software and/or hardware manner and is integrated in the message processing device. Further, the message processing device includes, but is not limited to: a forwarding chip, a network processor or a switching chip, etc. As shown in fig. 1, the method includes:
s110, determining first message type information of a message to be processed and first service type information of message processing equipment.
The message processing device may refer to a device capable of processing a message, and the message processing device is not limited, for example, the message processing device may be a forwarding chip, a network processor, or a switching chip.
The message to be processed may be a message that needs to be processed by the message processing device, and the message to be processed may extract required data included in the message to be processed to an internal cache, so as to perform operations such as table item lookup and message editing processing in the following.
The first packet type information may be information indicated by a packet type corresponding to the packet to be processed. The first message type information may indicate a message type corresponding to a message to be processed, and the message type is not limited, for example, the message type may be an Internet Protocol (IP) message, a Multiprotocol Label Switching (MPLS) message, a User Data Protocol (UDP) message, or a Transmission Control Protocol (TCP) message.
The first service type information may refer to information indicated by a service type that the message processing device needs to implement. The first service type information may indicate a service type that the message processing device needs to implement, where the service type is not limited, and the service type may include, but is not limited to, an Access Control List (ACL), a Network Address Translation (NAT), deep Packet Inspection (DPI), and the like. For example, the service type corresponding to the service processing based on the access control list may be the access control list.
The determination method of the first packet type information of the packet to be processed is not limited, as long as the first packet type information of the packet to be processed can be determined. If the message processing device may pre-read a part of message data included in the message to be processed from the external memory to the internal cache, the processor included in the message processing device may obtain the part of message data through the internal cache, and determine the first message type information of the message to be processed through the part of message data. The partial message data may be data read by the message processing device from an external memory according to actual needs, which is not limited to this, as long as the first message type information of the message to be processed can be determined by the partial message data. The partial message data may be data of a set byte of a message header of the message to be processed.
The determination method of the first service type information of the message processing device is not limited, as long as the first service type information of the message processing device can be determined. If the determination can be made according to the receiving port of the message processing device, for example, when the receiving port of the message processing device indicates NAT enabling, it is determined that the service type indicated by the first service type information of the message processing device is NAT; or when the receiving port of the message processing equipment indicates ACL enabling, determining that the service type indicated by the first service type information of the message processing equipment is ACL.
Determining first message type information of a message to be processed and first service type information of message processing equipment so as to determine a target processing template in a message processing template set subsequently through the determined first message type information and the first service type information.
S120, determining a target processing template corresponding to the first message type information and the first service type information in the message processing template set.
The set of message processing templates may refer to a set of one or more message processing templates, where a message processing template may refer to a template for a message processing device to process a message. The target processing template may be a message processing template set corresponding to the first message type information and the first service type information, and the message processing device may extract required data from the message to be processed through the target processing template.
In the packet processing template set, the manner of determining the target processing template corresponding to the first packet type information and the first service type information is not limited, as long as the target processing template corresponding to the first packet type information and the first service type information can be determined. For example, each message processing template in the message processing template set stores the message type information and the service type information corresponding to the message processing template, the message processing template set can use the first message type information and the first service type information as indexes, find the message processing template in which the message type information stored in the message processing template set is the same as the first message type information and the service type information is the same as the first service type information, and determine the found message processing template as the target processing template corresponding to the first message type information and the first service type information.
S130, according to one or more message extraction information included in the target processing template, target data indicated by the message extraction information is obtained from the message to be processed.
The message extraction information may be considered as information indicating target data to be extracted, the message extraction information may indicate the target data to be extracted through information indicating a message extraction position, a field length, a field type, or the like, and the message extraction information may enable the message processing device to extract the target data in the message to be processed. The target data may refer to data that the message processing device needs to extract in the message to be processed. And the message to be processed can be processed based on the target data.
The number of message extraction information is not limited, and one or more message extraction information may be included in the target processing template.
In one embodiment, for any message extraction information, there may be only one target data corresponding to the message extraction information, that is, it may be understood that only one target data may be extracted from the message to be processed by using one message extraction information. Correspondingly, the message extraction information and the target data are the same in number, and the number of the target data can be one or more.
In one embodiment, for any message extraction information, there may be multiple corresponding target data, that is, it may be understood that, by using one message extraction information, multiple corresponding target data may be extracted from the message to be processed. The plurality of target data may be adjacent data in the message to be processed. The message extraction information may include a location offset information, a field length information, and a plurality of field type information corresponding to different target data, and extracts a plurality of target data. In this embodiment, the position offset information may be target data closest to a start position of the to-be-processed packet in the to-be-processed packet, and the position offset information represents an offset between the start position of the target data and the start position of the to-be-processed packet. The field length information may indicate the length of all target data. The field type information may characterize the field type of each target data.
In one embodiment, the message extraction information includes at least:
position offset information, field length information and field type information;
the position offset information indicates offset information of the initial position of the corresponding target data relative to the initial position of the message to be processed, the field length information indicates length information of the corresponding target data, and the field type information indicates type information of the corresponding target data.
The position offset information indicates offset information of a starting position of corresponding target data relative to a starting position of a message to be processed, which can be understood as that offset of the starting position of the target data relative to the starting position of the message to be processed can be determined through the position offset information, that is, the starting position of a message processing device when extracting the target data from the message to be processed can be determined through the position offset information.
The field length information indicates length information of corresponding target data, and it can be understood that the length of the target data extracted by the message processing device in the message to be processed can be determined through the field length information.
The field type information indicates type information of the corresponding target data, and it can be understood that the field type of the target data extracted by the message processing device in the message to be processed can be determined by the field type information.
According to one or more message extraction information included in a target processing template, target data indicated by the message extraction information is acquired from a message to be processed, and it can be understood that if the target processing template includes one message extraction information, the message extraction information can be used for determining the position offset information, the field length information, the field type information and the like included in the message extraction information, so that message processing equipment can determine the initial position of the target data to be extracted in the message to be processed according to the position offset information, determine the length of the target data according to the field length information, determine the field type of the target data according to the field type information, and further enable the message processing equipment to extract the target data in the message to be processed; if the target processing template includes a plurality of message extraction information, the message processing device may extract a plurality of target data corresponding to the plurality of message extraction information from the message to be processed according to the position offset information, the field length information, the field type information, and the like included in each message extraction information.
In an embodiment, the first message type information of the message to be processed indicates that the message type is an IP message, the first service type information of the message processing device indicates that the service type is an NAT, and the corresponding target processing template may include two message extraction information, i.e., a message extraction information one and a message extraction information two. For example, the first message extraction information includes: the position offset information indicates that the offset of the starting position of the corresponding target data relative to the starting position of the message to be processed is 18, the field length information indicates that the length of the target data is 28, and the field type information indicates that the field type of the target data is IP + TCP; the message extraction information II comprises: the position offset information indicates that an offset of a start position of the corresponding target data relative to a start position of the message to be processed is 46, the field length information indicates that the length of the target data is 16, and the field type information indicates that a field type of the target data is a File Transfer Protocol (FTP).
The field type IP + TCP may be considered to correspond to two target data, that is, IP type target data and TCP type target data. The field type IP + TCP may also be considered as a corresponding target data, and the target data includes IP type target data and TCP type target data.
According to the technical scheme of the embodiment of the invention, the target processing template is determined in the message processing template in a centralized manner through the first message type information of the message to be processed and the first service type information of the message processing equipment, then the target data indicated by the message extraction information is obtained from the message to be processed through one or more message extraction information included in the target processing template, the message processing equipment does not need to repeatedly read data from an external memory, the target data can be extracted from the message to be processed through the target processing template, and the forwarding performance of the message processing equipment in message processing is improved.
Example two
Fig. 2 is a flowchart of a message processing method according to a second embodiment of the present invention, where in this embodiment, on the basis of the first embodiment, the first message type information of the message to be processed is determined, the target data indicated by the message extraction information is obtained from the message to be processed according to one or more pieces of message extraction information included in the target processing template, and the content before determining the target processing template corresponding to the first message type information and the first service type information in the message processing template set is further refined.
As shown in fig. 2, the method includes:
s111, acquiring partial message data of the message to be processed, wherein the storage capacity occupied by the partial message data is smaller than the maximum storage capacity of an internal cache of the message processing equipment.
The partial message data may refer to data in a message to be processed, and the partial message data may be used to determine first message type information of the message to be processed. The partial message data is not limited as long as the first message type information of the message to be processed can be obtained through the partial message data, and if the partial message data can be set according to actual needs.
The method for obtaining part of the message data of the message to be processed is not limited, as long as part of the message data of the message to be processed can be obtained, for example, the message processing device may read part of the message data from the external memory into the internal cache of the message processing device, so that the message processing device can obtain part of the message data of the message to be processed.
The storage capacity occupied by part of the message data is smaller than the maximum storage capacity of the internal cache of the message processing device, and it can be understood that the internal cache of the message processing device can contain part of the message data, that is, part of the message data can be stored in the internal cache of the message processing device. In addition, the internal cache may also be used to store target data.
And S112, determining first message type information of the message to be processed based on the partial message data.
The method for determining the first packet type information of the packet to be processed based on the partial packet data is not limited, as long as the first packet type information of the packet to be processed can be determined based on the partial packet data, for example, the packet processing device may read the partial packet data from the external memory to the internal cache, and then the processor included in the packet processing device determines the first packet type information of the packet to be processed through the partial packet data included in the internal cache.
S113, determining first service type information of the message processing equipment.
Determining the first service type information of the message processing device, which may be determined according to a receiving port of the message processing device, for example, when the receiving port of the message processing device indicates NAT enabling, determining that the service type indicated by the first service type information of the message processing device is NAT; or when the receiving port of the message processing equipment indicates ACL enabling, determining that the service type indicated by the first service type information of the message processing equipment is ACL.
The message processing device may include one or more receiving ports, each of which may be configured to implement a different service under different configurations, and when determining the first service type information, may determine the first service type information based on the configuration of the receiving port.
S120, determining a target processing template corresponding to the first message type information and the first service type information in the message processing template set.
S131, starting from a target position of the message to be processed, acquiring target data, wherein the length of the target data is the length indicated by the field length information, the target position is a position which is offset from the starting position of the message to be processed by the offset indicated by the offset information, and the field type of the target data is the type indicated by the field type information.
The target position is a position starting to shift the offset indicated by the offset information from the starting position of the message to be processed, and it can be understood that the target position may be a starting position determined by the offset information when the message processing device extracts the target data from the message to be processed, and the offset of the target position from the starting position of the message to be processed is the offset indicated by the offset information.
The method for acquiring the target data from the target position of the message to be processed may be that the message processing device acquires the target data from the target position of the message to be processed in an external memory, and reads the target data to an internal cache of the message processing device.
The target position of the message to be processed can be an initial position of the message processing equipment for acquiring target data in the message to be processed; starting from the target position of the message to be processed, offsetting the length indicated by the field length information, and setting the position after offsetting as the end position; the message processing device may obtain the target data from the target location and the end location of the message to be processed and all locations between the target location and the end location, where the length of the target data is the length indicated by the field length information, and the field type of the target data is the type indicated by the field type information.
In one embodiment, the number of the target data is one or more, and each target data corresponds to different message extraction information.
The number of the target data is one or more, and each target data corresponds to different message extraction information. That is, one target data has message extraction information uniquely corresponding to the target data, the number of the target data can be determined by the number of the message extraction information, and the number of the target data is the same as the number of the message extraction information. If the target processing template includes a plurality of message extraction information, the message processing device needs to extract a plurality of target data corresponding to the message extraction information and having the same quantity as the message extraction information from the message to be processed.
In one embodiment, before executing in the packet processing template set and determining the target processing template corresponding to the first packet type information and the first service type information, the method further includes:
and generating a message processing template set, wherein the message processing template set comprises one or more message processing templates, and each message processing template takes the message type information and the service type information as indexes and respectively stores corresponding message extraction information.
The message processing template set comprises one or more message processing templates, each message processing template takes the message type information and the service type information as indexes, and can be understood as determining the message processing template corresponding to the message type information and the service type information through the message type information and the service type information, for example, the mapping relation between each message processing template and the corresponding message type information and service type information can be established, and the message processing template corresponding to the message type information and the service type information can be determined through the mapping relation by taking the message type information and the service type information as indexes.
Each message processing template takes the message type information and the service type information as indexes and respectively stores corresponding message extraction information, so that a target processing template which can be used for processing the message to be processed is determined in the message processing template set through the message type information and the service type information in the following, and target data indicated by the message extraction information is determined in the message to be processed through the message extraction information stored in the target processing template.
In one embodiment, generating a set of message processing templates includes:
determining second message type information associated with the message processing equipment;
determining data required for processing the message corresponding to the second message type information under different service scenes aiming at each second message type information;
determining the extraction position information of the required data in the message;
and determining the field type of the extracted position information and the required data as message extraction information, and storing the message extraction information into a message processing template corresponding to the second message type information and second service type information corresponding to the service scene.
The second packet type information may indicate information indicated by all packet types associated with the packet processing device, and the second packet type information may indicate all packet types that the packet processing device can process, and the packet types are not limited, for example, the packet types may be IP packets, MPLS packets, UDP packets, or TCP packets. The second packet type information may be the same as the first packet type information, or the second packet type information may include the first packet type information.
The method for determining the second packet type information associated with the packet processing device is not limited, and the second packet type information associated with the packet processing device may be set according to the actual application requirement.
And determining data required for processing the message corresponding to the second message type information under different service scenes aiming at each second message type information. The data required for processing the message corresponding to the second message type information in different service scenarios may be the same or different, and specifically, the data required for processing the message corresponding to the second message type information in different service scenarios may be determined according to actual application requirements. For example, when the packet type indicated by a certain second packet type information is an IP packet, and the service type required by the service scenario is NAT, the data required for processing the packet corresponding to the second packet type information may be data indicated by fields with field types of IP + TCP and FTP.
The extraction position information may be regarded as information indicating a position of the required data in the packet, and the extraction position information may indicate the position of the required data in the packet by indicating information such as the extracted position of the packet or a field length.
Determining the extraction position information of the required data in the message, for example, starting to offset from the initial position of the message and searching the required data until the required data is searched in the message, that is, determining the extraction position information of the required data in the message according to the offset of the initial position of the required data in the message compared with the initial position of the message and the length determined according to the final position of the required data in the message compared with the initial position of the required data in the message. And determining the extraction position information of the required data in the message, so as to determine the position of the required data in the message according to the extraction position information of the required data in the message.
The field type of the extracted position information and the required data is determined as message extraction information, the message extraction information is stored into a message processing template corresponding to second message type information and second service type information corresponding to a service scene, the message processing equipment can determine corresponding message extraction information in the message processing template according to the second message type information and the second service type information corresponding to the service scene, and the message processing equipment can extract the required data from the message. Wherein, the second service type information may refer to information indicated by a service type corresponding to the service scenario.
It should be noted that, one message processing template may correspond to one or more required data. For any desired data, there may be a field type for extracting location information and desired data uniquely corresponding thereto.
According to the technical scheme of the embodiment of the invention, the first message type information of the message to be processed is determined through part of message data; determining first service type information of message processing equipment; determining a target processing template corresponding to the first message type information and the first service type information in the message processing template set; and acquiring target data from the target position of the message to be processed. The message processing equipment is not required to repeatedly read data from an external memory, the position of the target data in the message to be processed and the length and the field type of the target data can be determined through the target processing template, the target data can be obtained from the target position of the message to be processed, and the forwarding performance of the message processing equipment in message processing is improved.
EXAMPLE III
The present embodiment is an exemplary description of the above-described embodiments. In the embodiment of the present invention, a packet processing method for improving the forwarding performance of a network device (such as a packet processing device) is provided, which mainly includes two aspects: the generation of an extracted message field template (i.e., a set of message processing templates) and the extraction of a message field (i.e., target data).
And (3) generation of a message field extraction template:
1. the method includes the steps of distinguishing message types (namely determining second message type information associated with message processing equipment), and determining different fields to be extracted (namely determining data required for processing messages corresponding to the second message type information in different service scenes aiming at each second message type information), wherein the IP messages are mainly target IP, MPLS messages are labels, and port numbers of UDP/TCP messages are commonly used in message forwarding.
2. Different service types (i.e. second service type information), such as ACL, NAT or DPI, etc., concern the content of different positions of the message, and extract the corresponding message content (i.e. determine the extraction position information of the required data in the message) according to the service configuration.
3. Combining the message type and the service configuration to generate a template for extracting the message field, wherein the template comprises the position (namely position offset information) of the message, the length (field length information) of the extracted message and the field type (namely field type information).
The following is an example of an IP packet and an MPLS packet, and the extraction of the packet field is realized.
Fig. 3 is a schematic structural diagram of an IP packet according to a third embodiment of the present invention, as shown in fig. 3, the IP packet includes a plurality of data of different field types, and when extracting required data in the IP packet, the required data may be extracted from the IP packet according to a field template of the extracted packet.
Fig. 4 is a schematic structural diagram of an MPLS packet according to a third embodiment of the present invention, as shown in fig. 4, the MPLS packet includes a plurality of data of different field types, and when extracting required data in the MPLS packet, the required data may be extracted in the MPLS packet according to a field template of the extracted packet.
Extracting message fields:
when the processor receives the message, identifying a basic message type (namely determining first message type information of the message to be processed), wherein the message type is an IP message or an MPLS message and the like;
determining the service configuration of a receiving port (namely determining first service type information of message processing equipment);
selecting a proper template (namely, determining a target processing template corresponding to the first message type information and the first service type information in a message processing template set) according to the message type and the service configuration of the receiving port;
and extracting message fields through the selected template (namely acquiring target data indicated by the message extraction information from the message to be processed according to one or more message extraction information included in the target processing template).
Fig. 5 is a flowchart for determining a target processing template in a message processing template set according to a third embodiment of the present invention, as shown in fig. 5, if a message type is an IP message and a service configuration of a receiving port is NAT enabled, a template 1 is used to extract required data in the IP message; if the message type is MPLS message, the service configuration of the receiving port is ACL enable, and then the template 2 is used for extracting the required data in the MPLS message.
Template 1 content:
position offset (i.e., position offset information): 18; length (i.e., field length information): 28; type (i.e., field type information) IP + TCP;
position deviation: 46: length: 16; type FTP.
And 2, template content:
position deviation: 38; length: 8; type UDP;
position deviation: 46: length: 16; type USER.
One template may contain one field type or multiple field types.
The message processing method for improving the forwarding performance of the network equipment, which is provided by the embodiment of the invention, can improve the forwarding performance of the network equipment, so that the message of a typical scene (such as processing an IP message or an MPLS message) is read once in advance, and the forwarding performance meets the linear speed requirement.
Example four
Fig. 6 is a schematic structural diagram of a message processing apparatus according to a fourth embodiment of the present invention, which is applicable to a case of processing a message. As shown in fig. 6, the specific structure of the apparatus includes:
a first determining module 21, configured to determine first packet type information of a packet to be processed and first service type information of a packet processing device;
a second determining module 22, configured to determine, in the packet processing template set, a target processing template corresponding to the first packet type information and the first service type information;
the obtaining module 23 is configured to obtain, according to one or more pieces of message extraction information included in the target processing template, target data indicated by the message extraction information from the message to be processed.
The message processing apparatus provided in this embodiment first determines, by a first determining module, first message type information of a message to be processed and first service type information of a message processing device; then, a second determining module determines a target processing template corresponding to the first message type information and the first service type information in the message processing template set; and finally, acquiring target data indicated by the message extraction information from the message to be processed through the acquisition module according to one or more message extraction information included in the target processing template.
Further, the message extraction information at least includes:
position offset information, field length information and field type information;
the position offset information indicates offset information of the initial position of the corresponding target data relative to the initial position of the message to be processed, the field length information indicates length information of the corresponding target data, and the field type information indicates type information of the corresponding target data.
Further, the obtaining module 23 is specifically configured to:
and acquiring target data from a target position of the message to be processed, wherein the length of the target data is the length indicated by the field length information, the target position is a position which is offset from the initial position of the message to be processed by the offset indicated by the offset information, and the field type of the target data is the type indicated by the field type information.
Furthermore, the number of the target data is one or more, and each target data corresponds to different message extraction information.
Further, the first determining module 21 is specifically configured to:
acquiring partial message data of a message to be processed, wherein the storage capacity occupied by the partial message data is smaller than the maximum storage capacity of an internal cache of message processing equipment;
first message type information of a message to be processed is determined based on the partial message data.
Further, the apparatus further comprises:
the generating module is used for generating a message processing template set before executing the message processing template set and determining a target processing template corresponding to the first message type information and the first service type information, wherein the message processing template set comprises one or more message processing templates, and each message processing template takes the message type information and the service type information as indexes and respectively stores corresponding message extraction information.
Further, the generating module is specifically configured to:
determining second message type information associated with the message processing equipment;
determining data required for processing the message corresponding to the second message type information under different service scenes aiming at each second message type information;
determining the extraction position information of the required data in the message;
and determining the field type of the extracted position information and the required data as message extraction information, and storing the message extraction information into a message processing template corresponding to second message type information and second service type information corresponding to a service scene.
The message processing device provided by the embodiment of the invention can execute the message processing method provided by any embodiment of the invention, and has the corresponding functional module and beneficial effect of the execution method.
EXAMPLE five
Fig. 7 shows a schematic structural diagram of a message processing device that can be used to implement an embodiment of the present invention. The message processing device may be a device such as a forwarding chip, a network processor, or a switching chip. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the message processing apparatus 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, where the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the message processing apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the message processing device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the message processing device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The processor 11 performs the various methods and processes described above, such as the message processing method.
In some embodiments, the message processing method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the message processing device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the message processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the message processing method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a message processing device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the message processing apparatus. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A message processing method is applied to a message processing device, and the method comprises the following steps:
determining first message type information of a message to be processed and first service type information of the message processing equipment;
determining a target processing template corresponding to the first message type information and the first service type information in a message processing template set;
and acquiring target data indicated by the message extraction information from the message to be processed according to one or more message extraction information included in the target processing template.
2. The method of claim 1, wherein the packet extraction information comprises at least:
position offset information, field length information and field type information;
the position offset information indicates offset information of the starting position of the corresponding target data relative to the starting position of the message to be processed, the field length information indicates length information of the corresponding target data, and the field type information indicates type information of the corresponding target data.
3. The method according to claim 2, wherein the obtaining target data indicated by the packet extraction information from the packet to be processed according to one or more packet extraction information included in the target processing template includes:
and acquiring target data from a target position of the message to be processed, wherein the length of the target data is the length indicated by the field length information, the target position is a position which begins to deviate from the initial position of the message to be processed by the deviation amount indicated by the position deviation information, and the field type of the target data is the type indicated by the field type information.
4. The method of claim 3, wherein the number of the target data is one or more, and each target data corresponds to different message extraction information.
5. The method of claim 1, wherein determining the first packet type information of the packet to be processed comprises:
acquiring partial message data of a message to be processed, wherein the storage capacity occupied by the partial message data is smaller than the maximum storage capacity of an internal cache of the message processing equipment;
and determining first message type information of the message to be processed based on the partial message data.
6. The method of claim 1, wherein prior to performing in a set of message processing templates, determining a target processing template corresponding to the first message type information and the first traffic type information, further comprising:
and generating a message processing template set, wherein the message processing template set comprises one or more message processing templates, and each message processing template takes the message type information and the service type information as indexes and respectively stores corresponding message extraction information.
7. The method of claim 6, wherein generating the set of message processing templates comprises:
determining second message type information associated with the message processing equipment;
determining data required for processing the message corresponding to the second message type information under different service scenes aiming at each second message type information;
determining the extraction position information of the required data in the message;
and determining the field type of the extraction position information and the required data as the message extraction information, and storing the message extraction information into a message processing template corresponding to the second message type information and the second service type information corresponding to the service scene.
8. A message processing apparatus, comprising:
the first determining module is used for determining first message type information of a message to be processed and first service type information of the message processing equipment;
a second determining module, configured to determine, in a packet processing template set, a target processing template corresponding to the first packet type information and the first service type information;
and the acquisition module is used for acquiring target data indicated by the message extraction information from the message to be processed according to one or more message extraction information included in the target processing template.
9. A message processing apparatus, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202211379645.1A 2022-11-04 2022-11-04 Message processing method, device, equipment and storage medium Pending CN115714825A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211379645.1A CN115714825A (en) 2022-11-04 2022-11-04 Message processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211379645.1A CN115714825A (en) 2022-11-04 2022-11-04 Message processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115714825A true CN115714825A (en) 2023-02-24

Family

ID=85232248

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211379645.1A Pending CN115714825A (en) 2022-11-04 2022-11-04 Message processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115714825A (en)

Similar Documents

Publication Publication Date Title
CN114500633A (en) Data forwarding method, related device, program product and data transmission system
CN116418689A (en) Request message response method and device, electronic equipment and storage medium
CN115714825A (en) Message processing method, device, equipment and storage medium
CN115514683A (en) Method and device for determining packet loss reason, exchange chip and storage medium
CN115632866A (en) Message desensitization method, device, equipment and medium based on FPGA
CN108833282A (en) Data forwarding method, system, device and SDN switch
CN114500105A (en) Network packet interception method, device, equipment and storage medium
CN112860811A (en) Method and device for determining data blood relationship, electronic equipment and storage medium
CN113656731A (en) Advertisement page processing method and device, electronic equipment and storage medium
CN115174462B (en) Method and device for acquiring data forwarding table, forwarding equipment, controller and medium
CN112783507B (en) Data stream guiding playback method and device, electronic equipment and readable storage medium
CN115576902B (en) Method, device, equipment and medium for processing calibration description file
CN116599838A (en) Substation equipment information configuration management method, device, equipment and storage medium
CN116974856B (en) Method, device, equipment and medium for automatically acquiring log file
CN113472654B (en) Network traffic data forwarding method, device, equipment and medium
CN117596304A (en) Information extraction method and device, electronic equipment and storage medium
CN115293096B (en) Line generation method, device, electronic equipment and storage medium
CN116306407B (en) Verification method, device, equipment and storage medium of Network On Chip (NOC)
CN114338543B (en) Network access speed limiting method, device, equipment and storage medium
CN115883226A (en) Vehicle network attack analysis method, device, equipment and storage medium
CN117014371A (en) Network traffic processing method and device, electronic equipment and storage medium
CN116112382A (en) Network data capturing method and device, electronic equipment and storage medium
CN116225568A (en) Management method, device and equipment of application system interface and storage medium
CN116708327A (en) Spontaneous packet forwarding method and device, electronic equipment and storage medium
CN116301653A (en) Data storage method, device, equipment and medium applied to embedded system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination