## 4 TB-RPL Mechanism
### Detailed Process of TB-RPL  
In the previous section, a representation of the overall workflow was provided, which is a big picture of TB-RPL. This section offers the perspective of each node to process TB-RPL in detail. At the beginning, all the nodes select TB-RPL MOP. This MOP decision has been made already in the initialization DIO messages from LBR. After a DODAG is formed, each node starts to unicast its own DAO message to the preferred parent, and the downward routing establishment begins. During the downward routing path establishment, the deeply resource-constrained devices cannot keep storing routing information about their children continuously. When a network is large-scale and contains a mass of nodes, these devices' memory space will finally be used up to store the subtree routing information. In order to avoid the memory failure of weak nodes, a route entries threshold \(\alpha\) is defined as the upper boundary of a node's allowed number of route entries. Every node tries it best to store children's routing information. When a node's number of stored route entries is higher than \(\alpha\), it asks for help from its preferred parent. If the parent node's memory is enough, it will store the weak DAO message from its children. Otherwise, the parent node asks its own parent for help--in the worst case, until it reaches LBR. In this sense, the middle parents perform source routing for some P2P paths located in its subtree. Figure 8 summarizes the logic flow when a parent node receives a DAO message. It is worth noting that neighbor table is the prerequisite of setting up downward routes. In RFC 6550, three sets are defined and have the following relationship [13]. The preferred parent set is the subset of the parent set, which is the subset of the candidate neighbor set. In further detail, the establishment and maintenance of those three sets are performed by a specific neighbor discovery mechanism and objective function. If a node is not recognized as a neighbor, it cannot be included as a route further. The neighbor table is governed by a tailored policy. In addition, there is a point worth explaining, i.e., that the specific mechanism for neighbor discovery is not decided in RFC 6550, which will finally depend on the implementation choice. There are four functions referred to in the logic flow, which are the essential functions of TB-RPL. Algorithm 1 shows the pseudocode about the identified four functions in Figure 8. Generally, currNode is the current node that performs current processing function. pkt refers to the DAO packet waiting to be handled. Specifically, inPkt is the input DAO,  
Figure 7: The data flows in P2P communication based on the previous downward routes in Figure 6, where node G and node F send packets to each other. (**a**) illustrates the data flow from node G to node F, while (**b**) shows the direction from node F to node G.  
while the outPkt is output DAO. Then, trgLst is abbreviation for target list, which is a general list data structure. For the function _WeakDaoOutputu_, its purpose is to produce an output DAO based on the input DAO's set of _Trg(T)_ in a strict order, which is utilized by the parent to produce source routing header. Function _WeakDaoInput_ updates the current node's route entries based on the input DAO by producing and storing a source routing information in weak case. The remained functions, _NormalDaoOutput_ and _NormalDaoInput_, are the normal routines to handle corresponding DAO messages. In summary, TB-RPL provides a unified framework and mechanism to allow every memory limited node to do its best to save downward routing information, so overall memory availability increases. The memory limited problem has been improved. Moreover, in downward routing, the shortest route is generally selected by nodes at any given situation. The long-path problem has been solved.