It describes how RPL protocol selects the routes and optimizes them, which in ContikiRPL is based on hop count and ETX. The child nodes receiving this message calculate their rank accordingly and cost of reaching the parent node and forward this message until all the nodes present in the network join the DAG.
Open the contiki/core/net/ip/tcpip.c File
id means current node id
recvcount[id] = recvcount[id] +1;
if (nexthop != 0) {
forwardcount[id] = forwardcount[id] + 1;
} else {
forwardcount[id] = forwardcount[id];
}
Now open the terminal in contiki desktop and make the right directories to run the cooja simulator tools.
In terminal, go the this directory --> cd “contiki/ tools/ cooja”
Give Command: ant run