gnrc/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 
23 #ifndef NET_GNRC_SIXLOWPAN_ND_H
24 #define NET_GNRC_SIXLOWPAN_ND_H
25 
26 #include <stdint.h>
27 
28 #include "kernel_types.h"
29 #include "net/gnrc/ipv6/nc.h"
30 #include "net/gnrc/ipv6/netif.h"
31 #include "net/ipv6/addr.h"
32 #include "net/ndp.h"
33 #include "net/sixlowpan/nd.h"
34 #include "timex.h"
35 
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
46 #define GNRC_SIXLOWPAN_ND_MSG_MC_RTR_SOL (0x0220)
47 
51 #define GNRC_SIXLOWPAN_ND_MSG_UC_RTR_SOL (0x0221)
52 
56 #define GNRC_SIXLOWPAN_ND_MSG_DELETE_CTX (0x0222)
57 
61 #define GNRC_SIXLOWPAN_ND_MSG_ABR_TIMEOUT (0x0223)
62 
66 #define GNRC_SIXLOWPAN_ND_MSG_AR_TIMEOUT (0x0224)
67 
68 #ifndef GNRC_SIXLOWPAN_ND_AR_LTIME
69 
79 #define GNRC_SIXLOWPAN_ND_AR_LTIME (15U)
80 #endif
81 
89 #define GNRC_SIXLOWPAN_ND_RTR_MIN_CTX_DELAY (300U)
99 #define GNRC_SIXLOWPAN_ND_RTR_SOL_INT (10U)
101 #define GNRC_SIXLOWPAN_ND_MAX_RTR_SOL_INT (60U)
111 #define GNRC_SIXLOWPAN_ND_MIN_RTR_ADV_DELAY (10U)
116 #define GNRC_SIXLOWPAN_ND_MAX_RTR_ADV_DELAY (2U * US_PER_SEC)
117 
120 #define GNRC_SIXLOWPAN_ND_TENTATIVE_NCE_LIFETIME (20U)
121 
124 #define GNRC_SIXLOWPAN_ND_MULTIHOP_HOPLIMIT (64U)
125 
133 
140 
148 
164 kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_len,
165  kernel_pid_t iface, ipv6_addr_t *dst);
166 
175 void gnrc_sixlowpan_nd_rtr_sol_reschedule(gnrc_ipv6_nc_t *nce, uint32_t sec_delay);
176 
188 gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, eui64_t *eui64,
189  gnrc_pktsnip_t *next);
190 
207  uint8_t icmpv6_type, ipv6_addr_t *addr,
208  sixlowpan_nd_opt_ar_t *ar_opt,
209  uint8_t *sl2a, size_t sl2a_len);
210 
221 bool gnrc_sixlowpan_nd_opt_6ctx_handle(uint8_t icmpv6_type, sixlowpan_nd_opt_6ctx_t *ctx_opt);
222 
230 void gnrc_sixlowpan_nd_wakeup(void);
231 
232 #ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER
233 
244 void gnrc_sixlowpan_nd_opt_abr_handle(kernel_pid_t iface, ndp_rtr_adv_t *rtr_adv, int icmpv6_size,
245  sixlowpan_nd_opt_abr_t *abr_opt);
246 
259 gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_6ctx_build(uint8_t prefix_len, uint8_t flags, uint16_t ltime,
260  ipv6_addr_t *prefix, gnrc_pktsnip_t *next);
261 
273 gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_abr_build(uint32_t version, uint16_t ltime,
274  ipv6_addr_t *braddr, gnrc_pktsnip_t *next);
275 #else
276 #define gnrc_sixlowpan_nd_opt_abr_handle(iface, rtr_adv, icmpv6_size, abr_opt)
277 #define gnrc_sixlowpan_nd_opt_6ctx_build(prefix_len, flags, ltime, prefix, next) (NULL)
278 #define gnrc_sixlowpan_nd_opt_abr_build(version, ltime, braddr, next) (NULL)
279 #endif
280 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif /* NET_GNRC_SIXLOWPAN_ND_H */
286 
Types used by the kernel.
Address registration option format.
Definition: sixlowpan/nd.h:147
gnrc_pktsnip_t * gnrc_sixlowpan_nd_opt_6ctx_build(uint8_t prefix_len, uint8_t flags, uint16_t ltime, ipv6_addr_t *prefix, gnrc_pktsnip_t *next)
Builds the 6LoWPAN context option.
Definition of IPv6 interface type.
Definition: ipv6/netif.h:279
Definitions for IPv6 addresses.
Router-definitions for 6LoWPAN-ND.
uint8_t gnrc_sixlowpan_nd_opt_ar_handle(kernel_pid_t iface, ipv6_hdr_t *ipv6, uint8_t icmpv6_type, ipv6_addr_t *addr, sixlowpan_nd_opt_ar_t *ar_opt, uint8_t *sl2a, size_t sl2a_len)
Handles address registration option.
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
Data type to represent an IPv6 packet header.
Definition: ipv6/hdr.h:68
void gnrc_sixlowpan_nd_opt_abr_handle(kernel_pid_t iface, ndp_rtr_adv_t *rtr_adv, int icmpv6_size, sixlowpan_nd_opt_abr_t *abr_opt)
Handles authoritative border router option.
Authoritative border router option format.
Definition: sixlowpan/nd.h:178
Definitions for IPv6 specific information of network interfaces.
kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_len, kernel_pid_t iface, ipv6_addr_t *dst)
Get link-layer address and interface for next hop to destination IPv6 address.
Neighbor cache definitions.
Utility library for comparing and computing timestamps.
Router advertisement message format.
Definition: ndp.h:186
gnrc_pktsnip_t * gnrc_sixlowpan_nd_opt_abr_build(uint32_t version, uint16_t ltime, ipv6_addr_t *braddr, gnrc_pktsnip_t *next)
Builds the authoritative border router option.
Message type and helper function definitions for 6LoWPAN-ND.
void gnrc_sixlowpan_nd_rtr_sol_reschedule(gnrc_ipv6_nc_t *nce, uint32_t sec_delay)
Reschedules the next router advertisement for a neighboring router.
Border router definitions for 6LoWPAN.
void gnrc_sixlowpan_nd_init(gnrc_ipv6_netif_t *iface)
Initializes 6LoWPAN neighbor discovery for the interface.
6LoWPAN context option format
Definition: sixlowpan/nd.h:163
bool gnrc_sixlowpan_nd_opt_6ctx_handle(uint8_t icmpv6_type, sixlowpan_nd_opt_6ctx_t *ctx_opt)
Handles 6LoWPAN context option.
Type to represent parts (either headers or payload) of a packet, called snips.
Data type to represent an IPv6 address.
Definition: ipv6/addr.h:74
Data type to represent an EUI-64.
Definition: eui64.h:37
IPv6 neighbor discovery message type definitions.
void gnrc_sixlowpan_nd_uc_rtr_sol(gnrc_ipv6_nc_t *nce)
Unicasts a router solicitation to the neighbor represented by nce.
Neighbor cache entry as defined in RFC 4861, section 5.1 .
Definition: nc.h:122
void gnrc_sixlowpan_nd_mc_rtr_sol(gnrc_ipv6_netif_t *iface)
Multicasts a router solicitation over iface.
void gnrc_sixlowpan_nd_wakeup(void)
Handles registration calls after node-wakeup.
gnrc_pktsnip_t * gnrc_sixlowpan_nd_opt_ar_build(uint8_t status, uint16_t ltime, eui64_t *eui64, gnrc_pktsnip_t *next)
Builds the address registration option.