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. |
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.
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 |
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.
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().
srcAddr | Source address | |
srcLen | Source address length | |
destAddr | Destination address | |
destLen | Destination address length | |
isDestBroadcast | Is destination a broadcast frame? |
Referenced by fip_sixlowpan_process().
unsigned int fip_nd6_6lowpan_addRAOptions | ( | unsigned int | upperLength | ) |
todo extend buffer
SET LIFETIME CORRECTLY
References abroVersionNumber, fip_ip6addr_t::addr, fip_nd6_abro_t::address, fip_nd6_6co_t::context, fip_nd6_6co_t::contextIDFlags, fip_nd6_6co_t::contextLength, FIP_6CO_CFLAG, fip_ip6addr_cpy, FIP_ND6_OPTION_6CO, FIP_ND6_OPTION_ABRO, fip_packet_getBufPtr, fip_nd6_abro_t::length, fip_nd6_6co_t::length, fip_nd6_abro_t::reserved, fip_nd6_6co_t::reserved, fip_nd6_abro_t::type, fip_nd6_6co_t::type, fip_nd6_abro_t::versionNumber, and fip_nd6_6co_t::vlifetime.
Referenced by fip_nd6_generateRA().
fip_return_t fip_nd6_6lowpan_LBRTableNewEntry | ( | const uint8_t * | shortAddr, | |
const uint8_t * | eui64, | |||
uint16_t | lifetime | |||
) |
References fip_nd6_6lowpan_lbrTable_t::expireTime, fip_memcpy_ucharLen, RV_MEMORY_ERROR, RV_OK, fip_nd6_6lowpan_lbrTable_t::shortAddr, SIXLBR_UNUSED, SIXLBR_USED, and fip_nd6_6lowpan_lbrTable_t::state.
Referenced by fip_nd6_processRA().
void fip_nd6_6lowpan_processNA | ( | const fip_nd6_optionStruct_t * | optionStruct | ) |
Process an incoming Neighbour Advertisement.
optionStruct | Pointer to the preprocessed options |
References ADDR_DUPLICATE, ADDR_OPTIMISTIC, ADDR_PREFERRED, fip_nd6_aro_t::eui64, FIP_ARO_SUCCESS, FIP_ND6_OPTION_ARO, fip_packet_activeDrop(), fip_packet_getBufPtr, fip_packet_getFromIP6Hdr_destPtr, fip_packet_getIfNum, fip_ds6_searchStatus_t::index, fip_ds6_searchStatus_t::itemFound, fip_nd6_optionStruct_t::numOpts, fip_nd6_option_t::offset, fip_nd6_optionStruct_t::options, fip_nd6_aro_t::status, TRACE, TRACE_ADDVAR, and fip_nd6_option_t::type.
Referenced by fip_nd6_processNA().
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.
References fip_memcpy_ucharLen, fip_packet_activeNew(), fip_packet_getAttr, fip_packet_setAttr, fip_packet_setBufSize, fip_packet_setLLDestAddr, fip_packet_setLLSrcAddr, fip_packet_setToIP6Hdr_length, fip_sixlowpanhc_uncompress(), fip_timer_getExpireTime32miliS(), PS_PROCESSIP, PS_RECEIVINGLL, RV_MEMORY_ERROR, RV_OK, RV_UNHANDLED, SL_RXINPROCESS, and SL_UNKNOWN.
void fip_sixlowpan_process | ( | void | ) |
Generic Process.
References fip_hostInterface_getMiliSeconds32(), fip_hostInterface_sixGetPayLoadLength(), fip_hostInterface_sixSendCopyPayload(), fip_hostInterface_sixSendFinish(), fip_hostInterface_sixSendSetup(), fip_packet_activeDrop(), fip_packet_getAttr, fip_packet_getBufPtr, fip_packet_getBufSize, fip_packet_getBufSizes(), fip_packet_setAttr, fip_sixlowpanhc_compress(), fip_timer_isExpired32, PS_LLSENDING, PS_RECEIVINGLL, PS_STARTLLSEND, SL_RXINPROCESS, SL_UNKNOWN, and TRACE.
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:
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]
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]
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 |
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().
static fip_bool_t fip_sixlowpanhc_isNHCompressed | ( | uint8_t | nextHeader | ) | [static] |
Internal function which checks if next header is a compressible type.
nextHeader |
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.
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 |
References fip_ip6addr_cpy, fip_memcpy_ucharLen, fip_packet_setToIP6Hdr_length, fip_padUpTo8Byte, fip_toUint16, and sixUncompAddr().
Referenced by fip_sixlowpan_llInput().
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.
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 |
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().
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.
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().