CN110380970B - Self-adaptive data message forwarding method and device suitable for heterogeneous network - Google Patents

Self-adaptive data message forwarding method and device suitable for heterogeneous network Download PDF

Info

Publication number
CN110380970B
CN110380970B CN201910663043.0A CN201910663043A CN110380970B CN 110380970 B CN110380970 B CN 110380970B CN 201910663043 A CN201910663043 A CN 201910663043A CN 110380970 B CN110380970 B CN 110380970B
Authority
CN
China
Prior art keywords
data
protocol
unit
format
key field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910663043.0A
Other languages
Chinese (zh)
Other versions
CN110380970A (en
Inventor
王文东
王丹阳
田野
汤佶凡
阙喜戎
龚向阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing University of Posts and Telecommunications filed Critical Beijing University of Posts and Telecommunications
Priority to CN201910663043.0A priority Critical patent/CN110380970B/en
Publication of CN110380970A publication Critical patent/CN110380970A/en
Application granted granted Critical
Publication of CN110380970B publication Critical patent/CN110380970B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Abstract

The embodiment of the invention provides a self-adaptive data message forwarding method and a self-adaptive data message forwarding device suitable for a heterogeneous network, wherein the method comprises the following steps: acquiring a first data message, decapsulating a first protocol data unit based on a first analysis code unit in the first data message, and acquiring key field information, wherein the key field information comprises: the destination node address and the protocol version convert the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, wherein the second format is an identifiable format of the current node; encapsulating the data payload into a second protocol data unit; generating a second data message based on a preset second analysis code unit and a second protocol data unit; and sending the second data message to the next hop node according to the destination node address and the routing information recorded in the preset routing table. The embodiment of the invention can realize convenient forwarding of the protocol data unit in the heterogeneous network.

Description

Self-adaptive data message forwarding method and device suitable for heterogeneous network
Technical Field
The present invention relates to the field of computer network technologies, and in particular, to a method and an apparatus for adaptive data packet forwarding for a heterogeneous network.
Background
A heterogeneous network is a type of network composed of network devices and systems produced by different manufacturers, and may also be said to be composed of a plurality of nodes that employ different network protocols, where a network protocol refers to a set of conventions that must be followed by both communicating computers. With the rapid development of new technologies such as internet of things smart home and the like, the communication requirements between the nodes such as the sensor and the host are greatly increased. Generally, different network protocols are respectively adopted by nodes such as a sensor and a host, so that a network formed by the nodes such as the sensor and the host belongs to a heterogeneous network, and interconnection and intercommunication among a plurality of different nodes in the heterogeneous network need to be realized.
In the process of transmitting data among different nodes in a heterogeneous network, each node adopts respective network protocols to package and forward the data, the formats of the data packaged by the different network protocols are different, and the formats of the data sent by the nodes adopting the different network protocols cannot be directly identified by each node. Therefore, in the prior art, to transmit data between two nodes adopting different network protocols, a protocol gateway needs to be preset, the protocol gateway can identify the network protocols adopted by the two nodes, and one protocol gateway can only identify a limited number of network protocols, so as to convert the format of the data transmitted by one node into the format that can be identified by the other node. Therefore, in the process of data transmission, a node to be transmitted first transmits data to be transmitted to a protocol gateway, and the protocol gateway performs format conversion on the received data and then transmits the data to the node to be received.
Therefore, in order to implement data transmission among a plurality of nodes adopting different network protocols in a heterogeneous network, a plurality of protocol gateways need to be preset, when each node forwards data, format conversion is performed on the data through the protocol gateways, and the node to be received can identify the data, so that the whole data forwarding process is complex.
Disclosure of Invention
The embodiment of the invention aims to provide a self-adaptive data message forwarding method and a self-adaptive data message forwarding device which are suitable for a heterogeneous network, so as to realize convenient forwarding of a protocol data unit. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for forwarding an adaptive data packet applicable to a heterogeneous network, where the method includes:
obtaining a first data message, wherein the first data message comprises: the device comprises a first analysis code unit and a first protocol data unit, wherein the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information;
based on the first analysis code unit, decapsulating the first protocol data unit to obtain the key field information and the data load, where the key field information includes: destination node address and protocol version;
converting the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, wherein the second format is an identifiable format of the current node;
encapsulating the data payload into a second protocol data unit;
generating a second data message based on a preset second analysis code unit and the second protocol data unit;
and sending the second data message to a next hop node of the current node according to the destination node address and the routing information recorded in a preset routing table.
Optionally, the first data packet further carries a code length identifier, and after the step of obtaining the first data packet, the method further includes:
and determining the position of the first analysis code unit in the first data message through the code length identification.
Optionally, the step of decapsulating the first protocol data unit based on the first parsing code unit to obtain the key field information and the data payload includes:
converting the code format of the first analysis code unit into the execution format of the current node;
and according to the converted first analysis code unit, decapsulating the first protocol data unit to obtain the key field information and the data load.
Optionally, the first parsing code unit includes: the step of decapsulating the first protocol data unit according to the converted first parsing code unit to obtain the key field information and the data load includes:
determining a header of the first protocol data unit through the header length identification;
and positioning the position of the key field information in the header through the key field information identification, and reading the key field information according to a positioning result.
Optionally, the step of generating a second data packet based on a preset second parsing code unit and the second protocol data unit includes:
generating a copy of the second parsed code unit;
converting the code format of the copy into a preset general format;
and encapsulating the copy with the general format and the second protocol data unit together to obtain the second data message.
Optionally, the step of obtaining the first data packet includes:
acquiring a plurality of first data messages, and sequencing the first data messages according to a receiving time sequence to generate a message queue to be processed;
the method further comprises the following steps:
and aiming at the plurality of first data messages, advancing the first data messages with preset priority processing identifications to the front end of the message queue to be processed.
In a second aspect, an embodiment of the present invention provides an adaptive data packet forwarding apparatus suitable for a heterogeneous network, where the apparatus includes:
an obtaining module, configured to obtain a first data packet, where the first data packet includes: the device comprises a first analysis code unit and a first protocol data unit, wherein the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information;
a decapsulation module, configured to decapsulate the first protocol data unit based on the first parsing code unit, to obtain the key field information and the data load, where the key field information includes: destination node address and protocol version;
the conversion module is used for converting the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, wherein the second format is an identifiable format of the current node;
the encapsulation module is used for encapsulating the data load into a second protocol data unit;
the generating module is used for generating a second data message based on a preset second analysis code unit and the second protocol data unit;
and the sending module is used for sending the second data message to the next hop node of the current node according to the destination node address and the routing information recorded in a preset routing table.
Optionally, the apparatus further comprises:
a determining module, configured to determine, through code length identification, a position of the first parsing code unit in the first data packet.
Optionally, the decapsulation module includes:
the first conversion submodule is used for converting the code format of the first analysis code unit into the execution format of the current node;
and the decapsulation submodule is used for decapsulating the first protocol data unit according to the converted first analysis code unit to obtain the key field information and the data load.
Optionally, the decapsulation sub-module includes:
a processing unit, configured to determine a header of the first protocol data unit according to the header length identifier;
and the positioning and reading unit is used for positioning the position of the key field information in the header through the key field information identifier and reading the key field information according to the positioning result.
Optionally, the generating module includes:
a generation submodule for generating a copy of the second parsing code unit;
the second conversion submodule is used for converting the code format of the copy into a preset general format;
and the encapsulation submodule is used for encapsulating the copy with the general format and the second protocol data unit together to obtain the second data message.
Optionally, the obtaining module is specifically configured to:
acquiring a plurality of first data messages, and sequencing the first data messages according to a receiving time sequence to generate a message queue to be processed;
the device further comprises:
and the processing module is used for advancing the first data message with the preset priority processing identifier to the front end of the message queue to be processed aiming at the plurality of first data messages.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus; the machine-readable storage medium stores machine-executable instructions executable by the processor, the processor being caused by the machine-executable instructions to: the method steps of the adaptive data message forwarding method suitable for the heterogeneous network provided by the first aspect of the embodiment of the invention are realized.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program is executed by a processor to perform the method steps of the adaptive data packet forwarding method applicable to a heterogeneous network, provided by the first aspect of the present invention.
According to the self-adaptive data message forwarding method and device applicable to the heterogeneous network, a current node decapsulates a first protocol data unit through a first analysis code unit to obtain a destination node address and a protocol version, and then converts a current first format of key field information into an identifiable format of the current node according to the protocol version and a preset protocol rule mapping table, namely converts the current first format of the destination node address into the identifiable format; and then generating a second data message by using a preset second analysis code unit and a second protocol data unit, and sending the second data message to a next hop node according to the destination node address and the routing information recorded in a preset routing table, thereby completing the data forwarding work. The method and the device provided by the embodiment of the invention can directly analyze and forward the current node without identifying or processing the data by intermediate equipment, so that the current node can forward the protocol data unit more conveniently and quickly. In addition, the second data message sent also includes: the second section of the analysis code unit can analyze the protocol data unit, so that the next hop node can analyze and forward the received second data message by adopting the method, and the transmission of data in the whole heterogeneous network is more convenient and faster. Moreover, when a node with a new network protocol is added to the heterogeneous network, the method provided by the embodiment of the invention can make the implementation process simpler and more convenient by adding a new analysis code unit and adding a corresponding table entry in the protocol rule mapping table. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1a is a schematic flowchart of a method for forwarding an adaptive data packet applicable to a heterogeneous network according to an embodiment of the present invention;
fig. 1b is a schematic structural diagram of a first data packet according to an embodiment of the present invention;
fig. 2 is another schematic flow chart of a method for forwarding an adaptive data packet applicable to a heterogeneous network according to an embodiment of the present invention;
fig. 3a is a schematic structural diagram of a first code parsing unit according to an embodiment of the present invention;
fig. 3b is a schematic flowchart of a third flow of an adaptive data packet forwarding method applicable to a heterogeneous network according to an embodiment of the present invention;
fig. 4 is a fourth flowchart illustrating a method for forwarding an adaptive data packet applicable to a heterogeneous network according to an embodiment of the present invention;
fig. 5 is a fifth flowchart illustrating a method for forwarding an adaptive data packet applicable to a heterogeneous network according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an adaptive data packet forwarding apparatus suitable for a heterogeneous network according to an embodiment of the present invention;
fig. 7 is another schematic structural diagram of an adaptive data packet forwarding apparatus suitable for a heterogeneous network according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a third adaptive data packet forwarding apparatus suitable for a heterogeneous network according to an embodiment of the present invention;
fig. 9 is a fourth schematic structural diagram of an adaptive data packet forwarding apparatus suitable for a heterogeneous network according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of a fifth structure of an adaptive data packet forwarding apparatus suitable for a heterogeneous network according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of a sixth structure of an adaptive data packet forwarding apparatus suitable for a heterogeneous network according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1a, an embodiment of the present invention provides an adaptive data packet forwarding method applicable to a heterogeneous network, where the process may include the following steps:
s101, acquiring a first data message.
As shown in fig. 1b, in the embodiment of the present invention, the first data packet may include: the device comprises a first analysis code unit and a first protocol data unit, wherein the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information.
In a heterogeneous network, data needs to be forwarded through a plurality of intermediate nodes in the process of being transmitted from a source node to a destination node. Generally, before each node sends data, it firstly encapsulates the data load by using the network protocol followed by the node, that is, adds a header to the data load, or adds a header and a trailer to obtain a protocol data unit, and the adding manner and format of the header and the trailer in the data load are determined by the network protocol, that is, the formats of the protocol data units encapsulated by using different network protocols are different, and the nodes encapsulating the protocol data units by using different network protocols cannot mutually identify the contents of the protocol data units. When the intermediate node and the destination node receive the protocol data unit, the protocol data unit is decapsulated to obtain a header and a data load therein, and the intermediate node performs decapsulation and transmission on the data load. Because each node encapsulates the data load by adopting the network protocol which follows the node, each node cannot directly identify the protocol data unit encapsulated by adopting the network protocol which is different from that of the node.
In the embodiment of the present invention, by setting the first parsing code unit in the first data packet, the first parsing code unit may assist in parsing the first protocol data unit by using a current node that is different from a network protocol of a previous node, so that the current node receives the first data packet sent by the previous node, and may parse the first protocol data unit by using the first parsing code unit, so as to obtain the header and the data payload.
As an optional implementation manner of the embodiment of the present invention, the first data packet may further carry a code length identifier, and the position of the first parsing code unit in the first data packet may be determined through the code length identifier.
In an embodiment of the invention, the first resolution code unit may be determined by determining the position of the first resolution code unit in the first data message.
The first data packet includes a first parsing code unit and a first protocol data unit, and in actual use, the first parsing code unit may be added to the first protocol data unit to obtain the first data packet. The position of the first parsing code unit in the first data packet is not specifically limited in the embodiment of the present invention, and for example, the first parsing code unit may be added at the front end or the tail end of the first protocol data unit, that is, the first parsing code unit is located at the head or the tail end in the first data packet.
The code length identifier and the method for determining the position of the first parsing code unit in the first data message in the embodiment of the present invention are not specifically limited. For example, since the first data packet received by the current node is usually a binary sequence, the binary sequence length of the first parsing code unit may be represented by a code length identifier, the first parsing code is added to a preset position of the first protocol data unit, and the preset position is a known position of each node, and the current node may determine the position of the entire first parsing code unit in the first data packet by using the code length identifier and the preset position. It should be noted that the preset position may be the front end or the tail end of the first pdu.
Referring to fig. 1a, S102, decapsulate the first protocol data unit based on the first parsing code unit, to obtain key field information and a data payload.
In the embodiment of the present invention, the key field information may include: the destination node address, the protocol version, and other protocol fields, where the other protocol fields may include information such as a source address and options, and it is understood that the key field information may also include other information that needs to be used in the process of forwarding the first data packet. It should be noted that the Protocol version may be a network Protocol used when the node encapsulates the data payload, and for example, the Protocol version may be IPv4(Internet Protocol version 4) or IPv6(Internet Protocol version6, Internet Protocol version 6).
The method comprises the steps of decapsulating a first protocol data unit, namely splitting the first protocol data unit to obtain a header and a data load, and extracting key field information in the header of the first protocol data unit, so that a current node can obtain the information of the first protocol data unit from the key field information, for example, a source address can be used for knowing from which node the data load in a first data message is sent, a destination node to which the data load is sent can be known through a destination node address, a protocol version can be used for knowing a network protocol adopted by a previous node, and further knowing which network protocol is adopted by the protocol data unit for encapsulation.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 2, step S102 may specifically include:
s1021, the code format of the first analysis code unit is converted into the execution format of the current node.
In the embodiment of the present invention, each node may be represented as a platform, and the platform is composed of corresponding software and hardware, and may be a machine such as a processor. In practical applications, different platforms usually adopt different hardware architectures and software, so that a node can only execute instructions in a specific instruction set related to the platform when executing a parsing code unit. In order to enable each node to execute the parsing code unit in the received data message, the parsing code unit may be set to a general format, and after each node receives the parsing code unit in the general format, each node may convert the parsing code unit into an executable instruction stream adapted to the node platform through a respective software and hardware architecture, and then execute the instruction stream to complete a corresponding operation. Therefore, the first parsing code unit here may be in a general format, and the current node converts the first parsing code unit into an instruction stream adapted to the software and hardware platform of the current node, where the instruction stream is in an execution format of the current node, so as to execute the first parsing code unit, and decapsulate the first protocol data unit according to an instruction of the first parsing code unit.
And S1022, according to the converted first analysis code unit, decapsulating the first protocol data unit to obtain key field information and a data load.
In the embodiment of the present invention, through this step, the key field information can be obtained, and therefore, information such as the destination node address, the protocol version, the source address, and the option in the key field information can also be obtained, and the current node can further process the received first data packet according to the information.
As shown in fig. 3a, as an optional implementation manner of the embodiment of the present invention, the first parsing unit may include: as shown in fig. 3b, the header length identifier and the key field information identifier may specifically include, in step S1022:
s10221, identifying by header length, determining a header of the first protocol data unit.
In the embodiment of the present invention, the header may also be a binary sequence, and thus the header length indicator may indicate the length of the binary sequence. Usually, the header is located at the head of the first protocol data unit, and thus, the header can be determined by the header length identification.
The position of the header length identifier is not specifically limited in the embodiments of the present invention, for example, the header length identifier may be set in the first analysis code unit, and the header may be directly determined by the header length identifier in the first analysis code unit; alternatively, the header length identifier may be set in the first data packet and set at a position known by each node, for example, the header length identifier is set before the header, and then an identifier that may represent the position and length information of the header length identifier is set in the first parsing code unit, so that the current node may know the position of the header length identifier in the first data packet through the first parsing code unit, and may determine the header length identifier, and then may determine the header according to the header length identifier.
S10222, identifying by the key field information, locating the position of the key field information in the header, and reading the key field information according to the locating result.
In the embodiment of the present invention, since the key field information includes information such as a destination node address, a protocol version, a source address, and an option, the key field information identifier may also include a destination node address identifier, a protocol version identifier, a source address identifier, and an option identifier. The destination node address can also be a binary sequence, and the destination node address identification can be the position of the first byte in the header and the position of the last byte in the header in the destination node address; it may also be the position of the first byte in the header and the length of the binary sequence of the destination node address. It should be noted that the protocol version information identifier, the source address identifier, and the option identifier may be set according to two optional setting methods of the destination node address identifier, which is not described herein again in the embodiments of the present invention.
In addition, the setting position of the key field information identifier may refer to the setting position of the header length identifier, which is not described again in the embodiments of the present invention.
Referring to fig. 1a, S103, according to the obtained protocol version and a preset protocol rule mapping table, the current first format of the key field information is converted into a second format.
Because the first protocol data unit received by the current node is obtained by adopting the protocol version of the previous node for encapsulation, the current node cannot be directly identified by the current first format of the key field information in the first protocol data unit. The current node needs to convert the current node into a second format, where the second format is a format that can be directly recognized by the current node, that is, a format of a protocol data unit obtained by encapsulating a protocol version adopted by the current node.
A protocol rule mapping table, such as table 1, may be preset, and the content in the protocol rule mapping table may include corresponding rules of the current first format and the second format. In practical application, a current node may need to forward a plurality of different data packets from different previous nodes, so that a plurality of different protocol versions and corresponding rules between the protocol versions of the current node may be set in a protocol rule mapping table, where the plurality of different protocol versions are protocol versions adopted by the plurality of different previous nodes.
Table 1 protocol rules mapping table
Figure BDA0002139188930000111
Note that the other protocol field 1 and the other protocol field 2 in table 1 indicate a plurality of different protocol fields in the other protocol field, respectively.
Referring to fig. 1a, S104, the data payload is encapsulated into a second protocol data unit.
In this step, after the current node identifies the key field information in the header of the first protocol data unit, the data load is encapsulated by using the network protocol followed by the current node, that is, the header encapsulated according to the protocol rule is added to the head of the data load, or the header and the trailer encapsulated according to the protocol rule are respectively added to the head and the tail of the data load, so as to obtain the second protocol data unit. It should be noted that the data payload may be encapsulated by using the existing encapsulation technology, and the embodiment of the present invention is not described herein again.
Referring to fig. 1a, S105, a second data packet is generated based on a preset second parsing code unit and a second protocol data unit.
It should be noted that the preset second parsing code unit may be configured to parse the second protocol data unit, where the second parsing code unit may include a header length identifier and a key field information identifier, where the setting of the header length identifier and the key field information identifier may be set by referring to the setting manners of the header length identifier and the key field information identifier in steps S10221 and S10222 in the embodiment shown in fig. 1a, and details of the embodiment of the present invention are not repeated here.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 4, step S105 may specifically include:
s1051, a copy of the second analysis code unit is generated.
In practical application, a current node may need to forward a plurality of different data packets from a previous node that is not used, so that, in order to enable the current node to encapsulate a second analysis code and one of the second protocol data units, the second analysis code unit and other second protocol data units may be encapsulated, a copy of the second analysis code unit may be generated first, and then subsequent operations are performed on the copy, so that the current node always has an original second analysis code unit. It should be noted that the copy of the second resolution code unit has exactly the same content as the second resolution code unit.
And S1052, converting the code format of the copy into a preset general format.
It should be noted that the preset common format is a common format in which each node in the heterogeneous network can be directly converted through a hardware architecture provided by the node, and the preset common format can be set according to actual requirements. In this way, the next-hop node is facilitated to convert the second parsed code unit having the common format into an instruction stream that it can execute to complete the execution operation.
S1053, the copy with the general format and the second protocol data unit are packaged together to obtain a second data message.
In this step, the second parsing code unit may be added to the front end or the tail end of the second protocol data unit to obtain the second data message. To facilitate the next-hop node of the current node to determine the position of the second parsing code unit in the second data message, for example, a parsing code length identifier may be set in the second data message, and the parsing code length identifier may represent the length of the binary sequence of the second parsing code unit. In this way, the position of the second analysis code unit in the second data message can be determined by analyzing the code length identifier, so that the next-hop node can analyze the second protocol data unit according to the second analysis code unit.
As an optional implementation manner of the embodiment of the present invention, after the step of S1051, the code format of the second parsing code unit may also be converted into a preset common format, and the second parsing code unit having the common format and the second protocol data unit are jointly encapsulated to obtain the second data packet.
As an optional implementation manner in this embodiment of the present invention, the code format of the second parsing code unit may be converted into a preset common format, then a copy of the second parsing code with the common format is generated, and then the second parsing code with the common format or the copy thereof and the second protocol data unit are encapsulated together into the second data packet.
Referring to fig. 1a, S106, according to the destination node address and the routing information recorded in the preset routing table, the second data packet is sent to the next-hop node of the current node.
In the heterogeneous network, each path for sending the data message from the source address to the destination node address is preset and unique, and all nodes (a source node, a node for intermediate forwarding and a destination node) which need to process the data message know the sending path of the data message. In this embodiment of the present invention, the routing information in the preset routing table may be set according to actual requirements, and although each node only needs to feed back a next hop node address to the current node, because the current node may need to forward a plurality of different data packets and a transmission path of each data packet may be different, the routing information in the preset routing table may include: a destination node address and a next hop node address corresponding to the destination node address. After the current node acquires the destination node address, the next hop node address can be acquired by inquiring the routing information, and then the second data message is sent to the next hop node corresponding to the next hop node address.
An embodiment of the present invention further provides a method for forwarding an adaptive data packet applicable to a heterogeneous network, where on the basis of the flow shown in fig. 1a, as shown in fig. 5, the method includes:
s101', a plurality of first data messages are obtained, the first data messages are sequenced according to the receiving time sequence, and a message queue to be processed is generated.
The step is similar to step S101, but different from step S101 in that the step may obtain a plurality of first data packets, and may sequence the plurality of first data packets.
In the heterogeneous network, each node needs to forward a plurality of different first data messages, so that the first data messages with earlier receiving time can be arranged at the front position in the message queue to be processed, the first data messages with later receiving time are arranged at the back position in the message queue to be processed, and the message queue to be processed is generated. The current node can process the messages in sequence according to the front and back sequence of the message queue to be processed.
As shown in fig. 5, the method for forwarding an adaptive data packet applicable to a heterogeneous network according to the embodiment of the present invention may further include:
s201, aiming at a plurality of first data messages, advancing the first data messages with preset priority processing identification to the front end of a message queue to be processed.
In the embodiment of the present invention, the preset priority processing flag may be set according to an actual requirement, and exemplarily, 1 or 0 may be used to represent the priority processing, and 1 represents the priority processing, and 0 represents that the priority processing is not required. When the preset priority processing identifier in the first data packet is 1, the first data packet may be advanced to the front end of the to-be-processed packet queue, and when the preset priority processing identifier in the first data packet is 0, the first data packet is arranged in the to-be-processed packet queue according to the receiving time and processed according to the front-back sequence.
If a plurality of received first data messages are provided with priority processing identifiers, the plurality of first data messages can be arranged at the front end of the message queue to be processed in advance and sequenced according to the sequence of the receiving time.
Since the option field information in the first data packet usually includes an option, and the content in the option is an indication of whether special processing needs to be performed on the first data packet, in this embodiment of the present invention, the content in the option may be used to represent the preset priority processing identifier. In this case, as shown in fig. 5, steps S101', S102, and S103 respectively process all first data packets received by the current node to obtain an option in the key field information, and then determine whether the option is 1, if so, the first data packet needs to be processed preferentially, and if so, the option is 0, the first data packet does not need to be processed preferentially. It should be noted that the priority processing here may be to perform the operations in steps S104, S105, and S106 of the embodiment shown in fig. 5 on the data payload in the first data packet preferentially.
According to the self-adaptive data message forwarding method applicable to the heterogeneous network, a current node decapsulates a first protocol data unit through a first analysis code unit to obtain a destination node address and a protocol version, and then converts a current first format of key field information into an identifiable format of the current node according to the protocol version and a preset protocol rule mapping table, namely converts the current first format of the destination node address into the identifiable format; and then generating a second data message by using a preset second analysis code unit and a second protocol data unit, and sending the second data message to a next hop node according to the destination node address and the routing information recorded in a preset routing table, thereby completing the data forwarding work. The method and the device provided by the embodiment of the invention can directly analyze and forward the current node without identifying or processing the data by intermediate equipment, so that the current node can forward the protocol data unit more conveniently and quickly. In addition, the second data message sent also includes: the second section of the analysis code unit can analyze the protocol data unit, so that the next hop node can analyze and forward the received second data message by adopting the method, and the transmission of data in the whole heterogeneous network is more convenient and faster. In addition, when a heterogeneous network with a huge system and a complicated architecture is faced, and when a node with a new network protocol is added in the heterogeneous network, the network protocol of the newly added node needs to be added in a protocol gateway in the prior art, most of the existing protocol gateways are difficult to add the network protocol, the workload is large in the adding process, and the later maintenance cost is high; the method provided by the embodiment of the invention can add a new analysis code unit and a corresponding table entry in the protocol rule mapping table, so that the implementation process is simpler and more convenient, the operation and maintenance cost is lower, and the expansibility is stronger.
A specific embodiment of an adaptive data packet forwarding apparatus applicable to a heterogeneous network according to an embodiment of the present invention corresponds to the flow shown in fig. 1a, with reference to fig. 6, where fig. 6 is a schematic structural diagram of an adaptive data packet forwarding apparatus applicable to a heterogeneous network according to an embodiment of the present invention, and includes:
an obtaining module 301, configured to obtain a first data packet, where the first data packet includes: the device comprises a first analysis code unit and a first protocol data unit, wherein the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information.
A decapsulation module 302, configured to decapsulate the first protocol data unit based on the first analysis code unit to obtain key field information and a data load, where the key field information includes: destination node address and protocol version.
The converting module 303 is configured to convert the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, where the second format is an identifiable format of the current node.
An encapsulation module 304, configured to encapsulate the data payload into a second protocol data unit.
The generating module 305 is configured to generate a second data packet based on a preset second parsing code unit and a second protocol data unit.
A sending module 306, configured to send the second data message to the next hop node of the current node according to the destination node address and the routing information recorded in the preset routing table.
As an optional implementation manner in the embodiment of the present invention, as shown in fig. 7, the adaptive data packet forwarding apparatus applicable to a heterogeneous network provided in the embodiment of the present invention may further include:
a determining module 307, configured to determine, by the code length identifier, a position of the first parsing code unit in the first data packet.
As an alternative implementation manner of the embodiment of the present invention, as shown in fig. 8, the decapsulating module 302 includes:
the first converting submodule 3021 is configured to convert the code format of the first parsing code unit into an execution format of the current node.
The decapsulation submodule 3022 is configured to decapsulate the first protocol data unit according to the converted first parsing code unit, to obtain key field information and a data load.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 9, the decapsulation submodule 3022 may include:
a processing unit 30221, configured to determine a header of the first protocol data unit by using the header length identifier.
A positioning and reading unit 30222, configured to locate, by the key field information identifier, a position of the key field information in the header, and read the key field information according to the positioning result.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 10, the generating module 305 may include:
a generating submodule 3051 configured to generate a copy of the second analysis code unit.
And a second conversion sub-module 3052, configured to convert the code format of the copy into a common format.
The encapsulation submodule 3053 is configured to encapsulate the copy with the common format and the second protocol data unit together, so as to obtain a second data packet.
As an optional implementation manner of the embodiment of the present invention, the obtaining module is specifically configured to:
and acquiring a plurality of first data messages, sequencing the plurality of first data messages according to the receiving time sequence, and generating a message queue to be processed.
As shown in fig. 11, the adaptive data packet forwarding apparatus applicable to a heterogeneous network according to an embodiment of the present invention may further include:
the processing module 308 advances the first data packet with the preset priority processing identifier to the front end of the to-be-processed packet queue for the plurality of first data packets.
According to the self-adaptive data message forwarding device applicable to the heterogeneous network, the current node decapsulates the first protocol data unit through the first analysis code unit to obtain the destination node address and the protocol version, and then converts the current first format of the key field information into the recognizable format of the current node according to the protocol version and the preset protocol rule mapping table, namely converts the current first format of the destination node address into the recognizable format; and then generating a second data message by using a preset second analysis code unit and a second protocol data unit, and sending the second data message to a next hop node according to the destination node address and the routing information recorded in a preset routing table, thereby completing the data forwarding work. The method and the device provided by the embodiment of the invention can directly analyze and forward the current node without identifying or processing the data by intermediate equipment, so that the current node can forward the protocol data unit more conveniently and quickly. In addition, the second data message sent also includes: the second section of the analysis code unit can analyze the protocol data unit, so that the next hop node can analyze and forward the received second data message by adopting the method, and the transmission of data in the whole heterogeneous network is more convenient and faster. Moreover, when a node with a new network protocol is added to the heterogeneous network, the method provided by the embodiment of the invention can add a new analysis code unit and a corresponding table entry in the protocol rule mapping table, so that the implementation process is simpler and more convenient.
An embodiment of the present invention further provides an electronic device, as shown in fig. 12, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404.
A memory 403 for storing a computer program.
The processor 401, when executing the program stored in the memory 403, implements the following steps:
acquiring a first data message, wherein the first data message comprises: the device comprises a first analysis code unit and a first protocol data unit, wherein the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information.
Based on the first analysis code unit, decapsulating the first protocol data unit to obtain key field information and a data load, wherein the key field information comprises: destination node address and protocol version.
And converting the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, wherein the second format is an identifiable format of the current node.
The data payload is encapsulated into a second protocol data unit.
And generating a second data message based on a preset second analysis code unit and a second protocol data unit.
And sending the second data message to the next hop node of the current node according to the destination node address and the routing information recorded in the preset routing table.
In the electronic device provided by the embodiment of the present invention, the current node decapsulates the first protocol data unit through the first parsing code unit to obtain the destination node address and the protocol version, and then converts the current first format of the key field information into the recognizable format of the current node according to the protocol version and the preset protocol rule mapping table, that is, converts the current first format of the destination node address into the recognizable format; and then generating a second data message by using a preset second analysis code unit and a second protocol data unit, and sending the second data message to a next hop node according to the destination node address and the routing information recorded in a preset routing table, thereby completing the data forwarding work. The method and the device provided by the embodiment of the invention can directly analyze and forward the current node without identifying or processing the data by intermediate equipment, so that the current node can forward the protocol data unit more conveniently and quickly. In addition, the second data message sent also includes: the second section of the analysis code unit can analyze the protocol data unit, so that the next hop node can analyze and forward the received second data message by adopting the method, and the transmission of data in the whole heterogeneous network is more convenient and faster. Moreover, when a node with a new network protocol is added to the heterogeneous network, the method provided by the embodiment of the invention can add a new analysis code unit and a corresponding table entry in the protocol rule mapping table, so that the implementation process is simpler and more convenient.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the file is run on a computer, the computer is enabled to execute any of the above-mentioned adaptive data packet forwarding methods applicable to a heterogeneous network.
For the apparatus/electronic device/storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
It should be noted that the apparatus, the electronic device, and the storage medium according to the embodiments of the present invention are respectively an apparatus, an electronic device, and a storage medium that apply the above adaptive data packet forwarding method applicable to a heterogeneous network, and all embodiments of the above adaptive data packet forwarding method applicable to a heterogeneous network are applicable to the apparatus, the electronic device, and the storage medium, and can achieve the same or similar beneficial effects.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. An adaptive data packet forwarding method applicable to a heterogeneous network is applied to a current node, and the method comprises the following steps:
obtaining a first data message, wherein the first data message comprises: the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information;
based on the first analysis code unit, decapsulating the first protocol data unit to obtain the key field information and the data load, where the key field information includes: destination node address and protocol version;
converting the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, wherein the second format is an identifiable format of the current node;
encapsulating the data payload into a second protocol data unit;
generating a second data message based on a preset second analysis code unit and the second protocol data unit;
and sending the second data message to a next hop node of the current node according to the destination node address and the routing information recorded in a preset routing table.
2. The method according to claim 1, wherein the first data packet further carries a code length identifier, and after the step of obtaining the first data packet, the method further comprises:
and determining the position of the first analysis code unit in the first data message through the code length identification.
3. The method of claim 1, wherein the step of decapsulating the first protocol data unit based on the first parsed code unit to obtain the key field information and the data payload comprises:
converting the code format of the first analysis code unit into the execution format of the current node;
and according to the converted first analysis code unit, decapsulating the first protocol data unit to obtain the key field information and the data load.
4. The method of claim 3, wherein the first parsing the code unit comprises: the step of decapsulating the first protocol data unit according to the converted first parsing code unit to obtain the key field information and the data load includes:
determining a header of the first protocol data unit through the header length identification;
and positioning the position of the key field information in the header through the key field information identification, and reading the key field information according to a positioning result.
5. The method of claim 1, wherein the step of generating a second data packet based on a preset second parsing code unit and the second protocol data unit comprises:
generating a copy of the second parsed code unit;
converting the code format of the copy into a preset general format;
and encapsulating the copy with the general format and the second protocol data unit together to obtain the second data message.
6. The method of claim 1, wherein the step of obtaining the first data packet comprises:
acquiring a plurality of first data messages, and sequencing the first data messages according to a receiving time sequence to generate a message queue to be processed;
the method further comprises the following steps:
and aiming at the plurality of first data messages, advancing the first data messages with preset priority processing identifications to the front end of the message queue to be processed.
7. An adaptive data packet forwarding apparatus applicable to a heterogeneous network, applied to a current node, the apparatus comprising:
an obtaining module, configured to obtain a first data packet, where the first data packet includes: the device comprises a first analysis code unit and a first protocol data unit, wherein the first analysis code unit is used for analyzing the first protocol data unit, and the first protocol data unit carries: a header and a data payload, the header carrying: key field information;
a decapsulation module, configured to decapsulate the first protocol data unit based on the first parsing code unit, to obtain the key field information and the data load, where the key field information includes: destination node address and protocol version;
the conversion module is used for converting the current first format of the key field information into a second format according to the obtained protocol version and a preset protocol rule mapping table, wherein the second format is an identifiable format of the current node;
the encapsulation module is used for encapsulating the data load into a second protocol data unit;
the generating module is used for generating a second data message based on a preset second analysis code unit and the second protocol data unit;
and the sending module is used for sending the second data message to the next hop node of the current node according to the destination node address and the routing information recorded in a preset routing table.
8. The apparatus of claim 7, further comprising:
a determining module, configured to determine, through code length identification, a position of the first parsing code unit in the first data packet.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 6.
CN201910663043.0A 2019-07-22 2019-07-22 Self-adaptive data message forwarding method and device suitable for heterogeneous network Active CN110380970B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910663043.0A CN110380970B (en) 2019-07-22 2019-07-22 Self-adaptive data message forwarding method and device suitable for heterogeneous network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910663043.0A CN110380970B (en) 2019-07-22 2019-07-22 Self-adaptive data message forwarding method and device suitable for heterogeneous network

Publications (2)

Publication Number Publication Date
CN110380970A CN110380970A (en) 2019-10-25
CN110380970B true CN110380970B (en) 2020-10-13

Family

ID=68254885

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910663043.0A Active CN110380970B (en) 2019-07-22 2019-07-22 Self-adaptive data message forwarding method and device suitable for heterogeneous network

Country Status (1)

Country Link
CN (1) CN110380970B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111031027A (en) * 2019-12-09 2020-04-17 广州信天翁信息科技有限公司 Efficient data transmission method and heterogeneous data transmission layer
CN111131266A (en) * 2019-12-26 2020-05-08 广州信天翁信息科技有限公司 Data tag, responsibility tracing method and device
CN112202745B (en) * 2020-09-23 2023-01-31 深圳力维智联技术有限公司 Streaming protocol development method, device, equipment and storage medium
CN112214968A (en) * 2020-10-12 2021-01-12 中国民航信息网络股份有限公司 Message conversion method and device and electronic equipment
CN115208780A (en) * 2021-03-24 2022-10-18 中国电信股份有限公司 Method and device for determining maximum transmission unit, storage medium and electronic equipment
CN113271266B (en) * 2021-04-21 2024-03-22 锐捷网络股份有限公司 Message forwarding method and device of heterogeneous switching chip
CN113677043B (en) * 2021-06-21 2024-01-05 福建睿思特科技股份有限公司 Internet of things gateway based on ARM architecture and power transmission and transformation wireless networking protocol
CN113595910B (en) * 2021-07-30 2022-11-25 歌尔科技有限公司 Networking system, communication method, equipment and readable storage medium
CN113794582A (en) * 2021-08-10 2021-12-14 中国电子科技集团公司电子科学研究院 Heaven and earth integrated network communication management protocol and method
CN114866527B (en) * 2022-04-29 2023-09-15 中国科学院信息工程研究所 Data processing method, device and system
CN115633098B (en) * 2022-12-02 2023-03-31 北京红山微电子技术有限公司 Storage management method and device of many-core system and integrated circuit

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102404306A (en) * 2010-09-19 2012-04-04 腾讯科技(深圳)有限公司 Protocol configuration method and device
CN104618365A (en) * 2015-01-26 2015-05-13 华为技术有限公司 Protocol packet processing method, device and terminal
CN108494752A (en) * 2018-03-09 2018-09-04 万帮充电设备有限公司 A kind of analysis method and device of agreement

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101277293B (en) * 2007-06-25 2011-05-25 广东中大讯通软件科技有限公司 Adapter for implementing interconnection and intercommunication of multiple protocols among digital household equipments as well as method thereof
US9129071B2 (en) * 2012-10-24 2015-09-08 Texas Instruments Incorporated Coherence controller slot architecture allowing zero latency write commit
CN104639507B (en) * 2013-11-13 2018-04-24 中国科学院声学研究所 A kind of bearing protocol packet data transmission method and system between heterogeneous network
KR20170102717A (en) * 2016-03-02 2017-09-12 한국전자통신연구원 Micro server based on fabric network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102404306A (en) * 2010-09-19 2012-04-04 腾讯科技(深圳)有限公司 Protocol configuration method and device
CN104618365A (en) * 2015-01-26 2015-05-13 华为技术有限公司 Protocol packet processing method, device and terminal
CN108494752A (en) * 2018-03-09 2018-09-04 万帮充电设备有限公司 A kind of analysis method and device of agreement

Also Published As

Publication number Publication date
CN110380970A (en) 2019-10-25

Similar Documents

Publication Publication Date Title
CN110380970B (en) Self-adaptive data message forwarding method and device suitable for heterogeneous network
US11463275B2 (en) Electronic control unit, frame generating method, and non-transitory computer-readable recording medium storing a program
CN101573913B (en) Method and apparatus for improved multicast routing
CN111510386B (en) Method and device for processing message
WO2021056945A1 (en) Method for forwarding message in sr network, device, and system
CN112751769B (en) Method, device and system for sending message
EP4131870A1 (en) Service processing method and apparatus, and device and storage medium
WO2019223795A1 (en) Packet transmission method, communication device, and system
JP7448597B2 (en) Message generation method and device and message processing method and device
CN110247926B (en) Interaction method and system
US9762486B2 (en) Method and system for using extension headers to support protocol stack migration
CN113300929B (en) Message forwarding method and device, electronic equipment and storage medium
CN117041370A (en) Communication method and system
CN108848202B (en) Electronic device, data transmission method and related product
CN110581792A (en) Message transmission method and device
US20120250688A1 (en) System and method for unmarshalled routing
JP2019193201A (en) Device, method and program for packet acquisition
CN113497767A (en) Method and device for transmitting data, computing equipment and storage medium
CN117651084B (en) Heterogeneous protocol message processing method and device, electronic equipment and storage medium
CN113765794B (en) Data transmission method and device, electronic equipment and medium
CN110752992B (en) Device and method for realizing point-to-multipoint by MPLS SBFD reflection end
WO2023005620A1 (en) Message processing method and apparatus, and communication system
CN115277554A (en) Transmission method and communication device for multicast data message
CN114301993A (en) Data transmission method, device, terminal equipment and storage medium
CN117395195A (en) Communication method, device, equipment and storage medium

Legal Events

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