# Evaluation of 6 LoWPAN Generic Header Compression in the Context of a RPL Network
## 1 Introduction  
The Internet of Things (IoT) allows ubiquitous devices to interconnect and communicate seamlessly. The networks formed by these devices, Low-power Wireless Personal Area Networks (LoWPANs), have unique characteristics. These networks should operate with minimal power consumption to ensure a long battery life for the connected devices. They are designed for short-to-medium-range communication and have a limited bandwidth compared to other wireless technologies. Moreover, they are susceptible to interference. LoWPAN devices have a limited processing power and memory, which can be a constraint when implementing more complex IoT applications. Enabling Internet Protocol version 6 (IPv6) in these resource-constrained networks provides access to IPv6's advantages. Some of these are a simplified header structure, a significantly larger address space and seamless connectivity. Often, the IEEE 802.15.4 standard [1]. is selected as the Medium Access Control (MAC) and physical layer in LoWPANs, for which the maximum frame size is 127 bytes. After adding the link-layer security and frame overhead, only 81 bytes are available for data coming from upper layers. As the standard IPv6 header is already 40 bytes, not much transport and application data can be carried in one frame. Considering all this, the header compression of IPv6 packets is very important. The 6 LoWPAN Internet Engineering Task Force (IETF) working group was formed in 2004 to define a compression format for IPv6 to be used in LoWPANs. In 2007, the working group defined IPv6 over Low-power Wireless Personal Area Networks (6 LoWPANs) in RFC 4944 [2], amended by RFC 6282 [3] in 2011. These proposed standards define compression mechanisms for IPv6 headers, extension headers and User Datagram Protocol (UDP) headers as well as a fragmentation mechanism for IPv6 packets. Compression formats for other protocols, such as the Transmission Control Protocol (TCP) or Internet Control Message Protocol (ICMP), are not defined in these RFCs. In this article, we focus on Generic Header Compression (6 LoWPAN-GHC), defined in RFC 7400 [4], which is an extension of Next Header Compression (6 LoWPAN-NHC), defined in RFC 6282. The goal of 6 LoWPAN-GHC is to define a compression format that any protocol can use and as such avoid the need for specific formats for every header. 6 LoWPAN-GHC is based on LZ77 compression [5], making use of a dictionary and so-called bytecodes, where bytecodes are byte-size decompression instructions. Our work contributes to this domain by implementing 6 LoWPAN-GHC in the Rust programming language and by evaluating the implementation for wireless sensor networks that use the IPv6 Routing Protocol for Low-Power and Lossy Networks (RPL) as the routing protocol. This evaluation, through a simulation study and experiments on a real testbed, will highlight when it is advantageous to use 6 LoWPAN-GHC by considering performance parameters, such as the compression ratio, energy consumption and delay. Because of their structure, RPL control packets have a good chance of being compressed with the 6 LoWPAN-GHC mechanism. Indeed, depending on the type, they contain one or more IPv6 addresses and consecutive bytes of zeros. The IPv6 addresses have a high probability of being matched with the dictionary, and consecutive bytes of zeros will be replaced by a single decompression instruction. To summarise, the contributions of our work are the following:  
* An implementation of 6 LoWPAN-GHC in the Rust programming language on top of the smoltcp [6] library;
* An evaluation of the implementation by considering the following performance parameters: the compression ratio, energy consumption and delay;
* Insights into the conditions under which 6 LoWPAN-GHC could be efficient. This work is structured as follows: After a related work section, in which different compression techniques are discussed, Section 3 gives an introduction to the 6 LoWPAN and RPL landscapes. Section 4 explains how 6 LoWPAN-GHC functions.