Low-Power Border Router

Lowpan.Converter.Converter Class Reference

Converts IPv6 and 6LoWPAN packets between strings and header dictionnaries. More...

List of all members.

Public Member Functions

def __init__
 Initializes this object.
def ipv6_string_to_headers
 Converts an IPv6 string into IPv6 headers.
def ipv6_headers_to_string
 Converts IPv6 headers into an IPv6 string.
def lowpan_string_to_headers
 Converts a lowpan string into lowpan headers.
def lowpan_headers_to_string
 Converts lowpan headers into an lowpan string.

Public Attributes

 username
 log

Detailed Description

Converts IPv6 and 6LoWPAN packets between strings and header dictionnaries.


Constructor & Destructor Documentation

def Lowpan.Converter.Converter.__init__ (   self,
  username 
)

Initializes this object.

Parameters:
usernameThe name of the user this instance works for.

Member Function Documentation

def Lowpan.Converter.Converter.ipv6_string_to_headers (   self,
  ipv6_string 
)

Converts an IPv6 string into IPv6 headers.

The resulting headers are a dictionary which can contain the following fields:

  • 'ipv6' the IPv6 header, cut into fields
  • 'udp' (if present) the UDP header, cut into fields
  • 'payload', (if preset) all remaining bytes
  • 'validity', contains string 'valid' or 'invalid'
Precondition:
The string needs to be read beforehand, i.e. from a tun virtual interface.
Call before calling any other function in this module.
Parameters:
ipv6_stringA string of bytes, starting at the first byte of the IPv6 header ending at the last byte of the payload.
Returns:
ipv6_headers A dictionary with the different ipv6_headers and fields in the packet.
def Lowpan.Converter.Converter.ipv6_headers_to_string (   self,
  ipv6_headers 
)

Converts IPv6 headers into an IPv6 string.

Parameters:
ipv6_headersIPv6 headers.
Returns:
The corresponding IPv6 string
def Lowpan.Converter.Converter.lowpan_string_to_headers (   self,
  lowpan_string 
)

Converts a lowpan string into lowpan headers.

The resulting headers are a dictionary which can contain the following fields:

  • 'lowpan' the lowpan header, cut into fields
  • 'payload', (if preset) all remaining bytes
  • 'validity', contains string 'valid' or 'invalid'
Parameters:
lowpan_stringA string of bytes, starting at the first byte of the lowpan header ending at the last byte of the payload.
Returns:
lowpan_headers A dictionary with the different lowpan_headers and fields in the packet.
def Lowpan.Converter.Converter.lowpan_headers_to_string (   self,
  lowpan_headers 
)

Converts lowpan headers into an lowpan string.

Parameters:
lowpan_headersLoWPAN headers.
Returns:
The corresponding lowpan string.

Member Data Documentation