CN115801927A - Message parsing method and device - Google Patents

Message parsing method and device Download PDF

Info

Publication number
CN115801927A
CN115801927A CN202211457115.4A CN202211457115A CN115801927A CN 115801927 A CN115801927 A CN 115801927A CN 202211457115 A CN202211457115 A CN 202211457115A CN 115801927 A CN115801927 A CN 115801927A
Authority
CN
China
Prior art keywords
message
frame
data
key
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211457115.4A
Other languages
Chinese (zh)
Inventor
蔚彦昭
叶伟
胡旭
于磊
骆正新
袁重阳
赵安安
张楠乔
韩冰倩
张志鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CRSC Urban Rail Transit Technology Co Ltd
Original Assignee
CRSC Urban Rail Transit Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CRSC Urban Rail Transit Technology Co Ltd filed Critical CRSC Urban Rail Transit Technology Co Ltd
Priority to CN202211457115.4A priority Critical patent/CN115801927A/en
Publication of CN115801927A publication Critical patent/CN115801927A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a message analysis method and a device, wherein the message analysis method comprises the following steps: when a plurality of clients and a plurality of servers carry out message communication, message data to be analyzed are determined; analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message; and storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure. The method of the invention realizes the analysis of the message data by extracting the key-value data of the frame message and forming a new data structure by the frame type of the frame message, thereby improving the efficiency of analyzing, classifying and storing various different types of message data.

Description

Message parsing method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for parsing a packet.
Background
In the field of rail transit signal communication, UDP (User Datagram Protocol) has the characteristics of small time delay, high real-time performance and the like, and is widely applied to message data transmission.
In the related art, when one client or server receives multiple different types of UDP messages from other clients or servers and the messages contain multiple types of messages, the original UDP message parsing program needs to be modified for multiple times, and the efficiency of parsing or storing multiple types of message information is low.
Disclosure of Invention
The invention provides a message analysis method, which is used for solving the defects of low analysis or storage efficiency and long processing period of multi-type message information in the prior art and improving the processing efficiency of multi-type messages.
The invention provides a message analysis method, which comprises the following steps:
when a plurality of clients and a plurality of servers carry out message communication, determining message data to be analyzed, wherein the message data to be analyzed comprises a plurality of frame messages;
analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the frame message analysis table comprises a plurality of sequentially arranged identification information, the number of the sequentially arranged identification information is determined based on the data length of the frame message, and the sequentially arranged identification information is used for indicating the category of the frame data;
and storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure. According to the message analysis method provided by the invention, the frame message comprises a frame header and frame data, the identification information comprises identification serial numbers and identification values, and each identification serial number corresponds to a plurality of identification values;
analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the analyzing comprises:
sequentially filling a plurality of identification serial numbers into a data structure corresponding to the frame data by taking the position of the frame header as an initial position to obtain outer layer key data corresponding to the frame message;
searching target identification values corresponding to the identification sequence numbers based on the frame message analysis table, wherein the target identification value is one of the identification values;
and obtaining key-value data corresponding to the frame message based on the outer layer key data and the target identification value.
According to the message parsing method provided by the present invention, the storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure includes:
and respectively storing the key-value data corresponding to each frame message in the frame type structure of the frame message to obtain the dictionary data structure.
According to the message parsing method provided by the invention, the identification value comprises at least one of a number, a letter or a combination of the number and the letter.
According to the message parsing method provided by the present invention, after the obtaining of the dictionary data structure of the message data, the method further includes:
and storing the dictionary data structure in a data cluster corresponding to a message queue.
The invention also provides a message analysis device, which comprises:
the system comprises a confirmation module, a message analysis module and a message analysis module, wherein the confirmation module is used for determining message data to be analyzed when a plurality of clients and a plurality of servers perform message communication, and the message data to be analyzed comprises a plurality of frame messages;
the first processing module is configured to parse the frame message based on a preset frame message parsing table to obtain key-value data corresponding to the frame message, where the frame message parsing table includes a plurality of sequentially arranged identification information, the number of the sequentially arranged identification information is determined based on a data length of the frame message, and the sequentially arranged identification information is used to indicate a category of the frame data;
and the second processing module is used for storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
According to a message parsing apparatus provided by the present invention, the apparatus further includes:
and the third processing module is used for storing the dictionary data structure in a data cluster corresponding to the message queue after the dictionary data structure of the message data is obtained.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the program, the message analysis method is realized according to any one of the above.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a message parsing method as in any one of the above.
The present invention also provides a computer program product comprising a computer program, which when executed by a processor implements any of the message parsing methods described above.
According to the message analysis method and device, key-value data of each frame message are obtained through the position information of the frame message in the message data and the data length of each message, and the key-value data are added to the frame type structure of each frame message to form a new value dictionary structure; by extracting the key-value data of the frame message and the frame type of the frame message to form a new data structure, the analysis, classification and storage efficiency of the message data of various different types is improved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow diagram of a message parsing method provided in the present invention;
fig. 2 is a schematic structural diagram of a frame message provided by the present invention;
fig. 3 is a schematic structural diagram of a frame message parsing table provided by the present invention;
fig. 4 is a second schematic flow chart of the message parsing method provided in the present invention;
fig. 5 is a schematic structural diagram of a message parsing apparatus provided in the present invention;
fig. 6 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The message parsing method of the present invention is described below with reference to fig. 1 to 4.
Fig. 1 is a schematic flow diagram of a message parsing method provided by the present invention, where the message parsing method includes:
step 110, when the plurality of clients and the plurality of servers perform message communication, determining message data to be analyzed, wherein the message data to be analyzed comprises a plurality of frame messages.
In this step, the message data to be parsed may be a UDP message or a message constructed based on other communication protocols.
In this embodiment, a sending end of message data may be one Client, or may be a Client cluster including multiple clients, for example, the Client cluster is Client i (i =1, 2, 3, 4 \8230), and correspondingly, a receiving end of message data may be one Server, or may include a Server cluster including multiple servers, for example, the Server cluster may be Server i (i =1, 2, 3, 4 \8230).
In this embodiment, when the Client1 receives UDP packets from the Server2 and the Server3 at the same time, the TYPE of the packet data of the Server2 is TYPE2, the TYPE of the packet data of the Server3 is TYPE3, and the format of the packet data is as follows:
other data + TYPE 2-frame 1 message-frame 2 message-frame 3 message- \ 8230; -frame n message.
Wherein, the other data-TYPE 2 is the header of the message data, and the format of each frame of message is as follows:
target identification-source-type-length-frame data.
The target mark represents the address information of the receiving end, the source represents the address information of the sending end, the type represents the message type, the length is the length of the frame data representing the message data, the length is the count value, and the frame data represents the frame information contained in the message data; the target identifier, source, type and length all occupy one byte, the number of bits is 8, and the frame data length is adjustable, for example, the number of bits of the frame data is 8 × 8bits.
Fig. 2 is a schematic structural diagram of a frame message provided by the present invention, and in the embodiment shown in fig. 2, in the message data sent by the Server2 to the Client1, the target identifier of the first frame message (corresponding to the frame 1) is assumed to be the number 0xE0 of the Client 1; "Source" takes one byte, here assumed to be Server2 number 0x81; the type occupies one byte, represents the type of the frame 1 message, and is assumed to be 0x01; the length is one byte, representing the byte length of the following frame data, and is assumed to be 0x08.
And step 120, analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the frame message analysis table comprises a plurality of sequentially arranged identification information, the number of the plurality of sequentially arranged identification information is determined based on the data length of the frame message, and the plurality of sequentially arranged identification information is used for indicating the category of the frame data.
In this step, the frame message in the message data may have a plurality of different identification information, for example, when the frame data length is 8 bytes, at least 20 kinds of identification information may be stored, the bit occupied by each kind of identification information is minimum 1 and maximum 8, and the corresponding identification value is a limited combination of 1 and 0.
In this embodiment, the initial position corresponding to different identification information of the frame message may be a first position where a frame header of a plurality of frame messages of the message data appears, for example, because the composition of the message data includes a message header and a frame message, each frame message includes a target identifier, a source, a type, a length, and frame data, where the initial position of the target identifier may be marked as 0, that is, a bit corresponding to the target identifier is 0, and since the target identifier occupies 1 byte in the message data and the amount of information included is 8 bits, the initial position corresponding to the source may be marked as 8, and the position distance between the initial position of the target identifier and the original initial position is the number of bits included in the target identifier.
In this step, the information amount of the frame message may be the number of bits contained in the frame message.
In this step, the key-value data corresponding to the frame message is determined by the target identification value in the identification information, for example, for a frame message with a frame type of 0xE001, the corresponding key-value data may be a combination of "identification information 1: number or string type value", for example: "identification information 1", "identification information 2: hello "or" identification information 20 ".
In some embodiments, before a frame message in the message data is parsed, a frame message type check is performed, and whether a target identifier is a current client cluster and whether a type of a corresponding frame message is a type required to be parsed is determined by combining the target identifier and the frame message type.
Step 130, storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
In this step, the key-value data obtained by parsing may be stored in the frame type of the corresponding frame message, so as to obtain a new frame storage structure.
In some embodiments, the new frame storage structure generated after parsing the original message data may be a dictionary data structure of values.
In this embodiment, after each frame message in the message data is parsed according to the parsing rule, the parsed frame messages are respectively stored in the structure of the frame type corresponding to each frame message, so as to obtain a dictionary of the value of the message data.
Fig. 3 is a schematic diagram of frame message types provided by the present invention, in the embodiment shown in fig. 3, a frame type corresponds to 1 byte, the included bit number is 8, the frame data length is assumed to be 8 bytes, and the frame type can be used for storing data of identification information 1-identification information 20, each identification information occupies a limited combination of bits with minimum 1 and maximum 8, and the value is 1 and 0.
According to the message analysis method provided by the invention, each frame message is obtained through the position information of the frame message in the message data and the data length of each message, and is added to a structure corresponding to the frame type of each frame message to form a new value dictionary structure; the new data structure formed by the extracted frame message and the original frame message realizes the analysis of the message data, and improves the efficiency of analyzing and storing the message data of various different types.
In some embodiments, the frame message includes a frame header and frame data, the identification information includes identification sequence numbers and identification values, each identification sequence number corresponds to a plurality of identification values; analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the key-value data comprises the following steps: sequentially filling a plurality of identification serial numbers into a data structure corresponding to frame data by taking the position of the frame header as an initial position to obtain outer layer key data of the frame message; determining target identification values corresponding to the identification sequence numbers based on the frame message analysis table, wherein the target identification value is one of the identification values; and obtaining key-value data corresponding to the frame message based on the outer layer key data and the target identification value.
In this embodiment, each frame message in the message data may set multiple pieces of identification information according to the data length, where each piece of identification information includes an identification sequence number and multiple identification values, for example, one piece of identification information of a frame message may be set to "identification information 1, value 1 0001, value 2.
In this embodiment, the target identification value is one of a plurality of identification values included in each piece of identification information, for example, the target identification value of the above-mentioned frame message is 2 (corresponding to 0010).
In the embodiment, after receiving a piece of message data from the Server2, the Client1 firstly identifies that the header of the message is TYPE2, then starts to analyze the message, and sequentially analyzes the frame 1 message, the frame 2 message and the frame 3 message \8230; after the frame type is verified, according to a frame message analysis rule, starting to analyze according to the bit start bit and the occupied bit number of each frame message, wherein the frame message analysis rule is as follows:
target identification 0, length 8,
source {' start: "8", "length:" 8},
type { "start":16, "length":8},
length { 'start {' 24 ',' length: 8},
0xE001 { "identification information 1": 32 { "start":32 { "length":4},
identification information 2 { "start":36, "length":4},
identification information 3 { "start":40, { "length":2},
identification information 4 { "start":42, "length":2} },
0xE002 { "identification information 1": 32 { "start": 2},
identification information 2 { "start:" 34, "length:" 4},
identification information 3 { "start":38, "length":4},
identification information 4 { "start":42, "length":2.
Wherein, start represents the initial bit, length represents the bit number occupied, the target mark is in the first byte of the frame head, and occupies 8 bits, then the corresponding start is marked as 0, and length is 8; the 'source' is positioned at the second byte of the frame header, and occupies 8 bits, the corresponding start is 8, and the length is 8; the type is positioned in the third byte of the frame header, and occupies 8 bits, the corresponding start is 16, and the length is 8; the length is positioned in the fourth byte of the frame head, and occupies 8 bits, the corresponding start is 24, and the length is 8; frame data starts from the fifth byte, the start of the corresponding identification information 1 is 32, the length is determined by the bit number occupied by the identification information 1, the start of other identification information is determined by the bit where the identification information is located, and the start of the identification information n is equal to the start of the identification information n-1 plus the length of the identification information n-1.
According to the message analysis method provided by the invention, the key-value data of the frame message is obtained through the analysis mode of each frame message in the message data determined by the preset frame message analysis table, the analysis mode has strong expandability, and if new message types, frame messages and identification information need to be added, the frame message analysis rule is directly modified by modifying the frame message analysis table, namely, the program development amount is reduced.
In some embodiments, storing key-value data corresponding to the frame message in the message data to obtain a dictionary data structure, includes: and respectively storing the key-value data corresponding to each frame message in the frame type structure of the frame message to obtain a dictionary data structure.
In this embodiment, the frame type structure of the frame message is used to indicate the category information of the frame message.
In this embodiment, the key-value data corresponding to each frame message is stored in the frame type structure of the frame message, respectively, to form a new data structure.
Fig. 4 is a second schematic flow diagram of the message parsing method provided by the present invention, in the embodiment shown in fig. 4, a Client receiving end (corresponding to Client 1) receives a message sent by a server cluster, and first determines that a TYPE of the message (corresponding to TYPE 2) is a to-be-parsed TYPE, specifically, according to contents of n frame messages in the message data, whether a target identifier included in each frame message is matched with the TYPE of Client1, and whether the frame TYPE is the same as a preset TYPE, and when the target identifier is matched with the TYPE of Client1 and the frame TYPE is the same as the preset TYPE, parses each frame message to obtain a new data structure formed by each frame TYPE and corresponding key-value data (corresponding to frame 1, \8230; n TYPE + identification information: value), that is, dictionary data formed by key-value data (identification information: value) and frame message TYPE, and obtain updated message data.
According to the message analysis method provided by the invention, the key-value of the frame message in the message data is extracted, and the key-value and the frame type corresponding to the frame message form new structural data together, so that the analysis mode of the frame message is convenient, fast and efficient, and the development and debugging of subsequent application are facilitated.
In some embodiments, the message data to be parsed includes a plurality of message data, and determining the message data to be parsed includes: and determining target message data, wherein the target message data is one of a plurality of message data to be analyzed.
It is understood that the UDP message data generated by different types of clients or servers also includes multiple types, each type of message includes data of multiple types of messages, and before parsing the message data, determining the type of the message data to be parsed needs to be completed.
In this embodiment, the Client1 can receive UDP messages sent by the Server2 and the Server3 at the same time, the TYPE of the message data of the Server2 is TYPE2, the TYPE of the message of the Server3 is TYPE3, and after the Client1 identifies that the header of the message contains TYPE information of TYPE2, the Client analyzes a frame message in the message data corresponding to TYPE 2.
According to the message analysis method provided by the invention, the types of the message data are checked, so that the message data of various types can be conveniently classified, and the analysis efficiency of various types of message data is improved.
In some embodiments, the identification value comprises at least one of a number, a letter, or a combination of a number and a letter.
In this embodiment, the identification information corresponding to each frame message may include a plurality of identification sequence numbers, each identification sequence number corresponds to a plurality of identification values, and in order to distinguish the types of different frame messages, the content of the identification values may be set in a user-defined manner according to the actual needs of the user.
Optionally, the identification value under one identification number may be a value of a number or a character string type, for example, the identification value may be 1, hello, or the like.
According to the message analysis method provided by the invention, by setting multiple types of identification values for the frame messages, the types of different frame messages can be distinguished conveniently, and the accuracy of message analysis is improved.
In some embodiments, after obtaining the dictionary data structure for the message data, the method further comprises: and storing the dictionary data structure in a data cluster corresponding to the message queue.
In the embodiment, the dictionary data structure is stored in the message queue, and data can be directly analyzed or modified through a message queue management tool, so that compared with the analysis of an original UDP message, the method is more intuitive, higher in efficiency and more convenient for upper-layer application development and debugging.
In the embodiment shown in fig. 4, after dictionary data of frame message identification information and values are acquired, the dictionary data are stored in a message queue.
According to the message analysis method provided by the invention, the value dictionary data structure is used for upper-layer application development and debugging, so that the management efficiency of the sending data cluster is improved.
The following describes the message parsing apparatus provided in the present invention, and the message parsing apparatus described below and the message parsing method described above may be referred to in correspondence.
Fig. 5 is a schematic structural diagram of a message parsing apparatus provided in the present invention, and as shown in fig. 5, the present invention further provides a message parsing apparatus, which includes a confirmation module 510, a first processing module 520, and a second processing module 530.
A determining module 510, configured to determine message data to be analyzed when multiple clients perform message communication with multiple servers, where the message data to be analyzed includes multiple frame messages;
the first processing module 520 is configured to parse the frame message based on a preset frame message parsing table to obtain key-value data corresponding to the frame message, where the frame message parsing table includes a plurality of sequentially arranged identification information, the number of the plurality of sequentially arranged identification information is determined based on a data length of the frame message, and the plurality of sequentially arranged identification information is used to indicate a category of the frame data;
the second processing module 530 is configured to store the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
According to the message analysis device provided by the invention, key-value data of each frame message is obtained through the position information of the frame message in the message data and the data length of each message, and the key-value data is added into a structure corresponding to the frame type of each frame message to form a dictionary structure of a new value; the key-value data of the frame message and the frame type of the frame message are extracted to form a new data structure, so that the analysis, classification and storage efficiency of the message data of various different types is improved.
According to the message parsing apparatus provided by the present invention, the apparatus further includes:
and the third processing module is used for storing the dictionary data structure in the data cluster corresponding to the message queue after the dictionary data structure of the message data is obtained.
According to the message analysis device provided by the invention, the value dictionary data structure is used for upper-layer application development and debugging, so that the management efficiency of the sending data cluster is improved.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor) 610, a communication Interface 620, a memory (memory) 630 and a communication bus 640, wherein the processor 610, the communication Interface 620 and the memory 630 complete communication with each other through the communication bus 640. The processor 610 may invoke logic instructions in the memory 630 to perform a message parsing method comprising: when a plurality of clients and a plurality of servers perform message communication, determining message data to be analyzed, wherein the message data to be analyzed comprises a plurality of frame messages; analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the frame message analysis table comprises a plurality of orderly arranged identification information, the number of the orderly arranged identification information is determined based on the data length of the frame message, and the orderly arranged identification information is used for indicating the category of the frame data; and storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
In addition, the logic instructions in the memory 630 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, where the computer program product includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and when the computer program is executed by a processor, a computer can execute the message parsing method provided by the above methods, and the method includes: when a plurality of clients and a plurality of servers carry out message communication, message data to be analyzed are determined, wherein the message data to be analyzed comprise a plurality of frame messages; analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the frame message analysis table comprises a plurality of orderly arranged identification information, the number of the orderly arranged identification information is determined based on the data length of the frame message, and the orderly arranged identification information is used for indicating the category of frame data; and storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
In another aspect, the present invention also provides a non-transitory computer readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the message parsing method provided by the above methods when executed by a processor, and the method includes: when a plurality of clients and a plurality of servers carry out message communication, message data to be analyzed are determined, wherein the message data to be analyzed comprise a plurality of frame messages; analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the frame message analysis table comprises a plurality of orderly arranged identification information, the number of the orderly arranged identification information is determined based on the data length of the frame message, and the orderly arranged identification information is used for indicating the category of the frame data; and storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A message parsing method is characterized by comprising the following steps:
when a plurality of clients and a plurality of servers carry out message communication, determining message data to be analyzed, wherein the message data to be analyzed comprises a plurality of frame messages;
analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the frame message analysis table comprises a plurality of sequentially arranged identification information, the number of the sequentially arranged identification information is determined based on the data length of the frame message, and the sequentially arranged identification information is used for indicating the category of the frame data;
and storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
2. The message parsing method according to claim 1, wherein the frame message includes a frame header and frame data, the identification information includes identification sequence numbers and identification values, and each identification sequence number corresponds to a plurality of identification values;
analyzing the frame message based on a preset frame message analysis table to obtain key-value data corresponding to the frame message, wherein the analyzing comprises:
sequentially filling a plurality of identification serial numbers into a data structure corresponding to the frame data by taking the position of the frame header as an initial position to obtain outer key data of the frame message;
determining target identification values corresponding to the identification sequence numbers based on the frame message analysis table, wherein the target identification value is one of the identification values;
and obtaining key-value data corresponding to the frame message based on the outer layer key data and the target identification value.
3. The message parsing method according to claim 1, wherein the storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure comprises:
and respectively storing the key-value data corresponding to each frame message in the frame type structure of the frame message to obtain the dictionary data structure.
4. The message parsing method of claim 1, wherein the identification value comprises at least one of a number, a letter, or a combination of a number and a letter.
5. The message parsing method according to any one of claims 1-4, wherein after the obtaining the dictionary data structure of the message data, the method further comprises:
and storing the dictionary data structure in a data cluster corresponding to a message queue.
6. A message parsing apparatus, comprising:
the system comprises a confirmation module, a message analysis module and a message analysis module, wherein the confirmation module is used for determining message data to be analyzed when a plurality of clients and a plurality of servers perform message communication, and the message data to be analyzed comprises a plurality of frame messages;
the first processing module is configured to parse the frame message based on a preset frame message parsing table to obtain key-value data corresponding to the frame message, where the frame message parsing table includes a plurality of sequentially arranged identification information, the number of the sequentially arranged identification information is determined based on a data length of the frame message, and the sequentially arranged identification information is used to indicate a category of the frame data;
and the second processing module is used for storing the key-value data corresponding to the frame message in the message data to obtain a dictionary data structure.
7. The message parsing device according to claim 6, wherein the device further comprises:
and the third processing module is used for storing the dictionary data structure in a data cluster corresponding to the message queue after the dictionary data structure of the message data is obtained.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the message parsing method according to one of claims 1 to 5 when executing the program.
9. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the message parsing method according to one of claims 1 to 5.
10. A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the message parsing method of any one of claims 1 to 6.
CN202211457115.4A 2022-11-16 2022-11-16 Message parsing method and device Pending CN115801927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211457115.4A CN115801927A (en) 2022-11-16 2022-11-16 Message parsing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211457115.4A CN115801927A (en) 2022-11-16 2022-11-16 Message parsing method and device

Publications (1)

Publication Number Publication Date
CN115801927A true CN115801927A (en) 2023-03-14

Family

ID=85439440

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211457115.4A Pending CN115801927A (en) 2022-11-16 2022-11-16 Message parsing method and device

Country Status (1)

Country Link
CN (1) CN115801927A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117319529A (en) * 2023-11-29 2023-12-29 成都赛力斯科技有限公司 Message analysis method and device applied to vehicle end, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117319529A (en) * 2023-11-29 2023-12-29 成都赛力斯科技有限公司 Message analysis method and device applied to vehicle end, electronic equipment and storage medium
CN117319529B (en) * 2023-11-29 2024-02-02 成都赛力斯科技有限公司 Message analysis method and device applied to vehicle end, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US9112915B2 (en) Method and apparatus for protocol parsing
CN106815112B (en) Massive data monitoring system and method based on deep packet inspection
CN112311789B (en) Deep packet processing method and device, electronic device and storage medium
CN114157502B (en) Terminal identification method and device, electronic equipment and storage medium
CN112272123B (en) Network traffic analysis method, system, device, electronic equipment and storage medium
CN110460488B (en) Service flow identification method and device, and model generation method and device
CN111782140A (en) Network data packet storage method and device, computer equipment and storage medium
CN101287010A (en) Method and apparatus for identifying and verifying type of message protocol
CN111935081B (en) Data packet desensitization method and device
CN115801927A (en) Message parsing method and device
CN114172900A (en) File transmission method and system based on unidirectional network gate
CN114745455A (en) Network interface message data processing method, device, equipment and medium
CN108460044B (en) Data processing method and device
CN105939304B (en) Tunnel message parsing method and device
CN112822722B (en) Data message transmission method and device
CN116346961B (en) Financial message processing method and device, electronic equipment and storage medium
CN114979094A (en) Data transmission method, device, equipment and medium based on RTP
CN111177595B (en) Method for extracting asset information by templating HTTP protocol
CN114422624A (en) Data receiving method
CN112989315B (en) Fingerprint generation method, device and equipment for terminal of Internet of things and readable storage medium
CN112866275A (en) Flow sampling method, device and computer readable storage medium
CN108712394B (en) Radio frequency identification method and label
CN113949640A (en) Service data processing method and device
CN114553730B (en) Application identification method and device, electronic equipment and storage medium
CN116319468B (en) Network telemetry method, device, switch, network, electronic equipment and medium

Legal Events

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