|
Contiki 3.x
|
6lowpan implementation (RFC4944 and draft-ietf-6lowpan-hc-06)More...
#include <string.h>#include "contiki.h"#include "dev/watchdog.h"#include "net/link-stats.h"#include "net/ip/tcpip.h"#include "net/ip/uip.h"#include "net/ipv6/uip-ds6.h"#include "net/rime/rime.h"#include "net/ipv6/sicslowpan.h"#include "net/netstack.h"#include <stdio.h>#include "net/ip/uip-debug.h"Go to the source code of this file.
Macros | |
| #define | DEBUG DEBUG_NONE |
| FOR HC-06 COMPLIANCE TODO: -Add compression options to UDP, currently only supports both ports compressed or both ports elided. More... | |
| #define | MAC_MAX_PAYLOAD (127 - 2) |
| Maximum available size for frame headers, link layer security-related overhead, as well as 6LoWPAN payload. More... | |
| #define | COMPRESSION_THRESHOLD 0 |
| Some MAC layers need a minimum payload, which is configurable through the SICSLOWPAN_CONF_COMPRESSION_THRESHOLD option. More... | |
| #define | SICSLOWPAN_FIXED_HDRLEN 21 |
| Fixed size of a frame header. More... | |
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_HC1_PTR (packetbuf_ptr + packetbuf_hdr_len) |
| #define | PACKETBUF_HC1_DISPATCH 0 /* 8 bit */ |
| #define | PACKETBUF_HC1_ENCODING 1 /* 8 bit */ |
| #define | PACKETBUF_HC1_TTL 2 /* 8 bit */ |
| #define | PACKETBUF_HC1_HC_UDP_PTR (packetbuf_ptr + packetbuf_hdr_len) |
| #define | PACKETBUF_HC1_HC_UDP_DISPATCH 0 /* 8 bit */ |
| #define | PACKETBUF_HC1_HC_UDP_HC1_ENCODING 1 /* 8 bit */ |
| #define | PACKETBUF_HC1_HC_UDP_UDP_ENCODING 2 /* 8 bit */ |
| #define | PACKETBUF_HC1_HC_UDP_TTL 3 /* 8 bit */ |
| #define | PACKETBUF_HC1_HC_UDP_PORTS 4 /* 8 bit */ |
| #define | PACKETBUF_HC1_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 | UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) |
| #define | UIP_UDP_BUF ((struct uip_udp_hdr *)&uip_buf[UIP_LLIPH_LEN]) |
| #define | UIP_TCP_BUF ((struct uip_tcp_hdr *)&uip_buf[UIP_LLIPH_LEN]) |
| #define | UIP_ICMP_BUF ((struct uip_icmp_hdr *)&uip_buf[UIP_LLIPH_LEN]) |
Functions | |
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 void | 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 uip_lladdr_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... | |
Variables | |
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 | last_tx_status |
| the result of the last transmitted fragment | |
HC06 specific variables | |
| 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} |
6lowpan implementation (RFC4944 and draft-ietf-6lowpan-hc-06)
Definition in file sicslowpan.c.
1.8.6