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

Implementation of the MPL protocol. More...

#include "contiki.h"
#include "contiki-lib.h"
#include "contiki-net.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-ds6.h"
#include "net/ipv6/uip-icmp6.h"
#include "net/ipv6/multicast/uip-mcast6.h"
#include "net/ipv6/multicast/mpl.h"
#include "dev/watchdog.h"
#include "os/lib/trickle-timer.h"
#include "os/lib/list.h"
#include "sys/ctimer.h"
#include <string.h>
#include "sys/log.h"

Go to the source code of this file.

Macros

#define SEED_ID_S1(dst, src)   { (*(uint16_t *)&(dst)->id) = (src); (dst)->s = 1; }
 Set the seed id to a 16 bit constant dst: seed_id_t to set to the constant src: 16 bit integer to set.
 
#define SEED_ID_S2(dst, src)   { (*(uint64_t *)&(dst)->id) = (src); (dst)->s = 2; }
 Set the seed id to a 64 bit constant dst: seed_id_t to set to the constant src: 64 bit integer to set.
 
#define SEED_ID_S3(dst, l, h)   { (*(uint64_t *)&(dst)->id) = (l); (*(uint64_t *)&(dst)->id[8]) = (h); (dst)->s = 3; }
 Set the seed id to a 128 bit constant dst: seed_id_t to set to the constant l: Lower 64 bits of the seed id to set h: Upper 64 bits of the seed id to set.
 
#define seed_id_cmp(a, b)   (memcmp((a)->id, (b)->id, sizeof(uint8_t) * 16) == 0)
 Compare two contiki seed ids represented as seed_id_t types a: First value to compare b: Second value to compare.
 
#define seed_id_cpy(a, b)   (memcpy((a), (b), sizeof(seed_id_t)))
 Copy one seed_id_t into another.
 
#define seed_id_clr(a)   (memset((a), 0, sizeof(seed_id_t)))
 Clear a seed id value to zero a: Value to clear.
 
#define MSG_SET_IS_USED(h)   ((h)->seed != NULL)
 Get the state of the used flag in the buffered message set entry h: pointer to the message set entry.
 
#define MSG_SET_CLEAR_USED(h)   ((h)->seed = NULL)
 Clear the state of the used flag in the buffered message set entry h: pointer to the message set entry.
 
#define SEQ_VAL_IS_EQ(i1, i2)   ((i1) == (i2))
 s1 is said to be equal s2 if SEQ_VAL_IS_EQ(s1, s2) == 1
 
#define SEQ_VAL_IS_LT(i1, i2)
 s1 is said to be less than s2 if SEQ_VAL_IS_LT(s1, s2) == 1
 
#define SEQ_VAL_IS_GT(i1, i2)
 s1 is said to be greater than s2 iif SEQ_VAL_IS_LT(s1, s2) == 1
 
#define SEQ_VAL_ADD(s, n)   (((s) + (n)) % 0x100)
 Add n to s: (s + n) modulo (2 ^ SERIAL_BITS) => ((s + n) % 0x8000)
 
#define SEED_SET_IS_USED(h)   (((h)->domain != NULL))
 Get the state of the used flag in the buffered message set entry h: pointer to the message set entry.
 
#define SEED_SET_CLEAR_USED(h)   ((h)->domain = NULL)
 Clear the state of the used flag in the buffered message set entry h: pointer to the message set entry.
 
#define DOMAIN_SET_IS_USED(h)   (uip_is_addr_mcast(&(h)->data_addr))
 Get the state of the used flag in the buffered message set entry h: pointer to the message set entry.
 
#define DOMAIN_SET_CLEAR_USED(h)   (memset(&(h)->data_addr, 0, sizeof(uip_ip6addr_t)))
 Clear the state of the used flag in the buffered message set entry h: pointer to the message set entry.
 
#define HBH_GET_S(h)   (((h)->flags & 0xC0) >> 6)
 Get the MPL Parametrization for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_SET_S(h, s)   ((h)->flags |= ((s & 0x03) << 6))
 Set the MPL Parametrization bit for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_CLR_S(h)   ((h)->flags &= ~0xC0)
 Clear the MPL Parametrization bit for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_GET_M(h)   (((h)->flags & 0x20) == 0x20)
 Get the MPL Parametrization for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_SET_M(h)   ((h)->flags |= 0x20)
 Set the MPL Parametrization bit for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_GET_V(h)   (((h)->flags & 0x10) == 0x10)
 Get the MPL Parametrization for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_CLR_V(h)   ((h)->flags &= ~0x10)
 Set the MPL Parametrization bit for a multicast HBHO header m: pointer to the HBHO header.
 
#define SEED_INFO_GET_S(h)   ((h)->bm_len_S & 0x03)
 Get the S bits in the length/S field in the seed info header h: pointer to the seed info struct.
 
#define SEED_INFO_CLR_S(h)   ((h)->bm_len_S &= ~0x03)
 Clear the S bits within the length/S field in the seed info header h: pointer to the seed info struct.
 
#define SEED_INFO_SET_S(h, s)   ((h)->bm_len_S |= (s & 0x03))
 Set the S bits within the seed info struct.
 
#define SEED_INFO_GET_LEN(h)   ((h)->bm_len_S >> 2)
 Get the length bits from the seed info struct.
 
#define SEED_INFO_CLR_LEN(h)   ((h)->bm_len_S &= 0x03)
 Clear the length bits in the seed info struct.
 
#define SEED_INFO_SET_LEN(h, l)   ((h)->bm_len_S |= (l << 2))
 Set the length bits in the seed info struct.
 
#define mpl_control_trickle_timer_start(t)   { (t)->e = 0; trickle_timer_set(&(t)->tt, control_message_expiration, (t)); }
 Start the trickle timer for a control message t: Pointer to set that should be reset.
 
#define mpl_data_trickle_timer_start(t)   { (t)->e = 0; trickle_timer_set(&(t)->tt, data_message_expiration, (t)); }
 Start the trickle timer for a data message t: Pointer to set that should be reset.
 
#define mpl_trickle_timer_inconsistency(t)   { (t)->e = 0; trickle_timer_inconsistency(&(t)->tt); }
 Call inconsistency on the provided timer t: Pointer to set that should be reset.
 
#define mpl_trickle_timer_reset(t)   { (t)->e = 0; trickle_timer_reset_event(&(t)->tt); }
 Reset the trickle timer and expiration count for the set t: Pointer to set that should be reset.
 
#define BIT_VECTOR_SET_BIT(v, b)   (v[b / 8] |= (0x80 >> b % 8))
 Set a single bit within a bit vector that spans multiple bytes v: The bit vector b: The 0-indexed bit to set.
 
#define BIT_VECTOR_GET_BIT(v, b)   ((v[b / 8] & (0x80 >> b % 8)) == (0x80 >> b % 8))
 Get the value of a bit in a bit vector v: The bit vector b: The 0-indexed bit to get.
 
#define UIP_ADDR_MAKE_LINK_LOCAL(a)   (((uip_ip6addr_t *)a)->u8[1] = (((uip_ip6addr_t *)a)->u8[1] & 0xF0) | UIP_MCAST6_SCOPE_LINK_LOCAL)
 Modify an ipv6 address to give it link local scope a: uip_ip6addr_t address to modify.
 

Functions

static void icmp_in (void)
 
static struct mpl_msg * buffer_reclaim (void)
 
static void seed_id_net_to_host (seed_id_t *dst, void *src, uint8_t s)
 
static void seed_id_host_to_net (void *dst, seed_id_t *src)
 
static uint8_t accept (uint8_t in)
 

Variables

const struct uip_mcast6_driver mpl_driver
 The MPL engine driver.
 

Detailed Description

Implementation of the MPL protocol.

Author
Ed Rose - er154.nosp@m.06@b.nosp@m.ris.a.nosp@m.c.uk

Definition in file mpl.c.