OpenWSN Firmware
icmpv6rpl.h
Go to the documentation of this file.
1 #ifndef __ICMPv6RPL_H
2 #define __ICMPv6RPL_H
3 
11 #include "opentimers.h"
12 
13 //=========================== define ==========================================
14 
15 #define TIMER_DIO_TIMEOUT 1700
16 #define TIMER_DAO_TIMEOUT 10000
17 
18 #define MOP_DIO_A 1<<5
19 #define MOP_DIO_B 1<<4
20 #define MOP_DIO_C 1<<3
21 #define PRF_DIO_A 0<<2
22 #define PRF_DIO_B 0<<1
23 #define PRF_DIO_C 0<<0
24 #define G_DIO 1<<7
25 
26 #define FLAG_DAO_A 0<<0
27 #define FLAG_DAO_B 0<<1
28 #define FLAG_DAO_C 0<<2
29 #define FLAG_DAO_D 0<<3
30 #define FLAG_DAO_E 0<<4
31 #define FLAG_DAO_F 0<<5
32 #define D_DAO 1<<6
33 #define K_DAO 0<<7
34 
35 #define E_DAO_Transit_Info 0<<7
36 
37 #define PC1_A_DAO_Transit_Info 0<<7
38 #define PC1_B_DAO_Transit_Info 1<<6
39 
40 #define PC2_A_DAO_Transit_Info 0<<5
41 #define PC2_B_DAO_Transit_Info 0<<4
42 
43 #define PC3_A_DAO_Transit_Info 0<<3
44 #define PC3_B_DAO_Transit_Info 0<<2
45 
46 #define PC4_A_DAO_Transit_Info 0<<1
47 #define PC4_B_DAO_Transit_Info 0<<0
48 
49 #define Prf_A_dio_options 0<<4
50 #define Prf_B_dio_options 0<<3
51 
52 // max number of parents and children to send in DAO
53 //section 8.2.1 pag 67 RFC6550 -- using a subset
54 #define MAX_TARGET_PARENTS 0x01
55 
56 enum{
61 };
62 
63 //=========================== static ==========================================
64 
68 static const uint8_t all_routers_multicast[] = {
69  0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
70  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02
71 };
72 
73 //=========================== typedef =========================================
74 
75 //===== DIO
76 
80 BEGIN_PACK
81 typedef struct {
82  uint8_t rplinstanceId;
83  uint8_t verNumb;
85  uint8_t rplOptions;
86  uint8_t DTSN;
87  uint8_t flags;
88  uint8_t reserved;
89  uint8_t DODAGID[16];
91 END_PACK
92 
93 //===== DAO
94 
98 BEGIN_PACK
99 typedef struct {
100  uint8_t rplinstanceId;
101  uint8_t K_D_flags;
102  uint8_t reserved;
103  uint8_t DAOSequence;
104  uint8_t DODAGID[16];
106 END_PACK
107 
111 BEGIN_PACK
112 typedef struct {
113  uint8_t type;
114  uint8_t optionLength;
115  uint8_t E_flags;
116  uint8_t PathControl;
117  uint8_t PathSequence;
118  uint8_t PathLifetime;
120 END_PACK
121 
125 BEGIN_PACK
126 typedef struct {
127  uint8_t type;
128  uint8_t optionLength;
129  uint8_t flags;
130  uint8_t prefixLength;
132 END_PACK
133 
134 //=========================== module variables ================================
135 
136 typedef struct {
137  // admin
138  bool busySending;
139  uint8_t DODAGIDFlagSet;
140  // DIO-related
143  uint16_t periodDIO;
145  uint8_t delayDIO;
146  // DAO-related
151  uint16_t periodDAO;
152  uint8_t delayDAO;
154 
155 //=========================== prototypes ======================================
156 
157 void icmpv6rpl_init(void);
160 uint8_t icmpv6rpl_getRPLIntanceID(void);
161 
167 #endif
Definition: icmpv6rpl.h:58
uint8_t delayDAO
number of timerIdDIO events before actually sending a DAO.
Definition: icmpv6rpl.h:152
uint8_t rplinstanceId
set by the DODAG root.
Definition: icmpv6rpl.h:82
void icmpv6rpl_init()
Initialize this module.
Definition: icmpv6rpl.c:34
uint8_t PathSequence
Definition: icmpv6rpl.h:117
uint8_t reserved
Definition: icmpv6rpl.h:88
uint8_t optionLength
Definition: icmpv6rpl.h:128
Definition: icmpv6rpl.h:136
uint8_t type
set by the DODAG root.
Definition: icmpv6rpl.h:127
uint8_t PathLifetime
Definition: icmpv6rpl.h:118
icmpv6rpl_dao_transit_ht dao_transit
pre-populated DAO &quot;Transit Info&quot; option header.
Definition: icmpv6rpl.h:148
bool busySending
currently sending DIO/DAO.
Definition: icmpv6rpl.h:138
uint8_t owerror_t
Definition: openwsn.h:265
Header format of a RPL DAO &quot;Target&quot; option.
Definition: icmpv6rpl.h:126
uint16_t periodDIO
duration, in ms, of a timerIdDIO timeout.
Definition: icmpv6rpl.h:143
uint8_t K_D_flags
Definition: icmpv6rpl.h:101
void icmpv6rpl_sendDone(OpenQueueEntry_t *msg, owerror_t error)
Called when DIO/DAO was sent.
Definition: icmpv6rpl.c:127
uint8_t reserved
Definition: icmpv6rpl.h:102
uint8_t type
set by the DODAG root.
Definition: icmpv6rpl.h:113
uint8_t delayDIO
number of timerIdDIO events before actually sending a DIO.
Definition: icmpv6rpl.h:145
uint8_t DODAGIDFlagSet
is DODAGID set already?
Definition: icmpv6rpl.h:139
opentimer_id_t timerIdDAO
ID of the timer used to send DAOs.
Definition: icmpv6rpl.h:150
uint8_t rplOptions
Definition: icmpv6rpl.h:85
uint8_t DAOSequence
Definition: icmpv6rpl.h:103
icmpv6rpl_dao_ht dao
pre-populated DAO packet.
Definition: icmpv6rpl.h:147
uint8_t verNumb
Definition: icmpv6rpl.h:83
Definition: icmpv6rpl.h:57
#define opentimer_id_t
Definition: opentimers.h:28
uint8_t flags
Definition: icmpv6rpl.h:87
Header format of a RPL DIO packet.
Definition: icmpv6rpl.h:81
uint8_t PathControl
Definition: icmpv6rpl.h:116
uint8_t flags
Definition: icmpv6rpl.h:129
Definition: icmpv6rpl.h:60
uint8_t prefixLength
Definition: icmpv6rpl.h:130
Definition: openwsn.h:276
icmpv6rpl_dao_target_ht dao_target
pre-populated DAO &quot;Transit Info&quot; option header.
Definition: icmpv6rpl.h:149
void icmpv6rpl_receive(OpenQueueEntry_t *msg)
Called when RPL message received.
Definition: icmpv6rpl.c:151
dagrank_t rank
Definition: icmpv6rpl.h:84
uint16_t periodDAO
duration, in ms, of a timerIdDAO timeout.
Definition: icmpv6rpl.h:151
open_addr_t dioDestination
IPv6 destination address for DIOs.
Definition: icmpv6rpl.h:142
icmpv6rpl_dio_ht dio
pre-populated DIO packet.
Definition: icmpv6rpl.h:141
uint8_t E_flags
Definition: icmpv6rpl.h:115
uint8_t optionLength
Definition: icmpv6rpl.h:114
uint8_t icmpv6rpl_getRPLIntanceID()
Definition: icmpv6rpl.c:117
uint16_t dagrank_t
Definition: openwsn.h:264
Definition: openwsn.h:288
uint8_t DTSN
Definition: icmpv6rpl.h:86
Header format of a RPL DAO &quot;Transit Information&quot; option.
Definition: icmpv6rpl.h:112
uint8_t rplinstanceId
set by the DODAG root.
Definition: icmpv6rpl.h:100
Definition: icmpv6rpl.h:59
opentimer_id_t timerIdDIO
ID of the timer used to send DIOs.
Definition: icmpv6rpl.h:144
Header format of a RPL DAO packet.
Definition: icmpv6rpl.h:99