sixlowpan/nd.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef NET_SIXLOWPAN_ND_H
23 #define NET_SIXLOWPAN_ND_H
24 
25 #include <stdint.h>
26 
27 #include "byteorder.h"
28 #include "net/eui64.h"
29 #include "net/ipv6/addr.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
40 #define SIXLOWPAN_ND_OPT_AR_LEN (2U)
41 #define SIXLOWPAN_ND_OPT_ABR_LEN (3U)
42 
55 #define SIXLOWPAN_ND_OPT_ABR_LTIME_DEFAULT (10000U)
56 
63 #define SIXLOWPAN_ND_STATUS_SUCCESS (0)
64 #define SIXLOWPAN_ND_STATUS_DUP (1)
65 #define SIXLOWPAN_ND_STATUS_NC_FULL (2)
74 #define SIXLOWPAN_ND_OPT_6CTX_FLAGS_MASK (0x1f)
75 #define SIXLOWPAN_ND_OPT_6CTX_FLAGS_C (0x10)
76 #define SIXLOWPAN_ND_OPT_6CTX_FLAGS_CID_MASK (0x0f)
86 #define SIXLOWPAN_ND_MIN_CTX_CHANGE_SEC_DELAY (300U)
94 #define SIXLOWPAN_ND_MAX_RA_NUMOF (3U)
95 #define SIXLOWPAN_ND_MIN_MS_DELAY_BETWEEN_RAS (10000U)
96 #define SIXLOWPAN_ND_MAX_RA_MS_DELAY (2000U)
97 #define SIXLOWPAN_ND_TENTATIVE_NCE_SEC_LTIME (20U)
105 #define SIXLOWPAN_ND_MULTIHOP_HL (64U)
116 #define SIXLOWPAN_ND_RS_MSEC_INTERVAL (10000U)
117 #define SIXLOWPAN_ND_MAX_RS_NUMOF (3U)
121 #define SIXLOWPAN_ND_MAX_RS_SEC_INTERVAL (60U)
122 
130 typedef struct __attribute__((packed)) {
131  uint8_t type;
132  uint8_t code;
134  uint8_t status;
135  uint8_t resv;
140 
147 typedef struct __attribute__((packed)) {
148  uint8_t type;
149  uint8_t len;
150  uint8_t status;
152  uint8_t resv[3];
156 
163 typedef struct __attribute__((packed)) {
164  uint8_t type;
165  uint8_t len;
166  uint8_t ctx_len;
167  uint8_t resv_c_cid;
171 
178 typedef struct __attribute__((packed)) {
179  uint8_t type;
180  uint8_t len;
186 
196 static inline bool sixlowpan_nd_opt_6ctx_is_comp(const sixlowpan_nd_opt_6ctx_t *ctx_opt)
197 {
198  return (bool)(ctx_opt->resv_c_cid & SIXLOWPAN_ND_OPT_6CTX_FLAGS_C);
199 }
200 
208 static inline uint8_t sixlowpan_nd_opt_6ctx_get_cid(const sixlowpan_nd_opt_6ctx_t *ctx_opt)
209 {
211 }
212 
219 static inline void sixlowpan_nd_opt_6ctx_set_cid(sixlowpan_nd_opt_6ctx_t *ctx_opt, uint8_t cid)
220 {
223 }
224 
225 
226 #ifdef __cplusplus
227 }
228 #endif
229 
230 #endif /* NET_SIXLOWPAN_ND_H */
231 
EUI-64 data type definition.
Address registration option format.
Definition: sixlowpan/nd.h:147
uint8_t len
length in units of 8 octets
Definition: sixlowpan/nd.h:165
Definitions for IPv6 addresses.
network_uint16_t resv
reserved field
Definition: sixlowpan/nd.h:168
uint8_t status
indicates registration status in DAC; must be 0 in DAR.
Definition: sixlowpan/nd.h:134
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:76
network_uint16_t ltime
valid lifetime
Definition: sixlowpan/nd.h:183
eui64_t eui64
EUI-64.
Definition: sixlowpan/nd.h:137
static bool sixlowpan_nd_opt_6ctx_is_comp(const sixlowpan_nd_opt_6ctx_t *ctx_opt)
Checks if a 6LoWPAN context in an 6LoWPAN context option is valid for compression.
Definition: sixlowpan/nd.h:196
#define SIXLOWPAN_ND_OPT_6CTX_FLAGS_C
valid for compression
Definition: sixlowpan/nd.h:75
Authoritative border router option format.
Definition: sixlowpan/nd.h:178
uint8_t len
length in units of 8 octets
Definition: sixlowpan/nd.h:149
network_uint16_t ltime
registration lifetime
Definition: sixlowpan/nd.h:136
uint8_t type
message type
Definition: sixlowpan/nd.h:131
uint8_t type
option type
Definition: sixlowpan/nd.h:164
static uint8_t sixlowpan_nd_opt_6ctx_get_cid(const sixlowpan_nd_opt_6ctx_t *ctx_opt)
Gets a CID (context identifier) from a 6LoWPAN context option.
Definition: sixlowpan/nd.h:208
uint8_t ctx_len
context length
Definition: sixlowpan/nd.h:166
Duplicate address request and confirmation message format.
Definition: sixlowpan/nd.h:130
eui64_t eui64
EUI-64.
Definition: sixlowpan/nd.h:154
ipv6_addr_t addr
registered address
Definition: sixlowpan/nd.h:138
uint8_t resv
reserved field
Definition: sixlowpan/nd.h:135
network_uint16_t vhigh
version high
Definition: sixlowpan/nd.h:182
ipv6_addr_t braddr
6LoWPAN border router address
Definition: sixlowpan/nd.h:184
network_uint16_t ltime
registration lifetime
Definition: sixlowpan/nd.h:153
static void sixlowpan_nd_opt_6ctx_set_cid(sixlowpan_nd_opt_6ctx_t *ctx_opt, uint8_t cid)
Sets a CID (context identifier) for a 6LoWPAN context option.
Definition: sixlowpan/nd.h:219
Functions to work with different byte orders.
network_uint16_t ltime
valid lifetime
Definition: sixlowpan/nd.h:169
network_uint16_t vlow
version low
Definition: sixlowpan/nd.h:181
uint8_t type
option type
Definition: sixlowpan/nd.h:148
6LoWPAN context option format
Definition: sixlowpan/nd.h:163
uint8_t status
indicates registration status in NA response; must be 0 in NS messages
Definition: sixlowpan/nd.h:150
network_uint16_t csum
checksum
Definition: sixlowpan/nd.h:133
Data type to represent an IPv6 address.
Definition: ipv6/addr.h:74
Data type to represent an EUI-64.
Definition: eui64.h:37
uint8_t type
option type
Definition: sixlowpan/nd.h:179
uint8_t code
message code
Definition: sixlowpan/nd.h:132
uint8_t len
length in units of 8 octets
Definition: sixlowpan/nd.h:180
uint8_t resv_c_cid
3-bit reserved, 1-bit c flag, 4 bit CID
Definition: sixlowpan/nd.h:167
#define SIXLOWPAN_ND_OPT_6CTX_FLAGS_CID_MASK
mask for CID
Definition: sixlowpan/nd.h:76