Message data processing method and device based on frame structure classification, equipment and medium
Through the message data processing method based on frame structure classification, appropriate compression methods are used for different types of messages, and index tables are generated for processing, which solves the problem of waste of message storage and transmission resources in the existing technology, and achieves bandwidth and Effective reduction of storage space.
Patent Information
- Application Number
- CN202410801137.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-20
AI Technical Summary
The existing technology occupies a large bandwidth and storage space when storing and transmitting messages in network equipment, and is difficult to effectively compress and process, resulting in a waste of resources.
Using a message data processing method based on frame structure classification, the message information is obtained for classification processing and compression, the appropriate compression method is selected according to the message type, and an index table is generated for compression processing to reduce the consumption of transmission bandwidth and storage space.
Through the classification, processing and compression of different types of messages, the consumption of transmission bandwidth and storage space is significantly reduced, and the efficiency of data transmission and storage is improved.
Smart Images

Figure CN118677969A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network data processing, and in particular to a message data processing method, device, equipment and medium based on frame structure classification. Background Art
[0002] A message is a unit of data exchanged and transmitted in a network, i.e., a block of data to be sent by a station at one time. A message contains the complete data information to be sent, and its length is very inconsistent, unlimited and variable. With the intelligence of network devices and the complexity of network environment, the number of messages that need to be transmitted and stored has become increasingly large.
[0003] The commonly used message storage method is to use the pcap format to store the entire message content. When the tester capture function is implemented, it is generally implemented by transmitting and saving the entire message content, which occupies a large amount of transmission bandwidth and storage space. Summary of the invention
[0004] In order to reduce the consumption of transmission bandwidth and storage space, the present application provides a message data processing method, device, equipment and medium based on frame structure classification.
[0005] In a first aspect, the present application provides a method for processing message data based on frame structure classification, which adopts the following technical solution: A message data processing method based on frame structure classification, comprising: Acquire a target message and message information of the target message; Classify the target message based on the message information to generate a classification result; The target message is compressed based on the classification result.
[0006] By adopting the above technical solution, the messages are classified and processed, and different types of messages are compressed in different ways. When transmitting the messages, different means can be used to reduce the size of the compressed messages according to the types of the messages, thereby reducing the consumption of transmission bandwidth and storage space.
[0007] Optionally, the message information includes message content and a frame structure; and the classifying the target message based on the message information to generate a classification result includes: Performing type classification processing on the message based on the frame structure to generate a type classification result; Determine the message type of the target message based on the type classification result; Extracting characteristic fields from the message content based on the message type to obtain a message characteristic field; Performing flow splitting processing on the target message based on the message characteristic field to determine a message flow of the target message; The message type of the target message and the message flow are used as classification results.
[0008] Optionally, the compressing the target message based on the classification result includes: Determining whether the target message is of unknown classification based on the classification result; If the target message is of unknown classification, directly compress the target message; If the target message is not of unknown classification, a message index is generated based on the message feature field; An index table corresponding to the classification is obtained, and compression processing is performed on the message based on the index table and the message index.
[0009] Optionally, the compressing the message based on the index table and the message index includes: Determine whether the message index exists based on the index table; If the message index does not exist, create an index for the target message and directly compress the target message; If the message index exists, the target message is verified, and the target message is decompressed, compressed and saved based on the verification result.
[0010] Optionally, the method further includes: Get the message to be decompressed; Determine whether the message to be decompressed is a complete compressed message; If the message to be decompressed is a complete compressed message, decompress the message to be decompressed and update the preset table; If the message to be decompressed is not a complete compressed message, determining that the message to be decompressed is a disassembled compressed message; The message to be decompressed is decompressed based on a preset table.
[0011] In a second aspect, the present application provides a message data processing device based on frame structure classification, which adopts the following technical solution: A message data processing device based on frame structure classification, comprising: A message information acquisition module, used to acquire a target message and message information of the target message; A classification result generating module, used for classifying the target message based on the message information to generate a classification result; The message compression processing module is used to compress the target message based on the classification result.
[0012] By adopting the above technical solution, the messages are classified and processed, and different types of messages are compressed in different ways. When transmitting the messages, different means can be used to reduce the size of the compressed messages according to the types of the messages, thereby reducing the consumption of transmission bandwidth and storage space.
[0013] In a third aspect, the present application provides an electronic device, which adopts the following technical solution: An electronic device comprises a processor, wherein the processor is coupled to a memory; The processor is used to execute the computer program stored in the memory so that the electronic device executes the computer program of the message data processing method based on frame structure classification as described in any one of the first aspects.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium stores a computer program that can be loaded by a processor and execute the message data processing method based on frame structure classification as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a flow chart of a message data processing method based on frame structure classification provided in an embodiment of the present application.
[0016] Figure 2 It is a structural block diagram of a message data processing device based on frame structure classification provided in an embodiment of the present application.
[0017] Figure 3 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The present application is further described in detail below in conjunction with the accompanying drawings.
[0019] The embodiment of the present application provides a message data processing method based on frame structure classification, which can be executed by an electronic device, which can be a server or a terminal device, wherein the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smart phone, a tablet computer, a desktop computer, etc., but is not limited thereto.
[0020] Figure 1 A flowchart of a message data processing method based on frame structure classification is provided in an embodiment of the present application.
[0021] like Figure 1As shown, the main process of the method is described as follows (steps S101 to S103): Step S101, obtaining a target message and message information of the target message.
[0022] In this embodiment, the target message is a message waiting to be transmitted or a message waiting to be stored, and the number of target messages is at least one. The message information of the target message includes message content and frame structure, etc. The specific message information can be added and adjusted according to actual needs and is not specifically limited here.
[0023] Step S102: classify the target message based on the message information to generate a classification result.
[0024] For step S102, the message is type-classified based on the frame structure to generate a type classification result; the message type of the target message is determined based on the type classification result; the feature field of the message content is extracted based on the message type to obtain the message feature field; the target message is diverted based on the message feature field to determine the message flow of the target message; the message type and message flow of the target message are used as the classification result.
[0025] In this embodiment, different types of messages correspond to different frame structures, and the messages are classified and processed according to the different frame structures. Different frame structures correspond to one message type, and messages of the same type correspond to the same frame structure, thereby obtaining a type classification result. For example, the message types include ipv4, ipv6, tcp, udp, etc., and vlan processing can be added to obtain classifications such as vlan_ipv4, vlan_ipv6, vlan_tcp, vlan_udp, etc. In the subsequent feature field extraction, the vlan value is also used as the feature field. Different message types correspond to different feature fields. At the same time, messages of the same type will also correspond to different streams. Further division is performed according to the message type, and the feature field extraction operation is performed on the message content. According to the extracted feature fields, the target message is divided into unused message flows.
[0026] The characteristic fields of the same message flow remain unchanged. For example, for IP messages, the characteristic fields are dst ip and src ip; for TCP and UDP messages, the characteristic fields include dst ip and src ip, dst port and src port. The characteristic fields are determined according to the characteristics of the protocol when dividing.
[0027] After the message is classified, some variable fields in the message are determined according to the characteristics of the general protocol and are divided into the following two categories: The first category includes checksum fields and length fields, which can be checked for legitimacy and the restored message can be obtained by calculation, such as the length and checksum fields of the IP header; The second category is fields whose changes cannot be restored and need to be used as additional data Ext Data of the message, such as the identification field and ttl field of the IP header. If IP fragmentation is considered, the Flags and Fragment offset fields are added.
[0028] There are two data formats for compressed messages, and a 1-bit flag is used to distinguish the two formats. 0 is complete message compression, and 1 is classified compressed message. Class is the message classification (classes defined by frame structure, such as ipv4, ipv6, udp, tcp, etc.), index corresponds to the index value in the udp header table to find the corresponding message header, and Ext Data is the variable part of this udp format message, including the ttl and identification of the ip header.
[0029] Step S103: compress the target message based on the classification result.
[0030] For step S103, determine whether the target message is of unknown classification based on the classification result; if the target message is of unknown classification, directly compress the target message; if the target message is not of unknown classification, calculate based on the message feature field and generate a message index; obtain the index table of the corresponding classification, and compress the message based on the index table and the message index.
[0031] Furthermore, it is determined whether the message index exists based on the index table; if the message index does not exist, the index of the target message is established and the target message is directly compressed; if the message index exists, the target message is verified, and the target message is disassembled, compressed and saved based on the verification result.
[0032] The message index also includes the message header. When searching, after determining the message index, the message header needs to be verified, that is, there is a situation where one message index corresponds to multiple different message headers.
[0033] In this embodiment, a compression operation is performed before transmission or storage. When compressing, different target messages use different compression methods. Therefore, the target messages need to be verified and classified, so that different compression methods are used. A judgment is made based on the classification results. If the target message does not belong to any of the recorded classifications, the target message is directly compressed. After compression, the target message is a complete message.
[0034] If the target message is in the recorded classification, a hash operation is performed according to the characteristic fields of the target message, and the calculated hash value is used as the message index. An index table is preset, and a large number of message indexes are recorded in the index table. The message index is compared with the index table to determine whether the message index exists. If the message index does not exist, the target message is directly compressed. The compressed target message is also a complete message, and the message index of the target message is added to the index table; if the message index exists, it is necessary to further verify whether the message header exists, that is, whether the message header of the target message is recorded in the index table. If the message header of the target message is not recorded, the index table is updated according to the message header, and the target message is also directly compressed. The compressed target message is a complete message; only when both the message index and the message header exist in the index table, the decompression is performed. When the decompression is performed, the message protocol format of the target message is verified. If the verification passes, the index, variable part and payload compressed data are saved according to the compressed message format to obtain the decompressed compressed message.
[0035] In this embodiment, a message to be decompressed is obtained; it is determined whether the message to be decompressed is a complete compressed message; if the message to be decompressed is a complete compressed message, the message to be decompressed is decompressed and a preset table is updated; if the message to be decompressed is not a complete compressed message, it is determined that the message to be decompressed is a disassembled compressed message; and the message to be decompressed is decompressed based on the preset table.
[0036] If the message to be decompressed is a complete message, the complete message will be decompressed and used directly, and the preset decompression index table will be updated. The message will be classified according to the protocol analysis. If it is an unknown classification, it will not be processed. If it is a known classification, the feature fields will be extracted in the same way, and the extracted feature fields will be hashed. The hash value will be used as the index of the message, and the index will be compared with the decompression index table. If the comparison result is that the index exists, the message header corresponding to the index is used. If the comparison result is that the index does not exist, the index and message header will be added to the decompression index table.
[0037] If the message to be decompressed is not a complete message, the message to be decompressed is parsed according to the format to obtain the classification, index, variable part and payload compressed data, and the corresponding decompression index table is searched through the index to obtain the message header, and the payload is decompressed at the same time, and the message header is added to obtain the entire message, the variable part is replaced, and the check field, length and other parts are updated according to the protocol specification to obtain the complete message, thereby completing the complete decompression process.
[0038] Taking UDP packets as an example, the packet header includes an Ethernet header (18 bytes), an IP header (20 bytes), and a UDP header (8 bytes), totaling 46 bytes. After compression, it is 7 bytes in total, including flag+class 1 byte, index 1 byte, identification 2 bytes, flags and fragment offset fields 2 bytes, and TTL 1 byte. The packet header compression ratio is (46 bytes - 7 bytes) / 46 bytes * 100% = 84.78%. It can be seen that the size of the packet is greatly reduced.
[0039] Figure 2 A structural block diagram of a message data processing device 200 based on frame structure classification provided in an embodiment of the application.
[0040] like Figure 2 As shown, the message data processing device 200 based on frame structure classification mainly includes: The message information acquisition module 201 is used to acquire the target message and the message information of the target message; The classification result generating module 202 is used to classify the target message based on the message information and generate a classification result; The message compression processing module 203 is used to compress the target message based on the classification result.
[0041] As an optional implementation mode of this embodiment, the classification result generation module 202 is specifically used to perform type classification processing on the message based on the frame structure to generate a type classification result; determine the message type of the target message based on the type classification result; extract the feature field of the message content based on the message type to obtain the message feature field; divert the target message based on the message feature field to determine the message flow of the target message; and use the message type and message flow of the target message as the classification result.
[0042] As an optional implementation of this embodiment, the message compression processing module 203 includes: An unknown classification judgment module is used to judge whether the target message is of unknown classification based on the classification result; A first message compression module, used for directly compressing a target message; A message index generation module, used to generate a message index by performing calculations based on message feature fields; The second message compression module is used to obtain an index table corresponding to the classification, and compress the message based on the index table and the message index.
[0043] In this optional embodiment, the second message compression module is specifically used to determine whether a message index exists based on an index table; if the message index does not exist, an index of the target message is established and the target message is directly compressed; if the message index exists, the target message is verified, and the target message is disassembled, compressed and saved based on the verification result.
[0044] As an optional implementation of this embodiment, the message data processing device 200 based on frame structure classification further includes: A module for obtaining messages to be decompressed, used for obtaining messages to be decompressed; A complete message judgment module is used to judge whether the message to be decompressed is a complete compressed message; A preset table updating module, used for decompressing the message to be decompressed and updating the preset table; A message disassembly determination module, used for determining whether the message to be decompressed is a message to be disassembled and compressed; The message decompression module is used to decompress the message based on a preset table.
[0045] In one example, the module in any of the above devices can be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASICs), or, one or more digital signal processors (DSPs), or, one or more field programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.
[0046] For another example, when the modules in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0047] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0048] Figure 3 This is a structural block diagram of an electronic device 300 provided in an embodiment of the present application.
[0049] like Figure 3As shown, the electronic device 300 includes a processor 301 and a memory 302 , and may further include an information input / information output (I / O) interface 303 , one or more of a communication component 304 , and a communication bus 305 .
[0050] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps of the above-mentioned message data processing method based on frame structure classification; the memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include, for example, instructions for any application or method used to operate on the electronic device 300, and data related to the application. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), programmable read-only memory (Programmable Read-Only Memory, PROM), read-only memory (Read-Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0051] The I / O interface 303 provides an interface between the processor 301 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 304 is used for ... wired or wireless communication between the device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 104 can include: Wi-Fi components, Bluetooth components, NFC components.
[0052] The electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the message data processing method based on frame structure classification given in the above embodiment.
[0053] The communication bus 305 may include a path to transmit information between the above components. The communication bus 305 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 305 may be divided into an address bus, a data bus, a control bus, etc.
[0054] The electronic device 300 may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc., and may also be servers, etc.
[0055] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned message data processing method based on frame structure classification are implemented.
[0056] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0057] The terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or apparatus.
[0058] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.
Claims
1. A message data processing method based on frame structure classification, characterized in that: include: Acquire a target message and message information of the target message; Classify the target message based on the message information to generate a classification result; The target message is compressed based on the classification result.
2. The method according to claim 1, characterized in that The message information includes message content and frame structure; The classifying and processing the target message based on the message information to generate a classification result includes: Performing type classification processing on the message based on the frame structure to generate a type classification result; Determine the message type of the target message based on the type classification result; Extracting characteristic fields from the message content based on the message type to obtain a message characteristic field; Performing flow splitting processing on the target message based on the message characteristic field to determine a message flow of the target message; The message type of the target message and the message flow are used as classification results.
3. The method according to claim 2, characterized in that The compressing the target message based on the classification result includes: Determining whether the target message is of unknown classification based on the classification result; If the target message is of unknown classification, directly compress the target message; If the target message is not of unknown classification, a message index is generated based on the message feature field; An index table corresponding to the classification is obtained, and compression processing is performed on the message based on the index table and the message index.
4. The method according to claim 3, characterized in that: The compressing the message based on the index table and the message index comprises: Determine whether the message index exists based on the index table; If the message index does not exist, create an index for the target message and directly compress the target message; If the message index exists, the target message is verified, and the target message is decompressed, compressed and saved based on the verification result.
5. The method according to claim 1, characterized in that The method further comprises: Get the message to be decompressed; Determine whether the message to be decompressed is a complete compressed message; If the message to be decompressed is a complete compressed message, decompress the message to be decompressed and update the preset table; If the message to be decompressed is not a complete compressed message, determining that the message to be decompressed is a disassembled compressed message; The message to be decompressed is decompressed based on a preset table.
6. A message data processing device based on frame structure classification, characterized in that: include: A message information acquisition module, used to acquire a target message and message information of the target message; A classification result generating module, used for classifying the target message based on the message information to generate a classification result; The message compression processing module is used to compress the target message based on the classification result.
7. An electronic device, characterized in that: comprising a processor coupled to a memory; The processor is configured to execute a computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The method comprises a computer program or an instruction, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 5.
