User datagram protocol message processing method and device and storage medium
By directly encapsulating and decapsulating user datagram protocol messages in AUTOSAR architecture, the problem of low processing efficiency of UDP packets in traditional methods is solved, the processing efficiency and real-time performance are improved, and the CPU load is reduced. It is suitable for large data transmission scenarios .
Patent Information
- Application Number
- CN202411415510.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2024-12-31
AI Technical Summary
In the traditional AUTOSAR architecture, the user datagram protocol (UDP) packet processing efficiency is low, resulting in an impact on performance, especially in scenarios where large data volumes are processed, it is difficult to meet real-time requirements.
By obtaining the initial message body and determining its identity, find the target identity in the identification node library, encapsulate the packets according to the header information and send the message directly at the target terminal to avoid layer by layer encapsulation of the transmission layer and network layer, and simplify the process. Improve efficiency.
It realizes real-time and efficiency improvement of message processing, reduces CPU load, and is suitable for high-performance application scenarios such as radar data transmission.
Smart Images

Figure CN119232820A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the communication field of automotive electronic and electrical architecture, and in particular to a method, device and storage medium for processing user datagram protocol messages. Background Art
[0002] With the improvement of living standards, vehicles are becoming more and more popular in people's lives and playing an increasingly important role in people's lives. Therefore, the interaction between people and vehicles is becoming more and more frequent. With the popularization of security and multimedia services, there are more and more scenarios for large data transmission.
[0003] In the traditional AUTOSAR architecture, whether it is a secure TCP service or a UDP service that requires timely processing or has a large amount of data, the entire TcpIp protocol stack is required to process it. The TcpIp protocol stack continuously processes messages in the receiving or sending queue according to the order of the messages and the message priority.
[0004] This processing method is reasonable for the general AUTOSAR platform, but some ECUs with special functions may have special requirements for big data. If such a large amount of data is still processed step by step from the protocol stack, it will have a great impact on performance. Summary of the invention
[0005] The present application provides a method, device and storage medium for processing user datagram protocol messages, which can simplify the message processing flow, improve the efficiency of message sending and receiving, and ensure the real-time performance of message processing.
[0006] On the one hand, the present application provides a method for processing a user datagram protocol message, the method comprising:
[0007] Obtaining an initial message body, and determining a first identifier corresponding to the initial message body;
[0008] Searching for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address;
[0009] encapsulate the initial message body according to the header information to obtain a processed user datagram protocol message;
[0010] The processed User Datagram Protocol message is sent to a second target protocol module of a second terminal corresponding to the target address, so that the second target protocol module decapsulates the processed User Datagram Protocol message to obtain a processed message body.
[0011] On the other hand, a method for processing a user datagram protocol message is provided, the method comprising:
[0012] A processed user datagram protocol message sent by a first target protocol module of a first terminal is received; the processed user datagram protocol message is obtained by the first target protocol module encapsulating an initial message body according to header information; the header information is determined based on a first node; the first node also includes a target address; the first node is a node corresponding to the target identifier obtained by the first target protocol module searching for a target identifier matching the first identifier in an identifier node library; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first identifier is an identifier corresponding to the initial message body determined by the first target protocol module; the initial message body is obtained by the first target protocol module;
[0013] The processed user datagram protocol message is decapsulated to obtain a processed message body.
[0014] On the other hand, a device for processing a user datagram protocol message is provided, which is applied to a first target protocol module of a first terminal, and the device includes:
[0015] A first identifier determination module, used to obtain an initial message body and determine a first identifier corresponding to the initial message body;
[0016] A first node acquisition module is used to search for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address;
[0017] A processed user datagram protocol message determination module, used to encapsulate the initial message body according to the header information to obtain a processed user datagram protocol message;
[0018] The sending module is used to send the processed user datagram protocol message to the second target protocol module of the second terminal corresponding to the target address; so that the second target protocol module decapsulates the processed user datagram protocol message to obtain a processed message body.
[0019] On the other hand, a device for processing a user datagram protocol message is provided, which is applied to a second target protocol module of a second terminal, and the device includes:
[0020] A receiving module, used for receiving a processed user datagram protocol message sent by a first target protocol module of a first terminal; the processed user datagram protocol message is obtained by the first target protocol module encapsulating an initial message body according to header information; the header information is determined based on a first node; the first node also includes a target address; the first node is a node corresponding to the target identifier obtained by the first target protocol module searching for a target identifier matching the first identifier in an identifier node library; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first identifier is an identifier corresponding to the initial message body determined by the first target protocol module; the initial message body is obtained by the first target protocol module;
[0021] The processing module is used to decapsulate the processed user datagram protocol message to obtain a processed message body.
[0022] On the other hand, a computer-readable storage medium is provided, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the method for processing user datagram protocol messages as described above.
[0023] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes to implement the method for processing a user datagram protocol message as described above.
[0024] The method, device and storage medium for processing user datagram protocol messages provided by the present application have the following technical effects:
[0025] The present application obtains an initial message body and determines a first identifier corresponding to the initial message body; searches for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address; encapsulates the initial message body according to the header information to obtain a processed user datagram protocol message; sends the processed user datagram protocol message to a second target protocol module of a second terminal corresponding to the target address; so that the second target protocol module decapsulates the processed user datagram protocol message to obtain a processed message body. In the message sending process of the present application, the first target protocol module first obtains the initial message body and determines the first identifier, obtains the first node corresponding to the first identifier when the first identifier has been stored, and encapsulates the initial message body according to the header information in the first node to obtain a processed user datagram protocol message, and then sends the processed user datagram protocol message to the second target protocol module of the second terminal, and the second target protocol module decapsulates the received message, thereby realizing rapid message processing. It reduces the message processing time, simplifies the message processing process, improves the processing efficiency of user datagram protocol messages, ensures the real-time nature of message processing, and reduces the CPU load. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions and advantages of the embodiments of this specification or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0028] Figure 2 It is a schematic diagram of the location of the TCPIP module in ATUOSAR provided in the embodiment of this specification;
[0029] Figure 3 This is a schematic diagram of a cache chain provided in the embodiments of this specification;
[0030] Figure 4 It is a detailed schematic diagram of the IP header and the UDP header in the User Datagram Protocol message provided in the embodiment of this specification;
[0031] Figure 5 This is a schematic diagram of the data encapsulation process of the TcpIp module provided in the embodiment of this specification;
[0032] Figure 6 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0033] Figure 7 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0034] Figure 8 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0035] Fig. 9 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0036] Fig.10 It is a schematic diagram of an application environment provided by an embodiment of this specification;
[0037] Fig.11 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0038] Fig.12 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0039] Fig.13 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0040] Fig.14 It is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification;
[0041] Fig.15 It is a structural block diagram of a device for processing a user datagram protocol message provided in an embodiment of this specification;
[0042] Fig.16 It is a structural block diagram of a device for processing a user datagram protocol message provided in an embodiment of this specification;
[0043] Fig.17 It is a hardware structure block diagram of a server of a method for processing a user datagram protocol message provided in an embodiment of the present application; DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0046] The following describes a method for processing a user datagram protocol message of the present application. Figure 1 It is a flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification. This specification provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 1 As shown, the method can be applied to a control unit in a vehicle body controller, and the method may include:
[0047] S101: A first target protocol module of a first terminal obtains an initial message body, and determines a first identifier corresponding to the initial message body.
[0048] In the embodiment of this specification, the first terminal may be a message sending end, and the first target protocol module may be a layer in a TCPIP module located in the sending end, and the layer is located above the transport layer and the network layer, such as Figure 2 As shown, Figure 2The figure is a schematic diagram of the location of the TCPIP module in ATUOSAR. It can be seen that for the general AUTOSAR architecture, the processing of Ethernet messages is based on the TCPIP five-layer model, namely the application layer, transport layer, network layer, data link layer and physical layer, to encapsulate or unpack the data. In fact, the initial message body received by the first target protocol module is generated and sent by the application layer of the sender. The initial message body carries a first identifier, namely the socket identifier SocketId, which is used to identify the message. When the first target protocol module obtains the initial message body, it can determine the first identifier based on the initial message body for subsequent judgment and processing, thereby improving the efficiency of message transmission.
[0049] S103: The first target protocol module searches for a target identifier that matches the first identifier in the identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address.
[0050] In the embodiment of this specification, the preset identifier is the socket identifier SocketID carried by each sent message, and the preset node is the node carried by each sent message. Each node includes the socket identifier SocketID, the remote Internet Protocol address remote ipaddr, the remote hardware address remote macaddr, the local port local port, the Internet Protocol message header and the User Datagram Protocol message header ip+udphead. The preset identifier can be quickly matched to the preset node corresponding to the preset identifier. In fact, the TcpIp module maintains a linked list, such as Figure 3 As shown, Figure 3 This is a cached chain representation. Each node is stored in this chain to record and provide fast-sending IP headers and UDP headers. The header information is the UDP header and IP header of the message corresponding to the first node. The destination address is the Destination Address in the IP header, such as Figure 4 As shown, Figure 4 This is a detailed diagram of the IP header and UDP header in the User Datagram Protocol message. Figure 4 401 is the IP header details in the User Datagram Protocol message. It can be seen that the IP header includes the destination IP address, which is used to determine the IP address of the receiving end when the message is sent. When the initial message body is a learned message, that is, the first identifier and node information corresponding to the initial message body have been stored in the identifier node library, the first node corresponding to the first identifier can be obtained at this time, which facilitates the subsequent direct addition of the IP header and UDP header, thereby improving the efficiency of message encapsulation and message sending.
[0051] In the embodiment of the present specification, before the first target protocol module searches for a target identifier matching the first identifier in an identifier node library to obtain a first node corresponding to the target identifier, the method further includes:
[0052] The first target protocol module obtains a historical message body and determines a historical identifier corresponding to the historical message body;
[0053] In the embodiment of the present specification, the first target protocol module obtains the historical message header sent by the application layer of the first terminal, and determines the historical identifier for subsequent determination of the corresponding message processing strategy.
[0054] If there is no identifier matching the historical identifier in the identifier node library, the first target protocol module sends the historical message body to the first transport layer of the first terminal; so that the first transport layer performs an encapsulation process on the historical message body once to obtain an initially processed message; so that the first transport layer sends the initially processed message to the first network layer of the first terminal; so that the first network layer performs a secondary encapsulation process on the initially processed message to obtain a processed message.
[0055] In the embodiment of this specification, when there is no historical identifier in the identifier node library, it can be seen that the historical message body is the message body sent for the first time. At this time, it is necessary to follow the normal packet sending process and go through the complete TcpIp protocol stack, such as Figure 5 As shown, Figure 5 The schematic diagram of the data encapsulation process of the TCPIP module shows that in the complete message encapsulation process, the application layer first generates and sends a message to the transport layer, the transport layer receives the message and adds a UDP header, and then sends the processed message to the network layer, the network layer receives the processed message and adds an IP header, and thus the message encapsulation is completed. At this time, the historical message body is sent to the first transport layer of the first terminal for a first encapsulation process to obtain a first processed message with a UDP header added, and then the first transport layer sends the first processed message to the first network layer for a second encapsulation process to obtain a processed message with an IP header added, completing the encapsulation process for the first sent message. By using the TCP / IP protocol stack to complete the encapsulation process of the first sent message, the integrity of the data is ensured, which helps to learn the message header, facilitates the rapid encapsulation of the subsequent sent messages, reduces the processing time of the system, and improves the response speed of the system.
[0056] In the embodiment of the present specification, if there is no identifier matching the historical identifier in the identifier node library, after the first target protocol module sends the historical message body to the first transport layer of the first terminal, Figure 6 As shown, Figure 6A flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification, the method further includes:
[0057] S601: The first target protocol module determines a post-processing identifier and a post-processing node corresponding to the processed message; the processed node carries a processed target address; so that the first network layer sends the processed message to the first Ethernet network of the first terminal; so that the first Ethernet network sends the processed message to the target protocol module of the terminal corresponding to the processed protocol address.
[0058] In the embodiment of this specification, when the historical message body is a message sent for the first time, at this time, according to the processed target address carried by the processed node, the first terminal finally sends the processed message to the terminal corresponding to the processed target address through the first Ethernet network.
[0059] S602: The first target protocol module updates the identification node library according to the processed identification and the processed node to obtain an updated identification node library.
[0060] In the embodiment of the present specification, since the historical message body is a message sent for the first time, the processed message is learned at this time, and the processed identifier and the processed node in the processed message are added to the identifier node library, and the identifier node library is updated so that when the same message body is sent subsequently, the header can be directly added, which simplifies the processing flow and improves the efficiency of message sending.
[0061] S603: The first target protocol module performs matching processing on the acquired real-time identification of the real-time message body according to the updated identification node library.
[0062] In an embodiment of the present specification, when subsequent messages are sent, the first target protocol module matches the acquired real-time messages according to the updated identification node library. For example, if the application layer of the first terminal sends the historical message body for the second time, the identification node library stores the historical identification corresponding to the historical message body. At this time, the header information is directly added to the historical message body in the first target protocol module, avoiding encapsulation at the transport layer and the network layer, simplifying the message encapsulation process, helping more messages to be quickly packaged, enhancing the real-time performance of data transmission, and improving the efficiency of message sending.
[0063] S105: The first target protocol module encapsulates the initial message body according to the header information to obtain a processed User Datagram Protocol message.
[0064] In the embodiment of the present specification, since the initial message body is a learned message and the first node corresponding to the initial message body is obtained, the initial message body is directly encapsulated in the first target protocol module, and the header information in the first node, that is, the UDP header and the IP header are directly added to the header of the initial message body to obtain a processed user datagram protocol message without the need for layer-by-layer encapsulation processing through the transport layer and the application layer, thereby eliminating the processing time of the encapsulation protocol header and the data packet before sending, reducing end-to-end delay, and allowing the message processing method to be applied to application scenarios with high real-time requirements, such as radar data transmission scenarios, ensuring that messages can be sent quickly, improving system throughput, simplifying the processing flow, and reducing CPU load.
[0065] In the embodiment of the present specification, the header information includes a first target protocol header and a second target protocol header; the first target protocol module encapsulates the initial message body according to the header information to obtain a processed user datagram protocol message, such as Figure 7 As shown, Figure 7 A flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification includes:
[0066] S701: The first target protocol module obtains an initial message length value of the initial message body.
[0067] In the embodiments of this specification, during the message encapsulation process, the length value of the header needs to be determined based on the length value of the message body. Therefore, the initial message length value of the initial message body needs to be obtained for subsequent data processing to improve the reliability of the data processing results.
[0068] S702: The first target protocol module updates the first target protocol header and the second target protocol header according to the initial message length value to obtain an updated first target protocol header and an updated second target protocol header.
[0069] In the embodiments of the present specification, the first target protocol header may be a User Datagram Protocol UDP header, and the second target protocol header may be an Internet Protocol IP header. The UDP header and IP header are updated respectively according to the initial message length value, thereby facilitating obtaining a UDP header and IP header that match the initial message body, thereby improving the reliability of data processing and ensuring that a complete message is sent.
[0070] In the embodiment of the present specification, the first target protocol header includes a first data length value and a first target protocol length value; the second target protocol header includes a second data length value and a second target protocol length value; the first target protocol module updates the first target protocol header and the second target protocol header according to the initial message length value to obtain an updated first target protocol header and an updated second target protocol header, such as Figure 8 As shown, Figure 8 A flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification includes:
[0071] S801: If the initial message length value is greater than a preset message length threshold, the first target protocol module splits the initial message body according to a preset condition to obtain a message group; the message group includes a preset number of message bodies arranged in sequence.
[0072] In the embodiments of the present specification, the preset message length threshold, i.e., the byte length value of the maximum transmission unit MTU, can be 1500 bytes, for example. If the initial message length value is greater than 1500 bytes, the encapsulation processing and subsequent sending of the message cannot be completed at one time. The preset condition is that starting from the first byte of the initial message body, the initial message body is divided at intervals of a bytes, thereby obtaining a message group, and the message bodies in the message group are arranged in sequence in the order of splitting, so as to facilitate subsequent header encapsulation.
[0073] S802: The first target protocol module determines a target first data length value according to a target message body length value of a target message body and the first target protocol length value.
[0074] In the embodiments of this specification, Figure 4 As shown, Figure 4 402 is the first target protocol header, which can be the specific content of the UDP header. It can be seen that there are the first data length value Length and the UDP payload. In fact, the UDP payload is the target message body length value of the target message body, and the first target protocol length value is the length value of the first target protocol header, such as Figure 4 As shown, assuming that the byte threshold for splitting in the preset condition is 142 bytes and the first target protocol length value is 8 bytes, then the target first data length value is 150 bytes.
[0075] S803: The first target protocol module updates the first data length value to the target first data length value, and obtains an updated first target protocol header corresponding to the target message body.
[0076] In the embodiment of the present specification, at this time, the Length in the first target protocol header corresponding to the target message body obtained by splitting is updated to 150 bytes, and the UDP payload is updated to 142 bytes to obtain an updated first target protocol header.
[0077] S804: The first target protocol module determines a target second data length value according to the updated first data length value and the second target protocol length value.
[0078] In the embodiments of this specification, Figure 4 As shown, Figure 4 401 is the second target protocol header, which can be the specific content of the IP header, including the IP header length value Header Length, the second data length value Total Length and the packet flag Flags. Assuming that the updated first data length value is 150 bytes and the second target protocol length value is 20 bytes, then the target second data length value, i.e., the sum of the initial message length value, the first target protocol length value and the second target protocol length value, is 170 bytes.
[0079] S805: The first target protocol module updates the second data length value to the target second data length value, and obtains an updated second target protocol header corresponding to the target message body; the target message is any message body in the message group.
[0080] In the embodiment of the present specification, the TotalLength in the second target protocol header corresponding to the target message body is updated to 170 bytes at this time, and if the target message body is the first message body of the split, then the subpacket flag Flags in the second target protocol header can be set to 0x00 to indicate that this message body is the first message body, if the target message body is the second message body of the split, then the subpacket flag Flags in the second target protocol header can be set to 0x01 to indicate that this message body is the second message body, and so on, thereby obtaining the updated second target protocol header. By comparing the length value of the initial message body with the length value of the maximum transmission unit, it is ensured that the sent data will not exceed the maximum size that the terminal can handle, thereby avoiding the discard or segmentation caused by the excessive size of the data packet, reducing the network transmission delay, improving the efficiency of message transmission, helping the message to be quickly and effectively transmitted to the target address, and improving the reliability of message transmission, and by pre-saving the header information and dynamically modifying the length field when actually sending, the header construction work in the sending process is simplified, the complexity of the code is reduced, and the CPU load is reduced.
[0081] S703: The first target protocol module encapsulates the initial message body according to the updated first target protocol header and the updated second target protocol header to obtain the processed User Datagram Protocol message.
[0082] In the embodiment of the present specification, after the first target protocol header and the second target protocol header are updated, the updated first target protocol header and the updated second target protocol header are directly added to the header of the initial message body in the first target protocol module, thereby realizing the encapsulation processing of the initial message body, thereby obtaining a processed user datagram protocol message, which is a complete message and can be used for sending. By directly adding the necessary header information, the processing time of the message before sending is reduced, the encapsulation process of the message is simplified, and the end-to-end delay is reduced, so that the message processing method can be applied to application scenarios with high real-time requirements, such as radar data transmission scenarios, improving the system throughput, reducing the CPU load, and improving the message sending efficiency.
[0083] S107: The first target protocol module sends the processed User Datagram Protocol message to a second target protocol module of a second terminal corresponding to the target address.
[0084] In the embodiments of this specification, Figure 4 As shown, Figure 4 401 is the second target protocol header, which can be the specific content of the IP header, wherein the IP header includes the source IP address Source Address and the destination IP address Destination Address, and the first terminal is the sender. At this time, the IP address Source Address is the IP address of the first terminal, and the destination IP address Destination Address is the IP address of the terminal to which the first terminal needs to send the message. In fact, when the initial message body is a learned message, it is processed by the first target protocol module to form a processed user datagram protocol message. The first target protocol module first uses the Ethernet interface to send the processed user datagram protocol message to the first Ethernet network of the first terminal, and then sends the processed user datagram protocol message to the second Ethernet network of the second terminal through the first Ethernet network, and receives the message through the Ethernet interface of the second terminal and transmits it to the second target protocol module. The implementation of the sender and the receiver is simplified, the integrity of the data is ensured, the transmission efficiency of the message is improved, and the security and compatibility of the system are enhanced.
[0085] S109: The second target protocol module decapsulates the processed user datagram protocol message to obtain a processed message body.
[0086] In the embodiment of the present specification, the second target protocol module first determines whether the processed user datagram protocol message is a fast-receiving message, and then determines whether the processed user datagram protocol message has been learned, and then formulates different decapsulation strategies to achieve decapsulation processing of the processed user datagram protocol message, and finally obtains the processed message body, thereby improving the efficiency of message decapsulation processing and transmission efficiency, simplifying the message processing process, and achieving rapid processing of messages.
[0087] In the embodiment of the present specification, the processed user datagram protocol message carries a processed hardware address and a processed port number; the processed user datagram protocol message includes a processed first target protocol header and a processed second target protocol header; the second target protocol module decapsulates the processed user datagram protocol message to obtain a processed message body, including:
[0088] If the processed hardware address and the processed port number exist in the preset node library, the second target protocol module deletes the processed first target protocol header and the processed second target protocol header to obtain the processed message body; the preset node library includes the historical hardware address and historical port number carried by the historical user datagram protocol message.
[0089] In the embodiment of this specification, the preset node library can be a linked list maintained by the TcpIp module, such as Figure 3 As shown, the preset node library stores the node information of each learned message, obtains the processed hardware address of the processed user datagram protocol message, that is, the Mac address, and the processed port number, that is, port, firstly determines whether there is a hardware address matching the processed hardware address in the preset node library, if there is a hardware address matching the processed hardware address in the preset node library, then determines whether there is a port number matching the processed port number in the preset node library, if there is a port number matching the processed port number in the preset node library, then it can be determined that the processed user datagram protocol message is a message that has been learned, and the header information of the processed user datagram protocol message, that is, the UDP header and the IP header, can be directly stripped off to obtain the processed message body, thereby realizing rapid decapsulation processing of the processed user datagram protocol message, improving the message processing efficiency, simplifying the processing flow, and saving system resources.
[0090] If the processed hardware address and the processed port number do not exist in the preset node library, the second target protocol module sends the processed user datagram protocol message to the second network layer of the second terminal; so that the second network layer performs initial decapsulation processing on the processed user datagram protocol message to obtain a primary decapsulation message; so that the second network layer sends the primary decapsulation message to the second transport layer of the second terminal; so that the second transport layer performs secondary decapsulation processing on the primary decapsulation message to obtain the processed message body.
[0091] In the embodiment of this specification, if the processed hardware address and the processed port number do not exist in the preset node library, it means that the processed User Datagram Protocol message is the first received message, and it needs to go through the complete TCPIP protocol stack for unpacking and distribution, and needs to go through the second network layer and the second transport layer of the second terminal for layer-by-layer decapsulation processing, first stripping the second target protocol header, i.e., the IP header, at the network layer, and then stripping the first target protocol header, i.e., the UDP header, at the transport layer, to finally obtain the processed message body. By adopting different unpacking strategies for different types of messages, the unpacking processing time of the message is significantly reduced, the message processing speed is improved, the dependence on the TCP / IP protocol stack is reduced, the CPU load and memory usage are reduced, and the real-time performance of message transmission is improved.
[0092] In the embodiment of the present specification, if the processed hardware address and the processed port number do not exist in the preset node library, after the second target protocol module sends the processed user datagram protocol message to the second network layer of the second terminal, Fig. 9 As shown, Fig. 9 A flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification, the method further includes:
[0093] S901: The second target protocol module obtains a node corresponding to the processed user datagram protocol message; the node carries the processed hardware address, the processed port number, the processed first target protocol header and the processed second target protocol header of the processed user datagram protocol message.
[0094] In an embodiment of the present specification, if the processed user datagram protocol message is configured as a fast-receive message, then a node corresponding to the processed user datagram protocol message is obtained, including a processed hardware address, a processed port number, a processed first target protocol header, and a processed second target protocol header, for subsequent updating of a preset node library, simplifying the unpacking process so that more messages can be unpacked quickly, thereby improving message unpacking speed and transmission efficiency.
[0095] S902: The second target protocol module adds the node corresponding to the processed user datagram protocol message to the preset node library to obtain an updated preset node library.
[0096] In the embodiment of the present specification, the node corresponding to the processed User Datagram Protocol message is added to the preset node library, thereby implementing the update of the preset node library so that more subsequent messages can be quickly unpacked.
[0097] S903: The second target protocol module matches the real-time hardware address and the real-time port number of the acquired real-time user datagram protocol message according to the updated preset node library.
[0098] In the embodiments of the present specification, the second target protocol module matches the subsequently received messages according to the updated preset node library, and the learned messages are directly unpacked quickly in the second target protocol module without going through the network layer and the transport layer for layer-by-layer decapsulation, thereby simplifying the message unpacking process, allowing the messages to be delivered to the upper-layer applications faster, significantly reducing the message decapsulation processing time, improving the message processing efficiency, reducing the CPU load, ensuring the real-time nature of message processing, and enhancing the reliability and accuracy of the message processing results.
[0099] It can be seen from the technical solution provided by the above embodiments of this specification that the first target protocol module of the first terminal of this specification embodiment receives the initial message body. If the initial message body is a message sent for the first time, it is sent through the complete TCPIP protocol stack and learned; if the initial message body is a message sent subsequently, the header encapsulation is directly performed in the first target protocol module without passing through the transport layer and the network layer, and the byte length value of the maximum transmission unit is compared during the encapsulation process to achieve complete transmission of the message, and finally sent to the second terminal through the first Ethernet network of the first terminal; the second Ethernet network of the second terminal receives the processed user datagram protocol message sent by the first terminal, and directly unpacks the learned message in the second target protocol module. For messages that have not been learned and need to be received quickly, they are unpacked and learned through the complete protocol stack, which is convenient for subsequent fast reception. This application omits the transport layer and network layer processing steps in the traditional TCP / IP five-layer model for messages that need to be sent and received quickly, significantly reduces the processing time of the message in the protocol stack, reduces the CPU load, and improves the efficiency of data transmission. Especially in application scenarios that require the transmission of large amounts of data, such as radar data transmission, this message processing method can significantly improve performance, ensuring that messages can be transmitted in a timely and reliable manner while maintaining the stability and reliability of the system, achieving efficient message transmission and meeting the needs of high-performance applications.
[0100] In an exemplary embodiment, Fig.10 As shown, Fig.10 A schematic diagram of an application environment provided in an embodiment of this specification, the application environment may include at least a first terminal 1001 and a second terminal 1002.
[0101] Specifically, in the embodiments of this specification, the first terminal may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers, and may also be 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The first terminal 1001 may include a network communication unit, a processor, and a memory, etc. Specifically, the first terminal includes an application layer software component SWC, a transport layer socket adapter SoAd, a TCPIP module, an Ethernet interface EthIf, an Ethernet software implementation part Eth, and an Ethernet Ethernet. The first terminal 1001 can send a processed user datagram protocol message to the second terminal 1002.
[0102] Specifically, in the embodiments of this specification, the second terminal 1002 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers, and may also be 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The second terminal 1002 may include a network communication unit, a processor, and a memory, etc. Specifically, the second terminal includes an application layer software component SWC, a transport layer socket adapter SoAd, a TCPIP module, an Ethernet interface EthIf, an Ethernet software implementation part Eth, and an Ethernet Ethernet. The second terminal 1002 can decapsulate the processed user datagram protocol message to obtain a processed message body.
[0103] In an exemplary embodiment, Fig.11 As shown, Fig.11 A flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification includes:
[0104] S1101: Software component packaging.
[0105] In the embodiment of this specification, the software component SWC is located at the application layer, generates and sends data packets to the TCPIP module.
[0106] S1102: The socket adapter sends a packet.
[0107] In the embodiment of the present specification, the socket adapter SoAd is used to encapsulate the interface of the TCPIP module, receive the data packet sent by the software component SWC and send the data packet to the TCPIP module.
[0108] S1103: Determine whether the data has been learned; if it has been learned, go to S1108.
[0109] In the embodiment of the present specification, the message data arrives at the TCPIP module, and the TCPIP module determines whether the sent data packet is data that has been learned, and formulates different sending strategies for different data.
[0110] S1104: The protocol stack is sent normally.
[0111] In the embodiment of the present specification, when the message data sent this time is the first time to send data, the data packet has not been learned at this time, so the data packet sent this time needs to be sent through the complete TCPIP protocol stack, that is, the data packet is encapsulated layer by layer through the transport layer and the network layer to form a complete message.
[0112] S1105: Call the Ethernet interface to send.
[0113] In the embodiment of the present specification, after the data packet is encapsulated, the Ethernet interface is called to realize the transmission of the message, and the message is transmitted to the destination terminal through the Ethernet.
[0114] S1106: Learning the message header.
[0115] In the embodiments of the present specification, after the message is sent, the message header, that is, the UDP header and IP header in the message, is learned. In fact, it is also necessary to obtain the socket identifier, remote Internet Protocol address, remote hardware address and local port number of the message to form a node corresponding to the message, which is used to record and provide a fast-sending message header.
[0116] S1107: Save to linked list.
[0117] In the embodiment of this specification, the node corresponding to the message is saved in the linked list maintained by the TCPIP module, thereby realizing the learning of the message, so that the subsequent messages with the same socket identifier can be quickly encapsulated and processed. After the learning is completed, go to S1101 and enter a new round of sending process.
[0118] S1108: Determine whether the message length is greater than the maximum transmission unit. If the message length is greater than the maximum transmission unit, go to S1112.
[0119] In an embodiment of the present specification, when the data packet to be sent is data that has been learned, it is determined whether the data length value of the sent data packet is greater than the length value of the maximum transmission unit, and different sending strategies are applied to data tables of different lengths, thereby achieving complete message sending.
[0120] S1109: Modify the Internet Protocol message header and the User Datagram Protocol message header according to the message data length.
[0121] In the embodiment of the present specification, the data length value of the message sent at this time is less than or equal to the length value of the maximum transmission unit. It is only necessary to update the Internet Protocol message header and the User Datagram Protocol message header according to the data length value of the sent data packet, so as to achieve the adaptation of the Internet Protocol message header and the User Datagram Protocol message header to the sent message, thereby achieving the correct sending of the message.
[0122] S1110: Splice complete Internet Protocol messages.
[0123] In the embodiment of the present specification, after the Internet Protocol message header and the User Datagram Protocol message header are updated, the updated Internet Protocol message header and the User Datagram Protocol message header are added to the header of the message to be sent, thereby obtaining a complete message that can be used for sending.
[0124] S1111: Call the Ethernet interface to send.
[0125] In the embodiment of this specification, after the message splicing is completed, the Ethernet interface is directly called to realize the message sending, which simplifies the process from message encapsulation to sending and achieves the effect of fast message sending. After the message sending is completed, turn to S1101 and enter a new sending process.
[0126] S1112: Subcontracting.
[0127] In the embodiment of the present specification, the data length value of the message sent at this time is greater than the length value of the maximum transmission unit. It can be seen that the message sent at this time needs to be sub-packetized to achieve sending the message in segments, thereby ensuring the integrity of the message sending.
[0128] This embodiment starts sending data packets through software components, and the socket adapter carries the data packets and sends them to the TCPIP module. The TCPIP module receives the data packets and checks whether the header information of the data packets has been learned. If it has been learned, the header is directly added to achieve fast encapsulation. If it has not been learned, the message encapsulation is performed in a conventional manner. Finally, all processed messages are sent by calling the Ethernet interface, and the header is learned for the messages that have not been learned. The learned header information is saved in a linked list for subsequent use. By learning and caching the header, the situation where the header needs to be rebuilt every time it is sent is avoided, the transmission efficiency of the message is improved, and the header information is dynamically adjusted according to the size of the message data packet, so that the message processing method can adapt to different network conditions, help alleviate network congestion, and improve the success rate of data transmission.
[0129] In an exemplary embodiment, Fig.12 As shown, Fig.12 A flowchart of a method for processing a user datagram protocol message provided in an embodiment of this specification includes:
[0130] S1201: The Ethernet interface receives a message.
[0131] In the embodiment of the present specification, the receiving end calls the Ethernet interface to receive the message and transmits the message to the TCPIP module of the receiving end for message processing.
[0132] S1202: Determine whether the message has been learned. If the message has been learned, go to S1208.
[0133] In the embodiments of the present specification, by judging the received messages, different unpacking strategies are adopted for different types of messages, thereby simplifying the unpacking process and achieving fast unpacking.
[0134] S1203: The protocol stack processes the received packet normally.
[0135] In the embodiment of the present specification, for messages that have not been learned, that is, messages received for the first time, the TCPIP protocol stack processes the received packets normally, and the network layer and transport layer perform layer-by-layer decapsulation of the messages.
[0136] S1204: The socket adapter processes the received packet.
[0137] In the embodiment of the present specification, after the message is unpacked, a data packet is obtained, and the socket adapter SoAd receives the data packet and transmits the data packet to the application layer.
[0138] S1205: The software component processes the received packet.
[0139] In the embodiment of the present specification, the software component SWC of the application layer receives the data packet sent by the socket adapter SoAd and sends it to the upper layer application, thereby realizing the complete message receiving process.
[0140] S1206: Learning the message header.
[0141] In an embodiment of the present specification, if the message received this time is configured as a fast-receive message, the message header of the message received this time is obtained to learn the message information so that subsequent messages can be directly unpacked and processed without passing through the network layer and the transport layer.
[0142] S1207: Save to linked list.
[0143] In the embodiment of this specification, the learned message header is saved in the form of a node in the linked list maintained by the TCPIP module so that more subsequent messages can be quickly unpacked. After being saved in the linked list, the process goes to S1201 to enter a new receiving process.
[0144] S1208: Strip off the Internet Protocol message header and the User Datagram Protocol message header.
[0145] In the embodiment of the present specification, when the message received this time is a message that has been learned, the Internet Protocol message header and the User Datagram Protocol message header in the message are directly stripped off to achieve fast unpacking.
[0146] S1209: The socket adapter processes the received packet.
[0147] In the embodiment of the present specification, after the message is unpacked, the socket adapter SoAd receives the data packet obtained after the TCPIP module unpacks the data packet.
[0148] S1210: The software component processes the received packet.
[0149] In the embodiment of the present specification, the software component SWC receives the data packet sent by the socket adapter SoAd, transmits the data packet to the upper layer application, and then goes to S1201 to enter a new receiving process.
[0150] This embodiment first receives a message by calling an Ethernet interface, and then checks whether the header information has been learned. If so, the header information is directly deleted in the TCPIP module, and only the data packet content is retained; when the header is not learned, the protocol stack processes the data packet in a conventional manner, and the final data packet is transmitted to the software component for use by other applications. By learning and caching the header, it is avoided that the entire message structure needs to be parsed each time it is processed, which saves processing time, deletes unnecessary header information, reduces memory usage and processor resource consumption, and by saving the learned header information, it is convenient to subsequently process messages from the same source, thereby enhancing the scalability and flexibility of the system.
[0151] The following describes a specific embodiment of a method for processing a user datagram protocol message in this specification by taking the first target protocol module of the first terminal as the execution subject. Fig.13 This is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification. Specifically, Fig.13 As shown, the method may include:
[0152] S1301: Acquire an initial message body, and determine a first identifier corresponding to the initial message body.
[0153] S1302: Search for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between preset identifiers and preset nodes; the first node includes header information and a target address.
[0154] S1303: Encapsulate the initial message body according to the header information to obtain a processed User Datagram Protocol message.
[0155] S1304: Send the processed User Datagram Protocol message to a second target protocol module of a second terminal corresponding to the target address, so that the second target protocol module decapsulates the processed User Datagram Protocol message to obtain a processed message body.
[0156] In some embodiments, the header information includes a first target protocol header and a second target protocol header; and encapsulating the initial message body according to the header information to obtain a processed user datagram protocol message includes:
[0157] Obtaining an initial message length value of the initial message body;
[0158] According to the initial message length value, the first target protocol header and the second target protocol header are updated to obtain an updated first target protocol header and an updated second target protocol header;
[0159] The initial message body is encapsulated according to the updated first target protocol header and the updated second target protocol header to obtain the processed User Datagram Protocol message.
[0160] In some embodiments, the first target protocol header includes a first data length value and a first target protocol length value; the second target protocol header includes a second data length value and a second target protocol length value; and the updating process of the first target protocol header and the second target protocol header according to the initial message length value to obtain an updated first target protocol header and an updated second target protocol header includes:
[0161] If the initial message length value is greater than a preset message length threshold, the initial message body is split according to a preset condition to obtain a message group; the message group includes a preset number of message bodies arranged in sequence;
[0162] Determine a target first data length value according to a target message body length value of the target message body and the first target protocol length value;
[0163] Updating the first data length value to the target first data length value to obtain an updated first target protocol header corresponding to the target message body;
[0164] Determine a target second data length value according to the updated first data length value and the second target protocol length value;
[0165] The second data length value is updated to the target second data length value to obtain an updated second target protocol header corresponding to the target message body; the target message is any message body in the message group.
[0166] In some embodiments, before searching the identification node library for a target identification that matches the first identification to obtain a first node corresponding to the target identification, the method further includes:
[0167] Acquire a historical message body, and determine a historical identifier corresponding to the historical message body;
[0168] If there is no identifier matching the historical identifier in the identifier node library, the historical message body is sent to the first transport layer of the first terminal; so that the first transport layer performs an encapsulation process on the historical message body once to obtain an initially processed message; so that the first transport layer sends the initially processed message to the first network layer of the first terminal; so that the first network layer performs a second encapsulation process on the initially processed message to obtain a processed message.
[0169] In some embodiments, if there is no identifier matching the historical identifier in the identifier node library, after sending the historical message body to the first transport layer of the first terminal, the method further includes:
[0170] Determine a post-processing identifier and a post-processing node corresponding to the processed message; the processed node carries a processed target address; so that the first network layer sends the processed message to the first Ethernet network of the first terminal; so that the first Ethernet network sends the processed message to the target protocol module of the terminal corresponding to the processed protocol address;
[0171] According to the processed identifier and the processed node, the identifier node library is updated to obtain an updated identifier node library;
[0172] According to the updated identification node library, matching processing is performed on the acquired real-time identification of the real-time message body.
[0173] An embodiment of the present specification provides a device for processing a user datagram protocol message, which is applied to a first target protocol module of a first terminal, wherein the device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the method for processing the user datagram protocol message as described above.
[0174] A specific embodiment of a method for processing a user datagram protocol message in this specification is introduced by taking the second target protocol module of the second terminal as the execution subject. Fig.14 This is a flowchart of a method for processing a user datagram protocol message provided by an embodiment of this specification. Specifically, Fig.14 As shown, the method may include:
[0175] S1401: Receive a processed user datagram protocol message sent by a first target protocol module of a first terminal; the processed user datagram protocol message is obtained by the first target protocol module encapsulating an initial message body according to header information; the header information is determined based on a first node; the first node also includes a target address; the first node is a node corresponding to the target identifier obtained by the first target protocol module searching for a target identifier matching the first identifier in an identifier node library; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first identifier is an identifier corresponding to the initial message body determined by the first target protocol module; the initial message body is obtained by the first target protocol module.
[0176] S1402: Decapsulate the processed User Datagram Protocol message to obtain a processed message body.
[0177] In some embodiments, the processed user datagram protocol message carries a processed hardware address and a processed port number; the processed user datagram protocol message includes a processed first target protocol header and a processed second target protocol header; the decapsulation of the processed user datagram protocol message to obtain a processed message body includes:
[0178] If the processed hardware address and the processed port number exist in the preset node library, the processed first target protocol header and the processed second target protocol header are deleted to obtain the processed message body; the preset node library includes the historical hardware address and the historical port number carried by the historical user datagram protocol message;
[0179] If the processed hardware address and the processed port number do not exist in the preset node library, the processed user datagram protocol message is sent to the second network layer of the second terminal; so that the second network layer performs initial decapsulation processing on the processed user datagram protocol message to obtain a primary decapsulation message; so that the second network layer sends the primary decapsulation message to the second transport layer of the second terminal; so that the second transport layer performs secondary decapsulation processing on the primary decapsulation message to obtain the processed message body.
[0180] In some embodiments, if the processed hardware address and the processed port number do not exist in the preset node library, after sending the processed user datagram protocol message to the second network layer of the second terminal, the method further includes:
[0181] Acquire a node corresponding to the processed user datagram protocol message; the node carries the processed hardware address, the processed port number, the processed first target protocol header, and the processed second target protocol header of the processed user datagram protocol message;
[0182] Adding the node corresponding to the processed user datagram protocol message to the preset node library to obtain an updated preset node library;
[0183] According to the updated preset node library, matching processing is performed on the real-time hardware address and the real-time port number of the acquired real-time user datagram protocol message.
[0184] An embodiment of the present specification provides a device for processing a user datagram protocol message, which is applied to a second target protocol module of a second terminal. The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the method for processing the user datagram protocol message as described above.
[0185] The embodiment of the present specification also provides a device for processing a user datagram protocol message, which is applied to a first target protocol module of a first terminal, such as Fig.15 As shown, the device comprises:
[0186] A first identifier determination module 1501, configured to obtain an initial message body and determine a first identifier corresponding to the initial message body;
[0187] The first node acquisition module 1502 is used to search for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address;
[0188] A processed user datagram protocol message determining module 1503 is used to encapsulate the initial message body according to the header information to obtain a processed user datagram protocol message;
[0189] The sending module 1504 is used to send the processed user datagram protocol message to the second target protocol module of the second terminal corresponding to the target address; so that the second target protocol module decapsulates the processed user datagram protocol message to obtain a processed message body.
[0190] In some embodiments, the processed user datagram protocol message determination module may include:
[0191] The initial message length value submodule is used to obtain the initial message length value of the initial message body.
[0192] The updating submodule is used to update the first target protocol header and the second target protocol header according to the initial message length value to obtain an updated first target protocol header and an updated second target protocol header.
[0193] The encapsulation submodule is used to encapsulate the initial message body according to the updated first target protocol header and the updated second target protocol header to obtain the processed user datagram protocol message.
[0194] In some embodiments, the update submodule may include:
[0195] The message group acquisition unit is used to split the initial message body according to preset conditions to obtain a message group if the initial message length value is greater than a preset message length threshold; the message group includes a preset number of message bodies arranged in sequence.
[0196] The target first data length value determining unit is used to determine the target first data length value according to the target message body length value of the target message body and the first target protocol length value.
[0197] The first updating unit is used to update the first data length value to the target first data length value to obtain an updated first target protocol header corresponding to the target message body.
[0198] The target second data length value determining unit is used to determine the target second data length value according to the updated first data length value and the second target protocol length value.
[0199] The second updating unit is used to update the second data length value to the target second data length value to obtain an updated second target protocol header corresponding to the target message body; the target message is any message body in the message group.
[0200] In some embodiments, the apparatus may further include:
[0201] The historical identifier determination module is used to obtain the historical message body and determine the historical identifier corresponding to the historical message body.
[0202] A processed message acquisition module is used to send the historical message body to the first transport layer of the first terminal if there is no identifier matching the historical identifier in the identifier node library; so that the first transport layer performs an encapsulation process on the historical message body to obtain an initially processed message; so that the first transport layer sends the initially processed message to the first network layer of the first terminal; so that the first network layer performs a secondary encapsulation process on the initially processed message to obtain a processed message.
[0203] In some embodiments, the apparatus may further include:
[0204] A post-processing determination module is used to determine a post-processing identifier and a post-processing node corresponding to the processed message; the post-processing node carries a post-processing target address; so that the first network layer sends the processed message to the first Ethernet network of the first terminal; so that the first Ethernet network sends the processed message to the target protocol module of the terminal corresponding to the post-processing protocol address.
[0205] The updated identification node library determination module is used to update the identification node library according to the processed identification and the processed node to obtain an updated identification node library.
[0206] The real-time identification matching module is used to match the real-time identification of the acquired real-time message body according to the updated identification node library.
[0207] The embodiment of the present specification also provides a device for processing a user datagram protocol message, which is applied to a second target protocol module of a second terminal, such as Fig.16 As shown, the device comprises:
[0208] The receiving module 1601 is used to receive a processed user datagram protocol message sent by the first target protocol module of the first terminal; the processed user datagram protocol message is obtained by the first target protocol module encapsulating the initial message body according to the header information; the header information is determined based on the first node; the first node also includes a target address; the first node is a node corresponding to the target identifier obtained by the first target protocol module searching for a target identifier matching the first identifier in the identifier node library; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first identifier is an identifier corresponding to the initial message body determined by the first target protocol module; the initial message body is obtained by the first target protocol module;
[0209] The processing module 1602 is used to decapsulate the processed User Datagram Protocol message to obtain a processed message body.
[0210] In some embodiments, the processing module may include:
[0211] The first processing submodule is used to delete the processed first target protocol header and the processed second target protocol header to obtain the processed message body if the processed hardware address and the processed port number exist in the preset node library; the preset node library includes the historical hardware address and the historical port number carried by the historical user datagram protocol message.
[0212] The second processing submodule is used to send the processed user datagram protocol message to the second network layer of the second terminal if the processed hardware address and the processed port number do not exist in the preset node library; so that the second network layer performs initial decapsulation processing on the processed user datagram protocol message to obtain the initial decapsulation message; so that the second network layer sends the initial decapsulation message to the second transport layer of the second terminal; so that the second transport layer performs secondary decapsulation processing on the initial decapsulation message to obtain the processed message body.
[0213] In some embodiments, the apparatus may further include:
[0214] A processed node acquisition module is used to acquire a node corresponding to the processed user datagram protocol message; the node carries the processed hardware address, the processed port number, the processed first target protocol header and the processed second target protocol header of the processed user datagram protocol message.
[0215] The preset node library updating module is used to add the node corresponding to the processed user datagram protocol message to the preset node library to obtain an updated preset node library.
[0216] The real-time matching processing module is used to match the real-time hardware address and the real-time port number of the acquired real-time user datagram protocol message according to the updated preset node library.
[0217] The device and method embodiments in the described device embodiments are based on the same inventive concept.
[0218] An embodiment of the present application also provides a computer storage medium, which can be set in a terminal to store at least one instruction or at least one program related to a method for processing a user datagram protocol message in a method embodiment. The at least one instruction or at least one program is loaded and executed by the processor to implement the method for processing a user datagram protocol message provided in the above method embodiment.
[0219] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes to implement the method for processing the user datagram protocol message provided in the above method embodiment.
[0220] Optionally, in the embodiment of the present application, the storage medium may be located in at least one of the multiple network servers of the computer network. Optionally, in the present embodiment, the storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0221] The memory described in the embodiment of the present application can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0222] The method for processing a user datagram protocol message provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Fig.17 1 is a hardware structure diagram of a server of a method for processing a user datagram protocol message provided in an embodiment of the present application. Fig.17 As shown, the server 1700 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1710 (the central processing unit 1710 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1730 for storing data, and one or more storage media 1720 (such as one or more mass storage devices) for storing application programs 1723 or data 1722. Among them, the memory 1730 and the storage medium 1720 can be short-term storage or permanent storage. The program stored in the storage medium 1720 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 1710 can be configured to communicate with the storage medium 1720 and execute a series of instruction operations in the storage medium 1720 on the server 1700. The server 1700 may also include one or more power supplies 1760, one or more wired or wireless network interfaces 1750, one or more input and output interfaces 1740, and / or one or more operating systems 1721, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0223] The input / output interface 1740 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 1700. In one example, the input / output interface 1740 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In one example, the input / output interface 1740 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0224] It can be understood by those skilled in the art that Fig.17 The structure shown is for illustration only and does not limit the structure of the above electronic device. Fig.17 More or fewer components as shown, or with Fig.17 Different configurations shown.
[0225] From the method, device and storage medium for processing the user datagram protocol message provided by the above-mentioned application, it can be seen that the application obtains the initial message body and determines the first identifier corresponding to the initial message body; searches for the target identifier that matches the first identifier in the identifier node library to obtain the first node corresponding to the target identifier; the identifier node relationship library includes the mapping relationship between the preset identifier and the preset node; the first node includes header information and the target address; according to the header information, the initial message body is encapsulated to obtain the processed user datagram protocol message; the processed user datagram protocol message is sent to the second target protocol module of the second terminal corresponding to the target address; so that the second target protocol module decapsulates the processed user datagram protocol message to obtain the processed message body. The application first sends the initial message body to the first target protocol module by the first application layer through the first terminal, and then checks whether the header information has been learned. If not, the normal protocol stack sending method will be used. If it has been learned, the system will determine whether the length of the initial message body is greater than the preset message length threshold. If it is greater than the preset message length threshold, it will be sub-packetized. Otherwise, the header information will be adjusted according to the data length, and then the complete message will be assembled and finally sent by calling the Ethernet interface. By learning and caching the header information, dynamically adjusting the header information, and sub-packetizing, the efficiency and success rate of message transmission are improved; in the second target protocol module of the second terminal, the second Ethernet network will first check whether the header information has been learned after receiving the message. If it has not been learned, the normal protocol stack processing method will be adopted, and the header information will be learned and saved at the same time. If it has been learned, the header information will be deleted, and only the processed message body will be retained for processing. By learning and caching the header information, the efficiency and accuracy of message processing are improved, and the processing method can be used in scenarios with high real-time requirements to achieve rapid transmission and reception of messages, which not only simplifies the message processing process, reduces the CPU load, but also ensures the integrity and reliability of message transmission and reception.
[0226] It should be noted that the above sequence of the embodiments of this specification is for description only and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0227] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0228] A person skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0229] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for processing a user datagram protocol message, characterized in that: A first target protocol module applied to a first terminal, the method comprising: Obtaining an initial message body, and determining a first identifier corresponding to the initial message body; Searching for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address; encapsulate the initial message body according to the header information to obtain a processed user datagram protocol message; The processed User Datagram Protocol message is sent to a second target protocol module of a second terminal corresponding to the target address, so that the second target protocol module decapsulates the processed User Datagram Protocol message to obtain a processed message body.
2. The method according to claim 1, characterized in that The header information includes a first target protocol header and a second target protocol header; the encapsulation processing of the initial message body according to the header information to obtain a processed user datagram protocol message includes: Obtaining an initial message length value of the initial message body; According to the initial message length value, the first target protocol header and the second target protocol header are updated to obtain an updated first target protocol header and an updated second target protocol header; The initial message body is encapsulated according to the updated first target protocol header and the updated second target protocol header to obtain the processed User Datagram Protocol message.
3. The method according to claim 2, characterized in that The first target protocol header includes a first data length value and a first target protocol length value; the second target protocol header includes a second data length value and a second target protocol length value; the updating process of the first target protocol header and the second target protocol header according to the initial message length value to obtain an updated first target protocol header and an updated second target protocol header includes: If the initial message length value is greater than a preset message length threshold, the initial message body is split according to a preset condition to obtain a message group; the message group includes a preset number of message bodies arranged in sequence; Determine a target first data length value according to a target message body length value of the target message body and the first target protocol length value; Updating the first data length value to the target first data length value to obtain an updated first target protocol header corresponding to the target message body; Determine a target second data length value according to the updated first data length value and the second target protocol length value; The second data length value is updated to the target second data length value to obtain an updated second target protocol header corresponding to the target message body; the target message is any message body in the message group.
4. The method according to claim 1, characterized in that Before searching the identification node library for a target identification that matches the first identification to obtain a first node corresponding to the target identification, the method further includes: Acquire a historical message body, and determine a historical identifier corresponding to the historical message body; If there is no identifier matching the historical identifier in the identifier node library, the historical message body is sent to the first transport layer of the first terminal; so that the first transport layer performs an encapsulation process on the historical message body once to obtain an initially processed message; so that the first transport layer sends the initially processed message to the first network layer of the first terminal; so that the first network layer performs a second encapsulation process on the initially processed message to obtain a processed message.
5. The method according to claim 4, characterized in that If there is no identifier matching the historical identifier in the identifier node library, after sending the historical message body to the first transport layer of the first terminal, the method further includes: Determine a post-processing identifier and a post-processing node corresponding to the processed message; the processed node carries a processed target address; so that the first network layer sends the processed message to the first Ethernet network of the first terminal; so that the first Ethernet network sends the processed message to the target protocol module of the terminal corresponding to the processed protocol address; According to the processed identifier and the processed node, the identifier node library is updated to obtain an updated identifier node library; According to the updated identification node library, matching processing is performed on the acquired real-time identification of the real-time message body.
6. A method for processing a user datagram protocol message, characterized in that: A second target protocol module applied to a second terminal, the method comprising: A processed user datagram protocol message sent by a first target protocol module of a first terminal is received; the processed user datagram protocol message is obtained by the first target protocol module encapsulating an initial message body according to header information; the header information is determined based on a first node; the first node also includes a target address; the first node is a node corresponding to the target identifier obtained by the first target protocol module searching for a target identifier matching the first identifier in an identifier node library; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first identifier is an identifier corresponding to the initial message body determined by the first target protocol module; the initial message body is obtained by the first target protocol module; The processed user datagram protocol message is decapsulated to obtain a processed message body.
7. The method according to claim 6, characterized in that The processed user datagram protocol message carries a processed hardware address and a processed port number; the processed user datagram protocol message includes a processed first target protocol header and a processed second target protocol header; the decapsulation of the processed user datagram protocol message to obtain a processed message body includes: If the processed hardware address and the processed port number exist in the preset node library, the processed first target protocol header and the processed second target protocol header are deleted to obtain the processed message body; the preset node library includes the historical hardware address and the historical port number carried by the historical user datagram protocol message; If the processed hardware address and the processed port number do not exist in the preset node library, the processed user datagram protocol message is sent to the second network layer of the second terminal; so that the second network layer performs initial decapsulation processing on the processed user datagram protocol message to obtain a primary decapsulation message; so that the second network layer sends the primary decapsulation message to the second transport layer of the second terminal; so that the second transport layer performs secondary decapsulation processing on the primary decapsulation message to obtain the processed message body.
8. The method according to claim 7, characterized in that If the processed hardware address and the processed port number do not exist in the preset node library, after sending the processed user datagram protocol message to the second network layer of the second terminal, the method further includes: Acquire a node corresponding to the processed user datagram protocol message; the node carries the processed hardware address, the processed port number, the processed first target protocol header, and the processed second target protocol header of the processed user datagram protocol message; Adding the node corresponding to the processed user datagram protocol message to the preset node library to obtain an updated preset node library; According to the updated preset node library, matching processing is performed on the real-time hardware address and the real-time port number of the acquired real-time user datagram protocol message.
9. A device for processing user datagram protocol messages, characterized in that: A first target protocol module applied to a first terminal, the device comprising: A first identifier determination module, used to obtain an initial message body and determine a first identifier corresponding to the initial message body; A first node acquisition module is used to search for a target identifier that matches the first identifier in an identifier node library to obtain a first node corresponding to the target identifier; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first node includes header information and a target address; A processed user datagram protocol message determination module, used to encapsulate the initial message body according to the header information to obtain a processed user datagram protocol message; The sending module is used to send the processed user datagram protocol message to the second target protocol module of the second terminal corresponding to the target address; so that the second target protocol module decapsulates the processed user datagram protocol message to obtain a processed message body.
10. A device for processing user datagram protocol messages, characterized in that: A second target protocol module applied to a second terminal, the device comprising: A receiving module, used for receiving a processed user datagram protocol message sent by a first target protocol module of a first terminal; the processed user datagram protocol message is obtained by the first target protocol module encapsulating an initial message body according to header information; the header information is determined based on a first node; the first node also includes a target address; the first node is a node corresponding to the target identifier obtained by the first target protocol module searching for a target identifier matching the first identifier in an identifier node library; the identifier node relationship library includes a mapping relationship between a preset identifier and a preset node; the first identifier is an identifier corresponding to the initial message body determined by the first target protocol module; the initial message body is obtained by the first target protocol module; The processing module is used to decapsulate the processed user datagram protocol message to obtain a processed message body.
