## 2 Background and Literature Review
### IPv6 Routing Protocol for Low Power and Lossy Networks (RPL)
#### 2.1.1 RPL Overview  
IPv6 routing protocol for low power and lossy networks (RPL) is a routing protocol used in IoT networks based on IPv6 [6]. It is designed for IoT, as it requires few resources and has self-maintenance. RPL networks create a topology similar to a tree, which is called a directed acyclic graph (DAG). This DAG is built by various nodes. If a root node exists, it is translated to destination-oriented DAG (DODAG), where the default destination is usually the root node (i.e., sink). Devices always try to send data to the root, which can be used as a border router (BR) to communicate with the Internet or with other internal networks. Multiple RPL instances can coexist inside a DAG. This is possible because each RPL instance can have one or more DODAGs. However, all DODAGs in an RPL instance must have the same RPLInstanceID and use the same Objective function (OF). Thus, multiple applications can operate in a network at the same time and separately.  
OF is utilised in RPL protocol to select and optimise routes within an RPL instance. Usually, OF is based on some metrics or constraints (i.e., energy, latency, and throughput). The result of the function is the rank of the node, which is an indication of the node's distance from a DODAG root (hops from the root node). Two OFs are supported by RPL: zero objective function (OF0) and minimum rank with hysteresis objective function (MRHOF). The OF0 is based on hop count to calculate rank, whereas MRHOF uses the expected transmission count (ETX). Rank increases with every hop from the root, thus root has the minimum rank. This metric is also needed in the preferred parent selection process of a node. Nodes with lower rank are preferred. Parents are nodes that forward packets from a child node. Parents are, by definition, closer to the root, which is translated to a lower rank.  
RPL has two different modes: non-storing and storing mode. In non-storing mode, nodes just store the routes to arrive at their parents. Hence, if a node wants to communicate with another node, it needs to propagate this request until the desired node is reached. This mode can produce latency when communicating two specific nodes if they are far enough. However, nodes do not need memory resources to store a lot of information. In storing mode, nodes keep information about the routes of all the nodes in the network. Thus, communication between two nodes is simpler but more memory space is needed.  
A number of ICMPv6 control messages are used in RPL. DODAG information option (DIO) messages are sent by the root. These messages are needed to keep the DODAG and contain information about the OF, the rank of the broadcasting node, and the DODAG ID. If a DIO message is received by a node, the node will determine its rank (based on received rank) and the cost of getting to the node from itself. DODAG information solicitation (DIS) messages are used to solicit a DIO from an RPL node. In other words, it is used as a neighbour discovery. When a new node joins the DODAG, it multicasts a DIS message and waits to hear for a DIO. A destination advertisement object (DAO) message is sent to propagate information upwards. Nodes send this message to the root, so the message is propagated or forwarded by parent nodes until root node is reached. Then, a destination advertisement acknowledgement (DAO-ACK) is sent as an answer from the root node when receiving a DAO.  
In our work, Contiki-NG uses RPL-lite protocol, which is a lighter version of the standard RPL. This version of RPL removes support for the storing mode in favour of the non-storing mode. Usually, RPL-lite shows better performance and has a considerably smaller ROM footprint than ContikiRPL. Regarding the OF, we use the MRHOF, which is the default in Contiki-NG.