Contiki-Inga 3.x
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
core
net
ipv6
multicast
uip-mcast6.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011, Loughborough University - Computer Science
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the Institute nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*
29
* This file is part of the Contiki operating system.
30
*/
31
32
/**
33
* \file
34
* This header file contains configuration directives for uIPv6
35
* multicast support.
36
*
37
* We currently support 2 engines:
38
* - 'Stateless Multicast RPL Forwarding' (SMRF)
39
* RPL does group management as per the RPL docs, SMRF handles datagram
40
* forwarding
41
* - 'Multicast Forwarding with Trickle' according to the algorithm described
42
* in the internet draft:
43
* http://tools.ietf.org/html/draft-ietf-roll-trickle-mcast
44
*
45
* \author
46
* George Oikonomou - <oikonomou@users.sourceforge.net>
47
*/
48
49
#ifndef UIP_MCAST6_H_
50
#define UIP_MCAST6_H_
51
52
#include "contiki-conf.h"
53
#include "
net/ipv6/multicast/uip-mcast6-engines.h
"
54
#include "
net/ipv6/multicast/uip-mcast6-route.h
"
55
#include "
net/ipv6/multicast/smrf.h
"
56
#include "
net/ipv6/multicast/roll-tm.h
"
57
58
#include <string.h>
59
/*---------------------------------------------------------------------------*/
60
/* Constants */
61
/*---------------------------------------------------------------------------*/
62
#define UIP_MCAST6_DROP 0
63
#define UIP_MCAST6_ACCEPT 1
64
/*---------------------------------------------------------------------------*/
65
/* Multicast Address Scopes (RFC 4291 & draft-ietf-6man-multicast-scopes) */
66
#define UIP_MCAST6_SCOPE_INTERFACE 0x01
67
#define UIP_MCAST6_SCOPE_LINK_LOCAL 0x02
68
#define UIP_MCAST6_SCOPE_REALM_LOCAL 0x03
/* draft-ietf-6man-multicast-scopes */
69
#define UIP_MCAST6_SCOPE_ADMIN_LOCAL 0x04
70
#define UIP_MCAST6_SCOPE_SITE_LOCAL 0x05
71
#define UIP_MCAST6_SCOPE_ORG_LOCAL 0x08
72
#define UIP_MCAST6_SCOPE_GLOBAL 0x0E
73
/*---------------------------------------------------------------------------*/
74
/* Choose an engine or turn off based on user configuration */
75
/*---------------------------------------------------------------------------*/
76
#ifdef UIP_MCAST6_CONF_ENGINE
77
#define UIP_MCAST6_ENGINE UIP_MCAST6_CONF_ENGINE
78
#else
79
#define UIP_MCAST6_ENGINE UIP_MCAST6_ENGINE_NONE
80
#endif
81
/*---------------------------------------------------------------------------*/
82
/*
83
* Multicast API. Similar to NETSTACK, each engine must define a driver and
84
* populate the fields with suitable function pointers
85
*/
86
struct
uip_mcast6_driver {
87
char
*name;
88
89
/** Initialize the multicast engine */
90
void (* init)(void);
91
92
/**
93
* \brief Process an outgoing datagram with a multicast IPv6 destination
94
* address
95
*
96
* This may be needed if the multicast engine needs to, for example,
97
* add IPv6 extension headers to the datagram, cache it, decide it
98
* needs dropped etc.
99
*
100
* It is sometimes desirable to let the engine handle datagram
101
* dispatch instead of letting the networking core do it. If the
102
* engine decides to send the datagram itself, it must afterwards
103
* set uip_len = 0 to prevent the networking core from sending too
104
*/
105
void (* out)(void);
106
107
/**
108
* \brief Process an incoming multicast datagram and determine whether it
109
* should be delivered up the stack or not.
110
*
111
* \return 0: Drop, 1: Deliver
112
*
113
* When a datagram with a multicast destination address is received,
114
* the forwarding logic in core is bypassed. Instead, we let the
115
* multicast engine handle forwarding internally if and as necessary.
116
* This function is where forwarding logic must be hooked in.
117
*
118
* Once the engine is done with forwarding, it must signal via the
119
* return value whether the datagram needs delivered up the network
120
* stack.
121
*/
122
uint8_t (* in)(void);
123
};
124
/*---------------------------------------------------------------------------*/
125
/**
126
* \brief Get a multicast address' scope.
127
* a is of type uip_ip6addr_t*
128
*/
129
#define uip_mcast6_get_address_scope(a) ((a)->u8[1] & 0x0F)
130
/*---------------------------------------------------------------------------*/
131
/* Configure multicast and core/net to play nicely with the selected engine */
132
#if UIP_MCAST6_ENGINE
133
134
/* Enable Multicast hooks in the uip6 core */
135
#define UIP_CONF_IPV6_MULTICAST 1
136
137
#if UIP_MCAST6_ENGINE == UIP_MCAST6_ENGINE_ROLL_TM
138
#define RPL_CONF_MULTICAST 0
/* Not used by trickle */
139
#define UIP_CONF_IPV6_ROLL_TM 1
/* ROLL Trickle ICMP type support */
140
141
#define UIP_MCAST6 roll_tm_driver
142
#elif UIP_MCAST6_ENGINE == UIP_MCAST6_ENGINE_SMRF
143
#define RPL_CONF_MULTICAST 1
144
145
#define UIP_MCAST6 smrf_driver
146
#else
147
#error "Multicast Enabled with an Unknown Engine."
148
#error "Check the value of UIP_MCAST6_CONF_ENGINE in conf files."
149
#endif
150
#endif
/* UIP_MCAST6_ENGINE */
151
152
extern
const
struct
uip_mcast6_driver UIP_MCAST6;
153
/*---------------------------------------------------------------------------*/
154
/* Configuration Checks */
155
/*---------------------------------------------------------------------------*/
156
#if RPL_CONF_MULTICAST && (!UIP_CONF_IPV6_RPL)
157
#error "The selected Multicast mode requires UIP_CONF_IPV6_RPL != 0"
158
#error "Check the value of UIP_CONF_IPV6_RPL in conf files."
159
#endif
160
/*---------------------------------------------------------------------------*/
161
162
#endif
/* UIP_MCAST6_H_ */
Generated on Thu Apr 24 2014 16:26:12 for Contiki-Inga 3.x by
1.8.3.1