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.
10 #define PACKED __attribute__((packed))
13 * DIO: Updated to RFC6550, as published in 2012: section 6. (page 30)
16 #define ND_RPL_MESSAGE 155 /* 0x9B */
23 ND_RPL_SEC_DAG_IS
= 0x80,
24 ND_RPL_SEC_DAG_IO
= 0x81,
25 ND_RPL_SEC_DAG
= 0x82,
26 ND_RPL_SEC_DAG_ACK
= 0x83,
27 ND_RPL_SEC_CONSIST
= 0x84,
30 enum ND_RPL_DIO_FLAGS
{
31 ND_RPL_DIO_GROUNDED
= 0x80,
32 ND_RPL_DIO_DATRIG
= 0x40,
33 ND_RPL_DIO_DASUPPORT
= 0x20,
34 ND_RPL_DIO_RES4
= 0x10,
35 ND_RPL_DIO_RES3
= 0x08,
36 ND_RPL_DIO_PRF_MASK
= 0x07, /* 3-bit preference */
41 /* section 6 of draft-ietf-roll-rpl-19 */
42 struct nd_rpl_security
{
43 u_int8_t rpl_sec_t_reserved
; /* bit 7 is T-bit */
44 u_int8_t rpl_sec_algo
;
45 u_int16_t rpl_sec_kim_lvl_flags
; /* bit 15/14, KIM */
46 /* bit 10-8, LVL, bit 7-0 flags */
47 u_int32_t rpl_sec_counter
;
49 u_int8_t rpl_sec_ki
[0]; /* depends upon kim */
53 /* section 6.2.1, DODAG Information Solication (DIS_IS) */
54 struct nd_rpl_dis_is
{
55 u_int8_t rpl_dis_flags
;
56 u_int8_t rpl_dis_reserved
;
58 u_int8_t rpl_dis_options
[0];
62 /* section 6.3.1, DODAG Information Object (DIO) */
64 u_int8_t rpl_instanceid
;
66 u_int16_t rpl_dagrank
;
67 u_int8_t rpl_mopprf
; /* bit 7=G, 5-3=MOP, 2-0=PRF */
68 u_int8_t rpl_dtsn
; /* Dest. Advertisement Trigger Sequence Number */
69 u_int8_t rpl_flags
; /* no flags defined yet */
71 u_int8_t rpl_dagid
[DAGID_LEN
];
73 #define RPL_DIO_GROUND_FLAG 0x80
74 #define RPL_DIO_MOP_SHIFT 3
75 #define RPL_DIO_MOP_MASK (7 << RPL_DIO_MOP_SHIFT)
76 #define RPL_DIO_PRF_SHIFT 0
77 #define RPL_DIO_PRF_MASK (7 << RPL_DIO_PRF_SHIFT)
78 #define RPL_DIO_GROUNDED(X) ((X)&RPL_DIO_GROUND_FLAG)
79 #define RPL_DIO_MOP(X) (enum RPL_DIO_MOP)(((X)&RPL_DIO_MOP_MASK) >> RPL_DIO_MOP_SHIFT)
80 #define RPL_DIO_PRF(X) (((X)&RPL_DIO_PRF_MASK) >> RPL_DIO_PRF_SHIFT)
83 RPL_DIO_NONSTORING
= 0x0,
84 RPL_DIO_STORING
= 0x1,
85 RPL_DIO_NONSTORING_MULTICAST
= 0x2,
86 RPL_DIO_STORING_MULTICAST
= 0x3,
93 RPL_DIO_ROUTINGINFO
= 3,
95 RPL_DAO_RPLTARGET
= 5,
96 RPL_DAO_TRANSITINFO
= 6,
97 RPL_DIO_DESTPREFIX
= 8,
98 RPL_DAO_RPLTARGET_DESC
=9,
101 struct rpl_dio_genoption
{
102 u_int8_t rpl_dio_type
;
103 u_int8_t rpl_dio_len
; /* suboption length, not including type/len */
105 #define RPL_DIO_GENOPTION_LEN 2
107 #define RPL_DIO_LIFETIME_INFINITE 0xffffffff
108 #define RPL_DIO_LIFETIME_DISCONNECT 0
110 struct rpl_dio_destprefix
{
111 u_int8_t rpl_dio_type
;
112 u_int8_t rpl_dio_len
;
113 u_int8_t rpl_dio_prefixlen
; /* in bits */
114 u_int8_t rpl_dio_prf
; /* flags, including Route Preference */
115 u_int32_t rpl_dio_prefixlifetime
; /* in seconds */
117 u_int8_t rpl_dio_prefix
[0]; /* variable number of bytes */
121 /* section 6.4.1, DODAG Information Object (DIO) */
123 u_int8_t rpl_instanceid
;
124 u_int8_t rpl_flags
; /* bit 7=K, 6=D */
127 u_int8_t rpl_dagid
[DAGID_LEN
]; /* present when D set. */
129 #define ND_RPL_DAO_MIN_LEN 4 /* length without DAGID */
131 /* indicates if this DAO is to be acK'ed */
132 #define RPL_DAO_K_SHIFT 7
133 #define RPL_DAO_K_MASK (1 << RPL_DAO_K_SHIFT)
134 #define RPL_DAO_K(X) (((X)&RPL_DAO_K_MASK) >> RPL_DAO_K_SHIFT)
136 /* indicates if the DAGID is present */
137 #define RPL_DAO_D_SHIFT 6
138 #define RPL_DAO_D_MASK (1 << RPL_DAO_D_SHIFT)
139 #define RPL_DAO_D(X) (((X)&RPL_DAO_D_MASK) >> RPL_DAO_D_SHIFT)
141 struct rpl_dao_target
{
142 u_int8_t rpl_dao_type
;
143 u_int8_t rpl_dao_len
;
144 u_int8_t rpl_dao_flags
; /* unused */
145 u_int8_t rpl_dao_prefixlen
; /* in bits */
147 u_int8_t rpl_dao_prefix
[0]; /* variable number of bytes */
151 /* section 6.5.1, Destination Advertisement Object Acknowledgement (DAO-ACK) */
152 struct nd_rpl_daoack
{
153 u_int8_t rpl_instanceid
;
154 u_int8_t rpl_flags
; /* bit 7=D */
157 u_int8_t rpl_dagid
[DAGID_LEN
]; /* present when D set. */
159 #define ND_RPL_DAOACK_MIN_LEN 4 /* length without DAGID */
160 /* indicates if the DAGID is present */
161 #define RPL_DAOACK_D_SHIFT 7
162 #define RPL_DAOACK_D_MASK (1 << RPL_DAOACK_D_SHIFT)
163 #define RPL_DAOACK_D(X) (((X)&RPL_DAOACK_D_MASK) >> RPL_DAOACK_D_SHIFT)
173 * c-style: whitesmith