Contiki-NG
|
Data Structures | |
struct | sicslowpan_addr_context |
The header for fragments. More... | |
struct | sicslowpan_nh_compressor |
The structure of a next header compressor. More... | |
Macros | |
#define | LOG_MODULE "6LoWPAN" |
FOR HC-06 COMPLIANCE TODO: -Add compression options to UDP, currently only supports both ports compressed or both ports elided. More... | |
Functions | |
static void | add_paging_dispatch (uint8_t page) |
Adds Paging dispatch byte. | |
static void | add_6lorh_hdr (void) |
Adds 6lorh headers before IPHC. | |
static void | digest_paging_dispatch (void) |
Digest 6lorh headers before IPHC. | |
static void | digest_6lorh_hdr (void) |
Digest 6lorh headers before IPHC. | |
Pointers in the packetbuf buffer | |
#define | PACKETBUF_FRAG_PTR (packetbuf_ptr) |
#define | PACKETBUF_FRAG_DISPATCH_SIZE 0 /* 16 bit */ |
#define | PACKETBUF_FRAG_TAG 2 /* 16 bit */ |
#define | PACKETBUF_FRAG_OFFSET 4 /* 8 bit */ |
#define | PACKETBUF_IPHC_BUF ((uint8_t *)(packetbuf_ptr + packetbuf_hdr_len)) |
#define | PACKETBUF_PAYLOAD_END ((uint8_t *)(packetbuf_ptr + mac_max_payload)) |
#define | PACKETBUF_6LO_PTR (packetbuf_ptr + packetbuf_hdr_len) |
#define | PACKETBUF_6LO_DISPATCH 0 /* 8 bit */ |
#define | PACKETBUF_6LO_ENCODING 1 /* 8 bit */ |
#define | PACKETBUF_6LO_TTL 2 /* 8 bit */ |
#define | PACKETBUF_6LO_HC_UDP_PTR (packetbuf_ptr + packetbuf_hdr_len) |
#define | PACKETBUF_6LO_HC_UDP_DISPATCH 0 /* 8 bit */ |
#define | PACKETBUF_6LO_HC_UDP_HC1_ENCODING 1 /* 8 bit */ |
#define | PACKETBUF_6LO_HC_UDP_UDP_ENCODING 2 /* 8 bit */ |
#define | PACKETBUF_6LO_HC_UDP_TTL 3 /* 8 bit */ |
#define | PACKETBUF_6LO_HC_UDP_PORTS 4 /* 8 bit */ |
#define | PACKETBUF_6LO_HC_UDP_CHKSUM 5 /* 16 bit */ |
Pointers in the sicslowpan and uip buffer | |
#define | SICSLOWPAN_IP_BUF(buf) ((struct uip_ip_hdr *)buf) |
#define | SICSLOWPAN_UDP_BUF(buf) ((struct uip_udp_hdr *)&buf[UIP_IPH_LEN]) |
#define | SICSLOWPAN_IPPAYLOAD_BUF(buf) (&buf[UIP_IPH_LEN]) |
#define | UIP_IPPAYLOAD_BUF_POS(pos) (&uip_buf[UIP_IPH_LEN + (pos)]) |
#define | UIP_UDP_BUF_POS(pos) ((struct uip_udp_hdr *)UIP_IPPAYLOAD_BUF_POS(pos)) |
General variables | |
static uint8_t * | packetbuf_ptr |
A pointer to the packetbuf buffer. More... | |
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. More... | |
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 | |
variables specific to HC06 and more recent versions | |
static struct sicslowpan_addr_context * | context |
Addresses contexts for IPHC. More... | |
static uint8_t * | hc06_ptr |
pointer to the byte where to write next inline field. More... | |
const uint8_t | unc_llconf [] = {0x0f,0x28,0x22,0x20} |
const uint8_t | unc_ctxconf [] = {0x00,0x88,0x82,0x80} |
const uint8_t | unc_mxconf [] = {0x0f, 0x25, 0x23, 0x21} |
const uint8_t | llprefix [] = {0xfe, 0x80} |
static const uint8_t | ttl_values [] = {0, 1, 64, 255} |
IPHC related functions | |
static struct sicslowpan_addr_context * | addr_context_lookup_by_prefix (uip_ipaddr_t *ipaddr) |
find the context corresponding to prefix ipaddr | |
static struct sicslowpan_addr_context * | addr_context_lookup_by_number (uint8_t number) |
find the context with the given number | |
static uint8_t | compress_addr_64 (uint8_t bitpos, uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr) |
static void | uncompress_addr (uip_ipaddr_t *ipaddr, uint8_t const prefix[], uint8_t pref_post_count, uip_lladdr_t *lladdr) |
static int | compress_hdr_iphc (linkaddr_t *link_destaddr) |
Compress IP/UDP header. More... | |
static void | uncompress_hdr_iphc (uint8_t *buf, uint16_t ip_len) |
Uncompress IPHC (i.e., IPHC and LOWPAN_UDP) headers and put them in sicslowpan_buf. More... | |
IPv6 dispatch "compression" function | |
static void | compress_hdr_ipv6 (linkaddr_t *link_destaddr) |
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 (linkaddr_t *dest) |
This function is called by the 6lowpan code to send out a packet. More... | |
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. More... | |
static void | input (void) |
Process a received 6lowpan packet. More... | |
6lowpan compressions | |
#define | SICSLOWPAN_COMPRESSION_IPV6 0 /* No compression */ |
#define | SICSLOWPAN_COMPRESSION_IPHC 1 /* RFC 6282 */ |
#define | SICSLOWPAN_COMPRESSION_6LORH |
HC1 encoding | |
#define | SICSLOWPAN_HC1_NH_UDP 0x02 |
#define | SICSLOWPAN_HC1_NH_TCP 0x06 |
#define | SICSLOWPAN_HC1_NH_ICMP6 0x04 |
HC_UDP encoding (works together with HC1) | |
#define | SICSLOWPAN_HC_UDP_ALL_C 0xE0 |
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. More... | |
#define | sicslowpan_is_mcast_addr_decompressable(a) |
check whether the 9-bit group-id of the compressed multicast address is known. More... | |
#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. | |
#define | sicslowpan_is_mcast_addr_compressable48(a) |
#define | sicslowpan_is_mcast_addr_compressable32(a) |
#define | sicslowpan_is_mcast_addr_compressable8(a) |
#define LOG_MODULE "6LoWPAN" |
FOR HC-06 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 81 of file sicslowpan.c.
#define sicslowpan_is_iid_16_bit_compressable | ( | a | ) |
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 255 of file sicslowpan.h.
#define sicslowpan_is_mcast_addr_decompressable | ( | a | ) |
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.
a | is typed uint8_t * |
Definition at line 269 of file sicslowpan.h.
|
static |
Compress IP/UDP header.
This function is called by the 6lowpan code to create a compressed 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the uip_buf buffer.
IPHC (RFC 6282)
http://tools.ietf.org/html/
For LOWPAN_UDP compression, we either compress both ports or none. General format with LOWPAN_UDP compression is
* 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |0|1|1|TF |N|HLI|C|S|SAM|M|D|DAM| SCI | DCI | comp. IPv6 hdr| * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | compressed IPv6 fields ..... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | LOWPAN_UDP | non compressed UDP fields ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | L4 data ... | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ *
link_destaddr | L2 destination address, needed to compress IP dest |
Definition at line 651 of file sicslowpan.c.
|
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.
Definition at line 1758 of file sicslowpan.c.
|
static |
Take an IP packet and format it to be sent on an 802.15.4 network using 6lowpan.
localdest | The 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 1527 of file sicslowpan.c.
References packetbuf_clear(), packetbuf_dataptr(), packetbuf_hdr_len, packetbuf_ptr, and uncomp_hdr_len.
|
static |
This function is called by the 6lowpan code to send out a packet.
dest | the link layer destination address of the packet |
Definition at line 1453 of file sicslowpan.c.
|
static |
Uncompress IPHC (i.e., IPHC and LOWPAN_UDP) headers and put them in sicslowpan_buf.
This function is called by the input function when the dispatch is IPHC. We process the packet in the packetbuf buffer, uncompress the header fields, and copy the result in the sicslowpan buffer. At the end of the decompression, packetbuf_hdr_len and uncompressed_hdr_len are set to the appropriate values
buf | Pointer to the buffer to uncompress the packet into. |
ip_len | Equal to 0 if the packet is not a fragment (IP length is then inferred from the L2 length), non 0 if the packet is a 1st fragment. |
Definition at line 1037 of file sicslowpan.c.
|
static |
Addresses contexts for IPHC.
pointer to an address context.
Definition at line 482 of file sicslowpan.c.
|
static |
pointer to the byte where to write next inline field.
Definition at line 485 of file sicslowpan.c.
|
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 171 of file sicslowpan.c.
|
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 156 of file sicslowpan.c.
Referenced by output().