Packet character data extraction method and device, storage medium and electronic device

By deploying a data transmission and parsing module on the data parsing chip, the character position data of the target interval set is obtained and extracted, solving the problem of low efficiency in message character data extraction, realizing flexible message parsing, and adapting to the rapidly developing network service needs.

CN116708609BActive Publication Date: 2026-03-31SUZHOU CENTEC COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-20
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing technologies have low efficiency in extracting message character data, and the message parsing chip design is cumbersome and cannot meet the needs of rapidly developing network services.

Method used

A data transmission module, a data parsing module, and a data processing module are deployed on the data parsing chip. By detecting the target network protocol layer, the target interval set is obtained, the data at the character position indicated by the target interval set is extracted, and the data is transmitted to the data processing module to realize flexible message transmission operations.

Benefits of technology

It improves the efficiency of extracting message character data, is applicable to various network protocols, solves the problem of low efficiency in extracting message character data, and enables flexible message parsing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116708609B_ABST
    Figure CN116708609B_ABST
Patent Text Reader

Abstract

The application discloses a message character data extraction method and device, a storage medium and an electronic device, and is applied to a data analysis chip. The data analysis chip is provided with a data transmission module, a data analysis module and a data processing module. The method comprises the following steps: a data transmission module detects a target network protocol used by a target data packet of to-be-extracted transmission information received by the data analysis chip; the data transmission module acquires a target interval set corresponding to the target network protocol from a network protocol and interval set having a corresponding relationship; a data analysis module extracts data of a character position indicated by the target interval set from the target data packet as transmission information of the target data packet on the target network protocol layer, and transmits the data of the character position to the data processing module. By adopting the technical scheme, the problems, such as low extraction efficiency of message character data in related technologies, are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communications, and more specifically, to a method and apparatus for extracting message character data, a storage medium, and an electronic device. Background Technology

[0002] With the development of network technology, more and more services are being deployed, and the complexity of networks is rapidly increasing. Existing network processors all need to parse the headers of incoming packets before proceeding with further network service operations. Therefore, how to quickly and accurately parse packets is fundamental to network services. During packet parsing, keywords representing the data transmission method within each network protocol layer need to be extracted. Based on these keywords, the packet data is parsed and processed. Currently, to achieve fast and accurate packet data parsing, related technologies use named fields representing the transmission information of the corresponding network protocol in the packet parsing chip. When a data packet is received, the named field corresponding to the network protocol is searched to find the keyword representing the data transmission method at the corresponding network protocol layer. While this method can accurately extract the keyword representing the transmission method from the data packet, the continuous addition of keywords corresponding to network protocols makes the packet parsing chip bloated. Furthermore, the parsing functions supported by this method are relatively fixed and cannot meet the demands of today's rapidly evolving network services.

[0003] There is still no effective solution to the problem of low extraction efficiency of message character data in related technologies. Summary of the Invention

[0004] This application provides a method and apparatus for extracting message character data, a storage medium, and an electronic device to at least solve the problem of low extraction efficiency of message character data in related technologies.

[0005] According to one embodiment of this application, a method for extracting message character data is provided, applied to a data parsing chip. The data parsing chip is equipped with a data transmission module, a data parsing module, and a data processing module. The method includes: the data transmission module detecting the target network protocol used at the target network protocol layer of the target data packet whose transmission information to be extracted is received by the data parsing chip; the data transmission module obtaining a target interval set corresponding to the target network protocol from a network protocol and interval set with a corresponding relationship, wherein the target interval set includes target intervals used to indicate the character position of the transmission information of the target network protocol in the data packet; the data transmission module sending the target interval set to the data parsing module; the data parsing module extracting the data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmitting the data at the character position to the data processing module, wherein the data processing module performs message transmission operation on the target data packet at the corresponding network protocol layer according to the received data.

[0006] Optionally, the data parsing module extracts data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmits the data at the character position to the data processing module, including: the data parsing module extracts target character data from the target data packet according to the target interval set, wherein the target character data is used to characterize the transmission information of the target data packet at the target network protocol layer; the data parsing module writes the target character data into a parsing information container according to a target storage format, wherein the parsing information container is used to store character data characterizing the transmission information at multiple network protocol layers included in the target data packet, and the target storage format is used to characterize the character data of two adjacent network protocol layers being stored consecutively in the parsing information container; the data parsing module, upon determining that the character data of all network protocol layers included in the target data packet are stored in the parsing information container, transmits the parsing information container to the data processing module.

[0007] Optionally, the data parsing module extracts target character data from the target data packet according to the target interval set, including: the data parsing module extracts corresponding sub-character data from the target data packet according to the character position indicated by the target interval, wherein the target character data includes the sub-character data; the data parsing module determines the number of characters in the sub-character data; the data parsing module stores the sub-character data in a target storage location in a target data container corresponding to the number of characters, wherein the target data container is a data container corresponding to the target network protocol layer, the target data container is used for temporary storage of the sub-character data, and the storage granularity of the target storage location matches the number of characters.

[0008] Optionally, after the data parsing module stores the sub-character data in the target data container at the target storage location corresponding to the number of characters, the method further includes: the data parsing module extracting target verification information corresponding to the target network protocol layer from the target data packet; the data parsing module storing the target verification information in the target data container at the storage location corresponding to the target verification information, wherein the data processing module is further configured to determine, based on the target verification information, the enable state for performing message transmission operation on the target data packet at the target network protocol layer.

[0009] Optionally, the data parsing module writes the target character data into the parsing information container according to the target storage format, including: if the target network protocol layer is the first network protocol layer to be parsed in the network protocol architecture corresponding to the target data packet, the data parsing module stores the target character data in the parsing information container at the target end position corresponding to the target network layer; if the target network protocol layer is not the first network protocol layer to be parsed in the network protocol architecture corresponding to the target data packet, the data parsing module stores the target character data in the parsing information container at the adjacent storage position of the character data of the previously parsed network protocol layer.

[0010] Optionally, the data parsing module stores the target character data in the parsing information container at a target end position corresponding to the target network layer, including one of the following: when the network protocol architecture to which the target network protocol layer belongs is used to indicate the transmission mode of data packets between network devices, the data parsing module stores the target character data in a first end of the parsing information container, wherein the target end position includes the first end; when the network protocol architecture to which the target network protocol layer belongs is used to indicate the transmission mode of data packets between service layers of network devices, the data parsing module stores the target character data in a second end of the parsing information container, wherein the target end position includes the second end.

[0011] Optionally, the data transmission module obtains the target interval set corresponding to the target network protocol from the network protocols and interval sets with corresponding relationships, including: the data transmission module obtains target index information corresponding to the target network protocol from the network protocols and index information with corresponding relationships, wherein the index information is used to characterize the storage location of the corresponding interval set; the data transmission module extracts the target interval set from the storage location of the target interval set indicated by the target index information.

[0012] According to another embodiment of this application, a device for extracting message character data is also provided, applied to a data parsing chip. The data parsing chip is equipped with a data transmission module, a data parsing module, and a data processing module. The device includes: the data transmission module, used to detect the target network protocol used at the target network protocol layer of the target data packet whose transmission information to be extracted is received by the data parsing chip; the data transmission module, used to obtain a target interval set corresponding to the target network protocol from a network protocol and interval set with a corresponding relationship, wherein the target interval set includes target intervals used to indicate the character position of the transmission information of the target network protocol in the data packet; the data transmission module, used to send the target interval set to the data parsing module; the data parsing module, used to extract the data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmit the data at the character position to the data processing module, wherein the data processing module is used to perform message transmission operation on the target data packet at the corresponding network protocol layer according to the received data.

[0013] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described method for extracting message character data when it is run.

[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the message character data extraction method through the computer program.

[0015] In this embodiment, a data parsing chip is deployed with a data transmission module, a data parsing module, and a data processing module. The method includes: the data transmission module detecting the target network protocol used at the target network protocol layer of the target data packet for which transmission information to be extracted is received by the data parsing chip; the data transmission module obtaining a target interval set corresponding to the target network protocol from a set of network protocols and intervals with corresponding relationships, wherein the target interval set includes target intervals used to indicate the character position of the transmission information of the target network protocol in the data packet; the data transmission module sending the target interval set to the data parsing module; the data parsing module extracting the data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmitting the data at the character position to the data processing module, wherein the data processing module is used to perform message transmission operation on the target data packet at the corresponding network protocol layer according to the received data. This method involves setting intervals to represent the character positions of network protocol transmission information within data packets. These intervals indicate the location of the information to be extracted within the data packet. A correspondence between network protocols and interval sets is established. After determining the target network protocol used at the target network protocol layer of the target data packet, the correspondence between network protocols and interval sets allows for the location of the transmission information within the target data packet. This enables the extraction of the data representing the transmission information and facilitates data packet parsing. By setting intervals to represent the character positions of network protocol transmission information within data packets, the method flexibly determines the character positions of the transmission information corresponding to the network protocol used in the data packet, thereby improving the flexibility of the message character extraction method and making it applicable to various network protocols. This technical solution solves the problem of low extraction efficiency of message character data in related technologies, achieving the technical effect of improving the extraction efficiency of message character data. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the hardware environment for a method of extracting message character data according to an embodiment of this application;

[0019] Figure 2 This is a flowchart of a method for extracting message character data according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of an optional data storage container according to an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of an optional data packet according to an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of an optional parsing information container according to an embodiment of this application;

[0023] Figure 6 This is an illustration of an optional character data storage method according to an embodiment of this application. Figure 1 ;

[0024] Figure 7 This is an illustration of an optional character data storage method according to an embodiment of this application. Figure 2 ;

[0025] Figure 8 This is a structural block diagram of a message character data extraction device according to an embodiment of this application. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] The methods and embodiments provided in this application can be executed on a computer terminal, device terminal, or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a schematic diagram of the hardware environment for a method of extracting message character data according to an embodiment of this application. Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. In one exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 Equivalent functions or ratios shown Figure 1 The functions shown have more different configurations.

[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the message push sending method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0031] This embodiment provides a method for extracting message character data, applied to the aforementioned computer terminal. Figure 2 This is a flowchart of a method for extracting message character data according to an embodiment of this application, applied to a data parsing chip. The data parsing chip is equipped with a data transmission module, a data parsing module, and a data processing module. The process includes the following steps:

[0032] Step S202: The data transmission module detects the target network protocol used at the target network protocol layer of the target data packet for which the transmission information to be extracted is received by the data parsing chip;

[0033] Step S204: The data transmission module obtains the target interval set corresponding to the target network protocol from the network protocol and interval set with corresponding relationship, wherein the target interval included in the target interval set is used to indicate the character position of the transmission information of the target network protocol in the data packet;

[0034] Step S206: The data transmission module sends the target interval set to the data parsing module;

[0035] In step S208, the data parsing module extracts the data of the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmits the data of the character position to the data processing module. The data processing module is used to perform message transmission operation on the target data packet at the corresponding network protocol layer according to the received data.

[0036] In the technical solution provided in step S202 above, the detection of the target network protocol can be achieved by matching keywords in the network protocol, or it can be achieved by detecting the tag information of the network protocol used to characterize the network protocol layer in the target data packet.

[0037] In the technical solution provided in step S204 above, the interval is used to characterize the position of the transmission information of the network protocol in the data packet. By setting the interval as comprehensively as possible in the data parsing chip, the data parsing chip can have the function of extracting character data from data packets of various network protocols. The interval can be fixed in the data parsing chip.

[0038] Optionally, in this embodiment, the correspondence between network protocols and interval sets is configured by the user according to the message parsing requirements after the chip is fabricated. It can be flexibly configured according to the message parsing requirements, thereby enabling the data parsing chip to support message parsing operations for data packets of various network protocols.

[0039] Optionally, in this embodiment, the interval set may include, but is not limited to, one or more intervals, which are set according to the type of network protocol, and this solution does not limit this.

[0040] In the technical solution provided in step S206 above, the data parsing module is used to extract character data representing the transmitted information from the data packet according to the character position indicated by the intervals included in the target interval set. When the target interval set includes multiple target intervals, the data parsing module will extract the character data corresponding to each target interval in turn. The data parsing module may, but is not limited to, set up a container for storing the extracted character data to temporarily store the extracted character data. After the data parsing module completes the extraction of all target intervals in the target interval set, it will transmit the character data to the data processing module.

[0041] In the technical solution provided in step S208 above, the data parsing module can transmit the data to the data processing module after the character data of one network protocol layer has been extracted, or it can send all the character data of all network protocol layers included in the target data packet to the data processing module together after all the character data of all network protocol layers has been extracted. This solution does not limit this.

[0042] As an optional embodiment, the data parsing module extracts data indicating the character position of the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmits the data of the character position to the data processing module, including:

[0043] The data parsing module extracts target character data from the target data packet according to the target interval set, wherein the target character data is used to characterize the transmission information of the target data packet at the target network protocol layer;

[0044] The data parsing module writes the target character data into the parsing information container according to the target storage format. The parsing information container is used to store character data that represents the information transmitted on multiple network protocol layers included in the target data packet. The target storage format is used to represent that the character data of two adjacent network protocol layers are stored consecutively in the parsing information container.

[0045] When the data parsing module determines that all the character data of all network protocol layers included in the target data packet are stored in the parsing information container, it transmits the parsing information container to the data processing module.

[0046] Optionally, in this embodiment, the data parsing module can write the target character data of a certain network protocol layer into the parsing container after all the target character data of that network protocol layer has been extracted, or it can write the target character data of all network protocol layers included in the target data packet into the parsing information container together after all the target character data of all network protocol layers has been extracted. This solution does not limit this.

[0047] In related technologies, storage locations corresponding to network protocol layers are set in the parsing information container. When the parsing module extracts target character data of a certain network protocol layer, it stores the target character data in the corresponding storage location in the parsing information container. However, although this method makes character data storage quick and convenient, in actual use, there may be excess storage locations in some network protocol layers, while character locations corresponding to some network protocol layers may be insufficient due to the large amount of character data in the network protocol, thus affecting the efficiency of character data storage. In the embodiment of this application, the positions of the target character data on the target network protocol layer are continuous, thereby saving storage space in the parsing information container while ensuring that the character data corresponding to each network protocol layer can be stored in the parsing information container, thus improving the storage efficiency of character data.

[0048] As an optional embodiment, the data parsing module extracts target character data from the target data packet based on the target interval set, including:

[0049] The data parsing module extracts the corresponding sub-character data from the target data packet according to the character position indicated by the target interval, wherein the target character data includes the sub-character data;

[0050] The data parsing module determines the number of characters in the sub-character data;

[0051] The data parsing module stores the sub-character data in a target storage location within a target data container that corresponds to the number of characters. The target data container is a data container corresponding to the target network protocol layer. The target data container is used for temporary storage of the sub-character data, and the storage granularity of the target storage location matches the number of characters.

[0052] Optionally, in this embodiment, a target data container is provided in the data parsing chip for temporary storage of sub-character data extracted from the data packet by the data parsing module.

[0053] Optionally, in this embodiment, the target data container can be a storage container for storing character data of any network protocol layer, or the target data container can be a data container specifically set up for storing the target network protocol layer. That is, a data container corresponding to each network protocol layer is set up in the data parsing chip for temporary storage of sub-character data.

[0054] Optionally, in this embodiment, the target data container can be configured with storage areas of various storage granularities. When storing sub-character data into the target data container, the sub-character data can be stored in the storage area of ​​the corresponding storage granularity according to the number of characters in the sub-character data. This solution does not limit this. Figure 3 This is a schematic diagram of an optional data storage container according to an embodiment of this application, such as... Figure 3 As shown, the fields to be extracted are grouped into three categories: 32-bit, 16-bit, and 8-bit. The corresponding storage locations are configured in the target data container, and the corresponding fields in the message are stored in the corresponding locations in the target data container. At the same time, the target container also has a storage location for verification information (for example, a 32-bit Vector is provided to store the relevant flag fields in the message and the check information fields in the extraction process. In addition, a checksum information segment and a length information segment are provided).

[0055] As an optional embodiment, after the data parsing module stores the sub-character data in the target data container at the target storage location corresponding to the number of characters, the method further includes:

[0056] The data parsing module extracts the target verification information corresponding to the target network protocol layer from the target data packet;

[0057] The data parsing module stores the target verification information in the target data container at the storage location corresponding to the target verification information. The data processing module is also used to determine the enable state for performing message transmission operation on the target data packet at the target network protocol layer based on the target verification information.

[0058] Optionally, in this embodiment, the target verification information may include, but is not limited to, information check vectors, verification information segments, length information segments, etc., and this solution does not limit this.

[0059] As an optional embodiment, the data parsing module writes the target character data into the parsed information container according to the target storage format, including:

[0060] When the target network protocol layer is the first network protocol layer to be parsed in the network protocol architecture corresponding to the target data packet, the data parsing module stores the target character data in the parsing information container at the target end position corresponding to the target network layer;

[0061] If the target network protocol layer is not the first network protocol layer to be parsed in the network protocol architecture corresponding to the target data packet, the data parsing module stores the target character data in the parsing information container at the adjacent storage location of the character data of the previous parsed network protocol layer.

[0062] Optionally, in this embodiment, the parsed information container includes two end positions. When the target character data is the first network protocol layer to be parsed in the network protocol architecture, the target character data can be stored in any end position, or it can be stored in the end position corresponding to the architecture type of the network protocol architecture described by the network protocol layer. This solution does not limit this.

[0063] As an optional embodiment, the data parsing module stores the target character data in the parsed information container at the target end position corresponding to the target network layer, including one of the following:

[0064] When the network protocol architecture to which the target network protocol layer belongs is used to indicate the transmission method of data packets between network devices, the data parsing module stores the target character data in the first end of the parsed information container, wherein the target end position includes the first end;

[0065] When the network protocol architecture to which the target network protocol layer belongs is used to indicate the transmission method of data packets between the service layers of network devices, the data parsing module stores the target character data in the second end of the parsed information container, wherein the target end location includes the second end.

[0066] Optionally, in this embodiment, with the development of network technology, more and more services are being deployed, and the complexity of the network is increasing rapidly. To solve the problem of multi-layered network plane management in the infrastructure, network virtualization and tunneling technologies have been vigorously developed. Various technologies such as VXLAN and NVGRE separate the network topology (topo) of infrastructure operators and service users. Thus, infrastructure operators need to maintain their physical network (underlay, UL) architecture to ensure its normal operation; while service users maintain their logical network (overlay, OL) architecture at the service layer. Therefore, in order to realize different service functions, different functional network protocol architectures are set up.

[0067] Optionally, in this embodiment, different network protocol architectures can be set to achieve different business functions. Two network protocol architectures can coexist in the target data packet. Each network protocol architecture includes multiple network protocol layers. Therefore, a corresponding end position is set for the target character data in the first parsed network protocol layer in each network protocol architecture. For example, the target character data of the first parsed network protocol layer of one network protocol architecture is stored at the beginning position of the parsing information container, and then the target character data of other network protocol layers in the same network protocol architecture are stored sequentially from the beginning position to the end position. The target character data of the first parsed network protocol layer of another network protocol architecture is stored at the end position of the parsing information container, and then the target character data of other network protocol layers in the same network protocol architecture are stored sequentially from the end position to the beginning position. In this way, the storage space in the parsing information container is effectively utilized, and the storage efficiency of character data of different network protocol architectures in the same data packet is improved.

[0068] With the development of network technology, more and more services are being deployed, and the complexity of networks is increasing rapidly. In order to solve the problem of multi-layered network plane management in infrastructure, network virtualization and tunneling technologies have been vigorously developed.

[0069] Technologies like VXLAN and NVGRE separate the network topology (topology) of infrastructure operators from those of service users. This means that infrastructure operators need to maintain their physical network (underlay, UL) to ensure its operation, while service users maintain their logical network (overlay, OL) at the service layer. In other words, an overlay network is a virtual network built on top of an existing physical network. It has independent control and forwarding planes; the physical network is transparent to terminal devices connected to the overlay. This technology achieves the separation of the bearer network and the service network. Figure 4 This is an optional data packet illustration according to an embodiment of this application, such as... Figure 4 As shown in the figure below, VXLAN (Virtual Extensible LAN) packet data is characterized by a clear distinction between the inner and outer layers of the packet, and their basic packet header formats are similar.

[0070] In the data parsing chip, data packets are first processed by the data parsing module, which extracts the target character data representing the information transmitted by the data packet at the corresponding network layer. Then, the data parsing module transmits the target message data to the data processing module for further data packet parsing via a parsing information container. Figure 5 This is a schematic diagram of an optional parsing information container according to an embodiment of this application, such as... Figure 5As shown, considering the packet forwarding service requirements of switches in actual networks, it can be observed that when a packet needs to be parsed at both the outer (overlay) and inner (underlay) layers, it generates two sets of packet parsing information: PktIfoO and PktIfoU. Therefore, the parsing information container can store the target character data of the network protocol layers included in the inner and outer network protocol architectures. As shown in the figure, the "packet parsing information container" divides packets into layers two to five according to a concept similar to OSI (Open System Interconnection Model), and its design is uniform for both the outer and inner layers. In the example shown in the figure, for a normal service packet, the information required for its forwarding processing is entirely "outer" information. Therefore, the L2 container needs to accommodate complex and long outer information, such as MAC addresses, VLAN tags, NSH (Network Service Header) fields, which may typically reach 46 bytes. The L3 container also needs to accommodate relatively complex information, such as the deployment of Segment Routing IPv6, which typically requires the L3 container to support up to 112 bytes. Since most service packets are in TCP format, the L4 container needs to support at least a 16-byte basic header. Because switches typically perform Layer 3 routing, there's no need to parse subsequent service information. Therefore, the total is 174 bytes. At this point, the inner layer of the packet parsing information container (hereinafter PktIfo) is unused. For a tunnel packet, tunnel encapsulation is lightweight. As shown in the example, a typical VXLAN packet's L2 container only needs to hold a simple MAC address and VLAN tag, typically a maximum of 22 bytes; the L3 container typically only needs to hold a basic IP header, typically 40 bytes; and so on. The L4 container is 8 bytes for UDP, and the L5 container is 8-16 bytes for VXLAN. The total is 86 bytes. The parsing information container required for the inner layer packets is relatively longer. In summary, within a certain width, sharing the parsing information container between the inner and outer layers will achieve better resource utilization. However, sharing obviously brings processing complexity.

[0071] To avoid wasting storage resources during the target character data storage process in the above embodiments, the storage locations of target character data across different network protocol layers are contiguous in this embodiment. Figure 6 This is an illustration of an optional character data storage method according to an embodiment of this application. Figure 1 ,like Figure 6 As shown, the storage locations of target character data in each network protocol layer are continuous, avoiding the problem of uneven allocation of storage resources caused by setting corresponding storage locations for each network protocol layer in related technologies.

[0072] Depend on Figure 6 It can be seen that since the information at each layer is of variable length in the shared mode, the starting position of the inner parsing information container within the message parsing information container is determined by the varying lengths of the preceding containers, resulting in the greatest possible starting position after layer-by-layer stacking. In ASICs, each additional possibility adds a set of MUXs, and an increased number of possibilities leads to a large number of MUXs, resulting in significant chip logic overhead. Figure 7 This is an illustration of an optional character data storage method according to an embodiment of this application. Figure 2 ,like Figure 7 As shown, in cases where a data packet includes two network protocol architectures simultaneously, this embodiment stores the first parsed network protocol layer of each architecture at an end position. For example, the storage location of the first parsed network protocol layer in the inner network protocol architecture (used to indicate the transmission method of data packets between network devices) is set as the header storage location of the parsed information container. Therefore, the target character data of the inner network protocol architecture is stored sequentially from the header to the tail. Similarly, the storage location of the first parsed network protocol layer in the outer network protocol architecture (used to indicate the transmission method of data packets between service layers of network devices) is set as the tail storage location of the parsed information container. Therefore, the target character data of the outer network protocol architecture is stored from the tail to the header. This significantly reduces the possible positions of each layer container within the message parsing information container, thereby reducing the number of MUXs and saving overhead.

[0073] As an optional embodiment, the data transmission module obtains the target interval set corresponding to the target network protocol from a network protocol and interval set with corresponding relationships, including:

[0074] The data transmission module obtains target index information corresponding to the target network protocol from network protocols and index information with corresponding relationships, wherein the index information is used to characterize the storage location of the corresponding interval set;

[0075] The data transmission module extracts the target interval set from the storage location of the target interval set indicated by the target index information.

[0076] Optionally, in this embodiment, the correspondence between network protocols and index information can be flexibly set according to the data packet parsing requirements. After the data parsing chip is fabricated, the user can set this correspondence according to the data packet parsing requirements, that is, flexibly set the corresponding index information according to the network protocol used in the data packet. Then, when parsing the corresponding data packet, the corresponding search information can be determined according to the network protocol, and the corresponding target interval set can be found.

[0077] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software and necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0078] Figure 8 This is a structural block diagram of a message character data extraction device according to an embodiment of this application; as shown below. Figure 8 As shown, an application is made to a data parsing chip, on which a data transmission module, a data parsing module, and a data processing module are deployed. The device includes: the data transmission module, used to detect the target network protocol used at the target network protocol layer of the target data packet for which transmission information to be extracted is received by the data parsing chip; the data transmission module, used to obtain a target interval set corresponding to the target network protocol from a set of network protocols and intervals with corresponding relationships, wherein the target interval set includes target intervals used to indicate the character position of the transmission information of the target network protocol in the data packet; the data transmission module, used to send the target interval set to the data parsing module; the data parsing module, used to extract the data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmit the data at the character position to the data processing module, wherein the data processing module is used to perform message transmission operation on the target data packet at the corresponding network protocol layer according to the received data.

[0079] Based on the above, by setting an interval representing the character position of network protocol transmission information in a data packet, this interval can indicate the position of the information to be extracted in the data packet. Furthermore, a correspondence between network protocols and interval sets is established. After determining the target network protocol used at the target network protocol layer of the target data packet from which the transmission information to be extracted is located, the target interval set can be found through the correspondence between the network protocol and the interval set, thus locating the position of the transmission information to be extracted in the target data packet. This allows for the extraction of the data representing the transmission information, thereby achieving data packet parsing. In this application, by setting an interval representing the character position of network protocol transmission information in a data packet, the character position of the transmission information corresponding to the network protocol used by the data packet can be flexibly determined, thereby improving the flexibility of the message character extraction method and making it applicable to various network protocols. The above technical solution solves the problem of low extraction efficiency of message character data in related technologies, achieving the technical effect of improving the extraction efficiency of message character data.

[0080] Optionally, the data parsing module is configured to: extract target character data from the target data packet according to the target interval set, wherein the target character data is used to characterize the transmission information of the target data packet at the target network protocol layer; write the target character data into a parsing information container according to a target storage format, wherein the parsing information container is used to store character data characterizing the transmission information at multiple network protocol layers included in the target data packet, and the target storage format characterizing the character data of two adjacent network protocol layers is stored consecutively in the parsing information container; and transmit the parsing information container to the data processing module when it is determined that the character data of all network protocol layers included in the target data packet are stored in the parsing information container.

[0081] Optionally, the data parsing module is configured to: extract corresponding sub-character data from the target data packet according to the character position indicated by the target interval, wherein the target character data includes the sub-character data; determine the number of characters in the sub-character data; and store the sub-character data in a target storage location in a target data container corresponding to the number of characters, wherein the target data container is a data container corresponding to the target network protocol layer, the target data container is used for temporary storage of the sub-character data, and the storage granularity of the target storage location matches the number of characters.

[0082] Optionally, the apparatus further includes: after the data parsing module stores the sub-character data in the target data container at a target storage location corresponding to the number of characters, the data parsing module is configured to extract target verification information corresponding to the target network protocol layer from the target data packet; the data parsing module is configured to store the target verification information in the target data container at a storage location corresponding to the target verification information, wherein the data processing module is further configured to determine, based on the target verification information, an enable state for performing message transmission operations on the target data packet at the target network protocol layer.

[0083] Optionally, the data parsing module is configured to: when the target network protocol layer is the first network protocol layer to be parsed in the network protocol architecture corresponding to the target data packet, store the target character data in the parsing information container at the target end position corresponding to the target network layer; when the target network protocol layer is not the first network protocol layer to be parsed in the network protocol architecture corresponding to the target data packet, store the target character data in the parsing information container at an adjacent storage position to the character data of the previously parsed network protocol layer.

[0084] Optionally, the data parsing module is configured to: when the network protocol architecture to which the target network protocol layer belongs is used to indicate the transmission mode of data packets between network devices, the data parsing module stores the target character data in a first end of the parsing information container, wherein the target end location includes the first end; when the network protocol architecture to which the target network protocol layer belongs is used to indicate the transmission mode of data packets between service layers of network devices, the data parsing module stores the target character data in a second end of the parsing information container, wherein the target end location includes the second end.

[0085] Optionally, the data transmission module is configured to: obtain target index information corresponding to the target network protocol from network protocols and index information with corresponding relationships, wherein the index information is used to characterize the storage location of the corresponding interval set; and extract the target interval set from the storage location of the target interval set indicated by the target index information.

[0086] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the above-described methods for extracting message character data when it is run.

[0087] Optionally, in this embodiment, the storage medium can be configured to store program code for performing the following steps: the data transmission module detects the target network protocol used at the target network protocol layer of the target data packet for which transmission information to be extracted is received by the data parsing chip; the data transmission module obtains the target interval set corresponding to the target network protocol from a set of network protocols and intervals with corresponding relationships, wherein the target intervals included in the target interval set are used to indicate the character position of the transmission information of the target network protocol in the data packet; the data transmission module sends the target interval set to the data parsing module; the data parsing module extracts the data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmits the data at the character position to the data processing module, wherein the data processing module is used to perform message transmission operation on the target data packet at the corresponding network protocol layer according to the received data.

[0088] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above embodiments of the message character data extraction method.

[0089] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0090] Optionally, in this embodiment, the processor can be configured to execute the following steps via a computer program: the data transmission module detects the target network protocol used at the target network protocol layer of the target data packet for which transmission information to be extracted is received by the data parsing chip; the data transmission module obtains the target interval set corresponding to the target network protocol from a set of network protocols and intervals with corresponding relationships, wherein the target interval set includes target intervals used to indicate the character position of the transmission information of the target network protocol in the data packet; the data transmission module sends the target interval set to the data parsing module; the data parsing module extracts the data at the character position indicated by the target interval set from the target data packet as the transmission information of the target data packet at the target network protocol layer, and transmits the data at the character position to the data processing module, wherein the data processing module is used to perform message transmission operation on the target data packet at the corresponding network protocol layer according to the received data.

[0091] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0092] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0093] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0094] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method of extracting message character data, characterized by, The method is applied to a data analysis chip, wherein a data transmission module, a data analysis module and a data processing module are arranged on the data analysis chip, and the method comprises the following steps: The data transmission module detects a target network protocol used by a target data packet of to-be-extracted transmission information received by the data analysis chip on a target network protocol layer; The data transmission module acquires a target interval set corresponding to the target network protocol from a network protocol and interval set having a corresponding relationship, wherein a target interval included in the target interval set is used to indicate a character position of transmission information of the target network protocol in a data packet; The data transmission module sends the target interval set to the data analysis module; The data analysis module extracts data of the character position indicated by the target interval set from the target data packet as transmission information of the target data packet on the target network protocol layer, and transmits the data of the character position to the data processing module, wherein the data processing module is used to perform a packet transmission operation on the target data packet on a corresponding network protocol layer according to the received data; The data analysis module extracts data of the character position indicated by the target interval set from the target data packet as transmission information of the target data packet on the target network protocol layer, and transmits the data of the character position to the data processing module, comprising: the data analysis module extracts target character data from the target data packet according to the target interval set, wherein the target character data is used to represent transmission information of the target data packet on the target network protocol layer; the data analysis module writes the target character data into an analysis information container in a target storage format, wherein the analysis information container is used to store character data representing transmission information on multiple network protocol layers included in a target data packet, and the target storage format is used to represent that the character data of two adjacent network protocol layers is stored continuously in the analysis information container; the data analysis module transmits the analysis information container to the data processing module in a case where the character data of all network protocol layers included in the target data packet is stored in the analysis information container; The data analysis module extracts target character data from the target data packet according to the target interval set, comprising: the data analysis module extracts corresponding sub-character data from the target data packet according to a character position indicated by the target interval, wherein the target character data includes the sub-character data; the data analysis module determines a character quantity of the sub-character data; and the data analysis module stores the sub-character data in a target storage position of a target data container corresponding to the character quantity, wherein the target data container is a data container corresponding to the target network protocol layer, the target data container is used to temporarily store the sub-character data, and a storage granularity of the target storage position matches the character quantity. The data analysis module writes the target character data into the analysis information container according to a target storage format, including: in a case where the target network protocol layer is a first analyzed network protocol layer in a network protocol architecture corresponding to the target data packet, the data analysis module stores the target character data into a target end position in the analysis information container corresponding to the target network protocol layer; in a case where the target network protocol layer is a non-first analyzed network protocol layer in the network protocol architecture corresponding to the target data packet, the data analysis module stores the target character data into a storage position adjacent to the character data of a last analyzed network protocol layer in the analysis information container; The data analysis module stores the target character data into a target end position in the analysis information container corresponding to the target network protocol layer, including one of: in a case where a network protocol architecture to which the target network protocol layer belongs is used to indicate a transmission mode of a data packet between network devices, the data analysis module stores the target character data into a first end of the analysis information container, wherein the target end position includes the first end; in a case where the network protocol architecture to which the target network protocol layer belongs is used to indicate a transmission mode of a data packet between service layers of network devices, the data analysis module stores the target character data into a second end of the analysis information container, wherein the target end position includes the second end.

2. The method of claim 1, wherein, After the data analysis module stores the sub-character data into the target storage position in the target data container corresponding to the character quantity, the method further includes: The data analysis module extracts target verification information corresponding to the target network protocol layer from the target data packet; The data analysis module stores the target verification information into a storage position in the target data container corresponding to the target verification information, wherein the data processing module is further configured to determine an enabling state of performing a packet transmission operation on the target data packet on the target network protocol layer according to the target verification information.

3. The method of claim 1, wherein, The data transmission module obtains a target interval set corresponding to the target network protocol from a network protocol and interval set having a corresponding relationship, including: The data transmission module obtains target index information corresponding to the target network protocol from a network protocol and index information having a corresponding relationship, wherein the index information is used to represent a storage position of a corresponding interval set; The data transmission module extracts the target interval set from the storage position of the target interval set indicated by the target index information.

4. An apparatus for extracting message character data, characterized by comprising: The device is applied to a data analysis chip, and the data analysis chip is deployed with a data transmission module, a data analysis module, and a data processing module, and the device includes: The data transmission module is configured to detect a target network protocol used by a target data packet of to-be-extracted transmission information received by the data analysis chip on a target network protocol layer. The data transmission module is configured to acquire a target interval set corresponding to the target network protocol from the network protocol and interval set having the corresponding relationship, wherein the target interval included in the target interval set is used to indicate a character position of transmission information of the target network protocol in a data packet. The data transmission module is configured to transmit the target interval set to the data analysis module. The data analysis module is configured to extract data of the character position indicated by the target interval set from the target data packet as transmission information of the target data packet on the target network protocol layer, and transmit the data of the character position to the data processing module, wherein the data processing module is configured to perform a packet transmission operation on the target data packet on the corresponding network protocol layer according to the received data. The data analysis module is configured to extract target character data from the target data packet according to the target interval set, wherein the target character data is used to represent transmission information of the target data packet on the target network protocol layer; the data analysis module is configured to write the target character data into an analysis information container in a target storage format, wherein the analysis information container is used to store character data representing transmission information on multiple network protocol layers included in a target data packet, and the target storage format is used to represent that the character data of two adjacent network protocol layers is stored continuously in the analysis information container; and the data analysis module is configured to transmit the analysis information container to the data processing module when it is determined that the character data of all network protocol layers included in the target data packet is stored in the analysis information container. The data analysis module is configured to store the target character data into a target end position corresponding to the target network protocol layer in the analysis information container when the target network protocol layer is a first analyzed network protocol layer in a network protocol architecture corresponding to the target data packet, and store the target character data into a position adjacent to the character data of a last analyzed network protocol layer in the analysis information container when the target network protocol layer is a non-first analyzed network protocol layer in the network protocol architecture corresponding to the target data packet. The data analysis module is configured to extract corresponding sub-character data from the target data packet according to a character position indicated by the target interval, wherein the target character data comprises the sub-character data; the data analysis module is configured to determine a character quantity of the sub-character data; and the data analysis module is configured to store the sub-character data into a target storage position corresponding to the character quantity in a target data container, wherein the target data container is a data container corresponding to the target network protocol layer, the target data container is configured to temporarily store the sub-character data, and a storage granularity of the target storage position matches the character quantity. The data analysis module is configured to: in a case where a network protocol architecture to which the target network protocol layer belongs is used to indicate a transmission manner of a data packet between network devices, store the target character data into a first end portion of the analysis information container, wherein the target end portion position comprises the first end portion; and in a case where the network protocol architecture to which the target network protocol layer belongs is used to indicate a transmission manner of a data packet between service layers of network devices, store the target character data into a second end portion of the analysis information container, wherein the target end portion position comprises the second end portion.

5. A computer readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, wherein the program is configured to execute the method of any one of claims 1 to 3 when executed. 6.An electronic device comprising a memory and a processor, the electronic device comprising: The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 3 by using the computer program.

Citation Information

Patent Citations

  • Universal protocol adapting method and device

    CN102480462A