Packet forwarding method and apparatus

By deploying a protocol stack in distributed network nodes, routing decisions and data forwarding are performed directly, solving the problem of low forwarding efficiency caused by application layer processing in existing technologies, and achieving more efficient message transmission.

CN116471229BActive Publication Date: 2026-11-27ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310486685.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2026-11-27
Estimated Expiration
2043-04-28

AI Technical Summary

Technical Problem

In existing technologies, proactive routing methods require data to be reported to the application layer, resulting in low packet forwarding efficiency.

Method used

A protocol stack is pre-deployed in distributed network nodes, and routing decisions and data forwarding are performed directly through the protocol stack, avoiding application layer processing.

Benefits of technology

It improves message forwarding efficiency, reduces the number of interactions with the application layer, and increases data transmission speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116471229B_ABST
    Figure CN116471229B_ABST
Patent Text Reader

Abstract

The one or more embodiments of the specification provide a packet forwarding method and device. Wherein the method applied to any node in a distributed network can include: in the case of receiving a packet header of a to-be-forwarded packet, making a routing decision on the to-be-forwarded packet according to the packet header and a routing table maintained in the any node to determine a next hop node of the to-be-forwarded packet; in the case of receiving data contained in the to-be-forwarded packet, forwarding the received data to the next hop node according to a decision result of the routing decision by a protocol stack deployed in the any node; wherein the data is not processed via the application layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to one or more embodiments in the field of communication technology, and in particular to a message forwarding method and apparatus. Background Technology

[0002] In the field of communications, data is usually transmitted in the form of messages in a network, and the routing table records the routing nodes that can be used for message forwarding.

[0003] In a distributed network, nodes typically maintain a routing table for the network so that when a packet is received, the nodes can make routing decisions based on the routing table and then forward the received packet. Summary of the Invention

[0004] In view of the above, this specification provides a message forwarding method and apparatus through one or more embodiments.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of one or more embodiments of this specification, a message forwarding method is proposed, applied to any node in a distributed network, comprising:

[0007] Upon receiving the header of a message to be forwarded, a routing decision is made for the message to be forwarded based on the header and the routing table maintained in any of the nodes, so as to determine the next hop node of the message to be forwarded.

[0008] Upon receiving data contained in the message to be forwarded, the protocol stack deployed in any of the nodes forwards the received data to the next-hop node according to the decision result of the routing decision; wherein the data is not processed by the application layer.

[0009] According to a second aspect of one or more embodiments of this specification, a message forwarding apparatus is provided, applied to any node in a distributed network, comprising:

[0010] Upon receiving the header of a message to be forwarded, the decision unit performs a routing decision on the message to be forwarded based on the header and the routing table maintained in any of the nodes, in order to determine the next-hop node of the message to be forwarded.

[0011] The forwarding unit, upon receiving data contained in the message to be forwarded, forwards the received data to the next-hop node by the protocol stack deployed in any of the nodes according to the decision result of the routing decision; wherein the data is not processed by the application layer.

[0012] According to a third aspect of one or more embodiments of this specification, an electronic device is provided, comprising:

[0013] processor;

[0014] Memory used to store processor-executable instructions;

[0015] The processor implements the method as described in the first aspect by running the executable instructions.

[0016] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first aspect. Attached Figure Description

[0017] Figure 1 This is a flowchart of a message forwarding method provided in an exemplary embodiment.

[0018] Figure 2 This is a flowchart of another message forwarding method provided in an exemplary embodiment.

[0019] Figure 3 This is a schematic diagram of the structure of a device provided in an exemplary embodiment.

[0020] Figure 4 This is a block diagram of a message forwarding apparatus provided in an exemplary embodiment. Detailed Implementation

[0021] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0022] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.

[0023] In a distributed network, the routing table records information about forwarding nodes that can be used for packet forwarding; these nodes are called routing nodes. During packet forwarding, when any node in the distributed network receives a packet, it needs to make a routing decision using the maintained routing table to determine the next-hop node for the packet, and then forward the packet to the determined next-hop node.

[0024] In related technologies, a proactive routing method has been proposed to improve packet forwarding efficiency. In this method, any node can make a routing decision and determine the next-hop node upon receiving only the packet header. This allows subsequent reception of the same packet containing the same data to proceed directly based on the determined next-hop node without needing to make another routing decision. In other words, this method can perform routing decisions even before receiving the complete data, thus improving forwarding efficiency.

[0025] However, while proactive routing improves forwarding efficiency to some extent, this method relies on the application performing the forwarding operation, requiring it to report received data to the application layer. For example, after the application determines the next-hop node through routing decisions, subsequent received data also needs to be reported to the application layer so that the application can issue forwarding instructions based on the decision results, thereby forwarding the received data to the next-hop node.

[0026] It should be understood that because the packet forwarding operation of proactive routing needs to be performed by the application, it needs to report the data to the application layer, and then the application at the application layer issues forwarding instructions. As a result, the packet forwarding efficiency of proactive routing is still relatively low.

[0027] In view of this, this specification proposes a message forwarding method. In this method, nodes in a distributed network can pre-deploy protocol stacks and maintain routing tables. Based on this, when any node receives the header of a message to be forwarded, it can make a routing decision based on the header and the maintained routing table to determine the next-hop node. Under this premise, when receiving the data contained in the message to be forwarded, there is no need to report the received data to the application layer; instead, the deployed protocol stack directly forwards the received data to the next-hop node based on the routing decision result. In other words, the data forwarded based on the routing decision result in this specification does not need to be processed by the application layer.

[0028] It should be understood that, since this specification pre-deploys a protocol stack, after obtaining the routing decision result based on the packet header, the protocol stack can perform the operation of "forwarding the subsequently received data to the next hop node" without the need for the application to participate in the forwarding operation as in related technologies. This avoids the problem of low packet forwarding efficiency caused by the need to report data to the application layer in related technologies.

[0029] The message forwarding method proposed in this specification will now be described in detail with reference to the accompanying drawings.

[0030] Figure 1 This is a flowchart illustrating a message forwarding method as an exemplary embodiment of this specification. The method is applied to any node in a distributed network and may include the following steps:

[0031] Step 102: Upon receiving the header of the message to be forwarded, perform a routing decision on the message to be forwarded based on the header and the routing table maintained in any of the nodes to determine the next-hop node of the message to be forwarded.

[0032] In this specification, a message to be forwarded refers to a message whose destination node is not this node, but which needs to be forwarded by this node. Similar to proactive routing in related technologies, this specification does not require routing decisions to be made after receiving the complete message; instead, routing decisions can be made upon receiving the header of the message to be forwarded.

[0033] Different methods can be used for routing decisions in this specification.

[0034] In one embodiment, since routing tables are typically maintained at the application layer, routing decisions can be made at the application layer, similar to proactive routing in related technologies. For example, after receiving the header of a packet to be forwarded, the routing information contained in the header can be reported to the application layer so that a routing decision can be made based on the routing table maintained at the application layer, resulting in a decision. In actual implementation, an application program for maintaining routing tables and making routing decisions can be deployed in the application layer, allowing this application to make routing decisions based on the maintained routing table.

[0035] In another embodiment, since the protocol stack is pre-deployed in the node according to this specification, the routing decision operation can be offloaded to the protocol stack for execution. For example, the protocol stack can also maintain a routing table so that when it receives the header of a packet to be forwarded, the protocol stack can directly perform a routing decision on the packet to be forwarded based on the received header and the maintained routing table, and obtain the decision result.

[0036] It should be understood that, since this embodiment offloads the routing decision operation to the protocol stack, the entire packet forwarding operation, including "routing decision and forwarding of subsequently received data", does not require the application layer to participate. That is, the packet forwarding is completed at the lower layer of the system architecture. Compared with the previous embodiment, this further reduces the number of interactions with the application layer due to packet forwarding operations and improves packet forwarding efficiency.

[0037] In this embodiment, the routing table maintained by the protocol stack can be obtained in various ways. For example, the routing table maintained by the application layer can be sent to the protocol stack for storage; another example is that the protocol stack can record the routing table itself when other nodes forward it to this node. Of course, this example is only illustrative, and how the protocol stack specifically obtains the routing table can be determined by those skilled in the art according to actual needs, and this specification does not limit it.

[0038] In this example, when the routing table maintained by the protocol stack is distributed by the application layer, the routing table maintained by the protocol stack can be updated along with the routing table maintained by the application layer. For instance, when a local node obtains routing table update information for the distributed network, it can report this information to the application layer. The application layer then performs a routing table update operation to obtain the updated routing table. After completing the update operation, the updated routing table can be distributed to the protocol stack for updating its own routing table. It is worth noting that the routing table update information in this example can be either the updated routing table or replacement information for a specific routing node in the current routing table. The specific type of information can be determined by those skilled in the art based on actual needs, and this specification does not impose any restrictions on this.

[0039] In this specification, the message header may contain node information representing the target node of the message to be forwarded, serving as routing information for the message. Based on this, upon receiving the message header of the message to be forwarded, the node information contained in the header can be read, and the shortest path from the current node to the target node can be calculated based on the shortest path algorithm. Then, the next-hop node of the message to be forwarded can be determined based on the calculated shortest path. In one feasible embodiment, the shortest path obtained based on the shortest path algorithm can be represented in the form of an SPT (Shortest Path Tree). Based on this, the next-hop node can be determined from the shortest path tree. Of course, this example is merely illustrative. Any existing routing method can be used for routing decisions in this specification. For example, dynamic routing algorithms such as link-state routing algorithms and distance-vector routing algorithms can be used for routing decisions in this specification. How to determine the next-hop node specifically can be determined by those skilled in the art according to actual needs, and this specification does not impose any limitations on this.

[0040] Step 104: Upon receiving data contained in the message to be forwarded, the protocol stack deployed in any of the nodes forwards the received data to the next-hop node according to the decision result of the routing decision; wherein the data is not processed by the application layer.

[0041] In this specification, after completing the routing decision, if data is received from a packet to be forwarded, it is not necessary to report the data to the application layer; instead, the protocol stack can directly forward it to the next-hop node. In other words, data forwarded based on the decision result does not need to be processed by the application layer.

[0042] In this specification, the protocol stack can forward received data to the next-hop node in a variety of ways.

[0043] In one embodiment, the protocol stack can establish a forwarding connection between the local node and the next-hop node based on the routing decision. On this basis, when the data contained in the message to be forwarded is received, the protocol stack can forward the received data to the next-hop node based on the established forwarding connection.

[0044] In this embodiment, to distinguish between different messages and forward the data of the message to be forwarded, the protocol stack can also determine the receiving connection used to send the message to be forwarded to the local node, thus establishing a forwarding connection pair between the receiving connection and the aforementioned forwarding connection. Under this premise, upon receiving the data of the message to be forwarded sent through the aforementioned receiving connection, the protocol stack can determine the forwarding connection corresponding to the receiving connection based on the established forwarding connection pair, and forward the received data to the next-hop node through the determined forwarding connection.

[0045] In other words, this embodiment can forward data of subsequently received packets to be forwarded by establishing forwarding connection pairs. When forwarding packets in this way, the length of the forwarded data string can be used to determine whether the forwarding of the packet is complete. For example, the packet header can contain the length of the packet string to be forwarded. Based on this, the protocol stack can read the string length to determine whether the data received from the receiving connection belongs to the packet to be forwarded during the process of sending data received from the receiving connection to the next-hop node via the forwarding connection. Specifically, if the total string length of the data received from the receiving connection does not exceed the string length read from the packet header, the received data is determined to belong to the packet to be forwarded; otherwise, even if data is received from the forwarding connection, it is not forwarded. Of course, besides determining whether the received data belongs to the packet to be forwarded based on the string length, other methods can be used to determine whether to continue forwarding the received data to the next-hop node. For example, the packet identifier read from the packet header can be compared with the packet identifier of the subsequently received data to determine whether it belongs to the packet to be forwarded, and thus decide whether to forward it. This specification does not limit this approach.

[0046] It should be understood that the forwarding method in this embodiment, that is, the method of forwarding by establishing a forwarding connection pair, is equivalent to establishing a transmission channel for the message. It combines packet switching technology and streaming transmission technology, which can realize routing decisions when only the protocol header is received, and can improve transmission efficiency through streaming transmission technology.

[0047] In another embodiment, received packets to be forwarded can also be forwarded by recording packet identifiers. For example, the protocol stack can read the unique identifier of the packet to be forwarded contained in the packet header and record the correspondence between the routing decision result and the unique identifier. Based on this, if data of the packet to be forwarded is received, the protocol stack can determine the corresponding decision result according to the unique identifier contained in the data, and forward the packet according to the next hop node indicated by the decision result.

[0048] Of course, the above examples are merely illustrative. How to forward the data of the packet to be forwarded based on the decision result of the routing decision can be determined by those skilled in the art according to actual needs, and this specification does not impose any restrictions on this.

[0049] It is worth noting that this specification can essentially be considered a proactive routing approach. In other words, after completing the routing decision, the protocol stack can send the received data to the next-hop node even before receiving all the data contained in the message to be forwarded. That is, this specification does not require receiving all the data in the message before forwarding; it can begin forwarding even after receiving only a portion of the data. For example, streaming forwarding can be used. Of course, this example is merely illustrative. The specific method used to forward the received data can be determined by those skilled in the art based on actual needs, and this specification does not impose any restrictions on this.

[0050] In addition, this manual allows the deployment of protocol stacks in nodes as needed, enabling the protocol stacks to perform the aforementioned packet forwarding operations. For example, a node typically contains both a kernel-mode protocol stack and a user-mode protocol stack. The compilation permissions for the user-mode protocol stack are open; therefore, the protocol stack deployed in the node in this manual can be a user-mode protocol stack, allowing technicians to compile it and implement the technical solutions described herein. Of course, this example is merely illustrative and does not imply that kernel-mode protocol stacks cannot be used to implement the technical solutions described herein. For instance, if technicians have compilation permissions for the kernel-mode protocol stack, or if the kernel-mode protocol stack was compiled during development according to the standards for implementing the technical solutions described herein, the protocol stack deployed in the node for packet forwarding can certainly be a kernel-mode protocol stack, and this manual does not impose any restrictions on this.

[0051] It should be noted that the technical solutions in this specification can be applied to any type of distributed network, such as a P2P (Peer-to-Peer) network, a blockchain network, etc. The specific type of distributed network to which the technical solutions in this specification are applied can be determined by those skilled in the art based on actual needs, and this specification does not impose any restrictions on this.

[0052] In the case of a distributed network that is a blockchain network, the blockchain network can be deployed based on the traditional architecture of blockchain technology, in which all nodes in the blockchain network are formed by deploying blockchain code on corresponding physical devices. In most cases, each node corresponds to a physical device. Alternatively, the blockchain network can be deployed based on the BaaS (Blockchain as a Service) architecture in blockchain technology, in which all nodes in the blockchain network are formed by deploying blockchain code on virtual machines implemented in the cloud through cloud services. Blockchain nodes do not need to correspond to corresponding physical devices one by one.

[0053] As can be seen from the above technical solution, this specification pre-deploys a protocol stack in the nodes of the distributed network. Based on this, any node, upon receiving the protocol header of a message, can make a routing decision based on the message header and the routing table to determine the next-hop node for the message. Furthermore, when receiving data from the same message, the data does not need to be processed by the application layer; the protocol stack can forward it to the next-hop node based on the decision result.

[0054] It should be understood that in this embodiment, the protocol stack performs the data forwarding operation based on the routing decision result, so that when data is received subsequently, this specification does not need to report the data to the application layer. This avoids the problem of low forwarding efficiency caused by the application performing the routing forwarding operation in related technologies, which requires reporting the received data to the application layer.

[0055] Furthermore, this manual can also have the routing decision operation performed by the protocol stack, that is, the routing decision operation is offloaded to the protocol stack, so that this manual can complete the forwarding of the entire message without the participation of the application layer, further reducing the interaction with the application layer and improving the forwarding efficiency of the message.

[0056] The following section uses the example of "synchronizing the routing table maintained by the application layer to the user-space protocol stack so that the user-space protocol stack can make routing decisions" to introduce the packet forwarding method in this manual.

[0057] Figure 2 This is a flowchart illustrating another message forwarding method as an exemplary embodiment of this specification. Figure 2 As shown, the method may include the following steps:

[0058] Step 201: The user-space protocol stack receives the protocol header of the message.

[0059] In this embodiment, since the user-space protocol stack can be edited to implement different functions, it can be pre-edited to enable routing decision-making and data forwarding capabilities. Furthermore, since routing decisions rely on routing tables, this node can pre-distribute the routing table maintained at the application layer to the user-space protocol stack for its maintenance.

[0060] Step 202: The user-space protocol stack makes routing decisions on the received protocol headers based on the maintained routing table.

[0061] In this embodiment, when the user-space protocol stack receives the protocol header of a packet, it can make a routing decision based on the maintained routing table and thus determine the next-hop node of the corresponding packet.

[0062] For example, assuming this node receives the header 'a' of message A, it can read the node information of the target node 7 of message A contained in the header 'a'. Based on this, it can make a routing decision based on the read node information and the maintained routing table to determine the next-hop node of message A. For example, the shortest path algorithm can be used to determine the shortest path from this node to the target node 7, and then the next-hop node of message A can be determined based on the shortest path.

[0063] Step 203: The user-space protocol stack establishes a forwarding connection between the current node and the next-hop node based on the routing decision result.

[0064] Continuing with the example above, assuming this node is node 1, and the next hop node for packet A is determined to be node 2 based on the routing decision, then the user-space protocol stack can establish a forwarding connection between "node 1 and node 2".

[0065] Step 204: The user-space protocol stack establishes a forwarding connection pair between the receiving connection between the previous hop node and the current node and the established forwarding connection.

[0066] Continuing with the example above, assuming the previous hop node of message A is node 3, then message header a is sent to this node through the "node 3-node 1" forwarding connection established by node 3. From this node's perspective, "node 3-node 1" can be called the receiving connection. Based on this, the user-space protocol stack can establish forwarding connection pairs to represent the correspondence between this receiving connection and the forwarding connections it has established. For example, the forwarding connection pairs established in the user-space protocol stack can be shown in Table 1 below:

[0067] message Forwarding connection pairs Receive connection Forwarding links Message A Forwarding connection pair 1 Node 3 - Node 1 Node 1 - Node 2 Message B Forwarding connection pair 2 Node 4 - Node 1 Node 1-Node 5 Message C Forwarding connection to 3 Node 5 - Node 1 Node 1-Node 8 …… …… …… ……

[0068] Table 1

[0069] Step 205: The user-space protocol stack receives the message data through the receive connection between the previous hop node and this node.

[0070] Step 206: Based on the established forwarding connection pair, the user-space protocol stack determines the forwarding connection between the current node and the next-hop node.

[0071] In this embodiment, the message header may record the data length of the corresponding message so that the user-space protocol stack can determine whether the received data belongs to the same message as the message header.

[0072] Continuing with the example above, assuming message A contains a header a and a body a', the user-space protocol stack can read the string length of the body a' from the header a and record it. The information recorded in the user-space protocol stack at this time can be shown in Table 2 below:

[0073] message Forwarding connection pairs Receive connection Forwarding links String length Message A Forwarding connection pair 1 Node 3 - Node 1 Node 1 - Node 2 4536 Message B Forwarding connection pair 2 Node 4 - Node 1 Node 1-Node 5 7561 Message C Forwarding connection to 3 Node 5 - Node 1 Node 1-Node 8 5816 …… …… …… ……

[0074] Table 2

[0075] Based on this, when the user-space protocol stack receives data from the "Node 3-Node 1" receiving connection, it can determine the forwarding connection for data forwarding as "Node 1-Node 2" based on the correspondence shown in Table 2, and determine whether the string length of the received data after receiving the packet header a exceeds "4536". If it does not exceed the limit, the received data is forwarded through the "Node 1-Node 2" forwarding connection.

[0076] Step 207: The user-space protocol stack sends the received data to the next-hop node based on the determined forwarding connection.

[0077] As can be seen from the above technical solution, in this embodiment, the application layer routing table is pre-distributed to the user-space protocol stack for maintenance. Under this premise, when a node receives the packet header, it does not need to report the packet header to the application layer. Instead, the user-space protocol stack can directly make routing decisions on the packet header based on the maintained routing table, thereby determining the next-hop node of the packet. Based on this, when the same packet data is subsequently received, the user-space protocol stack can directly forward the received data based on the routing decision.

[0078] As can be seen, the message forwarding method in this embodiment only needs to be executed in the user-space protocol stack, without the need for application program participation. This avoids the problem in related technologies where the received data needs to be reported to the application layer due to the need for application program participation in message forwarding operations, which reduces message forwarding efficiency.

[0079] Figure 3 This is a schematic structural diagram of a device provided in an exemplary embodiment. Please refer to... Figure 3 At the hardware level, the device includes a processor 302, an internal bus 304, a network interface 306, memory 308, and non-volatile memory 310, and may also include other hardware required for business operations. One or more embodiments of this specification can be implemented in software, such as the processor 302 reading the corresponding computer program from the non-volatile memory 310 into memory 308 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0080] Please refer to Figure 4 Message forwarding devices can be applied to, for example Figure 3The device shown implements the technical solution described in this specification. This message forwarding device is applied to any node in a distributed network and may include:

[0081] Decision unit 401, upon receiving the header of a message to be forwarded, performs a routing decision on the message to be forwarded based on the header and the routing table maintained in any node, in order to determine the next-hop node of the message to be forwarded.

[0082] When forwarding unit 402 receives data contained in the message to be forwarded, the protocol stack deployed in any of the nodes forwards the received data to the next-hop node according to the decision result of the routing decision; wherein the data is not processed by the application layer.

[0083] Optionally, decision unit 401 is further used for:

[0084] The routing information in the packet header is reported to the application layer so that the routing decision of the packet to be forwarded can be made according to the routing table maintained in the application layer, and the decision result can be obtained.

[0085] Optionally, decision unit 401 is further used for:

[0086] The protocol stack performs routing decisions on the packet to be forwarded based on its own maintained routing table and the routing information in the packet header, and obtains the decision result.

[0087] Optional, also includes:

[0088] The update unit 403 obtains the routing table update information of the distributed network and reports the routing table update information to the application layer so as to perform a routing table update operation at the application layer and obtain the updated routing table.

[0089] The updated routing table is sent to the protocol stack so that the protocol stack can update the maintained routing table.

[0090] Optionally, the message header includes node information representing the target node of the message to be forwarded; the decision unit 401 is further configured to:

[0091] The node information contained in the packet header is read, and the shortest path from any node to the target node is calculated based on the shortest path algorithm. The next hop node of the packet to be forwarded is determined according to the calculated shortest path.

[0092] Optionally, the forwarding unit 402 is further used for:

[0093] The protocol stack deployed in any of the nodes establishes a forwarding connection between the node and the next-hop node based on the routing decision result;

[0094] The received data is forwarded to the next-hop node by the established forwarding connection through the protocol stack.

[0095] Optional,

[0096] The forwarding unit 402 is also used to: determine, by the protocol stack, a receiving connection for sending the message to be forwarded to any of the nodes, and establish a forwarding connection pair between the determined receiving connection and the forwarding connection;

[0097] The forwarding unit 402 is further configured to: upon receiving data contained in the message to be forwarded sent through the receiving connection, determine a forwarding connection corresponding to the receiving connection based on the forwarding connection pair, so as to forward the received data to the next-hop node through the determined forwarding connection.

[0098] Optional, also includes:

[0099] The reading unit 404 reads the string length of the message to be forwarded from the message header by the protocol stack; the string length is used by the protocol stack to determine whether the data received from the receiving connection belongs to the message to be forwarded.

[0100] Specifically, if the total string length of the data received from the receiving connection does not exceed the string length read from the packet header, the received data is determined to belong to the packet to be forwarded.

[0101] Optionally, the forwarding unit 402 is further used for:

[0102] If the protocol stack deployed in any of the nodes has not received all the data contained in the message to be forwarded, it shall send the received data to the next-hop node according to the decision result of the routing decision.

[0103] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0104] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0105] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0106] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0107] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0108] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0109] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this specification. The singular forms “a,” “described,” and “the” used in one or more embodiments of this specification and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0110] It should be understood that although the terms first, second, third, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of one or more embodiments of this specification, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."

[0111] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the protection scope of one or more embodiments of this specification.

Claims

1. A message forwarding method, applied to any node in a distributed network, wherein any node in the distributed network is equipped with a protocol stack, comprising: Upon receiving the header of a message to be forwarded, the protocol stack performs a routing decision on the message to be forwarded based on the header and the routing table maintained in any of the nodes, in order to determine the next-hop node of the message to be forwarded. Upon receiving data contained in the message to be forwarded, the protocol stack deployed in any of the nodes directly forwards the received data to the next-hop node based on the routing decision result; wherein, the entire process of message forwarding does not require the participation of the application layer, and the protocol stack forwards the received data to the next-hop node using streaming transmission after receiving only part of the data contained in the message to be forwarded.

2. The method according to claim 1, wherein the step of making a routing decision for the packet to be forwarded based on the packet header and the routing table maintained in any of the nodes includes: The protocol stack performs routing decisions on the packet to be forwarded based on its own maintained routing table and the routing information in the packet header, and obtains the decision result.

3. The method according to claim 2, further comprising: Obtain the routing table update information of the distributed network and report the routing table update information to the application layer so that the routing table update operation can be performed at the application layer to obtain the updated routing table; The updated routing table is sent to the protocol stack so that the protocol stack can update the maintained routing table.

4. The method according to claim 1, wherein the packet header includes node information for characterizing the target node of the packet to be forwarded; the step of making a routing decision for the packet to be forwarded based on the packet header and the routing table maintained in any node includes: The node information contained in the packet header is read, and the shortest path from any node to the target node is calculated based on the shortest path algorithm. The next hop node of the packet to be forwarded is determined according to the calculated shortest path.

5. The method according to claim 1, wherein the protocol stack deployed in any of the nodes forwards the received data to the next-hop node according to the decision result of the routing decision, comprising: The protocol stack deployed in any of the nodes establishes a forwarding connection between the node and the next-hop node based on the routing decision result; The received data is forwarded to the next-hop node by the established forwarding connection through the protocol stack.

6. The method according to claim 5, further comprising: The protocol stack determines the receiving connection for sending the message to be forwarded to any of the nodes, and establishes a forwarding connection pair between the determined receiving connection and the forwarding connection. The step of forwarding the received data to the next-hop node by the protocol stack deployed in any of the nodes according to the decision result of the routing decision when the data contained in the message to be forwarded is received through the receiving connection includes: when the data contained in the message to be forwarded is received through the receiving connection, the protocol stack determines the forwarding connection corresponding to the receiving connection based on the forwarding connection pair, so as to forward the received data to the next-hop node through the determined forwarding connection.

7. The method according to claim 6, further comprising: The protocol stack reads the string length of the message to be forwarded from the message header; The string length is used by the protocol stack to determine whether the data received from the receiving connection belongs to the message to be forwarded. Specifically, if the total string length of the data received from the receiving connection does not exceed the string length read from the packet header, the received data is determined to belong to the packet to be forwarded.

8. The method according to claim 1, wherein the protocol stack deployed in any of the nodes forwards the received data to the next-hop node according to the decision result of the routing decision, comprising: If the protocol stack deployed in any of the nodes has not received all the data contained in the message to be forwarded, it shall send the received data to the next-hop node according to the decision result of the routing decision.

9. A message forwarding device, applied to any node in a distributed network, wherein any node in the distributed network is equipped with a protocol stack, comprising: The decision unit, upon receiving the header of the packet to be forwarded, performs a routing decision on the packet based on the header and the routing table maintained in any node, in order to determine the next-hop node of the packet to be forwarded. The forwarding unit, upon receiving data contained in the message to be forwarded, directly forwards the received data to the next-hop node based on the routing decision result of the protocol stack; wherein, the entire message forwarding process does not require the participation of the application layer, and the protocol stack, after receiving only part of the data contained in the message to be forwarded, forwards the received data to the next-hop node using a streaming transmission method.

10. An electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor implements the method as described in any one of claims 1-8 by executing the executable instructions.

11. A computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the steps of the method as claimed in any one of claims 1-8.

Citation Information

Patent Citations

  • Reverse proxy methods and devices, and computer readable storage medium

    CN109547519A

  • Message forwarding method and device and message forwarding control method and device

    CN110417653A