6LoWPAN Implementation
[Flexible IP]

Collaboration diagram for 6LoWPAN Implementation:


Data Structures

struct  fip_sixlowpan_attr_t
 Holds the 6lowpan attributes associated with the current packet. More...

Modules

 6LoWPAN-ND

Files

file  fip_sixlowpan.c
 Sixlowpan Interface.
file  fip_sixlowpan.h
 Header for 6lowpan related functions.
file  fip_sixlowpan_hc.c
 IF Access Functions.

Enumerations

enum  fip_sixlowpan_state_t { SL_UNKNOWN = 0 , SL_RXINPROCESS }
 General 6lowpan state. More...

Functions

fip_return_t fip_sixlowpan_llInput (uint8_t *srcAddr, unsigned char srcAddrLen, uint8_t *destAddr, unsigned char destAddrLen, uint8_t *payloadPtr, unsigned char payloadLen)
 Receive an 802.15.4 Frame.
void fip_sixlowpan_process (void)
 Generic Process.
unsigned int fip_sixlowpanhc_compress (uint8_t *srcAddr, unsigned char srcLength, uint8_t *destAddr, unsigned char destLength)
 Compresses the current IPv6 packet according to 6lowpan-hc-13, returning the number of bytes compressed away.
unsigned char fip_sixlowpanhc_uncompress (uint8_t *srcAddr, unsigned char srcLength, uint8_t *destAddr, unsigned char destLength, uint8_t *payload, unsigned char payloadLen, uint16_t totalLen)
 Take a packet compressed with the IPHC format, and uncompresses it into the FIP packet buffer.
unsigned char fip_hostInterface_sixGetPayLoadLength (unsigned char destLen, unsigned char srcLen)
 Based on the destination & source address lengths, get the maximum amount of payload that can be fit into a data frame.
unsigned char fip_hostInterface_sixSendSetup (uint8_t *srcAddr, unsigned char srcLen, uint8_t *destAddr, unsigned char destLen, fip_bool_t isDestBroadcast)
 Setup a new data packet, the data itself is loaded with calls to CopyPayload().
void fip_hostInterface_sixSendCopyPayload (uint8_t *data, unsigned char dataLen)
 Copy data to the payload of the 6lowpan frame to send.
void fip_hostInterface_sixSendFinish (void)
 Current 6lowpan frame is done being copied, should be sent out.
unsigned int fip_nd6_6lowpan_addRAOptions (unsigned int upperLength)
fip_return_t fip_nd6_6lowpan_LBRTableNewEntry (const uint8_t *shortAddr, const uint8_t *eui64, uint16_t lifetime)
void fip_nd6_6lowpan_processNA (const fip_nd6_optionStruct_t *optionStruct)
 Process an incoming Neighbour Advertisement.
static _PACKEND void sixUncompAddr (uint8_t code, uint8_t *IID, uint8_t **inlinedIPHC, uint8_t *LLAddr, uint8_t LLLen)
 Uncompressed an address compressed according to 6lowpan-hc-11.
static unsigned char sixComprAddr (const uint8_t *IID, uint8_t *LLAddr, uint8_t LLLen, uint8_t **inlineLocation)
 Compress an address compressed according to 6lowpan-hc.
static fip_bool_t fip_sixlowpanhc_isNHCompressed (uint8_t nextHeader)
 Internal function which checks if next header is a compressible type.

Variables

uint16_t abroVersionNumber
 Authoritive Border Router.
fip_ip6addr_t abroAddress
 Authoritive Border Router.

Enumeration Type Documentation

General 6lowpan state.

Enumerator:
SL_UNKNOWN  Unknown state, processing hasn't started.
SL_RXINPROCESS  Receive in progress.


Function Documentation

unsigned char fip_hostInterface_sixGetPayLoadLength ( unsigned char  destLen,
unsigned char  srcLen 
)

Based on the destination & source address lengths, get the maximum amount of payload that can be fit into a data frame.

Parameters:
destLen Destination address length in bytes, for 802.15.4 is 2 or 8
srcLen Source address length in bytes, for 802.15.4 is 2 or 8
Returns:

Referenced by fip_sixlowpan_process().

void fip_hostInterface_sixSendCopyPayload ( uint8_t *  data,
unsigned char  dataLen 
)

Copy data to the payload of the 6lowpan frame to send.

Can be called multiple times, but will never copy more data in total than the call to getPayloadLength() reported is available.

Parameters:
data Pointer to data
dataLen Length of data to copy

Referenced by fip_sixlowpan_process().

unsigned char fip_hostInterface_sixSendSetup ( uint8_t *  srcAddr,
unsigned char  srcLen,
uint8_t *  destAddr,
unsigned char  destLen,
fip_bool_t  isDestBroadcast 
)

Setup a new data packet, the data itself is loaded with calls to CopyPayload().

Parameters:
srcAddr Source address
srcLen Source address length
destAddr Destination address
destLen Destination address length
isDestBroadcast Is destination a broadcast frame?
Returns:
non-zero if setup was successful and data can be written with calls to copyPayload.

Referenced by fip_sixlowpan_process().

unsigned int fip_nd6_6lowpan_addRAOptions ( unsigned int  upperLength  ) 

fip_return_t fip_nd6_6lowpan_LBRTableNewEntry ( const uint8_t *  shortAddr,
const uint8_t *  eui64,
uint16_t  lifetime 
)

void fip_nd6_6lowpan_processNA ( const fip_nd6_optionStruct_t optionStruct  ) 

fip_return_t fip_sixlowpan_llInput ( uint8_t *  srcAddr,
unsigned char  srcAddrLen,
uint8_t *  destAddr,
unsigned char  destAddrLen,
uint8_t *  payloadPtr,
unsigned char  payloadLen 
)

void fip_sixlowpan_process ( void   ) 

unsigned int fip_sixlowpanhc_compress ( uint8_t *  srcAddr,
unsigned char  srcLength,
uint8_t *  destAddr,
unsigned char  destLength 
)

Compresses the current IPv6 packet according to 6lowpan-hc-13, returning the number of bytes compressed away.

The results of compression go into the FIP_IPHDRBUF buffer. When you first allocated the buffer on this interface it should have extra room, otherwise you will end up having to resize it in this function. Before calling this, the packet buffer must have the following truths:

  • Link-Layer addresses set up in srcLLAddrLen,srcLLAddrOffset and destLLAddrLen, destLLAddrOffset attributes. A destination length of 'zero' means broadcast.

  • The FIP_IPHDRBUF is the main IP header, other buffers afterwards *may* be compressed.

The result is that some stuff will be compressed and have a different format, but some will not. For example a packet could look like:

  [FIP_IPHDRBUF: IPv6 Headers = 40 bytes ] [FIP_TLBUF: ICMPv6 Headers = 8 bytes] [FIP_TLBUF: ICMPv6 Payload = 64 bytes]
before calling: fip_packet_getSize(FIP_IPHDRBUF) = 40, fip_packet_getSize(FIP_TLBUF) = 72

After compression only the IPv6 headers will be compressed, the ICMPv6 stuff isn't touched. The IPv6 header for example may now be compressed down to 8 bytes. The packet now looks like:

  [FIP_IPHDRBUF: Compressed Header = 8 bytes] [FIP_TLBUF: ICMPv6 Headers = 8 bytes] [FIP_TLBUF: ICMPv6 Payload = 64 bytes]
After fip_packet_getSize(FIP_IPHDRBUF) = 8, fip_packet_getSize(FIP_TLBUF) = 72

Parameters:
srcAddr pointer to source 802.15.4 address
srcLength Length of source 802.15.4 address
destAddr pointer to dest 802.15.4 address
destLength length of dest 802.15.4 address
Returns:
Number of bytes which were compressed away

Todo:
: 6LOW.1: Support context > 0

Todo:
the following statement is no longer true with new buffer handling. However still need to check buffers get checked for length

Todo:
This code only works if the IPv6 header is compressed by a few bytes, as extension headers are NOT always compressed (sometimes longer even) and thus you will be writing the NHC data to the same spot OR AFTER the data which you are compressing. Oops. (This is fairly unlikely though, and impossible when using context-based or 802.15.4 based IPv6 addresses)

References fip_ip6addr_cpy, fip_isSrcUnspecified(), fip_packet_getBufPtr, fip_packet_getBufSize, fip_packet_getFromIP6Hdr_destAddr, fip_packet_getFromIP6Hdr_destPtr, fip_packet_getFromIP6Hdr_isDestMulticast, fip_packet_getFromIP6Hdr_srcPtr, fip_packet_setBufSize, fip_sixlowpanhc_isNHCompressed(), fip_Uint16_getLSB, fip_Uint16_getMSB, fip_ds6_searchStatus_t::itemFound, sixComprAddr(), TRACE, and TRACE_ADDVARH.

Referenced by fip_sixlowpan_process().

Here is the call graph for this function:

static fip_bool_t fip_sixlowpanhc_isNHCompressed ( uint8_t  nextHeader  )  [static]

Internal function which checks if next header is a compressible type.

Parameters:
nextHeader 
Returns:

Referenced by fip_sixlowpanhc_compress().

unsigned char fip_sixlowpanhc_uncompress ( uint8_t *  srcAddr,
unsigned char  srcLength,
uint8_t *  destAddr,
unsigned char  destLength,
uint8_t *  payload,
unsigned char  payloadLen,
uint16_t  totalLen 
)

Take a packet compressed with the IPHC format, and uncompresses it into the FIP packet buffer.

The packet to be uncompressed is pointed to by payload, and the result should will go entirely in the FIP_IPHDRBUF buffer. Space has already been allocated in the buffer, and you should not set any attributes of the packet buffer itself as that will be done by the calling function.

Parameters:
srcAddr Source 802.15.4 Address
srcLength Length of 802.15.4 Address
destAddr Destination 802.15.4 Address
destLength Length of 802.15.4 Address
payload Payload, points to first byte of IPHC
payloadLen Length of payload
totalLen Total length if known, 0 if not known
Returns:
Return the total uncompressed length

Todo:
exception

References fip_ip6addr_cpy, fip_memcpy_ucharLen, fip_packet_setToIP6Hdr_length, fip_padUpTo8Byte, fip_toUint16, and sixUncompAddr().

Referenced by fip_sixlowpan_llInput().

Here is the call graph for this function:

static unsigned char sixComprAddr ( const uint8_t *  IID,
uint8_t *  LLAddr,
uint8_t  LLLen,
uint8_t **  inlineLocation 
) [static]

Compress an address compressed according to 6lowpan-hc.

Parameters:
IID The IID of the IPv6 address
LLAddr Encapsulating Address
LLLen Encapsulating Address Length
inlineLocation Pointer to the inlinedIPHC pointer, which will be incremented by the amount of data we took from inline
Returns:
Code indicating the type of compression performed
Return values:
1 Wrote 8 bytes to in-line
2 Wrote 2 bytes to in-line
3 Wrote 0 bytes to in-line (address totally compressed)

References fip_ipUtils_generateAutoconfIID(), fip_memcpy_ucharLen, and RV_OK.

Referenced by fip_sixlowpanhc_compress().

Here is the call graph for this function:

static _PACKEND void sixUncompAddr ( uint8_t  code,
uint8_t *  IID,
uint8_t **  inlinedIPHC,
uint8_t *  LLAddr,
uint8_t  LLLen 
) [static]

Uncompressed an address compressed according to 6lowpan-hc-11.

Parameters:
code Code: 1 = Get 8 bytes from in-line Code: 2 = Get 2 bytes from in-line Code: 3 = Get 0 bytes from in-line
IID Where we write the IID
inlinedIPHC Pointer to the inlinedIPHC pointer, which will be incremented by the amount of data we took from inline
LLAddr Encapsulating Address
LLLen Encapsulating Address Length

References fip_ipUtils_generateAutoconfIID(), and fip_memcpy_ucharLen.

Referenced by fip_sixlowpanhc_uncompress().

Here is the call graph for this function:


Generated on Wed Dec 8 13:00:40 2010 for FIP by  doxygen 1.5.7.1