| Low-Power Border Router

- Main Page
- Packages
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes

# Lowpan.AddressCompressor.AddressCompressor Class Reference

Compressor/decompressor for IPv6 addresses. More...

List of all members.

## Public Member Functions
def | __init__
| Initializes this object.
def | compress
| Compresses an IPv6 address.
def | decompress
| Decompresses an IPv6 address.
## Public Attributes
| username
| inetContexts
| moteContexts
| log

## Detailed Description

Compressor/decompressor for IPv6 addresses.

## Constructor & Destructor Documentation

def Lowpan.AddressCompressor.AddressCompressor.__init__ | ( |  | self,
|  |  | username
| ) |  |

Initializes this object.

Parameters:

  username | The name of the user this instance works for.

## Member Function Documentation

def Lowpan.AddressCompressor.AddressCompressor.compress | ( |  | self,
|  |  | addressS,
|  |  | prefixS,
|  |  | srcORdest
| ) |  |

Compresses an IPv6 address.

Compressing an IPv6 address consists of compressing it will all available compressors (the non-context-based basis compressor as well as all available context-based compressors), and keeping the compressed address which yields the shorter packet.

If any context-based compressor 'fails', it compresses the address using the non-context-based basis compressor.

Parameters:

  addressS | The 128-bit IPv6 address to be compressed, in string format.
  prefixS | The IPv6 prefix (at most 64 bits) of the mote network.
  srcORdest | A string which indicates whether the address being compressed is the IPv6 src_addr ('src') or IPv6 dest_addrS ('dest'). This changes the set of contexts being used.

Returns:
  m The computed value of the lowpan 'm' field, should this compressor be used.
  xac The computed value of the lowpan 'sac' or 'dac' field, should this compressor be used.
  xam The computed value of the lowpan 'sam' or 'dam' field, should this compressor be used.
  xci The computed value of the lowpan 'sci' or 'dci' field, should this compressor be used. Contains None if this field does not need to appear in the packet.
  x_addr The computed value of the lowpan 'src_addrS' or 'dest_addrS' field, should this compressor be used. Contains None if this field does not need to appear in the packet.
  macDestAddr The destination MAC address if the destination address matches the network's prefix. Otherwise None.

def Lowpan.AddressCompressor.AddressCompressor.decompress | ( |  | self,
|  |  | macAddrS,
|  |  | m,
|  |  | xac,
|  |  | xam,
|  |  | xci,
|  |  | x_addrS,
|  |  | prefixS,
|  |  | srcORdest
| ) |  |

Decompresses an IPv6 address.

Decompressing an address consist of applying every context available, then the default (non-context-based) decompressor, until one succeeds.

Parameters:

  macAddrS | The MAC address of the mote where this message originated. 'None' the address being decompressed in the destination address.
  m | The value of the lowpan 'm' field, as read from the packet. None is x_addr if the source address.
  xac | The value of the lowpan 'sac' or 'dac' field, as read from the packet.
  xam | The value of the lowpan 'sam' or 'dam' field, as read from the packet.
  xci | The value of the lowpan 'sci' or 'dci' field, as read from the packet. None if this field is not in the packet.
  x_addrS | The value of the lowpan 'src_addrS' or 'dest_addrS' field, as read from the packet.
  prefixS | The IPv6 prefix (at most 64 bits) of the mote network.
  srcORdest | A string which indicates whether the address being compressed is the IPv6 src_addr ('src') or IPv6 dest_addrS ('dest'). This changes the set of contexts being used.

Returns:
  addressS The decompressed 128-bit address.

## Member Data Documentation

Lowpan.AddressCompressor.AddressCompressor.username

Lowpan.AddressCompressor.AddressCompressor.inetContexts

Lowpan.AddressCompressor.AddressCompressor.moteContexts

Lowpan.AddressCompressor.AddressCompressor.log