Contiki-NG
Loading...
Searching...
No Matches

Data Structures

struct  sicslowpan_addr_context
 An address context for IPHC address compression each context can have upto 8 bytes. More...
struct  sicslowpan_nh_compressor
 The structure of a next header compressor. More...

Macros

#define LOG_MODULE   "6LoWPAN"
 FOR RFC 6282 COMPLIANCE TODO: -Add compression options to UDP, currently only supports both ports compressed or both ports elided.

Functions

static void digest_paging_dispatch (void)
 Digest 6lorh headers before IPHC.
static void digest_6lorh_hdr (void)
 Digest 6lorh headers before IPHC.

General variables

static uint8_t * packetbuf_ptr
 A pointer to the packetbuf buffer.
static uint8_t packetbuf_hdr_len
 packetbuf_hdr_len is the total length of (the processed) 6lowpan headers (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed fields).
static int packetbuf_payload_len
 The length of the payload in the Packetbuf buffer.
static uint8_t uncomp_hdr_len
 uncomp_hdr_len is the length of the headers before compression (if HC2 is used this includes the UDP header in addition to the IP header).
static int mac_max_payload
 mac_max_payload is the maimum payload space on the MAC frame.
static uint8_t curr_page
 The current page (RFC 4944).
static int last_tx_status
 the result of the last transmitted fragment

Input/output functions common to all compression schemes

static void packet_sent (void *ptr, int status, int transmissions)
 Callback function for the MAC packet sent callback.
static void send_packet (void)
 This function is called by the 6lowpan code to send out a packet.
static uint8_t output (const linkaddr_t *localdest)
 Take an IP packet and format it to be sent on an 802.15.4 network using 6lowpan.
static void input (void)
 Process a received 6lowpan packet.

Address compressibility test functions

#define sicslowpan_is_iid_16_bit_compressable(a)
 check whether we can compress the IID in address 'a' to 16 bits.
#define sicslowpan_is_mcast_addr_decompressable(a)
 check whether the 9-bit group-id of the compressed multicast address is known.
#define sicslowpan_is_mcast_addr_compressable(a)
 check whether the 112-bit group-id of the multicast address is mappable to a 9-bit group-id It is true if the group is the all nodes or all routers group.

Detailed Description

Macro Definition Documentation

◆ LOG_MODULE

#define LOG_MODULE   "6LoWPAN"

FOR RFC 6282 COMPLIANCE TODO: -Add compression options to UDP, currently only supports both ports compressed or both ports elided.

-Verify TC/FL compression works

-Add stateless multicast option

Definition at line 82 of file sicslowpan.c.

◆ sicslowpan_is_iid_16_bit_compressable

#define sicslowpan_is_iid_16_bit_compressable ( a)
Value:
((((a)->u16[4]) == 0) && \
(((a)->u8[10]) == 0)&& \
(((a)->u8[11]) == 0xff)&& \
(((a)->u8[12]) == 0xfe)&& \
(((a)->u8[13]) == 0))

check whether we can compress the IID in address 'a' to 16 bits.

This is used for unicast addresses only, and is true if the address is on the format <PREFIX>::0000:00ff:fe00:XXXX NOTE: we currently assume 64-bits prefixes

Definition at line 213 of file sicslowpan.h.

◆ sicslowpan_is_mcast_addr_decompressable

#define sicslowpan_is_mcast_addr_decompressable ( a)
Value:
(((*a & 0x01) == 0) && \
((*(a + 1) == 0x01) || (*(a + 1) == 0x02)))

check whether the 9-bit group-id of the compressed multicast address is known.

It is true if the 9-bit group is the all nodes or all routers group.

Parameters
ais typed uint8_t *

Definition at line 227 of file sicslowpan.h.

Function Documentation

◆ input()

void input ( void )
static

Process a received 6lowpan packet.

The 6lowpan packet is put in packetbuf by the MAC. If its a frag1 or a non-fragmented packet we first uncompress the IP header. The 6lowpan payload and possibly the uncompressed IP header are then copied in siclowpan_buf. If the IP packet is complete it is copied to uip_buf and the IP layer is called.

Note
We do not check for overlapping sicslowpan fragments (it is a SHALL in the RFC 4944 and should never happen)

Definition at line 1850 of file sicslowpan.c.

References curr_page, digest_6lorh_hdr(), digest_paging_dispatch(), packetbuf_datalen(), packetbuf_dataptr(), packetbuf_hdr_len, packetbuf_payload_len, packetbuf_ptr, SICSLOWPAN_COMPRESSION, tcpip_input(), uip_buf, UIP_BUFSIZE, UIP_IP_BUF, uip_len, and uncomp_hdr_len.

◆ output()

uint8_t output ( const linkaddr_t * localdest)
static

Take an IP packet and format it to be sent on an 802.15.4 network using 6lowpan.

Parameters
localdestThe MAC address of the destination

The IP packet is initially in uip_buf. Its header is compressed and if necessary it is fragmented. The resulting packet/fragments are put in packetbuf and delivered to the 802.15.4 MAC.

Definition at line 1623 of file sicslowpan.c.

References last_tx_status, linkaddr_null, mac_max_payload, MAC_TX_OK, packetbuf_clear(), packetbuf_dataptr(), packetbuf_hdr_len, packetbuf_payload_len, packetbuf_ptr, packetbuf_set_datalen(), send_packet(), UIP_IP_BUF, uip_is_addr_linklocal, uip_len, and uncomp_hdr_len.

Variable Documentation

◆ packetbuf_payload_len

int packetbuf_payload_len
static

The length of the payload in the Packetbuf buffer.

The payload is what comes after the compressed or uncompressed headers (can be the IP payload if the IP header only is compressed or the UDP payload if the UDP header is also compressed)

Definition at line 175 of file sicslowpan.c.

Referenced by input(), and output().

◆ packetbuf_ptr

uint8_t* packetbuf_ptr
static

A pointer to the packetbuf buffer.

We initialize it to the beginning of the packetbuf buffer, then access different fields by updating the offset packetbuf_hdr_len.

Definition at line 160 of file sicslowpan.c.

Referenced by input(), and output().