The main functionality of 6LoWPAN is in its LoWPAN adaptation layer, which allows for the compression of IPv6 and following headers such as UDP along with fragmentation and mesh addressing features. 6LoWPAN headers are defined in [RFC4944] which has been later improved and extended by [ID-6lowpan-hc]. 6LoWPAN compression is stateless, and thus very simple and reliable. It relies on shared information known by all nodes from their participation in that LoWPAN, and the hierarchical IPv6 address space which allows IPv6 addresses to be elided completely most of the time.
The LoWPAN header consists of a dispatch value identifying the type of header, followed by an IPv6 header compression byte indicating which fields are compressed, and then any in-line IPv6 fields. If, for example, UDP or IPv6 extension headers follow IPv6, then these headers may also be compressed using what is called next-header compression [ID-6lowpan-hc]. An example of 6LoWPAN compression is given in Figure 1.10. In the upper packet a one-byte LoWPAN dispatch value is included to indicate full IPv6 over IEEE 802.15.4.
Figure 1.10 6LoWPAN header compression example (L = LoWPAN header).
Figure 1.11 gives an example of 6LoWPAN/UDP in its simplest form (equivalent to the lower packet in Figure 1.10), with a dispatch value and IPv6 header compression (LOWPAN_IPHC) as per [ID-6lowpan-hc] (2 bytes), all IPv6 fields compressed, then followed by a UDP next-header compression byte (LOWPAN_NHC) with compressed source and destination port fields and the UDP checksum (4 bytes). Therefore in the likely best case the 6LoWPAN/UDP header is just 6 bytes in length.
Figure 1.11 6LoWPAN/UDP compressed headers (6 bytes).
By comparison a standard IPv6/UDP header is 48 bytes in length as shown in Figure 1.12. Considering that in the worst case IEEE 802.15.4 has only 72 bytes of payload available after link-layer headers, compression is important. The 6LoWPAN format and features are described in detail in Chapter 2. Note: these figures showing packet formats are in box notation, see Section A.1 for an explanation.
Figure 1.12 Standard IPv6/UDP headers (48 bytes).