4 * NOTE: the contents of this file are an interpretation of RFC6550.
5 * no copyright is asserted on this file, as it transcribes
6 * a public specification.
11 * DIO: Updated to RFC6550, as published in 2012: section 6. (page 30)
14 #define ND_RPL_MESSAGE 155 /* 0x9B */
21 ND_RPL_SEC_DAG_IS
= 0x80,
22 ND_RPL_SEC_DAG_IO
= 0x81,
23 ND_RPL_SEC_DAG
= 0x82,
24 ND_RPL_SEC_DAG_ACK
= 0x83,
25 ND_RPL_SEC_CONSIST
= 0x84,
28 enum ND_RPL_DIO_FLAGS
{
29 ND_RPL_DIO_GROUNDED
= 0x80,
30 ND_RPL_DIO_DATRIG
= 0x40,
31 ND_RPL_DIO_DASUPPORT
= 0x20,
32 ND_RPL_DIO_RES4
= 0x10,
33 ND_RPL_DIO_RES3
= 0x08,
34 ND_RPL_DIO_PRF_MASK
= 0x07, /* 3-bit preference */
39 /* section 6 of draft-ietf-roll-rpl-19 */
40 struct nd_rpl_security
{
41 uint8_t rpl_sec_t_reserved
; /* bit 7 is T-bit */
43 uint16_t rpl_sec_kim_lvl_flags
; /* bit 15/14, KIM */
44 /* bit 10-8, LVL, bit 7-0 flags */
45 uint32_t rpl_sec_counter
;
47 uint8_t rpl_sec_ki
[0]; /* depends upon kim */
51 /* section 6.2.1, DODAG Information Solication (DIS_IS) */
52 struct nd_rpl_dis_is
{
53 uint8_t rpl_dis_flags
;
54 uint8_t rpl_dis_reserved
;
56 uint8_t rpl_dis_options
[0];
60 /* section 6.3.1, DODAG Information Object (DIO) */
62 uint8_t rpl_instanceid
;
65 uint8_t rpl_mopprf
; /* bit 7=G, 5-3=MOP, 2-0=PRF */
66 uint8_t rpl_dtsn
; /* Dest. Advertisement Trigger Sequence Number */
67 uint8_t rpl_flags
; /* no flags defined yet */
69 uint8_t rpl_dagid
[DAGID_LEN
];
71 #define RPL_DIO_GROUND_FLAG 0x80
72 #define RPL_DIO_MOP_SHIFT 3
73 #define RPL_DIO_MOP_MASK (7 << RPL_DIO_MOP_SHIFT)
74 #define RPL_DIO_PRF_SHIFT 0
75 #define RPL_DIO_PRF_MASK (7 << RPL_DIO_PRF_SHIFT)
76 #define RPL_DIO_GROUNDED(X) ((X)&RPL_DIO_GROUND_FLAG)
77 #define RPL_DIO_MOP(X) (enum RPL_DIO_MOP)(((X)&RPL_DIO_MOP_MASK) >> RPL_DIO_MOP_SHIFT)
78 #define RPL_DIO_PRF(X) (((X)&RPL_DIO_PRF_MASK) >> RPL_DIO_PRF_SHIFT)
81 RPL_DIO_NONSTORING
= 0x0,
82 RPL_DIO_STORING
= 0x1,
83 RPL_DIO_NONSTORING_MULTICAST
= 0x2,
84 RPL_DIO_STORING_MULTICAST
= 0x3,
91 RPL_DIO_ROUTINGINFO
= 3,
93 RPL_DAO_RPLTARGET
= 5,
94 RPL_DAO_TRANSITINFO
= 6,
95 RPL_DIO_DESTPREFIX
= 8,
96 RPL_DAO_RPLTARGET_DESC
=9,
99 struct rpl_dio_genoption
{
100 uint8_t rpl_dio_type
;
101 uint8_t rpl_dio_len
; /* suboption length, not including type/len */
103 #define RPL_DIO_GENOPTION_LEN 2
105 #define RPL_DIO_LIFETIME_INFINITE 0xffffffff
106 #define RPL_DIO_LIFETIME_DISCONNECT 0
108 struct rpl_dio_destprefix
{
109 uint8_t rpl_dio_type
;
111 uint8_t rpl_dio_prefixlen
; /* in bits */
112 uint8_t rpl_dio_prf
; /* flags, including Route Preference */
113 uint32_t rpl_dio_prefixlifetime
; /* in seconds */
115 uint8_t rpl_dio_prefix
[0]; /* variable number of bytes */
119 /* section 6.4.1, DODAG Information Object (DIO) */
121 uint8_t rpl_instanceid
;
122 uint8_t rpl_flags
; /* bit 7=K, 6=D */
125 uint8_t rpl_dagid
[DAGID_LEN
]; /* present when D set. */
127 #define ND_RPL_DAO_MIN_LEN 4 /* length without DAGID */
129 /* indicates if this DAO is to be acK'ed */
130 #define RPL_DAO_K_SHIFT 7
131 #define RPL_DAO_K_MASK (1 << RPL_DAO_K_SHIFT)
132 #define RPL_DAO_K(X) (((X)&RPL_DAO_K_MASK) >> RPL_DAO_K_SHIFT)
134 /* indicates if the DAGID is present */
135 #define RPL_DAO_D_SHIFT 6
136 #define RPL_DAO_D_MASK (1 << RPL_DAO_D_SHIFT)
137 #define RPL_DAO_D(X) (((X)&RPL_DAO_D_MASK) >> RPL_DAO_D_SHIFT)
139 struct rpl_dao_target
{
140 uint8_t rpl_dao_type
;
142 uint8_t rpl_dao_flags
; /* unused */
143 uint8_t rpl_dao_prefixlen
; /* in bits */
145 uint8_t rpl_dao_prefix
[0]; /* variable number of bytes */
149 /* section 6.5.1, Destination Advertisement Object Acknowledgement (DAO-ACK) */
150 struct nd_rpl_daoack
{
151 uint8_t rpl_instanceid
;
152 uint8_t rpl_flags
; /* bit 7=D */
155 uint8_t rpl_dagid
[DAGID_LEN
]; /* present when D set. */
157 #define ND_RPL_DAOACK_MIN_LEN 4 /* length without DAGID */
158 /* indicates if the DAGID is present */
159 #define RPL_DAOACK_D_SHIFT 7
160 #define RPL_DAOACK_D_MASK (1 << RPL_DAOACK_D_SHIFT)
161 #define RPL_DAOACK_D(X) (((X)&RPL_DAOACK_D_MASK) >> RPL_DAOACK_D_SHIFT)
171 * c-style: whitesmith