Address allocation method and device, node determination method and device and storage medium
By introducing non-leaf nodes into the network and leveraging the dispersion of address allocation functions between these nodes, the problems of high address allocation cost and high network resource consumption in the prior art are solved, and more efficient address allocation is achieved.
Patent Information
- Application Number
- CN202411929732.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-06
- Publication Date
- 2025-04-29
AI Technical Summary
In the prior art, nodes in the network need to allocate addresses through servers, resulting in high allocation costs and high network resources consumption, especially when the nodes are far away from the server.
By introducing non-leaf nodes into the network, the address allocation function is scattered between these nodes. The first node obtains the address of the second node according to its address, and uses it as a high bit, increasing the low bit of n bits to form the address of the second node, thereby realizing the functional dispersion of address allocation.
The cost of address allocation is reduced, the consumption of network resources is reduced, and the efficiency of address allocation is improved. Through the distributed address allocation function, the need to set up a dedicated address server separately is avoided.
Smart Images

Figure CN119906696A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202110763620.0, and the original application date is July 6, 2021. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of communications, and in particular to a method for allocating addresses, a method for determining nodes, a device and a storage medium. Background Art
[0003] The address is the identifier of the node. When a node joins the network, it needs to request an address, and then the node uses the address to communicate with other nodes. For example, when a node sends a message to another node, the source address of the message is the address of the node. When the other node receives the message and returns a response message to the node, the destination address of the response message is the address of the node.
[0004] In order to allocate addresses, a server is currently set up, and the server includes an address pool, and the address pool includes multiple addresses. When a node joins the network, the node sends an address allocation request to the server. The server receives the address allocation request, selects an address from the address pool as the address of the node, and returns an address allocation response to the node, and the address allocation response includes the address of the node. The node receives the address allocation response and obtains the address of the node from the address allocation response.
[0005] In the process of implementing this application, the inventor found that the prior art has at least the following problems:
[0006] Each node in the network requests the server to allocate an address, which requires setting up a separate server and has high allocation costs. When the node is far away from the server, the address allocation request and address allocation response are forwarded through multiple hops, which consumes a lot of network resources. Summary of the invention
[0007] The present application provides a method for allocating addresses, a method for determining nodes, an apparatus and a storage medium to reduce the cost of address allocation and the consumption of network resources. The technical solution is as follows:
[0008] In a first aspect, the present application provides a method for allocating addresses, in which a first node obtains an address of a second node according to an address of the first node, the address of the first node consists of m bits, the address of the second node consists of m+n bits, the high m bits of the address of the second node are the same as the low m bits of the address of the first node, and m and n are both integers greater than 0. The first node sends the address of the second node to the second node.
[0009] Among them, since the address of the first node is composed of m bits, the address of the second node is composed of m+n bits, and the high m bits of the address of the second node are the same as the low m bits of the address of the first node, the first node uses its own address as the high bit when allocating the address, and adds n bits of the low bit on this basis to obtain the address of the second node. In this way, the second node can be a child node of the first node, and the first node allocates addresses to its child nodes, so the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a server for dedicated address allocation separately, which reduces the cost of address allocation. In addition, the distance between the child nodes of the first node and the first node is often close, which can reduce the network resources consumed when allocating addresses.
[0010] At present, when the addresses are uniformly allocated by the server, the pressure on the server is relatively large, which affects the efficiency of address allocation. However, in this application, since the first node is responsible for allocating addresses for its child nodes, the function of allocating addresses is dispersed on different non-leaf nodes, so that addresses are allocated quickly. Since the allocated address consists of m+n bits, and the high m bits of the address are the same as the low m bits of the address of the first node, the allocated address is short and flexible, and the bit efficiency of the address is high.
[0011] In a possible implementation, if the lower n bits of the address of the second node meet the condition of allowing the node to allocate an address, the second node can allocate an address. If the lower n bits of the address of the second node meet the condition of prohibiting the node from allocating an address, the second node cannot allocate an address. In this way, it is possible to ensure that the child node accesses the non-leaf node in the network, while preventing the child node from accessing the leaf node of the network.
[0012] In another possible implementation, the condition for allowing a node to allocate an address includes a first condition and / or a second condition. If the first p bits of the lower n bits of the address of the second node meet the first condition, the second node can be allocated an address, where p is an integer greater than 0; or, if the first n-1 bits and the last bit of the lower n bits of the address of the second node meet the second condition, the second node can be allocated an address. In this way, the lower n bits are used to ensure that non-leaf nodes can be allocated addresses, so that child nodes can access non-leaf nodes in the network.
[0013] In another possible implementation, the first condition is that n=p and p is a specified integer, and the second condition is that the values of the first n-1 bits are all 1 and the value of the last bit is 0.
[0014] In another possible implementation, the conditions for prohibiting node address allocation include the third condition, the fourth condition and / or the fifth condition. If the first p bits of the lower n bits of the address of the second node meet the third condition, the second node cannot be allocated an address; or, if the length of the lower n bits of the address of the second node meets the fourth condition, the second node cannot be allocated an address; or, if the first n-1 bits and the last bit of the lower n bits of the address of the second node meet the fifth condition, the second node cannot be allocated an address. In this way, the lower n bits can ensure that the leaf node cannot be allocated an address, thereby preventing the child node from accessing the leaf node in the network.
[0015] In another possible implementation, the third condition is that n is greater than p, p is a specified integer and the first p bits are a specified address, the fourth condition is that the length of the lower n bits of the address of the second node is less than the specified integer p, and the fifth condition is that the values of the first n-1 bits are all 1 and the value of the last bit is 1.
[0016] In another possible implementation, the first node sends a first message to the second node, the first message includes a field with a length equal to x bytes, the field is used to carry the address of the second node, and x is an integer greater than 0. Since bytes are currently used as storage units, the length of the field is x bytes, which facilitates the storage of the address of the second node in the first message.
[0017] In another possible implementation, the first node selects a free address from a first address pool as the lower n bits of the address of the second node, the first node includes the first address pool, the number of bits included in each address in the first address pool is equal to p, p is a specified integer greater than 0, and n=p.
[0018] In another possible implementation, when the type of the second node is a non-leaf node, the first node selects a free address from the first address pool as the lower n bits of the address of the second node. Since the length of each address in the first address pool is p, when the type of the second node is a non-leaf node, an address is selected from the first address pool as the lower n bits of the second node, so that the non-leaf node can be allocated an address through the lower n bits, so that the child node can access the non-leaf node in the network.
[0019] In another possible implementation, when the first address pool does not include an idle address, the first node selects an idle address from the second address pool as the lower n bits of the address of the second node, the first node includes the second address pool, the second address pool includes the first type address and / or the second type address, the number of bits included in the first type address is less than p, the number of bits included in the second type address is greater than p, and the first p bits of the second type address are the designated address in the first address pool. Among them, the number of addresses in the second address pool is relatively large, so when there are many child nodes connected to the first node, the first node also allocates different addresses to the child nodes.
[0020] In another possible implementation, when the type of the second node is a leaf node, the first node selects a free address from the second address pool as the lower n bits of the address of the second node, the second address pool includes the first type address and / or the second type address, the number of bits included in the first type address is less than p, the number of bits included in the second type address is greater than p, the first p bits of the second type address are the designated address, and p is a designated integer greater than 0. In this way, the lower n bits can ensure that the leaf node cannot be assigned an address, thereby preventing the child node from accessing the leaf node in the network.
[0021] In another possible implementation, the first node is the parent node of the second node. In this way, when the second node requests address allocation, the request only needs to be sent through one hop, thereby reducing the consumption of network resources.
[0022] In another possible implementation manner, the first node requests allocation of a first address, where the first address is the address of the first node.
[0023] In another possible implementation, the first node updates the high m bits of the address of each node in the node set to the first address, and the node set includes the child nodes of the first node. In this way, even if the first node is not connected to the network, the first node can assign addresses to its child nodes. After the first node is connected to the network, the first node updates the high m bits of the address of each of its child nodes to the first address, thereby ensuring the correctness of the address of each child node.
[0024] In a second aspect, the present application provides a method for determining a node, in which a first node receives a first message, the first message includes a destination address, the destination address consists of x bits, and x is an integer greater than 0. The first node determines a next hop node of the first message based on the address of the first node and the destination address, the address of the first node consists of y bits, and y is an integer greater than 0.
[0025] Since the first node determines the next hop node of the first message based on the address of the first node and the destination address, the format of the destination address is supported as follows: the high m bits of the destination address are the address of the parent node of the second node corresponding to the destination address, and m is an integer greater than 0 and less than x. The destination address in this format is allocated by the node to which the second node requests it to connect, so that the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a separate server for dedicated address allocation, which reduces the cost of address allocation. In addition, the distance between the second node and the node to which it connects is often closer, which can reduce the network resources consumed when allocating addresses.
[0026] In a possible implementation, when x is less than y, the first node determines that the next hop node of the first message is the parent node of the first node. Thus, when it is determined that x is less than y, the first message can be sent to the parent node of the first node, thereby improving the forwarding efficiency of the first message.
[0027] In another possible implementation, when x is greater than or equal to y, the first node determines the next hop node of the first message based on the address of the first node and the first address, where the first address is the high y bits of the destination address. Since the first address is the high y bits of the destination address, the first node can ensure the correctness of determining the next hop node based on the address of the first node and the first address, thereby avoiding forwarding errors.
[0028] In another possible implementation, when the address of the first node is different from the first address, the first node determines that the next hop node of the first message is the parent node of the first node. In this way, when it is determined that the address of the first node is different from the first address, the first message can be sent to the parent node of the first node, thereby improving the forwarding efficiency of the first message.
[0029] In another possible implementation, when the address of the first node is the same as the first address and x is greater than y, the first node determines the next hop node of the first message based on the second address, and the second address is the part of the destination address other than the first address, which can ensure the correctness of determining the next hop node and avoid forwarding errors.
[0030] In another possible implementation, when the number of bits included in the second address is less than or equal to p, or when the first p bits of the second address are a specified address, the node corresponding to the destination address is a child node of the first node, the first node determines that the next hop node of the first message is the son node corresponding to the destination address, and p is a specified integer greater than 0.
[0031] In another possible implementation, when the number of bits included in the second address is greater than p and the first p bits of the second address are not the specified address, the first node determines that the next hop node of the first message is the node corresponding to the third address, and the third address includes the first address and the first p bits of the second address.
[0032] In another possible implementation, when the value of each bit included in the second address is 1, or the value of the least significant bit of the second address is 0 and the value of each bit of the second address except the least significant bit is 1, the node corresponding to the destination address is the son node of the first node, and the first node determines that the next hop node of the first message is the son node corresponding to the destination address.
[0033] In another possible implementation, there is a bit with a value of 0 in the bits other than the lowest bit of the second address, the first node obtains the fourth address, the fourth address is the first z bits of the second address, z is an integer greater than 0, the lowest bit of the fourth address has a value of 0, and the first z-1 bits of the fourth address have values of 1. The first node determines that the next hop node of the first message is the node corresponding to the third address, and the third address includes the first address and the fourth address.
[0034] In another possible implementation manner, when the address of the first node is the same as the first address and x=y, the first node processes the first message.
[0035] In another possible implementation, the high m bits of the destination address are the same as the address of the parent node of the second node, the second node is the node corresponding to the destination address, and m is an integer greater than 0 and less than x. Since the high m bits of the destination address are the address of the parent node of the second node, the destination address in this format is allocated by the node to which the second node requests it to connect, so that the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a separate server for dedicated address allocation, thereby reducing the cost of address allocation. In addition, the distance between the second node and the node to which it connects is often relatively close, which can reduce the network resources consumed when allocating addresses.
[0036] In another possible implementation manner, the destination address in the second aspect or any possible implementation manner of the second aspect is allocated using the method provided by the first aspect or any possible implementation manner of the first aspect.
[0037] In a third aspect, the present application provides an apparatus for allocating addresses, for executing a method executed by a first node in the first aspect or any possible implementation of the first aspect. Specifically, the apparatus includes a unit for executing a method executed by a first node in the first aspect or any possible implementation of the first aspect.
[0038] In a fourth aspect, the present application provides a device for determining a node, for executing a method executed by a first node in the second aspect or any possible implementation of the second aspect. Specifically, the device includes a unit for executing the method executed by a first node in the second aspect or any possible implementation of the second aspect.
[0039] In a fifth aspect, the present application provides a device for allocating addresses, the device comprising a transceiver, a processor and a memory. The transceiver, the processor and the memory may be connected via an internal connection. The memory is used to store a program, the processor is used to execute the program in the memory and cooperate with the transceiver, so that the device completes the method performed by the first node in the first aspect or any possible implementation of the first aspect.
[0040] In a sixth aspect, the present application provides a device for determining a node, the device comprising a transceiver, a processor, and a memory. The transceiver, the processor, and the memory may be connected via an internal connection. The memory is used to store a program, and the processor is used to execute the program in the memory and cooperate with the transceiver, so that the device completes the method performed by the first node in the second aspect or any possible implementation of the second aspect.
[0041] In the seventh aspect, the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium, and the computer program is loaded by a processor to implement instructions of the method executed by the first node of the above-mentioned first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect.
[0042] In an eighth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program is loaded by a processor to execute instructions of a method executed by a first node of the first aspect, the second aspect, any possible implementation of the first aspect, or any possible implementation of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;
[0044] Figure 2 is a flow chart of a method for allocating addresses provided in an embodiment of the present application;
[0045] Figure 3 This is another network architecture diagram provided by an embodiment of the present application;
[0046] Figure 4is a flow chart of another method for allocating addresses provided in an embodiment of the present application;
[0047] Figure 5 This is another network architecture diagram provided by an embodiment of the present application;
[0048] Figure 6 is a flow chart of a method for determining a node provided in an embodiment of the present application;
[0049] Figure 7 This is a flow chart of a method for determining a next hop node provided in an embodiment of the present application;
[0050] Figure 8 It is a schematic diagram of the structure of a device for allocating addresses provided in an embodiment of the present application;
[0051] Fig. 9 is a schematic diagram of the structure of a device for determining a node provided in an embodiment of the present application;
[0052] Fig.10 is a schematic diagram of the structure of another device for allocating addresses provided in an embodiment of the present application;
[0053] Fig.11 It is a schematic diagram of the structure of another device for determining a node provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0055] The following is an introduction to the concepts involved in this application.
[0056] A parent node is a node with at least one directly connected subordinate node. The node is the parent node of the at least one directly connected subordinate node. The parent node is a relative concept. In a tree structure network, the node is directly connected to the at least one directly connected subordinate node, that is, the connection between the node and any directly connected subordinate node does not pass through other nodes. The node is the i-th layer node of the tree structure network, and the at least one directly connected subordinate node is the i+1-th layer node of the tree structure network, i=1, 2, 3, ...
[0057] A child node is a directly connected subordinate node of a parent node, that is, the connection between a child node and a parent node does not pass through other nodes. In a tree structure network, a parent node is located at the i-th layer, and the child node of the parent node is located at the i+1th layer.
[0058] A child node is a subordinate node of a parent node. A node connected to a parent node is called a child node of the parent node. The connection between the child node and the parent node may not pass through other nodes, or may pass through at least one other node. In a tree-structured network, the parent node is located at the i-th layer, and the child node of the parent node is located at the j-th layer, j = i+1, i+2, i+3, ...
[0059] An address, consisting of one or more bits, is used to uniquely identify a node in the network.
[0060] The high m bits of the address are the 1st to mth bits with the highest address. For example, assuming the address is "10011010", and the address is from high to low from left to right, that is, the leftmost bit "1" of the address is the highest bit of the address, and the rightmost bit "0" of the address is the lowest bit of the address. Assuming m = 3, the high 3 bits of the address are the 1st to 3rd bits with the highest address, that is, "100".
[0061] The lower n bits of the address are the lowest n bits of the address. For example, still taking the above address "10011010" as an example, assuming n=4, the lower 4 bits of the address are the lowest 4 bits of the address, that is, "1010".
[0062] Bearer can be understood as carrying or including. The field in the message is used to bear the address, which actually means that the field includes the address or carries the address.
[0063] The address pool includes one or more addresses. The address pool is divided into a first address pool and a second address pool. The number of bits included in each address in the first address pool is p, and p is a specified integer greater than 0, that is, each address in the first address pool has the same length and is equal to p. For example, p=2, 3, or 4, etc. integer values. Assuming p=2, the addresses in the first address pool can be "00", "01", "10" and / or "11". The second address pool includes first-type addresses and / or second-type addresses. The number of bits included in the first-type address is less than p, the number of bits included in the second-type address is greater than p, and the high p bits in the second-type address are the specified addresses in the first address pool. For example, assuming p=2, the specified address in the first address pool is "11", the first-type address includes "1" and / or "0", and the second-type address includes "110", "111", "1100" or "1101", etc.
[0064] The conditions for allowing nodes to allocate addresses define the conditions under which nodes can allocate addresses. When the lower n bits of the node address meet the conditions, the node can allocate an address. The conditions for allowing nodes to allocate addresses include the first condition, the second condition and / or the third condition. The first condition is that n=p and p is a specified integer, the second condition is that p is a specified integer and the first p bits of the lower n bits are the specified address, and the third condition is that the first n-1 bits of the lower n bits are all 1 and the last bit is 0.
[0065] The condition for prohibiting node address allocation defines the condition under which the node cannot be allocated an address. When the lower n bits of the node address meet this condition, the node cannot be allocated an address. The condition for prohibiting node address allocation includes the fourth condition and / or the fifth condition, the fourth condition is that the length of the lower n bits of the node address is less than the specified integer p, and the fifth condition is that the first n-1 bits of the lower n bits are all 1 and the last bit is 1.
[0066] See also Figure 1 The present application provides a network architecture 100, which is a tree-structured network, including:
[0067] The root node A has at least one child node, and the at least one child node is connected to the root node A.
[0068] For any child node among the at least one child node, a direct connection is established between the root node A and the child node, so that the child node can access the root node A.
[0069] For example, see Figure 1 , the at least one child node includes node B1, node B2, node B3, node B4, node B5, node B6 and node B7. The root node A establishes direct connections with node B1, node B2, node B3, node B4, node B5, node B6 and node B7 respectively, so that node B1, node B2, node B3, node B4, node B5, node B6 and node B7 are connected to the root node A respectively.
[0070] For any one of the at least one child node, the type of the node may be a leaf node, which does not have the child node access authority; or the type of the node may be a non-leaf node, which has the child node access authority.
[0071] When the type of the node is a non-leaf node, the node may have at least one child node. For any child node of the at least one child node, a direct connection is established between the node and the child node to enable the child node to access the node.
[0072] For example, see Figure 1, the type of node B2 is a non-leaf node, and node B2 has at least one child node, which includes node C1, node C2, node C3, node C4, node C5, and node C6. Node B2 establishes direct connections with node C1, node C2, node C3, node C4, node C5, and node C6, respectively, so that node C1, node C2, node C3, node C4, node C5, and node C6 are connected to node B2 respectively.
[0073] In some embodiments, the network architecture 100 is a wireless network architecture or a wired network architecture, etc.
[0074] In some embodiments, the network architecture 100 is an Internet of Things (IOT) network, etc.
[0075] For a node in the network architecture 100 , when the type of the node is a non-leaf node, the direct connection between the node and its child nodes will not pass through other nodes.
[0076] For the direct connection between the node and the child node, when the network architecture 100 is a wireless network architecture, the direct connection between the node and the child node can be a wireless network connection. When the network architecture 100 is a wired network architecture, when there is a wired line connection between the node and the child node, the direct connection between the node and the child node is a connection established on the wired line.
[0077] For example, see Figure 1 , for node B2, node C1 is a child node of node B2, and the direct connection between node C1 and node B2 does not pass through other nodes. The direct connection between node C1 and node B2 is a wireless network connection, or the direct connection between node C1 and node B2 is a connection established on a wired line between node C1 and node B2.
[0078] For each node of a non-leaf node type in the network architecture 100, each node can be assigned an address, that is, each node has an address allocation function.
[0079] In some embodiments, for each node, the address allocation function of the node is enabled, so that the node allocates addresses to subnodes connected to the node through the address allocation function. Alternatively, the address allocation function of the node is not enabled, so that although the node has the address allocation function and can allocate addresses, the node will not allocate addresses to subnodes connected to the node.
[0080] For a node of a non-leaf node type in the network architecture 100, when the address allocation function of the node is enabled, the node can allocate addresses for w-layer child nodes connected to the node through the address allocation function, where w is an integer greater than 0. The first-layer child nodes of the node include the son nodes of the node, and the second-layer child nodes of the node include the grandchild nodes of the node. The meanings of the third to w-th layer child nodes are similar and will not be described in detail.
[0081] The node includes w first address pools, which correspond to the w layers one by one, that is, each layer of sub-nodes corresponds to a first address pool, and each address in the first address pool includes p bits, where p is a specified integer greater than 0, so each first address pool includes 2 p address.
[0082] In some embodiments, the node further includes w second address pools, and the w second address pools correspond to the w layers one by one, that is, each layer of subnodes corresponds to a second address pool, and the second address pool includes first type addresses and / or second type addresses. The number of bits included in the first type address is less than p, and the number of bits included in the second type address is greater than p. The first p bits of the second type address are the designated addresses in the first address pool. Therefore, the number of first type addresses is equal to (2 p-1 +2 p-2 +……+2), the number of second type addresses is infinite.
[0083] For example, assuming w = 1, p = 2, for Figure 1 In the network architecture 100 shown, the node A is a non-leaf node, and the address allocation function of the node A is turned on. The node A allocates addresses to the first-layer child nodes connected to the node through the address allocation function, that is, allocates addresses to the child nodes B1, B2, B3, B4, B5, B6, and B7. Figure 1 The node B2 in the network architecture 100 shown is a non-leaf node, and the address allocation function of node B2 is turned on. Node B2 uses the address allocation function to allocate addresses to the first-layer child nodes connected to the node, that is, to allocate addresses to child nodes C1, child node C2, child node C3, child node C4, child node C5 and child node C6.
[0084] Node A (or node B2) includes a first address pool corresponding to the first-layer child nodes, the first address pool includes four addresses, each address includes 2 bits, that is, the four addresses in the first address pool are: 00, 01, 10 and 11. Assuming that address "11" is the designated address in the first address pool, node A (or node B2) also includes a second address pool corresponding to the first-layer child nodes. Among them, the number of bits included in the first type address in the second address pool is less than 2, and the first type address can be address "0" and / or "1". The number of bits included in the second type address in the second address pool is greater than 2 and the first two bits are "11", for example, the second type address can be address "110", "111", "1100", "1101", "1110" and / or "11111", etc.
[0085] For another example, assuming w = 2, p = 2, for Figure 1 In the network architecture 100 shown, the node A is a non-leaf node, and the address allocation function of the node A is turned on. The node A allocates addresses to the first-layer subnodes and the second-layer subnodes connected to the node through the address allocation function, that is, allocates addresses to the subnodes B1, B2, B3, B4, B5, B6, and B7 in the first-layer subnodes, and allocates addresses to the subnodes C1, C2, C3, C4, C5, and C6 in the second-layer subnodes. In this example, although the subnode B2 is a non-leaf node and can allocate addresses, the address allocation function of the subnode B2 is not turned on, and the subnodes C1, C2, C3, C4, C5, and C6 connected will not be allocated addresses.
[0086] Node A includes two first address pools, which are respectively the first address pool 1 corresponding to the first-layer child nodes and the first address pool 2 corresponding to the second-layer child nodes. The first address pool 1 (or the first address pool 2) includes four addresses, and the number of bits included in each address is 2, that is, the four addresses in the first address pool 1 (or the first address pool 2) are: 00, 01, 10 and 11. Assuming that address "11" is the designated address in the first address pool 1 (first address pool 2), node A also includes two second address pools, which are respectively the second address pool 1 corresponding to the first-layer child nodes and the second address pool 2 corresponding to the second-layer child nodes. The number of bits included in the first type of address in the second address pool 1 (or the second address pool 2) is less than 2, and the first type of address can be address "0" and / or "1". The second type of address in the second address pool 1 (or the second address pool 2) includes a bit number greater than 2 and the first two bits are "11". For example, the second type of address in the second address pool 1 (or the second address pool 2) can be addresses "110", "111", "1100", "1101", "1110" and / or "11111", etc.
[0087] For nodes whose node types in the network architecture 100 are non-leaf nodes, the detailed process of allocating addresses to the nodes will be described in detail in subsequent embodiments and will not be introduced here.
[0088] See also Figure 2 The present application embodiment provides a method 200 for allocating addresses, and the method 200 can be applied to Figure 1 The network architecture 100 shown includes:
[0089] Step 201: A first node receives an address allocation request sent by a second node, where the second node is a child node of the first node.
[0090] The second node sends the address allocation request to its parent node. If the address allocation function of the parent node is enabled, the parent node is the first node. If the address allocation function of the parent node is not enabled, the parent node continues to send the address allocation request to its parent node until the node with the address allocation function enabled receives the address allocation request. The node with the address allocation function enabled is the first node.
[0091] In some embodiments, when the network architecture 100 is a wireless network architecture, when the second node starts, it selects a node and requests to access the selected node. If the selected node can allocate an address, that is, the type of the selected node is a non-leaf node, and has child node access authority and address allocation function, the selected node allows the second node to access and establishes a direct connection with the second node. At this time, the selected node is the parent node of the second node. If the selected node cannot allocate an address, that is, the type of the selected node is a leaf node, and does not have child node access authority and address allocation function, the selected node rejects the access request of the second node, and the second node reselects a node and requests to access the reselected node until the parent node is selected, and then sends an address allocation request to its parent node.
[0092] For example, suppose Figure 1 The network architecture 100 shown is a wireless network architecture. The types of nodes A, B1, B2 and B3 in the network architecture 100 are all non-leaf nodes, and all can be assigned addresses, and have child node access rights and address allocation functions. Assuming that the second node is node C1, node C1 selects a node at startup, assuming that node B5 is selected, and requests to access node B5. Since the type of node B5 is a leaf node, node B5 cannot assign addresses, and does not have child node access rights and address allocation functions, so node B5 rejects the access request of node C1. Node C1 reselects a node, assuming that node B2 is selected, and requests to access node B2. Since node B2 can assign addresses, node B2 has child node access functions and address allocation functions, node B2 allows node C1 to access and establishes a direct connection with node C1. At this time, node B2 is the parent node of node C1. Then node C1 sends an address allocation request to node B2.
[0093] In some embodiments, when the network architecture 100 is a wired network architecture, there is a wired line connecting the second node to its parent node, and the second node directly sends an address allocation request to its parent node. Figure 1 The network architecture 100 shown is a wired network architecture. There is a wired line connecting node C1 and node B2 in the network architecture 100. Node B2 is the parent node of node C1. Node B2 can allocate addresses. Node B2 has child node access function and address allocation function. Node C1 sends an address allocation request to node B2.
[0094] In the above example, if the address allocation function of node B2 is turned on, node B2 is the first node in step 201, and the operation of allocating an address to node C1 is performed next. If the address allocation function of node B2 is not turned on, the parent node of node B2 is node A, and node B2 sends an address allocation request to node A. Node A is the root node of the network architecture 100 and has an address allocation function. The address allocation function of node A is turned on, node A is the first node in step 201, and the operation of allocating an address to node C1 is performed next.
[0095] In some embodiments, the address allocation request includes the type of the second node. The type of the second node is a leaf node, or a non-leaf node.
[0096] In some embodiments, when the network architecture 100 is a wireless network architecture, the address allocation request includes the type of the second node.
[0097] Step 202: The first node obtains a second address, where the second address includes n bits, and n is an integer greater than 0.
[0098] In step 202, the first node selects a free address from a first address pool as a second address. The first node includes the first address pool. The number of bits included in each address in the first address pool is equal to p, where p is a specified integer greater than 0. In this case, n=p.
[0099] The first address pool corresponds to the sub-node layer number of the second node. For example, assuming that the second node is a first-layer sub-node of the first node, the first address pool corresponds to the first-layer sub-node, and assuming that the second node is a second-layer sub-node of the first node, the first address pool corresponds to the second-layer sub-node.
[0100] In some embodiments, before selecting a free address from the first address pool, the first node obtains the first address pool. The first node allocates addresses to w-layer child nodes connected to the first node. In implementation, the first node determines the number of child nodes where the second node is located, and obtains the first address pool corresponding to the number of child nodes.
[0101] In some embodiments, the first node assigns an address to one layer of child nodes, that is, w=1, that is, the first node only assigns an address to its child nodes, the second node is the child node of the first node, and the first node includes a first address pool. The first node may not determine the number of child nodes where the second node is located, and directly obtain the first address pool.
[0102] In some embodiments, the first node includes a network topology diagram of the network architecture 100, and the first node determines the sub-node layer number where the second node is located based on the network topology diagram. Alternatively, the address allocation request includes the sub-node layer number, and the first node obtains the sub-node layer number where the second node is located from the address allocation request.
[0103] In some embodiments, the initial value of the number of child node layers included in the address allocation request sent by the second node is 1. The parent node of the second node receives the address allocation request. If the address allocation function of the parent node is not enabled, the parent node increases the number of child node layers in the address allocation request and then sends the address allocation request to its parent node.
[0104] In step 202, the first node may select an address from the first address pool as the second address in the following ways:
[0105] In the first mode, the addresses in the first address pool are only allocated to nodes of non-leaf node type. Therefore, before the first node selects an idle address from the first address pool, the first node also obtains the type of the second node. If the type of the second node is a non-leaf node, the first node selects an idle address from the first address pool as the second address.
[0106] In the first mode, for the first layer of sub-nodes where the second node is located, the first layer of sub-nodes includes two types of leaf nodes and non-leaf nodes. The number of leaf nodes included in the first layer of sub-nodes is less than or equal to the number of first type addresses in the second address pool, and the second address pool corresponds to the number of sub-node layers where the second node is located, that is, the number of leaf nodes included in the first layer of sub-nodes is limited. In this way, the second address pool may not include the second type of address, and the second address pool includes enough first type addresses to be allocated to the leaf nodes in the first layer of sub-nodes, so that the addresses in the first address pool are only allocated to nodes of the non-leaf node type.
[0107] In some embodiments, when the address allocation request sent by the second node includes the type of the second node, the first node obtains the type of the second node from the address allocation request.
[0108] In some embodiments, the first node includes a network topology map of the network architecture 100, and the first node determines whether the second node is a leaf node or a non-leaf node based on the network topology map, and obtains the type of the second node based on the determination result.
[0109] For example, see Figure 1, assuming that the second node is node C1, the type of node C1 is a non-leaf node, the first node is node B2, node C1 is the first-level child node of node B2, the first address pool of node B2 includes addresses "00", "01", "10" and "11", and node B2 selects the free address "00" from the four addresses as the second address.
[0110] For another example, see Figure 1 , assuming that the second node is node C1, the type of node C1 is a non-leaf node, the first node is node A, node C1 is the second-layer child node of node A, node A includes the first address pool 1 and the first address pool 2, and the first address pool 2 corresponds to the second-layer child node. Node A determines that the subnode level number of node C1 is "2", and obtains the first address pool 2 corresponding to the subnode level number "2". The first address pool 2 includes addresses "00", "01", "10" and "11", and node A selects the idle address "00" from the four addresses as the second address.
[0111] In the first mode, when the type of the second node is a leaf node, the first node selects an idle first-type address from the second address pool as the second address. In this case, n is less than p.
[0112] The second address pool corresponds to the sub-node layer number of the second node. For example, assuming that the second node is a first-layer sub-node of the first node, the second address pool corresponds to the first-layer sub-node, and assuming that the second node is a second-layer sub-node of the first node, the second address pool corresponds to the second-layer sub-node.
[0113] In some embodiments, before selecting a free address from the second address pool, the first node obtains the second address pool. The first node allocates addresses to w-layer child nodes connected to the first node. In implementation, the first node determines the number of child nodes where the second node is located, and obtains the second address pool corresponding to the number of child nodes.
[0114] In some embodiments, the first node assigns an address to one layer of child nodes, that is, w=1, that is, the first node only assigns an address to its child nodes, the second node is the child node of the first node, and the first node includes a second address pool. The first node may not determine the number of child nodes where the second node is located and directly obtain the second address pool.
[0115] For example, see Figure 1 , assuming that the second node is node C1, the type of node C1 is a leaf node, the first node is node B2, node C1 is a first-layer child node of node B2, and the second address pool of node B2 includes first-type addresses, and the first-type addresses can be addresses "0" and / or "1". Assume that node B2 selects an idle first-type address "0" from the second address pool as the second address.
[0116] For another example, see Figure 1 , assuming that the second node is node C1, the type of node C1 is a leaf node, the first node is node A, node C1 is the second-layer child node of node A, node A includes a second address pool 1 and a second address pool 2, and the second address pool 2 corresponds to the second-layer child node. Node A determines that the subnode layer number of node C1 is "2", and obtains the second address pool 2 corresponding to the subnode layer number "2". The second address pool 2 of node A includes a first type of address, and the first type of address can be an address "0" and / or "1". Assume that node A selects an idle address "0" from the second address pool 2 as the second address.
[0117] In the second mode, at least one address in the first address pool is a designated address, and non-designated addresses in the first address pool other than the designated address are only allocated to nodes of non-leaf node type. Therefore, before the first node selects an idle address from the first address pool, the first node also obtains the type of the second node. When the type of the second node is a non-leaf node, the first node selects an idle non-designated address from the first address pool as the second address.
[0118] In the second mode, for the first layer of sub-nodes where the second node is located, the first layer of sub-nodes includes two types, leaf nodes and non-leaf nodes, and the number of leaf nodes included in the first layer of sub-nodes is unlimited. For the second address pool corresponding to the number of sub-node layers where the second node is located, the second address pool includes first-type addresses and / or second-type addresses, and the number of second-type addresses is unlimited, so the second address pool has enough addresses to allocate to the leaf nodes included in the first layer of sub-nodes, thereby allocating the non-specified addresses in the first address pool only to nodes of the non-leaf node type.
[0119] The operation of the first node obtaining the type of the second node in the second mode is the same as the operation of the first node obtaining the type of the second node in the first mode, and will not be described in detail here.
[0120] In the second mode, when the type of the second node is a leaf node, the first node selects an idle designated address from the first address pool as the second address, in which case n = p. Alternatively, the first node selects an idle address from the second address pool as the second address, in which case n is not equal to p, that is, n may be less than p, or n may be greater than p.
[0121] When the idle address selected by the first node from the second address pool is a first type address, n is less than p; when the idle address selected by the first node from the second address pool is a second type address, n is greater than p.
[0122] The second address pool corresponds to the subnode level number where the second node is located. The operation of the first node acquiring the second address pool corresponding to the subnode level number is the same as the operation of the first node acquiring the second address pool in the first mode, which will not be described in detail here.
[0123] For example, see Figure 1 , assuming that the second node is node C1, the type of node C1 is a leaf node, the first node is node B2, node C1 is a first-layer child node of node B2, and the second address pool of node B2 includes first-type addresses and / or second-type addresses, the first-type addresses can be addresses "0" and / or "1", and the second-type addresses can be addresses "110", "111", "1100", "1101", "1110" and / or "11111", etc. Assume that node B2 selects the idle address "110" as the second address from the second address pool.
[0124] For another example, see Figure 1 , assuming that the second node is node C1, the type of node C1 is a leaf node, the first node is node A, node C1 is the second-layer child node of node A, node A includes a second address pool 1 and a second address pool 2, and the second address pool 2 corresponds to the second-layer child node. Node A determines that the number of the child node layer where node C1 is located is "2", and obtains the second address pool 2 corresponding to the number of the child node layer "2". The second address pool 2 of node A includes a first-type address and / or a second-type address, the first-type address can be an address "0" and / or "1", and the second-type address can be an address "110", "111", "1100", "1101", "1110" and / or "11111", etc. Assume that node A selects an idle address "110" from the second address pool 2 as the second address.
[0125] In a third manner, when there is an idle address in the first address pool, the first node selects an idle address from the first address pool as the second address.
[0126] The third method can be applied to a wireless network architecture, where the second node accesses its selected parent node and requests the first node to allocate an address. In this case, the first node does not need to obtain the type of the second node, and as long as there is an idle address in the first address pool, the first node selects an idle address from the first address pool as the second address.
[0127] For the layer of child nodes where the second node is located, the number of leaf nodes included in the layer of child nodes is limited, that is, the number of leaf nodes is less than or equal to the number of first type addresses in the second address pool; or, the number of leaf nodes included in the layer of child nodes is not limited, and the second address pool corresponds to the number of sub-node layers where the second node is located.
[0128] Therefore, in the third method, when the number of leaf nodes included in the first layer of sub-nodes is limited, the addresses in the first address pool are only allocated to nodes of non-leaf node type. Therefore, when the second address is the address allocated by the first node from the first address pool, the first node determines that the type of the second node is a non-leaf node.
[0129] When there is no free address in the first address pool, the first node obtains a second address pool corresponding to the number of subnodes where the second node is located, the second address pool includes first-type addresses, and selects a free first-type address from the second address pool as the second address, where n is less than p. The first node determines that the type of the second node is a leaf node.
[0130] When the number of leaf nodes included in the first layer of child nodes is not limited, the non-specified address in the first address pool is only allocated to nodes of the non-leaf node type, so when the second address is the non-specified address allocated by the first node from the first address pool, the first node determines that the type of the second node is a non-leaf node. When the second address is the specified address allocated by the first node from the first address pool, the first node determines that the type of the second node is a leaf node.
[0131] When there is no free address in the first address pool, the first node obtains a second address pool corresponding to the number of subnodes where the second node is located, the second address pool includes first type addresses and / or second type addresses, selects a free first type address from the second address pool as the second address, n is less than p, or selects a second type address from the second address pool as the second address, n is greater than p. The first node determines that the type of the second node is a leaf node.
[0132] The second address pool corresponds to the subnode level number where the second node is located. The operation of the first node acquiring the second address pool corresponding to the subnode level number is the same as the operation of the first node acquiring the second address pool in the first mode, which will not be described in detail here.
[0133] In the first, second or third manner, the second address may satisfy the condition that allows the node to allocate an address, in which case the second node can allocate an address, that is, the type of the second node is a non-leaf node. Alternatively, the second address may satisfy the condition that prohibits the node from allocating an address, that is, the type of the second node is a leaf node.
[0134] The condition for allowing a node to allocate an address includes a first condition, and if the first p bits of the second address meet the first condition, the second node can allocate an address. The first condition is n=p and p is a specified integer, that is, the length of the second address is p.
[0135] In some embodiments, the first condition further includes the following: the second address is a non-specified address in the first address pool.
[0136] The condition for prohibiting the node from allocating an address includes a third condition and / or a fourth condition. If the first p bits of the second address meet the third condition, the second node cannot be allocated an address; or, if the length of the second address meets the fourth condition, the second node cannot be allocated an address. The third condition is that n is greater than p, p is a specified integer and the first p bits are a specified address, and the fourth condition is that the length of the second address is less than the specified integer p.
[0137] Step 203: The first node obtains the address of the second node based on the third address and the second address, where the third address is the address of the parent node of the second node.
[0138] The address length of the second node is m+n, where m is the address length of the parent node of the second node, that is, the length of the third address. The high m bits of the address of the second node are the same as the low m bits of the address of the first node, and the low n bits of the address of the second node are the second address.
[0139] In step 203, when the second node is a first-layer child node of the first node, the first node is the parent node of the second node, the third address is the address of the first node, and the first node combines the third address and the second address into the address of the second node.
[0140] In step 203, when the second node is the v-th child node of the first node, v is an integer greater than 1 and less than or equal to w, there is at least one other node between the path from the first node to the second node, the first node obtains the address of the parent node of the second node to obtain the third address, and the first node combines the third address and the second address into the address of the second node.
[0141] For example, assuming that the first node is node B2, the second node is node C1, the second address is "00", the third address is the address of node B2, and the third address is "101". In this way, the address of the second node C1 obtained by node B2 is "10100", and the address length of the second node C1 is 5. Or,
[0142] Assume that the first node is node A, the second node is node C1, the second address is "00", and the first node A obtains the address of the parent node B2 of the second node C1 as the third address, and the third address is "101". In this way, the address of the second node C1 obtained by the first node A is "10100", and the address length of the second node C1 is 5.
[0143] Step 204: The first node sends an address allocation response to the second node, where the address allocation response includes the address of the second node.
[0144] In some embodiments, the address allocation response also includes a type of the second node.
[0145] In some embodiments, when the first node obtains the second address using the third method described above, the address allocation response also includes the type of the second node.
[0146] In some embodiments, when the second address is an address in the first address pool or the second address is a non-specified address in the first address pool, the type of the second node is a non-leaf node. When the second address is an address in the second address pool or the second address is a specified address in the first address pool, the type of the second node is a leaf node.
[0147] The second node receives the address allocation response, and sets its own address to the address included in the address allocation response.
[0148] In some embodiments, the address allocation response includes the type of the second node, and the second node sets its own type to the type included in the address allocation response.
[0149] In some embodiments, the address assignment response includes a field of length equal to x bytes including the address of the second node.
[0150] In some embodiments, the field includes x subfields, each of which is one byte long. The first bit of the xth subfield carries an end indication, which is used to indicate that the xth subfield is the last subfield of the field. For each subfield in the 1st to x-1st subfields, the first bit of the subfield carries a belonging indication, which is used to indicate that the subfield belongs to the field. The values of the 2nd to eth bits of the 1st subfield are 0, the e+1th to 8th bits of the 1st subfield and the 2nd to 8th bits of each subfield in the 2nd to xth subfields are all the addresses of the second node, e=7*xm-n+1, * is a multiplication operation.
[0151] For example, the address of the second node is "1110111010", m+n=10, and the address allocation response includes a field with a length of two bytes, x=2, and the field includes a first subfield and a second subfield, e=2*7-m-n+1=14-10+1=5. The first bit of the second subfield carries an end indication "0", and the end indication "0" is used to indicate that the second subfield is the last subfield of the field. The first bit of the first subfield carries a belonging indication "1", and the belonging indication "1" is used to indicate that the first subfield belongs to the field. The values of the 2nd to 5th bits of the first subfield are 0, and the 6th to 8th bits of the first subfield and the 2nd to 8th bits of the second subfield are the address of the second node "1110111010". Therefore, the first subfield is "10000111", the second subfield is "00111010", and the field is "10000111 00111010".
[0152] In some embodiments, the first node may be a child node of a certain node. When the first node accesses its parent node, the first node also requests allocation of a first address according to the above steps 201-204, and updates the first m bits of each address in the node set to the first address. The node set includes the child nodes of the first node.
[0153] In implementation, the first node sends an update request to each node in the node set, the update request including the first address and m. For any node in the node set, the node updates the first m bits of its own address to the first address in order to receive the update request.
[0154] For example, see Figure 3 , assuming that the address of node A is "1", that is, m=1, node A accesses its parent node D, and node A requests to be assigned a first address. Assuming that the assigned first address is "110", node A sends an update request to node B1, node B2, node B3, node B4, node B5, node B6, node B7, node C1, node C2, node C3, node C4, node C5 and node C6, and the update request includes the first address "110" and m=1.
[0155] For node B2, the address of node B2 is "101". Node B2 receives the update request and updates the previous bit "1" in "101" to "110", and the address of node B2 is "11001". For the updated addresses of other nodes, see Figure 3 shown.
[0156] In some embodiments, when the second node is a non-leaf node, the second node enables the address allocation function or does not enable the address allocation function.
[0157] In the embodiment of the present application, the second node is a child node of the first node. Since the address of the first node is composed of m bits, the address of the second node is composed of m+n bits, and the high m bits of the address of the second node are the same as the low m bits of the address of the first node, the first node uses its own address as the high bit when allocating the address, and adds n bits of the low bit on this basis to obtain the address of the second node. In this way, the first node allocates addresses to its child nodes, so the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a server for dedicated address allocation separately, which reduces the cost of address allocation. In addition, the distance between the child nodes of the first node and the first node is often close, which can reduce the network resources consumed when allocating addresses. Since the first node is responsible for allocating addresses to its child nodes, the function of allocating addresses is dispersed on different non-leaf nodes, thereby quickly allocating addresses. Since the allocated address is composed of m+n bits, and the high m bits of the address are the same as the low m bits of the address of the first node, the allocated address is short and flexible, the bit efficiency of the address is high, and the allocated address is variable in length and more flexible.
[0158] See also Figure 4 The present application embodiment provides a method 400 for allocating addresses, and the method 400 can be applied to Figure 1 The network architecture 100 shown includes:
[0159] Step 401: The same as step 201, which will not be described in detail here.
[0160] Step 402: The first node obtains a second address, where the second address includes n bits, where n is an integer greater than 0, and the values of the n bits included in the second address are all 1; or, the values of the first n-1 bits of the second address are all 1 and the value of the least significant bit is 0.
[0161] In step 402, the first node allocates n bits, each bit has a value of 1, or the values of the 1st to n-1st bits are all 1, and the value of the nth bit is 0, and the n bits are used as the second address.
[0162] In step 402, the first node may obtain the second address in the following ways:
[0163] In the first method, the first node obtains the type of the second node. When the type of the second node is a leaf node, n bits with a value of 1 are allocated, and the n bits are used as the second address. When the type of the second node is a non-leaf node, n bits are allocated, the values of the 1st to n-1st bits are 1, the value of the nth bit is 0, and the n bits are used as the second address.
[0164] For detailed process of the first node obtaining the type of the second node, see Figure 2 The detailed process of the first node obtaining the type of the second node in step 202 is not described in detail here.
[0165] For example, see Figure 5 , assuming that the first node is node A or node B1, and the second node is node C1, n=2, the first node A (or B1) is allocated two bits, which can be "10" or "11". If the type of node C1 is a non-leaf node, "10" is used as the second address. If the type of node C1 is a leaf node, "11" is used as the second address.
[0166] For another example, see Figure 5 , assuming that the first node is node A or node B1, and the second node is node C2, n=3, the first node A (or B2) is allocated three bits, and the three bits can be "110" or "111". If the type of node C2 is a non-leaf node, "110" is used as the second address. If the type of node C2 is a leaf node, "111" is used as the second address.
[0167] In the second method, the first node is assigned n bits with a value of 1, and the n bits are used as the second address to determine the type of the second node as a leaf node; or, n bits are assigned, the values of the 1st to n-1st bits are 1, the value of the nth bit is 0, and the n bits are used as the second address to determine the type of the second node as a non-leaf node.
[0168] The second method can be applied to a wireless network architecture, where the second node accesses its selected parent node and requests the first node to allocate an address. In this case, the first node does not need to obtain the type of the second node, but directly obtains the second address in the second method.
[0169] In some embodiments, the second address may satisfy the condition that allows the node to allocate an address, in which case the second node can allocate an address, and the type of the second node is a non-leaf node, that is, the first node determines that the type of the second node is a non-leaf node. Alternatively, the second address may satisfy the condition that prohibits the node from allocating an address, and the type of the second node is a leaf node, that is, the first node determines that the type of the second node is a leaf node.
[0170] In some embodiments, the condition for allowing a node to allocate an address includes a second condition, and if the first n-1 bits and the last bit of the second address meet the second condition, the second node can allocate an address.
[0171] In some embodiments, the condition for prohibiting a node from allocating an address includes a fifth condition. If the first n-1 bits and the last bit of the second address satisfy the fifth condition, the second node cannot allocate an address.
[0172] In some embodiments, the second condition is that the values of the first n-1 bits of the second address are all 1 and the value of the last bit of the second address is 0, and the fifth condition is that the values of the first n-1 bits of the second address are all 1 and the value of the last bit of the second address is 1.
[0173] Steps 403-404 are the same as steps 203-204 respectively and will not be described in detail here.
[0174] For example, see Figure 5 , assuming that the second node is node C1, the second address is "10", and the parent node of node C1 is node B1, assuming that the address of node B1 is "110", use "110" as the upper 3 bits of the address of node C1, and use "10" as the lower 2 bits of the address of node C1, and the address of node C1 is "11010".
[0175] For another example, see Figure 5 , assuming that the second node is node C2, and the second address is "111", and the parent node of node C2 is node B1, assuming that the address of node B1 is "110", use "110" as the upper 3 bits of the address of node C2, and use "111" as the lower 3 bits of the address of node C2, and the address of node C2 is "110111".
[0176] In some embodiments, in step 404, the address allocation response sent by the first node further includes the type of the second node.
[0177] In some embodiments, when the first node obtains the second address using the second method described above, the address allocation response also includes the type of the second node.
[0178] In some embodiments, the value of the bits 1 to n-1 of the second address are all 1 and the value of the nth bit is 0, and the type of the second node is a non-leaf node. The value of each bit of the second address is 1, and the type of the second node is a leaf node.
[0179] In the embodiment of the present application, since the address of the first node is composed of m bits, the address of the second node is composed of m+n bits, and the high m bits of the address of the second node are the same as the low m bits of the address of the first node, the first node uses its own address as the high bit when allocating the address, and adds the low bit of n bits on this basis to obtain the address of the second node. In addition, when the second node is a non-leaf node, the values of the first n-1 bits of the address of the low n bits are all 1 and the value of the last bit is 0; when the second node is a leaf node, the values of the low n bits are all 1, which simplifies the complexity of address allocation, thereby improving the efficiency of address allocation. In addition, the second node can be a child node of the first node, and the first node allocates addresses to its child nodes, so the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a server for dedicated address allocation separately, which reduces the cost of address allocation. In addition, the distance between the child nodes of the first node and the first node is often close, which can reduce the network resources consumed when allocating addresses. At present, when the addresses are allocated uniformly by the server, the pressure on the server is relatively large, which affects the efficiency of address allocation. However, in the present application, since the first node is responsible for allocating addresses to its child nodes, the address allocation function is dispersed on different non-leaf nodes, so that addresses are allocated quickly. Since the allocated address consists of m+n bits, and the high m bits of the address are the same as the low m bits of the address of the first node, the allocated address is short and flexible, and the bit efficiency of the address is high.
[0180] See also Figure 6 The present application embodiment provides a method 600 for determining a node, and the method 600 can be applied to Figure 1 , Figure 3 or Figure 5 The network architecture 100 shown includes:
[0181] Step 601: A first node receives a first message, where the first message includes a destination address.
[0182] The destination address includes x bits, where x is an integer greater than 0. The address of the first node includes y bits, where y is an integer greater than 0.
[0183] Among them, the highest m bits of the destination address are the same as the lowest m bits of the address of the parent node of the second node, the second node is the node corresponding to the destination address, m is the address length of the parent node, and m is an integer greater than 0 and less than x.
[0184] The destination address can be the second node according to the above Figure 2 The method 200 or Figure 4 The method 400 is shown requesting allocation.
[0185] For example, see Figure 1, the first node B2, the first node B2 receives the first message, the first message includes a destination address of "10100", x = 5, the address of node B2 is "101", y = 3. The node corresponding to the destination address is node C1, the parent node of node C1 is node B2, the address of node B2 is "101", and the length of the address "101" of node B2 is 3, that is, m = 3.
[0186] For another example, see Figure 5 , the first node B1, the first node B1 receives the first message, the destination address included in the first message is "11010", x=5, the address of node B1 is "110", y=3. The node corresponding to the destination address is node C1, the parent node of node C1 is node B1, the address of node B1 is "110", and the length of the address "110" of node B1 is 3, that is, m=3.
[0187] In some embodiments, the first message includes a field having a length equal to v bytes, the field including a destination address.
[0188] In some embodiments, the field includes v subfields, each of which is one byte long. The first bit of the vth subfield carries an end indication, which is used to indicate that the vth subfield is the last subfield of the field. For each subfield in the 1st to v-1st subfields, the first bit of the subfield carries a belonging indication, which is used to indicate that the subfield belongs to the field. The values of the 2nd to eth bits of the 1st subfield are 0, and the e+1th to 8th bits of the 1st subfield and the 2nd to 8th bits of each subfield in the 2nd to xth subfields are the addresses of the second node, e=7*vm-n+1.
[0189] In some embodiments, a first node receives a first message, identifies the starting position of the first subfield included in the field from the first message, determines the v subfields included in the field based on the starting position and the first bit of each subfield in the v subfields, and reads the destination address from the v subfields.
[0190] Step 602: The first node compares the address of the first node with the destination address. If the two are the same, step 603 is executed; if the two are different, step 604 is executed.
[0191] If the address of the first node is the same as the destination address, the first node and the second node are the same node, the first message is a message sent from other nodes to the first node, and the operation of the following step 603 is performed.
[0192] If the address of the first node is different from the destination address, the first node and the second node are different nodes, and the second node may be a child node of the first node or may not be a child node of the first node. The following operation of step 604 is performed.
[0193] Step 603: The first node processes the first message, and the process ends.
[0194] The address at the first node is the same as the destination address, indicating x=y.
[0195] Step 604: The first node determines the next hop node of the first message based on the address of the first node and the destination address.
[0196] In some embodiments, see Figure 7 In step 604, the first node determines the next hop node of the first message according to the following operations 61-65, where the operations 61-65 are respectively:
[0197] 61: The first node compares x and y. If x is less than y, perform operation 62. If x is greater than or equal to y, perform operation 63.
[0198] If x is smaller than y, it means that the length of the destination address is smaller than the address length of the first node, and the second node corresponding to the destination address is not a child node of the first node.
[0199] If x is greater than or equal to y, it means that the length of the destination address is greater than or equal to the address length of the first node, and the second node corresponding to the destination address may be a child node of the first node, or may not be a child node of the first node.
[0200] For example, see Figure 1 Assume that the first node is node B2, the first address is the address “101” of node B2, y=3, the destination address included in the first message is “10100”, and x=5. Node B2 compares and finds that x is greater than y, and performs operation 63.
[0201] For example, see Figure 5 Assume that the first node is node B1, the first address is the address “110” of node B1, y=3, the destination address included in the first message is “11010”, x=5. Node B1 compares and finds that x is greater than y, and performs operation 63.
[0202] 62: The first node determines that the next hop node of the first message is the parent node of the first node, and the process ends.
[0203] When the length x of the destination address is less than the address length y of the first node, it means that the second node corresponding to the destination address is not a child node of the first node, so the first node sends the first message to the parent node of the first node, and the parent node of the first node processes the first message. For example, when the second node corresponding to the destination address is the parent node of the first node, the parent node of the first node processes the first message; when the second node corresponding to the destination address is not the parent node of the first node, the parent node of the first node forwards the first message. Therefore, the first node determines that the next hop node of the first message is the parent node of the first node.
[0204] 63: The first node determines whether the address of the first node is the same as the first address, where the first address is the highest y bits of the destination address. If the two are different, perform operation 64; if the two are the same, perform operation 65.
[0205] When the address of the first node is different from the first address, it means that the second node corresponding to the destination address is not a child node of the first node. When the address of the first node is the same as the first address, it means that the second node corresponding to the destination address is a child node of the first node.
[0206] For example, see Figure 1 , assuming that the first node is node B2, the address of node B2 is "101", y=3, the destination address included in the first message is "10100", and the highest 3 bits of the destination address "10100" are "101", that is, the first address is "101". Node B2 compares the address "101" of node B2 with the first address "101", and finds that the two are the same, so it is concluded that the node C1 corresponding to the destination address "10100" is the child node of node B2.
[0207] For another example, see Figure 5 , assuming that the first node is node B1, the first address is the address "110" of node B1, y=3, the destination address included in the first message is "11010", and the highest 3 bits of the destination address "11010" are "110", that is, the first address is "110". Node B1 compares the address "110" of node B1 with the first address "110", and finds that the two are the same, so it is concluded that the node C1 corresponding to the destination address "11010" is the child node of node B1.
[0208] 64: The first node determines that the next hop node of the first message is the parent node of the first node, and the process ends.
[0209] When the address of the first node is different from the first address, it means that the high y bits of the address of the first node and the destination address are different, the second node is not a child node of the first node, and the first node needs to send the first message to the parent node of the first node, so the first node determines that the next hop node of the first message is the parent node of the first node.
[0210] 65: The first node determines a next hop node of the first message based on a second address, where the second address is a portion of the destination address excluding the first address.
[0211] In some embodiments, the destination address is the second node through the above Figure 2 The method 200 shown in FIG. 2 requests an address to be allocated. Then, in operation 65, when the number of bits included in the second address is less than or equal to p, or the first p bits of the second address are the specified address, the second node corresponding to the destination address is a child node of the first node, and the first node determines that the next hop node of the first message is the child node corresponding to the destination address, and p is a specified integer greater than 0.
[0212] For example, see Figure 1 , assuming that the first node is node B2, p=2, the address of the first node B2 is "101", and the destination address included in the first message is "10100", so the first address is "101", and the second address is the part of the destination address "10100" except "101", that is, the second address is "00". Among them, the number of bits included in the second address "00" is equal to p, so the node C1 corresponding to the destination address "10100" is a child node of the first node B2, and the first node B2 determines that the next hop node of the first message is the child node C1 corresponding to the destination address "10100".
[0213] In some embodiments, the destination address is the second node through the above Figure 2 The method 200 is shown as requesting an assigned address. Then, in operation 65, when the number of bits included in the second address is greater than p and the first p bits of the second address are not the designated address, the first node determines that the next hop node of the first message is a node corresponding to the third address, and the third address includes the first address and the first p bits of the second address.
[0214] When the number of bits included in the second address is greater than p and the first p bits of the second address are not the designated address, the second node corresponding to the destination address accesses a child node of the first node, the second node is a child node under the child node, and the third address is the address of the child node. Since the second node is a child node under the child node, the first node needs the child node corresponding to the third address to forward the first message. Therefore, the first node determines that the next hop node of the first message is the node corresponding to the third address.
[0215] For another example, see Figure 1, assuming that the first node is node A, p=2, the address of the first node A is "1", and the destination address included in the first message is "10100", so the first address is "1", and the second address is the part of the destination address "10100" except "1", that is, the second address is "0100". Among them, the number of bits included in the second address "0100" is greater than p, so the node C1 corresponding to the destination address "10100" is a child node (node B2) of the access node A. The third address includes the first address "1" and the first p bits "01" of the second address "0100", that is, the third address is "101". The first node A determines that the next hop node of the first message is the son node B2 corresponding to the third address "101".
[0216] In some embodiments, the destination address is the second node through the above Figure 4 The method 400 is shown as requesting an allocated address. Then, in operation 65, when the value of each bit included in the second address is 1, or the value of the lowest bit of the second address is 0 and the value of each bit of the second address other than the lowest bit is 1, the node corresponding to the destination address is the son node of the first node, and the first node determines that the next hop node of the first message is the son node corresponding to the destination address.
[0217] For example, see Figure 5 , assuming that the first node is node B1, the address of the first node B1 is "110", the destination address included in the first message is "11010", the first address is "110", and the second address is the part of the destination address "11010" except "110", that is, the second address is "10". Among them, the value of the lowest bit of the second address is 0 and the value of each bit of the second address except the lowest bit is 1, the node C1 corresponding to the destination address "11010" is the child node of the first node B1, and the first node B1 determines that the next hop node of the first message is the child node C1 corresponding to the destination address "11010".
[0218] In some embodiments, the destination address is the second node through the above Figure 4 The method 400 shown in FIG. 4 is a method for requesting an address to be allocated. Then, in operation 65, there is a bit with a value of 0 in the bits other than the lowest bit of the second address, and the first node obtains a fourth address, the fourth address is the first z bits of the second address, z is an integer greater than 0, the lowest bit of the fourth address has a value of 0, and the first z-1 bits of the fourth address have values of 1. The first node determines that the next hop node of the first message is the node corresponding to the third address, and the third address includes the first address and the fourth address.
[0219] The second node corresponding to the destination address is connected to a son node of the first node. The second node is a child node under the son node. The third address is the address of the son node. Since the second node is a child node under the son node, the first node needs the son node corresponding to the third address to forward the first message.
[0220] For example, see Figure 5 , assuming that the first node is node A, the address of the first node A is "1", the destination address included in the first message is "11010", the first address is "1", and the second address is the part of the destination address "11010" except the first address "1", that is, the second address is "1010". Among them, the value of the second bit of the second address is 0, that is, there are bits with a value of 0 in the other bits of the second address except the lowest bit. The first node A obtains the fourth address, the fourth address is the first 2 bits of the second address "1010", the fourth address is "10", the value of the lowest bit of the fourth address "10" is 0, and the value of the first bit of the fourth address is 1. The third address includes the first address "1" and the fourth address "10", that is, the third address is "110". The first node A determines that the next hop node of the first message is the node corresponding to the third address "110", that is, node B1.
[0221] Step 605: The first node sends a first message to the determined next hop node.
[0222] The next hop node receives the first message, takes the next hop node as the first node, and executes the operations of steps 601 to 605 above.
[0223] In an embodiment of the present application, a first node receives a first message, the first message includes a destination address, the destination address is composed of x bits, and x is an integer greater than 0. The first node determines the next hop node of the first message based on the address of the first node and the destination address, the address of the first node is composed of y bits, and y is an integer greater than 0. Since the first node determines the next hop node of the first message based on the address of the first node and the destination address, the format of the destination address supported in this way is: the high m bits of the destination address are the address of the parent node of the second node corresponding to the destination address, and m is an integer greater than 0 and less than x. The destination address in this format is allocated by the node to which the second node requests it to access, so that the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a server for dedicated address allocation separately, which reduces the cost of address allocation. In addition, the distance between the second node and the node to which it accesses is often close, which can reduce the network resources consumed when allocating addresses.
[0224] See also Figure 8, the present application embodiment provides a device 800 for allocating addresses, and the device 800 is deployed on the non-leaf node provided in the above embodiment. Figure 1 , Figure 3 or Figure 5 On a non-leaf node in the network architecture 100 shown, or deployed on Figure 2 On the first node in the method 200 shown, or deployed on Figure 4 On the first node in the method 400. The device 800 includes:
[0225] The processing unit 801 is configured to obtain an address of a second node according to an address of the device 800, wherein the address of the device 800 consists of m bits, and the address of the second node consists of m+n bits, the high m bits of the address of the second node are the same as the low m bits of the address of the device 800, and m and n are both integers greater than 0;
[0226] The sending unit 802 is configured to send the address of the second node to the second node.
[0227] Optionally, the detailed process of the processing unit 801 obtaining the address of the second node is as follows: Figure 2 Steps 202-203 of method 200 or Figure 4 The relevant contents of steps 402 - 403 of the method 400 are not described in detail here.
[0228] Optionally, if the lower n bits of the address of the second node meet the condition for allowing the node to allocate an address, the second node may allocate an address;
[0229] If the lower n bits of the address of the second node meet the condition for prohibiting the node from allocating addresses, the second node cannot allocate addresses.
[0230] Optionally, the condition for allowing the node to allocate an address includes the first condition and / or the second condition.
[0231] If the first p bits of the lower n bits of the address of the second node meet the first condition, the second node can be assigned an address, where p is an integer greater than 0; alternatively, if the first n-1 bits and the last bit of the lower n bits of the address of the second node meet the second condition, the second node can be assigned an address.
[0232] Optionally, the first condition is n=p and p is a specified integer, and the second condition is that the values of the first n-1 bits are all 1 and the value of the last bit is 0.
[0233] Optionally, the conditions for prohibiting a node from allocating an address include a third condition, a fourth condition and / or a fifth condition. If the first p bits of the lower n bits of the address of the second node meet the third condition, the second node cannot be allocated an address; or, if the length of the lower n bits of the address of the second node meets the fourth condition, the second node cannot be allocated an address; or, if the first n-1 bits and the last bit of the lower n bits of the address of the second node meet the fifth condition, the second node cannot be allocated an address.
[0234] Optionally, the third condition is that n is greater than p, p is a specified integer and the first p bits are a specified address, the fourth condition is that the length of the lower n bits of the address of the second node is less than the specified integer, and the fifth condition is that the values of the first n-1 bits are all 1 and the value of the last bit is 1.
[0235] Optionally, the sending unit 802 is used to send a first message to the second node, where the first message includes a field with a length equal to x bytes, where the field is used to carry the address of the second node, and x is an integer greater than 0.
[0236] Optionally, the processing unit 801 is also used to select a free address from the first address pool as the lower n bits of the address of the second node. The device 800 includes a first address pool, and the number of bits included in each address in the first address pool is equal to p, where p is a specified integer greater than 0, and n=p.
[0237] Optionally, the processing unit 801 selects a free address from the first address pool as the lower n bits of the address of the second node, see Figure 2 Step 202 of method 200 or Figure 4 The relevant contents of step 402 of the method 400 are not described in detail here.
[0238] Optionally, the processing unit 801 is configured to select a free address from the first address pool as the lower n bits of the address of the second node when the type of the second node is a non-leaf node.
[0239] Optionally, the processing unit 801 selects a free address from the first address pool as the lower n bits of the address of the second node, see Figure 2 Step 202 of method 200 or Figure 4 The relevant contents of step 402 of the method 400 are not described in detail here.
[0240] Optionally, the processing unit 801 is further configured to:
[0241] In the case that the first address pool does not include a free address, a free address is selected from the second address pool as the lower n bits of the address of the second node, the device 800 includes a second address pool, the second address pool includes a first type address and / or a second type address, the first type address includes a number of bits less than p, the second type address includes a number of bits greater than p, and the first p bits of the second type address are a designated address in the first address pool.
[0242] Optionally, the processing unit 801 selects a free address from the second address pool as the lower n bits of the address of the second node. Figure 2 Step 202 of method 200 or Figure 4 The relevant contents of step 402 of the method 400 are not described in detail here.
[0243] Optionally, the processing unit 801 is further configured to:
[0244] When the type of the second node is a leaf node, an idle address is selected from the second address pool as the lower n bits of the address of the second node. The second address pool includes first-type addresses and / or second-type addresses. The number of bits included in the first-type addresses is less than p, and the number of bits included in the second-type addresses is greater than p. The first p bits of the second-type addresses are designated addresses, and p is a designated integer greater than 0.
[0245] Optionally, the processing unit 801 selects a free address from the second address pool as the lower n bits of the address of the second node. Figure 2 Step 202 of method 200 or Figure 4 The relevant contents of step 402 of the method 400 are not described in detail here.
[0246] Optionally, the device 800 is a parent node of the second node.
[0247] Optionally, the processing unit 801 is further configured to request allocation of a first address, where the first address is an address of the device.
[0248] Optionally, the processing unit 801 is further configured to update the high m bits of the address of each node in the node set to the first address, and the node set includes the child nodes of the device 800 .
[0249] Optionally, the processing unit 801 updates the high m bits of the address of each node in the node set to the first address. Figure 2 Step 204 of method 200 or Figure 4 The relevant contents of step 404 of the method 400 are not described in detail here.
[0250] In an embodiment of the present application, the processing unit obtains the address of the second node according to the address of the device, the address of the device is composed of m bits, the address of the second node is composed of m+n bits, the high m bits of the address of the second node are the same as the low m bits of the address of the device, and m and n are both integers greater than 0. Among them, since the address of the device is composed of m bits, the address of the second node is composed of m+n bits, and the high m bits of the address of the second node are the same as the low m bits of the address of the device, the processing unit uses the address of the device as the high bit when allocating the address, and adds n bits of low bit on this basis to obtain the address of the second node. In this way, the second node can be a child node of the device, and the processing unit allocates addresses to the child nodes of the device, so the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a server for dedicated address allocation separately, which reduces the cost of address allocation. In addition, the distance between the child nodes of the device and the device is often close, which can reduce the network resources consumed when allocating addresses.
[0251] See also Fig. 9 , the present application embodiment provides a device 900 for determining a node, and the device 900 is deployed on the non-leaf node provided in the above embodiment. Figure 1 , Figure 3 or Figure 5 On a non-leaf node in the network architecture 100 shown, or deployed on Figure 6 On the first node in the method 600. The device 900 includes:
[0252] The receiving unit 901 is configured to receive a first message, where the first message includes a destination address, where the destination address consists of x bits, where x is an integer greater than 0;
[0253] The processing unit 902 is used to determine the next hop node of the first message based on the address of the device 900 and the destination address, where the address of the device 900 consists of y bits, and y is an integer greater than 0.
[0254] Optionally, the detailed process of the processing unit 901 determining the next hop node of the first message is as follows: Figure 6 The contents related to steps 602 - 604 of the method 600 are not described in detail here.
[0255] Optionally, the processing unit 902 is used to determine that the next hop node of the first message is the parent node of the device 900 when x is less than y.
[0256] Optionally, the processing unit 902 is used to determine the next hop node of the first message based on the address of the device 900 and the first address when x is greater than or equal to y, and the first address is the high y bits of the destination address.
[0257] Optionally, the processing unit 901 determines the next hop node of the first message based on the address of the device 900 and the first address. Figure 6 The relevant contents of step 604 of the method 600 are not described in detail here.
[0258] Optionally, the processing unit 902 is configured to determine that the next hop node of the first message is the parent node of the device 900 when the address of the device 900 is different from the first address.
[0259] Optionally, the processing unit 902 is used to determine the next hop node of the first message based on a second address when the address of the device 900 is the same as the first address and x is greater than y, where the second address is the part of the destination address excluding the first address.
[0260] Optionally, the detailed process of the processing unit 901 determining the next hop node of the first message based on the second address is as follows: Figure 7 Operation 65 of the method 600 will not be described in detail here.
[0261] Optionally, the processing unit 902 is configured to:
[0262] When the number of bits included in the second address is less than or equal to p, or the first p bits of the second address are a specified address, the node corresponding to the destination address is a child node of the device 900, and the next hop node of the first message is determined to be the child node corresponding to the destination address, and p is a specified integer greater than 0;
[0263] When the number of bits included in the second address is greater than p and the first p bits of the second address are not the designated address, the next hop node of the first message is determined to be the node corresponding to the third address, and the third address includes the first address and the first p bits of the second address.
[0264] Optionally, the processing unit 902 is configured to:
[0265] When the value of each bit included in the second address is 1, or when the value of the least significant bit of the second address is 0 and the value of each bit of the second address except the least significant bit is 1, the node corresponding to the destination address is the son node of the device 900, and the next hop node of the first message is determined to be the son node corresponding to the destination address.
[0266] Optionally, the processing unit 902 is configured to:
[0267] There is a bit with a value of 0 in the bits other than the lowest bit of the second address, obtaining a fourth address, the fourth address is the first z bits of the second address, z is an integer greater than 0, the lowest bit of the fourth address has a value of 0, and the first z-1 bits of the fourth address have values of 1;
[0268] It is determined that the next hop node of the first message is a node corresponding to the third address, where the third address includes the first address and the fourth address.
[0269] Optionally, the processing unit 902 is further configured to process the first message when the address of the device 900 is the same as the first address and x=y.
[0270] Optionally, the high m bits of the destination address are the same as the address of the parent node of the second node, the second node is the node corresponding to the destination address, and m is an integer greater than 0 and less than x.
[0271] In an embodiment of the present application, a receiving unit receives a first message, the first message includes a destination address, the destination address is composed of x bits, and x is an integer greater than 0. The processing unit determines the next hop node of the first message based on the address and the destination address of the device, the address of the device is composed of y bits, and y is an integer greater than 0. Since the next hop node of the first message is determined based on the address and the destination address of the device, the format of the destination address supported in this way is: the high m bits of the destination address are the address of the parent node of the second node corresponding to the destination address, and m is an integer greater than 0 and less than x. The destination address in this format is allocated by the node to which the second node requests it to access, so that the address allocation function is dispersed on different non-leaf nodes in the network, and there is no need to set up a server for dedicated address allocation separately, thereby reducing the cost of address allocation. In addition, the distance between the second node and the node to which it accesses is often close, which can reduce the network resources consumed when allocating addresses.
[0272] See also Fig.10 , the present application embodiment provides a schematic diagram of a device 1000 for allocating addresses. The device 1000 is a non-leaf node provided in the above embodiment. For example, Figure 1 , Figure 3 or Figure 5 The non-leaf nodes in the network architecture 100 shown are, or are Figure 2 The first node in the method 200 shown, or Figure 4 The first node in the method 400 is shown. The apparatus 1000 comprises at least one processor 1001 , an internal connection 1002 , a memory 1003 and at least one transceiver 1004 .
[0273] The device 1000 is a hardware structure device that can be used to implement Figure 8The functional modules in the device 800 are as follows. For example, those skilled in the art may think of Figure 8 The processing unit 801 in the device 800 shown can be implemented by the at least one processor 1001 calling the code in the memory 1003. Figure 8 The sending unit 802 in the device 800 shown may be implemented by the transceiver 1004 .
[0274] Optionally, the device 1000 may also be used to implement the function of the first node in any of the above embodiments.
[0275] Optionally, the processor 1001 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0276] The internal connection 1002 may include a path to transmit information between the components. Optionally, the internal connection 1002 is a single board or a bus.
[0277] The transceiver 1004 is used to communicate with other devices or communication networks.
[0278] The memory 1003 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0279] The memory 1003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 1001. The processor 1001 is used to execute the application code stored in the memory 1003, and cooperate with at least one transceiver 1004, so that the device 1000 implements the functions of the method of the present patent.
[0280] In a specific implementation, as an embodiment, the processor 1001 may include one or more CPUs, such as Fig.10 CPU0 and CPU1 in.
[0281] In a specific implementation, as an embodiment, the apparatus 1000 may include multiple processors, for example Fig.10 1001 and 1007 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0282] See also Fig.11 , the present application embodiment provides a schematic diagram of a device 1100 for determining a node. The device 1100 is a non-leaf node provided in the above embodiment. For example, Figure 1 , Figure 3 or Figure 5 The non-leaf nodes in the network architecture 100 shown are, alternatively, Figure 6 The first node in the method 600 is shown. The apparatus 1100 comprises at least one processor 1101 , an internal connection 1102 , a memory 1103 and at least one transceiver 1104 .
[0283] The device 1100 is a hardware structure device that can be used to implement Fig. 9 The functional modules in the device 900 are as follows. For example, those skilled in the art may think of Fig. 9 The processing unit 902 in the device 900 shown can be implemented by the at least one processor 1101 calling the code in the memory 1103. Fig. 9 The receiving unit 901 in the device 900 shown may be implemented by the transceiver 1104 .
[0284] Optionally, the device 1100 may also be used to implement the function of the first node in any of the above embodiments.
[0285] Optionally, the processor 1101 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0286] The internal connection 1102 may include a path to transmit information between the components. Optionally, the internal connection 1102 is a single board or a bus.
[0287] The transceiver 1104 is used to communicate with other devices or communication networks.
[0288] The memory 1103 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0289] The memory 1103 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 1101. The processor 1101 is used to execute the application code stored in the memory 1103, and cooperate with at least one transceiver 1104, so that the device 1100 implements the functions of the method of the present patent.
[0290] In a specific implementation, as an embodiment, the processor 1101 may include one or more CPUs, such as Fig.11 CPU0 and CPU1 in.
[0291] In a specific implementation, as an embodiment, the device 1100 may include multiple processors, such as Fig.111 and 1107. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0292] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0293] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for allocating addresses, characterized in that: The method comprises: The first node obtains the address of the second node according to the address of the first node, the address of the first node consists of m bits, the address of the second node consists of m+n bits, the high m bits of the address of the second node are the same as the m bits included in the address of the first node, and m and n are both integers greater than 0; The first node sends the address of the second node to the second node.
2. The method according to claim 1, characterized in that The second node is a leaf node, and the values of the lower n bits of the address of the second node are all 1; Alternatively, the second node is a non-leaf node, the values of the first n-1 bits of the lower n bits are all 1, and the value of the last bit of the lower n bits is 0.
3. The method according to claim 1 or 2, characterized in that The second node is a non-leaf node, and the second node has an address allocation function; or, The second node is a leaf node, and the second node does not have an address allocation function.
4. The method according to any one of claims 1 to 3, characterized in that The first node sending the address of the second node to the second node includes: The first node sends a first message to the second node, where the first message includes a field with a length equal to x bytes, where the field is used to carry the address of the second node, and x is an integer greater than 0.
5. The method according to any one of claims 1 to 3, characterized in that The first node is a parent node of the second node.
6. The method according to any one of claims 1 to 3, characterized in that The method further comprises: The first node requests allocation of a first address, where the first address is an address of the first node.
7. The method according to claim 6, characterized in that The method further comprises: The first node updates the high m bits of the address of each node in a node set including child nodes of the first node to the first address.
8. A method for allocating addresses, characterized in that: The method is applied to a first node, the first node includes a first address pool and a second address pool, the number of bits included in each address in the first address pool is equal to p, p is a specified integer greater than 0, the second address pool includes first type addresses and / or second type addresses, the number of bits included in the first type addresses is less than p, the number of bits included in the second type addresses is greater than p, and the first p bits of the second type addresses are the specified addresses in the first address pool, including: The address of the first node consists of m bits, the address of the second node consists of m+n bits, the high-order m bits of the address of the second node are the same as the m bits included in the address of the first node, and m and n are both integers greater than 0; The first node sends the address of the second node to the second node.
9. The method according to claim 8, characterized in that The second node is a non-leaf node, and the first node selects an idle non-specified address from the first address pool as the lower n bits of the address of the second node; or, the second node is a leaf node, and the first node selects an idle address from the second address pool as the lower n bits of the address of the second node.
10. The method according to claim 8, characterized in that The second node is a non-leaf node, and the second node has an address allocation function; or, The second node is a leaf node, and the second node does not have an address allocation function.
11. The method according to any one of claims 8 to 10, characterized in that The first node sending the address of the second node to the second node includes: The first node sends a first message to the second node, where the first message includes a field with a length equal to x bytes, where the field is used to carry the address of the second node, and x is an integer greater than 0.
12. The method according to any one of claims 8 to 10, characterized in that The first node is a parent node of the second node.
13. The method according to any one of claims 8 to 10, characterized in that The method further comprises: The first node requests allocation of a first address, where the first address is an address of the first node.
14. The method according to claim 13, characterized in that The method further comprises: The first node updates the high m bits of the address of each node in a node set including child nodes of the first node to the first address.
15. A method for determining a node, characterized in that: The method is applied to a first node included in a network architecture, wherein the address of each node in the network architecture is obtained by using the method according to any one of claims 1 to 7, or the address of each node is obtained by using the method according to any one of claims 8 to 14, comprising: The first node receives a first message, where the first message includes a destination address, where the destination address consists of x bits, where x is an integer greater than 0, and where a node corresponding to the destination address is a node in the network architecture; The first node determines a next hop node of the first message based on the address of the first node and the destination address, where the address of the first node consists of y bits, and y is an integer greater than 0.
16. The method according to claim 15, characterized in that The first node determines, based on the address of the first node and the destination address, a next hop node of the first message, including: When x is less than y, the first node determines that the next hop node of the first message is the parent node of the first node.
17. The method according to claim 15 or 16, characterized in that The first node determines, based on the address of the first node and the destination address, a next hop node of the first message, including: When x is greater than or equal to y, the first node determines a next hop node of the first message based on the address of the first node and a first address, where the first address is high y bits of the destination address.
18. The method according to claim 17, characterized in that The first node determines a next hop node of the first message based on the address of the first node and the first address, including: When the address of the first node is different from the first address, the first node determines that the next hop node of the first message is the parent node of the first node.
19. The method according to claim 17, characterized in that The first node determines a next hop node of the first message based on the address of the first node and the first address, including: When the address of the first node is the same as the first address and x is greater than y, the first node determines the next hop node of the first message based on a second address, where the second address is the portion of the destination address excluding the first address.
20. The method of claim 19, wherein: The first node determines a next hop node of the first message based on the second address, including: When the number of bits included in the second address is less than or equal to p, or when the first p bits of the second address are a specified address, the node corresponding to the destination address is a child node of the first node, and the first node determines that the next hop node of the first message is the child node corresponding to the destination address, and p is a specified integer greater than 0; When the number of bits included in the second address is greater than p and the first p bits of the second address are not the specified address, the first node determines that the next hop node of the first message is the node corresponding to the third address, and the third address includes the first address and the first p bits of the second address.
21. The method of claim 19, wherein: The first node determines a next hop node of the first message based on the second address, including: When the value of each bit included in the second address is 1, or when the value of the least significant bit of the second address is 0 and the value of each bit of the second address except the least significant bit is 1, the node corresponding to the destination address is the son node of the first node, and the first node determines that the next hop node of the first message is the son node corresponding to the destination address.
22. The method according to claim 19 or 21, characterized in that The first node determines a next hop node of the first message based on the second address, including: If there is a bit with a value of 0 in the bits other than the lowest bit of the second address, the first node obtains a fourth address, where the fourth address is the first z bits of the second address, z is an integer greater than 0, the lowest bit of the fourth address has a value of 0, and the first z-1 bits of the fourth address have values of 1; The first node determines that the next hop node of the first message is a node corresponding to a third address, where the third address includes the first address and the fourth address.
23. The method according to any one of claims 18, 19, 20 and 21, characterized in that The method further comprises: When the address of the first node is the same as the first address and x=y, the first node processes the first message.
24. The method according to any one of claims 15, 16, 18, 19, 20 and 21, characterized in that The high m bits of the destination address are the same as the address of the parent node of the second node, the second node is the node corresponding to the destination address, and m is an integer greater than 0 and less than x.
25. A device for allocating addresses, characterized in that: The device comprises: a processing unit, configured to obtain an address of a second node according to an address of the device, wherein the address of the device consists of m bits, the address of the second node consists of m+n bits, the high-order m bits of the address of the second node are the same as the m bits included in the address of the device, and both m and n are integers greater than 0; A sending unit, configured to send the address of the second node to the second node.
26. The device according to claim 25, characterized in that The second node is a leaf node, and the values of the lower n bits of the address of the second node are all 1; alternatively, the second node is a non-leaf node, the values of the first n-1 bits of the lower n bits are all 1, and the value of the last bit of the lower n bits is 0.
27. The device according to claim 25 or 26, characterized in that The second node is a non-leaf node, and the second node has an address allocation function; or, The second node is a leaf node, and the second node does not have an address allocation function.
28. The device according to any one of claims 25 to 27, characterized in that The sending unit is used to send a first message to the second node, where the first message includes a field with a length equal to x bytes, where the field is used to carry the address of the second node, and x is an integer greater than 0.
29. The device according to any one of claims 25 to 27, characterized in that The device is a parent node of the second node.
30. The device according to any one of claims 25 to 27, characterized in that The processing unit is further configured to request allocation of a first address, where the first address is the address of the device.
31. The device according to claim 30, characterized in that The processing unit is further configured to update the high m bits of the address of each node in the node set to the first address, and the node set includes the child nodes of the device.
32. A device for allocating addresses, characterized in that: The device includes a first address pool and a second address pool, the number of bits included in each address in the first address pool is equal to p, and p is a specified integer greater than 0, the second address pool includes first type addresses and / or second type addresses, the number of bits included in the first type addresses is less than p, the number of bits included in the second type addresses is greater than p, and the first p bits of the second type addresses are the specified addresses in the first address pool, and the device further includes: A processing unit, configured to select, when the second node is a non-leaf node, an idle non-specified address from the first address pool as the lower n bits of the address of the second node; or, when the second node is a leaf node, select an idle address from the second address pool as the lower n bits of the address of the second node; wherein the address of the device is composed of m bits, the address of the second node is composed of m+n bits, the upper m bits of the address of the second node are the same as the m bits included in the address of the device, and m and n are both integers greater than 0; A sending unit, configured to send the address of the second node to the second node.
33. The device according to claim 32, characterized in that The second node is a non-leaf node, and the second node has an address allocation function; or, The second node is a leaf node, and the second node does not have an address allocation function.
34. The device according to claim 32 or 33, characterized in that The sending unit is used to send a first message to the second node, where the first message includes a field with a length equal to x bytes, where the field is used to carry the address of the second node, and x is an integer greater than 0.
35. The device according to claim 32 or 33, characterized in that The device is a parent node of the second node.
36. The device according to claim 32 or 33, characterized in that The processing unit is further configured to request allocation of a first address, where the first address is the address of the device.
37. The device according to claim 36, characterized in that The processing unit is further configured to update the high m bits of the address of each node in the node set to the first address, and the node set includes the child nodes of the device.
38. A device for determining a node, characterized in that: The device is a node in a network architecture, and the address of each node in the network architecture is obtained by using the device according to any one of claims 25 to 31, or the address of each node is obtained by using the device according to any one of claims 32 to 37, including: A receiving unit, configured to receive a first message, wherein the first message includes a destination address, the destination address consists of x bits, x is an integer greater than 0, and a node corresponding to the destination address is a node in the network architecture; A processing unit is used to determine a next hop node of the first message based on the address of the device and the destination address, the address of the device consists of y bits, and y is an integer greater than 0.
39. The device according to claim 38, characterized in that The processing unit is used to determine that the next hop node of the first message is the parent node of the device when x is less than y.
40. The device according to claim 38 or 39, characterized in that The processing unit is used to determine the next hop node of the first message based on the address of the device and a first address when x is greater than or equal to y, where the first address is the high y bits of the destination address.
41. The device according to claim 40, characterized in that The processing unit is configured to determine that the next hop node of the first message is the parent node of the device when the address of the device is different from the first address.
42. The device according to claim 40, characterized in that The processing unit is used to determine the next hop node of the first message based on a second address when the address of the device is the same as the first address and x is greater than y, where the second address is the part of the destination address excluding the first address.
43. The device according to claim 42, characterized in that The processing unit is used for: When the number of bits included in the second address is less than or equal to p, or when the first p bits of the second address are a specified address, the node corresponding to the destination address is a child node of the device, and the next hop node of the first message is determined to be the child node corresponding to the destination address, and p is a specified integer greater than 0; When the number of bits included in the second address is greater than p and the first p bits of the second address are not the specified address, the next hop node of the first message is determined to be the node corresponding to the third address, and the third address includes the first address and the first p bits of the second address.
44. The device according to claim 42, characterized in that The processing unit is used for: When the value of each bit included in the second address is 1, or when the value of the least significant bit of the second address is 0 and the value of each bit of the second address except the least significant bit is 1, the node corresponding to the destination address is the son node of the device, and the next hop node of the first message is determined to be the son node corresponding to the destination address.
45. The device according to claim 42 or 44, characterized in that The processing unit is used for: If there is a bit with a value of 0 in the bits other than the lowest bit of the second address, a fourth address is obtained, where the fourth address is the first z bits of the second address, z is an integer greater than 0, the lowest bit of the fourth address has a value of 0, and the first z-1 bits of the fourth address have values of 1; Determine that a next hop node of the first message is a node corresponding to a third address, where the third address includes the first address and the fourth address.
46. The device according to any one of claims 41, 42, 43 and 44, characterized in that The processing unit is further configured to process the first message when the address of the device is the same as the first address and x=y.
47. The device according to any one of claims 38, 39, 41, 42, 43 and 44, characterized in that The high m bits of the destination address are the same as the address of the parent node of the second node, the second node is the node corresponding to the destination address, and m is an integer greater than 0 and less than x.
48. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a computer, the method according to any one of claims 1 to 24 is implemented.
49. A computer program product, characterized in that The computer program product comprises a computer program stored in a computer-readable storage medium, and the computer program is loaded by a processor to implement the method according to any one of claims 1 to 24.