Contiki 3.x
Macros
roll-tm.c File Reference

    This file implements IPv6 MCAST forwarding according to the
    algorithm described in the "MCAST Forwarding Using Trickle"
    internet draft.
More...

#include "contiki.h"
#include "contiki-lib.h"
#include "contiki-net.h"
#include "net/ipv6/uip-icmp6.h"
#include "net/ipv6/multicast/uip-mcast6.h"
#include "net/ipv6/multicast/roll-tm.h"
#include "dev/watchdog.h"
#include <string.h>
#include "net/ip/uip-debug.h"

Go to the source code of this file.

Macros

#define TRICKLE_TIME(m, d)   ((clock_time_t)((m) << (d)))
 Convert a timer to a sane clock_time_t value after d doublings m is a value of Imin, d is a number of doublings Careful of overflows.
 
#define TRICKLE_IMAX(t)   ((uint32_t)((t)->i_min << (t)->i_max))
 Convert Imax from number of doublings to clock_time_t units for trickle_param t. More...
 
#define TRICKLE_ACTIVE(t)   ((uint32_t)(TRICKLE_IMAX(t) * t->t_active))
 Convert Tactive for a trickle timer to a sane clock_time_t value t is a pointer to the timer Careful of overflows.
 
#define TRICKLE_DWELL(t)   ((uint32_t)(TRICKLE_IMAX(t) * t->t_dwell))
 Convert Tdwell for a trickle timer to a sane clock_time_t value t is a pointer to the timer Careful of overflows.
 
#define SUPPRESSION_ENABLED(t)   ((t)->k != ROLL_TM_INFINITE_REDUNDANCY)
 Check if suppression is enabled for trickle_param t t is a pointer to the timer.
 
#define SUPPRESSION_DISABLED(t)   ((t)->k == ROLL_TM_INFINITE_REDUNDANCY)
 Check if suppression is disabled for trickle_param t t is a pointer to the timer.
 
#define TIMER_CONFIGURE(m)
 Init trickle_timer[m].
 
#define SEQ_VAL_IS_EQ(i1, i2)   ((i1) == (i2))
 s1 is said to be equal s2 iif SEQ_VAL_IS_EQ(s1, s2) == 1
 
#define SEQ_VAL_IS_LT(i1, i2)
 s1 is said to be less than s2 iif 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)) % 0x8000)
 Add n to s: (s + n) modulo (2 ^ SERIAL_BITS) => ((s + n) % 0x8000)
 
#define SLIDING_WINDOW_IS_USED(w)   ((w)->flags & SLIDING_WINDOW_U_BIT)
 Is Occupied sliding window location w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_IS_USED_SET(w)   ((w)->flags |= SLIDING_WINDOW_U_BIT)
 Set 'Is Used' bit for window w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_IS_USED_CLR(w)   ((w)->flags &= ~SLIDING_WINDOW_U_BIT)
 Clear 'Is Used' bit for window w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_LISTED_SET(w)   ((w)->flags |= SLIDING_WINDOW_L_BIT)
 Set 'Is Seen' bit for window w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_LISTED_CLR(w)   ((w)->flags &= ~SLIDING_WINDOW_L_BIT)
 Clear 'Is Seen' bit for window w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_IS_LISTED(w)   ((w)->flags & SLIDING_WINDOW_L_BIT)
 Is the sliding window at location w listed in current ICMP message? w: pointer to a sliding window.
 
#define SLIDING_WINDOW_M_SET(w)   ((w)->flags |= SLIDING_WINDOW_M_BIT)
 Set M bit for window w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_M_CLR(w)   ((w)->flags &= ~SLIDING_WINDOW_M_BIT)
 Clear M bit for window w w: pointer to a sliding window.
 
#define SLIDING_WINDOW_GET_M(w)   ((uint8_t)(((w)->flags & SLIDING_WINDOW_M_BIT) == SLIDING_WINDOW_M_BIT))
 Retrieve trickle parametrization for sliding window at location w w: pointer to a sliding window.
 
#define MCAST_PACKET_TTL(p)   (((struct uip_ip_hdr *)(p)->buff)->ttl)
 Get the TTL of a buffered packet p: pointer to a packet buffer.
 
#define MCAST_PACKET_USED_SET(p)   ((p)->flags |= MCAST_PACKET_U_BIT)
 Set 'Is Used' bit for packet p p: pointer to a packet buffer.
 
#define MCAST_PACKET_USED_CLR(p)   ((p)->flags &= ~MCAST_PACKET_U_BIT)
 Clear 'Is Used' bit for packet p p: pointer to a packet buffer.
 
#define MCAST_PACKET_IS_USED(p)   ((p)->flags & MCAST_PACKET_U_BIT)
 Is Occupied buffer location p.
 
#define MCAST_PACKET_MUST_SEND(p)   ((p)->flags & MCAST_PACKET_S_BIT)
 Must we send this message this pass?
 
#define MCAST_PACKET_SEND_SET(p)   ((p)->flags |= MCAST_PACKET_S_BIT)
 Set 'Must Send' bit for message p p: pointer to a struct mcast_packet.
 
#define MCAST_PACKET_SEND_CLR(p)   ((p)->flags &= ~MCAST_PACKET_S_BIT)
 Clear 'Must Send' bit for message p p: pointer to a struct mcast_packet.
 
#define MCAST_PACKET_IS_LISTED(p)   ((p)->flags & MCAST_PACKET_L_BIT)
 Is the message p listed in current ICMP message? p: pointer to a struct mcast_packet.
 
#define MCAST_PACKET_LISTED_SET(p)   ((p)->flags |= MCAST_PACKET_L_BIT)
 Set 'Is Listed' bit for message p p: pointer to a struct mcast_packet.
 
#define MCAST_PACKET_LISTED_CLR(p)   ((p)->flags &= ~MCAST_PACKET_L_BIT)
 Clear 'Is Listed' bit for message p p: pointer to a struct mcast_packet.
 
#define MCAST_PACKET_FREE(p)   ((p)->flags = 0)
 Free a multicast packet buffer p: pointer to a struct mcast_packet.
 
#define SEQUENCE_LIST_GET_M(l)   ((uint8_t)(((l)->flags & SEQUENCE_LIST_M_BIT) == SEQUENCE_LIST_M_BIT))
 Get the Trickle Parametrization for an ICMPv6 sequence list l: pointer to a sequence list structure.
 
#define SEQUENCE_LIST_GET_S(l)   ((uint8_t)(((l)->flags & SEQUENCE_LIST_S_BIT) == SEQUENCE_LIST_S_BIT))
 Get the Seed ID Length for an ICMPv6 sequence list l: pointer to a sequence list structure.
 
#define HBH_GET_M(h)   (((h)->flags & 0x80) == 0x80)
 Get the Trickle Parametrization for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_SET_M(h)   ((h)->flags |= 0x80)
 Set the Trickle Parametrization bit for a multicast HBHO header m: pointer to the HBHO header.
 
#define HBH_GET_SV_MSB(h)   ((h)->flags & 0x7F)
 Retrieve the Sequence Value MSB from a multicast HBHO header m: pointer to the HBHO header.
 

Detailed Description

    This file implements IPv6 MCAST forwarding according to the
    algorithm described in the "MCAST Forwarding Using Trickle"
    internet draft.
    The current version of the draft can always be found in
    http://tools.ietf.org/html/draft-ietf-roll-trickle-mcast

    This implementation is based on the draft version stored in
    ROLL_TM_VER
Author
George Oikonomou - oikon.nosp@m.omou.nosp@m.@user.nosp@m.s.so.nosp@m.urcef.nosp@m.orge.nosp@m..net

Definition in file roll-tm.c.

Macro Definition Documentation

#define TRICKLE_IMAX (   t)    ((uint32_t)((t)->i_min << (t)->i_max))

Convert Imax from number of doublings to clock_time_t units for trickle_param t.

Again, watch out for overflows

Definition at line 118 of file roll-tm.c.