An IP message parsing method and system suitable for the Internet of Things

By using the order-hopping IP message analysis method in the Internet of Things, IP messages are parsed according to the attribute table, the problems of inflexible resolution and poor scalability in the existing technology are solved, and efficient and flexible IP message analysis is achieved. Suitable for diversified communications of IoT devices.

CN118984345BActive Publication Date: 2025-01-14杭州半云科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411396989.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-01-14
Estimated Expiration
2044-10-09

AI Technical Summary

Technical Problem

The existing technology lacks flexibility in parsing hexadecimal IP packets, which leads to rewriting code every time the docking document changes, which increases cost and complexity, and the fixed format limits scalability, making it difficult to adapt to the Internet of Things. Diverse communication needs.

Method used

Using an IP message parsing method suitable for the Internet of Things, by looking for preset initiators, intercepting and parsing characters in IP messages based on preconfigured attribute tables, generating KV values, realizing sequence-jump-to-order parsing, adapting Fixed-length and uncertain-length messages, and custom parsing methods are implemented by configuring attribute tables, which are highly flexible and scalable.

Benefits of technology

It improves the efficiency and flexibility of IP packet resolution, reduces repetitive labor, saves attribute configuration time, is suitable for the deployment and configuration of IoT devices, and adapts to diversified communication needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984345B_ABST
    Figure CN118984345B_ABST
Patent Text Reader

Abstract

Multiple embodiments of this specification relate to the field of information technology, and specifically to an IP message parsing method and system suitable for the Internet of Things. The method includes the steps of: trying to find a pre-set start character from a specified position of the IP message; when the start character exists, according to a pre-configured attribute table, repeatedly intercepting the characters at the specified position of the IP message; the attribute table records a number of attributes, the attributes include attribute name, start bit, occupied length and parsing method, respectively using the parsing method to parse the corresponding characters and obtain attribute values; generating the attribute name and the KV value of the attribute value to complete the parsing of the IP message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Multiple embodiments of this specification relate to the field of information technology, and specifically to an IP message parsing method and system applicable to the Internet of Things. Background Art

[0002] The current Internet of Things industry is developing at an astonishing speed. IoT devices have been widely used in various fields, from large-scale industrial IoT systems to home smart devices. As more and more smart hardware devices join the network, data exchange has become an urgent need. In this process, network communication is an indispensable link, and TCP / UDP protocol, as a commonly used transmission protocol, supports the transmission of a large number of data packets. These data packets are usually transmitted in the network in hexadecimal form. However, the safe and efficient parsing of the hexadecimal message format has become a challenge in data exchange. When parsing such data, it is usually necessary to write customized code according to specific business requirements and docking documents, and parse according to predefined business logic. This method lacks flexibility. Whenever a new docking document is encountered, the code needs to be rewritten, which not only increases the cost of docking, but also makes the whole process complicated and time-consuming. In order to meet this challenge, the industry urgently needs to find a more flexible and efficient parsing method to reduce duplication of work and improve the efficiency of data exchange. Summary of the invention

[0003] Multiple embodiments of this specification describe an IP message parsing method and system suitable for the Internet of Things.

[0004] In a first aspect, an embodiment of the present specification provides an IP message parsing method applicable to the Internet of Things, comprising the steps of:

[0005] Try to find a preset start character from a specified position of the IP message;

[0006] When the initiator is present, the characters at the specified position of the IP message are intercepted multiple times according to a pre-configured attribute table; the attribute table records a number of attributes, including attribute name, start bit, occupied length and parsing method,

[0007] Use the parsing method to parse the corresponding characters respectively to obtain attribute values;

[0008] Generate the attribute name and the KV value of the attribute value to complete the parsing of the IP message.

[0009] In a second aspect, the embodiments of this specification provide an IP message parsing system applicable to the Internet of Things, including:

[0010] A search module attempts to search for a preset start character from a specified position of the IP message;

[0011] The interception module, when the initiator is present, intercepts the characters at the specified position of the IP message multiple times according to a pre-configured attribute table; the attribute table records a number of attributes, the attributes including attribute name, start bit, occupied length and parsing method,

[0012] A parsing module, using the parsing method to parse the corresponding characters to obtain attribute values;

[0013] The generation module generates a KV value pair of the attribute name and the attribute value to complete the parsing of the IP message.

[0014] In a third aspect, an embodiment of this specification provides an electronic device, including a processor and a memory;

[0015] The processor is connected to the memory;

[0016] The memory is used to store executable program code;

[0017] The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method described in any one of the above aspects.

[0018] In a fourth aspect, an embodiment of the present specification provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in any of the above aspects.

[0019] In a fifth aspect, an embodiment of this specification provides a computer program product, including a computer program, which implements the method described in any of the above aspects when executed by a processor.

[0020] The beneficial effects brought by the technical solutions provided by some embodiments of this specification include at least:

[0021] In multiple embodiments of this specification, the provided IP message parsing method can perform a jump-sequence analysis according to the attribute table, and only parse the required attributes, thereby improving the parsing efficiency of the IP message. The IP message parsing method disclosed in multiple embodiments of this specification can adapt to fixed-length IP messages, and can also adapt to variable-length IP messages, and can customize the parsing method by configuring the attribute table, which has highly flexible scalability. The use of a public attribute table allows the relevant configuration of the attribute to be reused, saving the configuration time of the attribute, and is suitable for a large number of devices in the Internet of Things to be deployed and configured.

[0022] Other features and advantages of the various embodiments of the present specification will be further disclosed in the following detailed description and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0024] Figure 1 A schematic diagram of an application scenario of the IP packet parsing method provided in an embodiment of this specification.

[0025] Figure 2 A flowchart of an IP packet parsing method provided in an embodiment of this specification.

[0026] Figure 3 A flowchart of a repeated attribute parsing method provided in an embodiment of this specification.

[0027] Figure 4 A schematic diagram of a verification and generation method provided in an embodiment of this specification.

[0028] Figure 5 A schematic diagram of a repeated attribute resolution system provided in an embodiment of this specification.

[0029] Figure 6 A schematic diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0030] The following is an explanation and description of the technical solutions of the embodiments of this specification in conjunction with the drawings of the embodiments of this specification, but the following embodiments are only preferred embodiments of this specification, not all. Based on the embodiments in the implementation mode, other embodiments obtained by those skilled in the art without creative work are all within the scope of protection of this specification.

[0031] The terms "first", "second", "third", etc. in the description and claims of this specification and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0032] In the following description, terms such as "inside", "outside", "up", "down", "left", "right", etc. that indicate directions or positional relationships are only used to facilitate the description of the embodiments and simplify the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as a limitation of this specification.

[0033] The data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection of relevant data complies with the relevant laws, regulations and standards of relevant countries and regions.

[0034] Before describing the technical solution in this specification, an introduction is given to the application scenarios and related technologies.

[0035] The IP protocol is the basis of the Internet protocol. It defines the way data packets are transmitted in the network, enabling different network devices to communicate. Convenient networking communication mainly depends on network devices such as routers, switches, and gateways. The communication process can be roughly divided into the following steps: First, the source device encapsulates the data into an IP data packet, which includes information such as the destination address, source address, and packet length; then, the data packet is sent to the next hop device, usually a router or gateway, through the network interface; the router selects the best path based on the routing table and forwards the data packet to the next router or directly transmits it to the destination; during this process, the router may perform NAT (network address translation) to adapt to communication between different networks; when the data packet reaches the target network, the switch or other network device in the target network finally delivers the data packet to the final destination device, that is, the receiving device; the receiving device decapsulates the data packet, restores the original data, and confirms that the received data packet is correct. Throughout the process, the IP protocol ensures that the data packet can be accurately and efficiently transmitted from the source address to the destination address, and can ensure the reliability of communication even in the case of complex and changing network topology.

[0036] The origin of the Internet of Things can be traced back to the development of Internet technology and the advancement of sensor technology. As various sensors become smaller, cheaper and less power-hungry, engineers began to envision connecting various objects in the physical world to the Internet to collect and analyze data. The Internet of Things relies on a variety of key technologies, including sensor technology, wireless communication technology, cloud computing, big data analysis, and artificial intelligence. Sensor technology is used to collect data from the environment or equipment, and wireless communication technology ensures that this data can be reliably transmitted between different devices. Cloud computing and big data technology provide the ability to store and process massive amounts of data. The application of the Internet of Things is very wide. For example, in the field of smart homes, the Internet of Things technology can enable remote control and automated management of various devices in the home, such as lights, air conditioners, and security systems. It can also be used in traffic management, environmental monitoring, public safety, and other aspects.

[0037] The IP message format mainly includes the header part and the data part. Among them, the header part contains fields such as version number, header length, service type, total length, identifier, flag, fragment offset, survival time (TTL), protocol, header checksum, source IP address, destination IP address, etc. The data part is the actual data to be transmitted. The message parsing process first requires the receiving device to check the header checksum of the IP message to ensure that the message is not damaged. Then, the routing table is searched according to the destination IP address to determine the next hop of the message. Then the TTL value is checked to prevent the message from looping infinitely in the network. If the TTL value is zero, the message is discarded and an ICMP timeout message is sent, otherwise the message continues to be processed. However, IP messages still have problems such as insufficient security and are vulnerable to man-in-the-middle attacks or data tampering.

[0038] More importantly, the fixed format of the IP message header limits scalability and makes it difficult to adapt to new demands that may arise in the future. The "Internet of Everything" in the Internet of Things includes a variety of communication forms. If they are unified according to the current IP message format, the efficiency of communication will be limited. Therefore, higher diversity and scalability requirements are put forward for communication technology. Therefore, it is necessary to study communication technology based on TCP / IP communication that is more suitable for the Internet of Things. This specification discloses a technology for IP message parsing that supports easy addition of custom communication formats and supports jump parsing.

[0039] Please refer to the attached Figure 1 , is a schematic diagram of the application scenario of the technical solution recorded in this specification. In the Internet of Things, multiple Internet of Things devices 10 are connected to a host 20 through a network, and the host 20 has a parsing device 21. The parsing device 21 is responsible for parsing the IP message sent by the Internet of Things device 10 received from the network. The technical solution recorded in this specification is applied on the host 20, and specifically runs on the parsing device 21 to implement the parsing of the IP message. Among them, the Internet of Things device 10 can be a printer, a projector, a sensor, a smart terminal, a smart phone, a tablet computer, a laptop, a PDA, a personal computer, a smart speaker, a smart TV, a smart watch, a car device, a wearable device, etc. The host 20 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The Internet of Things device 10 and the server can be directly or indirectly connected through wired or wireless communication, and this application is not limited here. There is no limit on the number of servers and IoT devices 10.

[0040] Since this application involves some professional terms, these professional terms will be introduced below.

[0041] IP packets

[0042] IP message refers to the data packet transmitted in the network, which consists of two parts, namely the header and data. The header contains the information required to ensure the correct transmission of the data packet, such as version number, header length, service type, total length, identifier, flag, fragment offset, time to live (TTL), protocol, header checksum, source IP address, destination IP address, etc. The data is the actual information to be transmitted. During the transmission process, the message is forwarded by the router until it reaches the destination. The information in the header helps the router determine the best path and ensure that the data packet can be delivered to the destination address accurately and efficiently.

[0043] Internet of Things

[0044] The Internet of Things refers to a network formed by connecting various devices and objects through the Internet. These devices and objects can communicate with each other and share data, thereby realizing intelligent management and control. The Internet of Things uses a variety of information sensing devices such as sensors, radio frequency identification (RFID), global positioning system (GPS), infrared sensors, etc. to connect any object to the Internet for information exchange and communication to achieve intelligent identification, positioning, tracking, monitoring and management. The Internet of Things technology is widely used in smart homes, smart cities, industrial production, medical health, transportation and logistics, etc., improving production efficiency and service quality, and bringing a more convenient and intelligent lifestyle.

[0045] KV value

[0046] KV value is the abbreviation of Key-Value, which is usually used in configuration files or databases to represent the form of key-value pairs for storing and retrieving data. The key is a unique identifier, and the value is the data item associated with it. This form of key-value pairs simplifies the process of data storage and access, making the data structure clearer and easier to use. In fields such as the Internet of Things and software development, KV values ​​are widely used in a variety of application scenarios such as cache, database, and configuration management.

[0047] Conversational Services

[0048] The session service in TCP / IP communication refers to the bidirectional or multidirectional data exchange process based on the Transmission Control Protocol (TCP) and the Internet Protocol (IP) in the network. The TCP protocol ensures the reliable transmission and sequential delivery of data packets, while the IP protocol is responsible for transmitting data packets from the source address to the destination address. The session service usually starts with the sender initiating a connection request to the receiver. After the three-way handshake is established, the two parties can exchange data multiple times. After multiple data exchanges are completed, the connection is disconnected by waving four times. During the entire session, the TCP / IP protocol stack works together. For example, each session service creates and maintains a service serial number to ensure the integrity, sequence and reliability of the data. It is suitable for a variety of network applications such as web browsing, email, and file transfer. Example 1

[0049] This manual first provides an IP message parsing method suitable for the Internet of Things. Figure 2 , including the steps of:

[0050] Step S01) attempts to search for a preset initiator from a specified position of the IP message.

[0051] As an example, the start character is set to "@@", which occupies two bytes and the character code is "4040". When the Internet of Things device 10 sends an IP message, under the premise of following the necessary rules of the IP message itself, it starts with "@@" at the custom content of the IP message, so that the host 20 knows that the IP message can be parsed in subsequent steps. The necessary rules refer to the IP message rules that enable the IP message to flow in the communication link and eventually reach the host 20. Exemplarily, the necessary rules need to include the version number, header length, total length, lifetime, protocol, header checksum, source IP address, and destination IP address in the header of the IP message. In this embodiment, the IP message sent by the Internet of Things device 10 also complies with the aforementioned necessary rules, generates corresponding content in the message header of the IP message, and starts with "@@" in the data part of the IP message. On the other hand, an end character can also be set. Exemplarily, the end character is "2323". When the end character is read, it means that the IP message parsing method recorded in this embodiment has been executed. The subsequent parsing of the IP message is performed according to the IP message parsing method disclosed in the art. If no end character is set, the IP message parsing method disclosed in this embodiment is completed at the end of the data part of the IP message.

[0052] Step S02) When the initiator exists, the characters at the specified position of the IP message are intercepted multiple times according to the pre-configured attribute table. The attribute table records several attributes, and the attributes include attribute name, start bit, occupied length and parsing method. Exemplarily, the attribute "initiator", the attribute name is "initiator", the start bit is 0, the occupied length is 2 bytes, and the parsing method is "default". The attribute "command byte", the attribute name is "command byte", the occupied length is 1 byte, the start bit is default, and the parsing method is "convert to decimal".

[0053] In this embodiment, the characters related to the attributes, including the attribute name and the attribute value, are continuous in the IP message. Therefore, the start bit of the previous attribute is offset by its occupied length to obtain the start bit of the next attribute. Therefore, the IP message parsing method recorded in this embodiment needs to read the start bit and occupied length of the first attribute, the first attribute is fixed as the "start character", and then read the attribute name and occupied length of each attribute in sequence, determine whether it is the attribute to be parsed according to the attribute name, obtain the character corresponding to the attribute according to the occupied length, and calculate the start bit of the next attribute at the same time.

[0054] As shown in Table 1, it is an example attribute table, that is, in an IP message, some attributes in the attribute table are stored. For example, an IP message stores the start symbol, service serial number, protocol version number, timestamp, source address, target address, application data, number of information objects, system type, system address, component type, component address, component status, component description, status occurrence time, and end symbol in sequence. Among them, the source address and target address are different from the source IP address and the destination IP address. The source address and target address refer to the addresses assigned by the Internet of Things application to the Internet of Things device 10 and the host 20. Of course, in special cases, the IP address obtained by the Internet of Things device 10 and the IP address of the host 20 can also be directly used as the address assigned by the Internet of Things application. However, in this embodiment, the source address and the target address can be expressed not only by IP addresses, but also by other methods.

[0055] Table 1 Example property table

[0056]

[0057] The application data indicates the number and parameter value of the IoT application. For example, if the IoT application is to collect the status of the IoT device 10, the parameter value includes a value indicating that this collection is a daily automatic collection. The number of information objects is 1, indicating that the status of one IoT device 10 is collected this time. The system type indicates the type code of the control system running on the IoT device 10. The system address indicates the identification address assigned to the control system running on the IoT device 10. The component type indicates the device type of the IoT device 10. The component address indicates the identification address assigned to the IoT device 10. The component status indicates the running status of the IoT device 10. The component description indicates the description of the running status of the IoT device 10, which occupies 31 bytes, that is, it is mainly used to record the attributes of the required collected data. The state occurrence time indicates the time of this collection of the IoT device 10. The matching value indicates that after parsing, the attribute value of the attribute needs to match the value, otherwise it will be deemed as an invalid message. For example, if the attribute value obtained by parsing the initiator is not "4040", the IP message will be determined as an invalid message. The attribute value obtained by parsing the command characters needs to be "02". If the attribute value obtained by parsing is not "02", the IP message will be judged as an invalid message. This judgment is only set from the perspective of the host 20 receiving the IP message, so the attribute table in Table 1 is also an attribute table in a specific host 20. Devices with other roles in the Internet of Things will have different settings.

[0058] On the other hand, according to a pre-configured attribute table, the method for multiple times intercepting characters at specified positions of the IP message includes: reading a preset required attribute table and an attribute table, and according to the start bit and occupied length of the attribute recorded in the attribute table, intercepting the characters at the position in the IP message corresponding to the attribute recorded in the required attribute table.

[0059] For example, if only two attributes, component status and component description, are needed, that is, this IP message is obtained by a designated call test, not daily automatic collection, so the system address, component address and other attributes are all known. At this time, according to the attribute name and occupied length recorded in the attribute table (recording all attributes), the start bit and occupied length of the attribute recorded in the required attribute table (recording component status and component description) are searched and obtained in sequence.

[0060] Step S03) Use the parsing method to parse the corresponding characters to obtain attribute values.

[0061] The attribute value can be obtained by parsing the characters using the parsing method recorded in the attribute table. For example, the time parsing recorded in Table 1 parses the characters into time, and the decimal conversion converts the characters into decimal values.

[0062] Step S04) Generate the attribute name and the KV value of the attribute value to complete the parsing of the IP message.

[0063] Exemplarily, the data portion of the IP message is represented in hexadecimal as follows:

[0064] 44408900010228180F0D08155CA7B774010000000000000000D2A1D4BAB2B2D2A1C26CFBBFBCA8B81C3000000202002020208180F0D0818B72323

[0065] Through parsing, we get the start symbol = 4040, service serial number = 8900, protocol version number = 0102, time tag = 28180F0D0815, target address = 000000000000, source address = 155CA7B77401, command byte = 02, checksum = B7, and end symbol = 2323. The parsing of other attributes is abbreviated here. The KV value can be constructed using the technology disclosed in the art to complete the parsing of the IP message.

[0066] On the other hand, the attribute table also records a translation table of the attribute, the translation table records the translation value of the attribute value, and when generating the KV value of the attribute value, the attribute name and the translation value are used to generate the KV value.

[0067] For example, the attribute name is command byte, and its translation is {"0":"reserved","1":"control command","2":"send data","3":"confirm","4":"request","5":"response","6":"deny","128":"heartbeat"}, that is, after converting its attribute value into a decimal value, the value is translated into text (or string) according to the translation record in the attribute table. This makes the attribute value directly readable and allows the attribute value itself to play its due role.

[0068] In another exemplary embodiment, the translation comparison of the attribute is recorded as follows:

[0069] Command byte: {"0":"reserved","1":"control command","2":"send data","3":"confirm","4":"request","5":"response","6":"deny","128":"heartbeat"},

[0070] Type flag: { "0": "Reserved", "1": "Upload building fire protection facility system status", "2": "Upload building fire protection facility component operation status", "3": "Upload building fire protection facility component analog value", "4": "Upload building fire protection facility operation information", "5": "Upload building fire protection facility system time", "21": "Upload Internet of Things information transmission device operation status (Type 1)", "22": "Upload Internet of Things information transmission device operation status (Type 2)", "23": "Upload Internet of Things information transmission device operation status (Type 3)", "24": "Upload Internet of Things information transmission device operation status (Type 4)", "100": "Upload Internet of Things information transmission device operation status (Type 5)", "128": "User-defined"}, System type: { "0": "General","1": "Indoor fire hydrant system","2": "Electrical fire monitoring system","3": "Combustible gas detection alarm system","4": "Fixed fire cannon fire extinguishing system","128": "Fire alarm system"}, Component type: { "0": "General","1": "Fire alarm controller","91": "Fire water pump","92": "Fire water tank"}, Analog type: {"1": "Event count","2": "Height","3": "Temperature","4": "Pressure MPa","5": "Pressure kPa","6": "Gas concentration","7": "Time","8": "Voltage (V)","9": "Current","10": "Flow rate (L / s)","11": "Wind speed","12": "Wind speed"}.

[0071] These attributes record the translation comparison contents included in the attribute table stored by the host 20 for parsing IP messages in an Internet of Things application for monitoring building fire safety.

[0072] The attribute table includes a public attribute table and a local attribute table. The public attribute table is stored in a designated public storage space, and the local attribute table is stored locally. The public attribute table accepts the setting of new attributes. When the attributes recorded in the public attribute table and the local attribute table are repeated, the local attribute table shall prevail.

[0073] Exemplarily, the public attribute table records the initiator, service serial number, protocol version number, timestamp, source address, destination address, and end character attributes; the local attribute table records application data, command characters, type flag, number of information objects, system type, system address, component type, component address, component status, component description, status occurrence time, and checksum; the two together constitute an attribute table for parsing IP packets.

[0074] The new technical effects achieved by this embodiment include: being able to perform a jump-sequence analysis according to the attribute table, only analyzing the required attributes, thereby improving the parsing efficiency of the IP message. The IP message parsing method disclosed in this embodiment can adapt to fixed-length IP messages and variable-length IP messages, and can customize the parsing method by configuring the attribute table, which has highly flexible scalability. The use of a public attribute table allows the relevant configuration of the attribute to be reused, saving the configuration time of the attribute, and is suitable for the deployment and configuration of a large number of devices in the Internet of Things. Example 2

[0075] In this embodiment, the attribute table records at least one attribute group and a number of information objects, the attribute group records a plurality of attributes, and the method further comprises the steps of:

[0076] Parsing the number of information objects from the IP message according to the start bit and occupied length of the number of information objects;

[0077] When the number of information objects is non-zero, several attribute groups are parsed backwards according to the start bit, occupied length and parsing method of the attribute group record to generate KV values ​​of the attributes included in the attribute group, and the number of attribute groups parsed is determined by the number of information objects. The rest is the same as in Embodiment 1.

[0078] Still taking Table 1 as an example, the attribute after the number of information objects in Table 1 is the attribute group. The attribute group includes system type, system address, component type, component address, component status, component description, and status occurrence time. When the number of information objects is 1, it means no loop. When the number of information objects is an integer greater than 1, it means that this IP message carries the values ​​of multiple attribute groups, and the attribute values ​​of the entire attribute group are read in sequence according to the attribute name and occupied length recorded in the attribute group.

[0079] The beneficial technical effects newly achieved by this embodiment compared to Embodiment 1 include: by establishing attribute groups, cyclic parsing of attribute groups is achieved under the control of the number of information objects, so that the status reporting data of multiple IoT devices 10 can be aggregated by one of the IoT devices 10 or the concentrator and then reported to the host 20 in one IP message, thereby improving data reporting efficiency and also helping to quickly complete the parsing. Example 3

[0080] In this embodiment, when the first IP packet of this session service is received, the first IP packet records the repeated attribute name and repeated length in this session service. Figure 3 , the method further comprises the steps of:

[0081] Step S101) parsing the first IP message to obtain the repeated attribute name and repeated length in the current session service;

[0082] Step S102) parsing the first IP message to obtain the attribute value of the repeated attribute according to the repeated attribute name and the repeated length, and generating a corresponding KV value;

[0083] Step S103) Before the current session ends, in the subsequent parsing of the IP message, the parsing of the repetition length of the repetition attribute is skipped, and the KV value is used as the parsing result. The rest is the same as in Embodiment 1.

[0084] In the communication of the Internet of Things, a large number of Internet of Things devices 10 have the same attribute information. For example, multiple monitoring devices deployed in the same building have the same system type, component type, and component address, so it is not necessary to parse them in each IP message. In this embodiment, it is only necessary to declare the repeated attributes and the length occupied by the attribute values ​​of these repeated attributes (i.e., the repeated length) in the first IP message, and parse these repeated attributes in the first IP message. The corresponding repeated attributes in the subsequent IP messages are directly skipped and no longer parsed.

[0085] The beneficial technical effects newly achieved by this embodiment compared to Embodiment 1 include: by actively declaring the repeated attribute name and repeated length in the first IP message of the session service and parsing them in the first IP message, subsequent IP messages can skip the parsing of these attributes, thereby improving the efficiency of IP message parsing. Example 4

[0086] In this embodiment, the IP message also records the checksum of each attribute value. In the same session service, when the checksum of the attribute of the IP message is the same as the checksum of the same attribute of the previous IP message, the decoding of the attribute is skipped, and the attribute value of the same attribute in the previous IP message is used as the attribute value of the attribute. In the Internet of Things, when there are many Internet of Things devices 10, there will be a large number of IP messages with the same attribute values. In this embodiment, the checksum of each attribute value is calculated, which plays a role in identifying transmission errors. At the same time, when the checksum of the same attribute in multiple IP messages in this call back service is the same, it indicates that the attribute values ​​of the attribute in these IP messages are the same. Therefore, the subsequent parsing of IP messages with the same checksum can be skipped.

[0087] Please see the attached Figure 4 , the method for generating the checksum includes:

[0088] Step S201) preset a multiple value and an offset value, wherein the multiple value and the offset value are both expressed in binary numbers;

[0089] Step S202) truncating the attribute value into a plurality of binary segments of a preset length;

[0090] Step S203) reading the first binary segment as a binary number and multiplying it by the multiple value, and then adding it to the offset value to obtain a sum, discarding the high-order value of the sum so that the sum is the same as the length of the binary segment;

[0091] Step S204) reads the second binary segment, uses the sum as the multiple value, repeats the previous step, until the last binary segment is multiplied by the multiple value, and then adds the offset value to obtain the final sum, and takes the end of the final sum as the checksum according to the preset length. The rest is the same as in Example 1.

[0092] The attribute value is truncated into a binary segment with a length of 16 bits. After multiplying the binary number by the preset multiple value and adding it to the offset value, the high bit of the result is discarded, and only the last 16 bits of the binary value are retained. Then the retained 16-bit binary value is regarded as the multiple value, multiplied with the next binary number, and then the offset value is added. This is repeated until all binary segments are calculated. Exemplarily, the three binary segments are respectively recorded as A1, A2 and A3, the multiple value is recorded as B, and the offset value is recorded as C. Then first calculate D1=A1*B+C. Take the last 16 bits of D1 and record it as D11. Then calculate D2=A2*D11+C, take the last 16 bits of D2 and record it as D21. Then calculate D3=A3*D21+C, take the last 16 bits of D3 and record it as D31, and so on. If the last binary segment is less than 16 bits, add 0 at the end. After calculation, it can be seen that when two attribute values ​​are the same, the checksums calculated by the two are the same. When two attribute values ​​are different, the probability that the calculated checksums are the same is 1 / 2^16, which is approximately 1 / 65536, a sufficiently low probability.

[0093] Compared with Example 1, the beneficial technical effects newly achieved by this embodiment include: by setting the checksum, it is possible to detect whether there are any errors in the transmission process of the IP message, and it is also possible to quickly find the same attribute value, so that the attribute value of the same attribute name of the previous IP message can be directly adopted without parsing the current IP message. It can be suitably used in the Internet of Things where there are a large number of repeated and identical attribute values, thereby improving the parsing efficiency of the IP message.

[0094] On the other hand, this manual provides an IP message parsing system suitable for the Internet of Things. Figure 5 ,include:

[0095] A search module 100 attempts to search for a preset initiator from a specified position of the IP message;

[0096] The interception module 200, when the initiator is present, intercepts the characters at the specified position of the IP message multiple times according to a pre-configured attribute table; the attribute table records a number of attributes, the attributes including attribute name, start bit, occupied length and parsing method,

[0097] The parsing module 300 parses the corresponding characters using the parsing method to obtain attribute values;

[0098] The generation module 400 generates a KV value pair of the attribute name and the attribute value to complete the parsing of the IP message.

[0099] See also Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown.

[0100] like Figure 6 As shown, the electronic device 1100 may include: at least one processor 1101, at least one network interface 1104, a user interface 1103, a memory 1105 and at least one communication bus 1102. Among them, the communication bus 1102 can be used to realize the connection and communication of the above-mentioned components. Among them, the user interface 1103 may include a button, and the optional user interface may also include a standard wired interface and a wireless interface. Among them, the network interface 1104 may include but is not limited to a Bluetooth module, an NFC module, a Wi-Fi module, etc. Among them, the processor 1101 may include one or more processing cores. The processor 1101 uses various interfaces and lines to connect various parts in the entire electronic device 1100, and executes various functions and processes data of the routing device 1100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1105, and calling data stored in the memory 1105. Optionally, the processor 1101 can be implemented in at least one hardware form of DSP, FPGA, and PLA. The processor 1101 may integrate one or a combination of CPU, GPU and modem, etc. Among them, the CPU mainly processes the operating system, user interface and application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication.

[0101] It is understandable that the above-mentioned modem may not be integrated into the processor 1101, but may be implemented by a separate chip.

[0102] Among them, the memory 1105 may include RAM or ROM. Optionally, the memory 1105 includes a non-transitory computer-readable medium. The memory 1105 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1105 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1105 may also be at least one storage device located away from the aforementioned processor 1101. The memory 1105 as a computer storage medium may include an operating system, a network communication module, a user interface module and an application. The processor 1101 may be used to call the application stored in the memory 1105 and execute the methods in the above-mentioned multiple embodiments.

[0103] The embodiments of this specification also provide a computer-readable storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the multiple steps in the above embodiments. If the components of the above electronic device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.

[0104] The embodiments of this specification also provide a computer program product, including a computer program, which implements multiple steps in the above embodiments when executed by a processor.

[0105] In the absence of conflict, the technical features in this embodiment and implementation scheme can be combined arbitrarily.

[0106] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes a plurality of computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of this specification is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes multiple available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).

[0107] When implemented by hardware or firmware, the aforementioned method flow is programmed into the hardware circuit to obtain the corresponding hardware circuit structure and realize the corresponding function. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit, and its logic function is determined by the user programming the device. The designer programs by himself to "integrate" a digital system on a PLD, without asking a chip manufacturer to design and make a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when writing program development, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL), and HDL is not just one, but many. Those skilled in the art should also be aware that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit to easily obtain the hardware circuit that implements the logic method flow.

[0108] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.

Claims

1. An IP message parsing method suitable for the Internet of Things, characterized in that: Includes steps: Try to find a preset start character from a specified position of the IP message; When the initiator is present, the characters at the specified position of the IP message are intercepted multiple times according to a pre-configured attribute table; the attribute table records a number of attributes, including attribute name, start bit, occupied length and parsing method, Use the parsing method to parse the corresponding characters respectively to obtain attribute values; Generate the attribute name and the KV value of the attribute value to complete the parsing of the IP message; The IP message also records the checksum of each attribute value. In the same session service, when the checksum of the attribute of the IP message is the same as the checksum of the same attribute of the previous IP message, the decoding of the attribute is skipped, and the attribute value of the same attribute in the previous IP message is used as the attribute value of the attribute; The method for generating the checksum includes: Preset multiple value and offset value, wherein the multiple value and offset value are both expressed in binary numbers; Truncating the attribute value into a number of binary segments of preset length; Reading the first binary segment is regarded as multiplying the binary number by the multiple value, and then adding the binary number to the offset value to obtain a sum, and discarding the high-order value of the sum so that the sum is the same as the length of the binary segment; Read the second binary segment, use the sum as the multiple value, repeat the previous step until the final sum is obtained by multiplying the last binary segment by the multiple value, and then adding the final sum to the offset value, and take the end of the final sum as the checksum according to the preset length.

2. According to claim 1, a method for parsing IP packets suitable for the Internet of Things is characterized in that: The attribute table records at least one attribute group and a number of information objects, the attribute group records a number of attributes, and the method further comprises the steps of: Parsing the number of information objects from the IP message according to the start bit and occupied length of the number of information objects; When the number of information objects is non-zero, several attribute groups are parsed backward according to the start bit, occupied length and parsing method of the attribute group record to generate KV values ​​of the attributes included in the attribute group, and the number of attribute groups parsed is determined by the number of information objects.

3. According to claim 1, a method for parsing IP packets applicable to the Internet of Things is characterized in that: The attribute table also records a translation table of the attribute, and the translation table records the translation value of the attribute value. When generating the KV value of the attribute value, the attribute name and the translation value are used to generate the KV value.

4. The IP message parsing method applicable to the Internet of Things according to claim 1, characterized in that: According to the pre-configured attribute table, the method of multiple times intercepting characters at the specified position of the IP message includes: The preset required attribute table and attribute table are read, and according to the start bit and occupied length of the attribute recorded in the attribute table, the characters at the position corresponding to the attribute recorded in the required attribute table in the IP message are intercepted.

5. The IP message parsing method applicable to the Internet of Things according to claim 1 is characterized in that: When the first IP packet of this session service is received, the first IP packet records the repeated attribute name and repeated length in this session service. The method further comprises the steps of: Parsing the first IP message to obtain the repeated attribute name and repeated length in the current session service; According to the repeated attribute name and the repeated length, the first IP message is parsed to obtain the attribute value of the repeated attribute, and a corresponding KV value is generated; Before the session ends, in the subsequent parsing of the IP message, the parsing of the repetition length of the repetition attribute is skipped, and the KV value is used as the parsing result.

6. An IP message parsing system suitable for the Internet of Things, characterized in that: include: A search module attempts to search for a preset start character from a specified position of the IP message; The interception module, when the initiator is present, intercepts the characters at the specified position of the IP message multiple times according to a pre-configured attribute table; the attribute table records a number of attributes, the attributes including attribute name, start bit, occupied length and parsing method, A parsing module, using the parsing method to parse the corresponding characters to obtain attribute values; A generation module generates a KV value pair of the attribute name and the attribute value to complete the parsing of the IP message; The IP message also records the checksum of each attribute value. In the same session service, when the checksum of the attribute of the IP message is the same as the checksum of the same attribute of the previous IP message, the decoding of the attribute is skipped, and the attribute value of the same attribute in the previous IP message is used as the attribute value of the attribute; The method for generating the checksum includes: Preset multiple value and offset value, wherein the multiple value and offset value are both expressed in binary numbers; Truncating the attribute value into a number of binary segments of preset length; Reading the first binary segment is regarded as multiplying the binary number by the multiple value, and then adding the binary number to the offset value to obtain a sum, and discarding the high-order value of the sum so that the sum is the same as the length of the binary segment; Read the second binary segment, use the sum as the multiple value, repeat the previous step until the final sum is obtained by multiplying the last binary segment by the multiple value, and then adding the final sum to the offset value, and take the end of the final sum as the checksum according to the preset length.

7. An electronic device, characterized in that including a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Data processing method and terminal device

    CN110191095A

  • Data packet analysis method and system, storage medium and electronic equipment

    CN115701088A

  • Message analysis method and device, storage medium and computer equipment

    CN116155745A