Contiki-NG
|
IPv6 multicast according to the algorithm in the "MCAST Forwarding Using Trickle" internet draft. More...
Files | |
file | roll-tm.c |
Implementation of the ROLL TM multicast engine. | |
file | roll-tm.h |
Header file for the implementation of the ROLL-TM multicast engine. | |
Data Structures | |
struct | roll_tm_stats |
Multicast stats extension for the ROLL TM engine. More... | |
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. | |
#define | ROLL_TM_VER 1 |
Supported Draft Version. | |
#define | ROLL_TM_ICMP_CODE 0 |
ROLL TM ICMPv6 code field. | |
#define | ROLL_TM_IP_HOP_LIMIT 0xFF |
Hop limit for ICMP messages. | |
#define | ROLL_TM_WINS 2 |
Number of Sliding Windows In essence: How many unique sources of simultaneous multicast traffic do we want to support for our lowpan If a node is seeding two multicast streams, parametrized on different M values, then this seed will occupy two different sliding windows. | |
#define | ROLL_TM_BUFF_NUM 6 |
Maximum Number of Buffered Multicast Messages This buffer is shared across all Seed IDs, therefore a new very active Seed may eventually occupy all slots. More... | |
#define | ROLL_TM_SHORT_SEEDS 0 |
Use Short Seed IDs [short: 2, long: 16 (default)] It can be argued that we should (and it would be easy to) support both at the same time but the draft doesn't list this as a MUST so we opt for code/ram savings. | |
#define | ROLL_TM_DEST_ALL_NODES 0 |
Destination address for our ICMPv6 advertisements. More... | |
#define | ROLL_TM_SET_M_BIT 1 |
M param for our outgoing messages By default, we set the M bit (conservative). More... | |
Functions | |
static uint8_t | accept (uint8_t in) |
Processes an incoming or outgoing multicast message and determines whether it should be dropped or accepted. More... | |
Variables | |
const struct uip_mcast6_driver | roll_tm_driver |
The ROLL TM engine driver. | |
IPv6 multicast according to the algorithm 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.
In draft v2, the document was renamed to "Multicast Protocol for Low power and Lossy Networks (MPL)" Due to very significant changes between draft versions 1 and 2, MPL will be implemented as a separate engine and this file here will provide legacy support for Draft v1.
#define ROLL_TM_BUFF_NUM 6 |
Maximum Number of Buffered Multicast Messages This buffer is shared across all Seed IDs, therefore a new very active Seed may eventually occupy all slots.
It would make little sense (if any) to define support for fewer buffered messages than seeds*2
Definition at line 187 of file roll-tm.h.
Referenced by accept().
#define ROLL_TM_DEST_ALL_NODES 0 |
#define ROLL_TM_SET_M_BIT 1 |
#define TRICKLE_IMAX | ( | t | ) | ((uint32_t)((t)->i_min << (t)->i_max)) |
|
static |
Processes an incoming or outgoing multicast message and determines whether it should be dropped or accepted.
in | 1: Incoming packet, 0: Outgoing (we are the seed) |
Definition at line 894 of file roll-tm.c.
References HBH_GET_M, HBH_GET_SV_MSB, HBH_SET_M, MCAST_PACKET_IS_LISTED, MCAST_PACKET_IS_USED, MCAST_PACKET_LISTED_CLR, MCAST_PACKET_LISTED_SET, MCAST_PACKET_SEND_SET, MCAST_PACKET_TTL, MCAST_PACKET_USED_SET, ROLL_TM_BUFF_NUM, ROLL_TM_ICMP_CODE, ROLL_TM_IP_HOP_LIMIT, ROLL_TM_VER, ROLL_TM_WINS, SEQ_VAL_ADD, SEQ_VAL_IS_EQ, SEQ_VAL_IS_GT, SEQ_VAL_IS_LT, SEQUENCE_LIST_GET_M, SEQUENCE_LIST_GET_S, SLIDING_WINDOW_GET_M, SLIDING_WINDOW_IS_LISTED, SLIDING_WINDOW_IS_USED_SET, SLIDING_WINDOW_LISTED_CLR, SLIDING_WINDOW_LISTED_SET, SLIDING_WINDOW_M_CLR, SLIDING_WINDOW_M_SET, tcpip_output(), TIMER_CONFIGURE, UIP_BUFSIZE, uip_ext_len, uip_htons(), uip_icmp6_register_input_handler(), UIP_ICMP_BUF, UIP_IP_BUF, uip_is_addr_linklocal, uip_is_addr_linklocal_allnodes_mcast, uip_is_addr_linklocal_allrouters_mcast, uip_is_addr_mcast_non_routable, uip_is_addr_unspecified, uip_len, uip_lladdr, UIP_LLADDR_LEN, UIP_LLH_LEN, and UIP_PROTO_HBHO.