## 4 TB-RPL Mechanism
### Detailed Process of TB-RPL
Finally, with the consistent logic and common working context, there are no concepts of switch or interoperate with different MOPs required, so time and resource overheads for switching or interoperating between MOPs are saved. The hybrid-overhead problem has been overcome. Figure 8: The logic flow of a parent node to process input DAO messages. “nbr” refers to neighbor table. ``` (The symbol* indicates the data type of a pointer like in C programming language) Input:Node *currNode, DAO *pkt Output:DAO *pkt, Table RouteTable FunctionWeakDaoOutput (DAO *inPkt, Node *currNode): if(inPkt *weakFlag == 1)then  tryLst = inPkt * do.trg; // construct correct order of Trt option  insert (0, trgLst, currNode *ipAddr);  outPkt * do.trg = createTrgFrom (trgLst); // there is empty of Parent Address field in Trust option  outPkt * do.trg = createTrg(currNode * parent);  send (outPkt, currNode * parent);  end if  end FunctionNormalDaInput (DAO *inPkt, Node *currNode): if(inPkt * weakFlag == 0)then  nbr = inPkt * sender;  if(addNbr (currNode * nbrLst, nbr) == 1)then  nbr = inPkt * nbr;  target = inPkt * rrg [0];  route = list (target, nextHop);  addRoute (currNode * routeTable, route);  end if  end FunctionWeakDaoInput (DAO *inPkt, Node *currNode): if(inPkt * weakFlag == 1)then  nbr = inPkt * sender; if(addNbr (currNode * nbrLst, nbr) == 1)then  jointNextHop = list (nbr);  trgLst = inPkt * do.trg; // put all targets into joint next-hop in the designated order except the last target for (hop in trgLst - 1)do  addList (jointNextHop, hop);  end  target = getTail (trgLst);  route = struct (target, jointNextHop);  addRoute (currNode * routeTable, route);  end if  end FunctionNormalDaOutput (DAO *inPkt, Node *currNode): if(inPkt * weakFlag == 0)then  outPkt * do.trg = inPkt * do. for optimization. Contiki-NG contains the whole network protocol stack to support communications in LLN, from physical layer, MAC layer, network layer, transport layer, until application layer. A complete RPL protocol in RFC 6550 is implemented as the native routing mechanism working in network layer. Particularly, RFC 6550 only formulates a main body of RPL; there are still some auxiliary functions reserved to be decided, such as neighbor discovery mechanism, objective function, various timers, and so on. Moreover, Contiki-NG contains a companioned simulator named Cooja, which is a convenient tool for performance evaluation of RPL. Cooja simulates hardware device functions and provides the relevant interfaces to upper layers implemented in Contiki-NG operating system. It is worth noting that the specific neighbor discovery mechanism in Contiki-NG implementation is the neighbor discovery for IP version 6, which is standardized in RFC 4861 [37]. Generally, that mechanism is used to obtain other nodes' link-layer addresses and to detect and maintain information about reachable nodes, such as the related information of each path to a neighbor. The detailed mechanism specification is out of the scope of this research. In all evaluations, the default settings of this neighbor discovery mechanism embedded in the Contiki-NG operating system are always kept. In our evaluation, Z1 notes and Sky notes [38; 39] are selected as hardware platforms, which are directly supported and simulated by Cooja. Specifically, the memory spaces of Z1 and Sky are both much limited. The Z1 note's number of routing table entries is 8 by default in Contiki-NG, while that of Sky more is 16. In the MAC layer, CSMA is used, as well as an adaption layer 6 LoWPAN. Based on the previous layers, RPL along with IPv6 operate at the network layer. As the core parts of RPL, the objective function and timers of control message are kept at the default settings which are the minimum rank with hysteresis objective function (MRHOF) [40] and trickle timer [41], respectively. Aiming to evaluate P2P communication efficiently, UDP is selected to act on transport layer.