Skip to main content

3.1. LOWPAN_IPHC Encoding Format

This section specifies the format of the LOWPAN_IPHC encoding that describes how an IPv6 header is compressed. The encoding can be 2 octets long for the base encoding or 3 octets long when an additional context encoding is present. The IPv6 header fields that are not fully elided are placed immediately after the LOWPAN_IPHC, either in a compressed form if the field is partially elided or literally.

3.1.1. Base Format

    0                                       1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | 1 | 1 | TF |NH | HLIM |CID|SAC| SAM | M |DAC| DAM |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Figure 2: LOWPAN_IPHC base Encoding

TF: Traffic Class, Flow Label: As specified in [RFC3168], the 8-bit IPv6 Traffic Class field is split into two fields: 2-bit Explicit Congestion Notification (ECN) and 6-bit Differentiated Services Code Point (DSCP).

  • 00: ECN + DSCP + 4-bit Pad + Flow Label (4 bytes)
  • 01: ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided.
  • 10: ECN + DSCP (1 byte), Flow Label is elided.
  • 11: Traffic Class and Flow Label are elided.

NH: Next Header:

  • 0: Full 8 bits for Next Header are carried in-line.
  • 1: The Next Header field is compressed and the next header is encoded using LOWPAN_NHC, which is discussed in Section 4.1.

HLIM: Hop Limit:

  • 00: The Hop Limit field is carried in-line.
  • 01: The Hop Limit field is compressed and the hop limit is 1.
  • 10: The Hop Limit field is compressed and the hop limit is 64.
  • 11: The Hop Limit field is compressed and the hop limit is 255.

CID: Context Identifier Extension:

  • 0: No additional 8-bit Context Identifier Extension is used. If context-based compression is specified in either Source Address Compression (SAC) or Destination Address Compression (DAC), context 0 is used.
  • 1: An additional 8-bit Context Identifier Extension field immediately follows the Destination Address Mode (DAM) field.

SAC: Source Address Compression

  • 0: Source address compression uses stateless compression.
  • 1: Source address compression uses stateful, context-based compression.

SAM: Source Address Mode:

If SAC=0:

  • 00: 128 bits. The full address is carried in-line.
  • 01: 64 bits. The first 64-bits of the address are elided. The value of those bits is the link-local prefix padded with zeros. The remaining 64 bits are carried in-line.
  • 10: 16 bits. The first 112 bits of the address are elided. The value of the first 64 bits is the link-local prefix padded with zeros. The following 64 bits are 0000:00ff:fe00:XXXX, where XXXX are the 16 bits carried in-line.
  • 11: 0 bits. The address is fully elided. The first 64 bits of the address are the link-local prefix padded with zeros. The remaining 64 bits are computed from the encapsulating header (e.g., 802.15.4 or IPv6 source address) as specified in Section 3.2.2.

If SAC=1:

  • 00: The UNSPECIFIED address, ::
  • 01: 64 bits. The address is derived using context information and the 64 bits carried in-line. Bits covered by context information are always used. Any IID bits not covered by context information are taken directly from the corresponding bits carried in-line. Any remaining bits are zero.
  • 10: 16 bits. The address is derived using context information and the 16 bits carried in-line. Bits covered by context information are always used. Any IID bits not covered by context information are taken directly from their corresponding bits in the 16-bit to IID mapping given by 0000:00ff:fe00:XXXX, where XXXX are the 16 bits carried in-line. Any remaining bits are zero.
  • 11: 0 bits. The address is fully elided and is derived using context information and the encapsulating header (e.g., 802.15.4 or IPv6 source address). Bits covered by context information are always used. Any IID bits not covered by context information are computed from the encapsulating header as specified in Section 3.2.2. Any remaining bits are zero.

M: Multicast Compression

  • 0: Destination address is not a multicast address.
  • 1: Destination address is a multicast address.

DAC: Destination Address Compression

  • 0: Destination address compression uses stateless compression.
  • 1: Destination address compression uses stateful, context-based compression.

DAM: Destination Address Mode:

If M=0 and DAC=0 This case matches SAC=0 but for the destination address:

  • 00: 128 bits. The full address is carried in-line.
  • 01: 64 bits. The first 64-bits of the address are elided. The value of those bits is the link-local prefix padded with zeros. The remaining 64 bits are carried in-line.
  • 10: 16 bits. The first 112 bits of the address are elided. The value of the first 64 bits is the link-local prefix padded with zeros. The following 64 bits are 0000:00ff:fe00:XXXX, where XXXX are the 16 bits carried in-line.
  • 11: 0 bits. The address is fully elided. The first 64 bits of the address are the link-local prefix padded with zeros. The remaining 64 bits are computed from the encapsulating header (e.g., 802.15.4 or IPv6 destination address) as specified in Section 3.2.2.

If M=0 and DAC=1:

  • 00: Reserved.
  • 01: 64 bits. The address is derived using context information and the 64 bits carried in-line. Bits covered by context information are always used. Any IID bits not covered by context information are always used. Any IID bits not covered by context information are taken directly from the corresponding bits carried in-line. Any remaining bits are zero.
  • 10: 16 bits. The address is derived using context information and the 16 bits carried in-line. Bits covered by context information are always used. Any IID bits not covered by context information are taken directly from their corresponding bits in the 16-bit to IID mapping given by 0000:00ff:fe00:XXXX, where XXXX are the 16 bits carried in-line. Any remaining bits are zero.
  • 11: 0 bits. The address is fully elided and is derived using context information and the encapsulating header (e.g. 802.15.4 or IPv6 destination address). Bits covered by context information are always used. Any IID bits not covered by context information are computed from the encapsulating header as specified in Section 3.2.2. Any remaining bits are zero.

If M=1 and DAC=0:

  • 00: 128 bits. The full address is carried in-line.
  • 01: 48 bits. The address takes the form ffXX::00XX:XXXX:XXXX.
  • 10: 32 bits. The address takes the form ffXX::00XX:XXXX.
  • 11: 8 bits. The address takes the form ff02::00XX.

If M=1 and DAC=1:

  • 00: 48 bits. This format is designed to match Unicast-Prefix-based IPv6 Multicast Addresses as defined in [RFC3306] and [RFC3956]. The multicast address takes the form ffXX:XXLL:PPPP:PPPP:PPPP:PPPP:XXXX:XXXX. where the X are the nibbles that are carried in-line, in the order in which they appear in this format. P denotes nibbles used to encode the prefix itself. L denotes nibbles used to encode the prefix length. The prefix information P and L is taken from the specified context.
  • 01: reserved
  • 10: reserved
  • 11: reserved

3.1.2. Context Identifier Extension

This specification expects that a conceptual context is shared between the node that compresses a packet and the node(s) that needs to expand it. How the contexts are shared and maintained is out of scope. What information is contained within a context information is out of scope. Actions in response to unknown and/or invalid contexts are out of scope. The specification enables a node to use up to 16 contexts. The context used to encode the source address does not have to be the same as the context used to encode the destination address.

If the CID field is set to '1' in the LOWPAN_IPHC encoding, then an additional octet extends the LOWPAN_IPHC encoding following the DAM bits but before the IPv6 header fields that are carried in-line. The additional octet identifies the pair of contexts to be used when the IPv6 source and/or destination address is compressed. The context identifier is 4 bits for each address, supporting up to 16 contexts. Context 0 is the default context. The encoding is shown in Figure 3.

    0   1   2   3   4   5   6   7
+---+---+---+---+---+---+---+---+
| SCI | DCI |
+---+---+---+---+---+---+---+---+

Figure 3: LOWPAN_IPHC Encoding

SCI: Source Context Identifier. Identifies the prefix that is used when the IPv6 source address is statefully compressed.

DCI: Destination Context Identifier. Identifies the prefix that is used when the IPv6 destination address is statefully compressed.