ndp/internal.h
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 GNRC_NDP_INTERNAL_H
23 #define GNRC_NDP_INTERNAL_H
24 
25 #include "kernel_types.h"
26 #include "net/gnrc/ipv6/nc.h"
27 #include "net/ipv6/addr.h"
28 #include "net/ipv6/hdr.h"
29 #include "net/ndp.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
47 ipv6_addr_t *gnrc_ndp_internal_default_router(void);
48 
57 void gnrc_ndp_internal_set_state(gnrc_ipv6_nc_t *nc_entry, uint8_t state);
58 
72 void gnrc_ndp_internal_send_nbr_sol(kernel_pid_t iface, ipv6_addr_t *src, ipv6_addr_t *tgt,
73  ipv6_addr_t *dst);
74 
92 void gnrc_ndp_internal_send_nbr_adv(kernel_pid_t iface, ipv6_addr_t *tgt, ipv6_addr_t *dst,
93  bool supply_tl2a, gnrc_pktsnip_t *ext_opts);
94 
103 void gnrc_ndp_internal_send_rtr_sol(kernel_pid_t iface, ipv6_addr_t *dst);
104 
105 #if (defined(MODULE_GNRC_NDP_ROUTER) || defined(MODULE_GNRC_SIXLOWPAN_ND_ROUTER))
106 
117 void gnrc_ndp_internal_send_rtr_adv(kernel_pid_t iface, ipv6_addr_t *src,
118  ipv6_addr_t *dst, bool fin);
119 #else
120 
126 #define gnrc_ndp_internal_send_rtr_adv(iface, src, dst, fin)
127 #endif
128 
142 int gnrc_ndp_internal_sl2a_opt_handle(gnrc_pktsnip_t *pkt, ipv6_hdr_t *ipv6, uint8_t icmpv6_type,
143  ndp_opt_t *sl2a_opt, uint8_t *l2addr);
144 
158 int gnrc_ndp_internal_tl2a_opt_handle(gnrc_pktsnip_t *pkt, ipv6_hdr_t *ipv6,
159  uint8_t icmpv6_type, ndp_opt_t *tl2a_opt,
160  uint8_t *l2addr);
161 
174 bool gnrc_ndp_internal_mtu_opt_handle(kernel_pid_t iface, uint8_t icmpv6_type,
175  ndp_opt_mtu_t *mtu_opt);
176 
189 bool gnrc_ndp_internal_pi_opt_handle(kernel_pid_t iface, uint8_t icmpv6_type,
190  ndp_opt_pi_t *pi_opt);
191 
202 static inline void gnrc_ndp_internal_reset_nbr_sol_timer(gnrc_ipv6_nc_t *nc_entry, uint32_t delay,
203  uint16_t type, kernel_pid_t pid)
204 {
205  xtimer_remove(&nc_entry->nbr_sol_timer);
206  nc_entry->nbr_sol_msg.type = type;
207  xtimer_set_msg(&nc_entry->nbr_sol_timer, delay, &nc_entry->nbr_sol_msg, pid);
208 }
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* GNRC_NDP_INTERNAL_H */
215 
Types used by the kernel.
Definitions for IPv6 addresses.
Prefix information option format.
Definition: ndp.h:253
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
MTU option format.
Definition: ndp.h:282
Data type to represent an IPv6 packet header.
Definition: ipv6/hdr.h:68
General NDP option format.
Definition: ndp.h:239
Neighbor cache definitions.
IPv6 header type and helper function definitions.
msg_t nbr_sol_msg
msg_t for gnrc_ipv6_nc_t::nbr_sol_timer
Definition: nc.h:139
void delay(unsigned long msec)
Sleep for a given amount of time [milliseconds].
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
static void xtimer_set_msg(xtimer_t *timer, uint32_t offset, msg_t *msg, kernel_pid_t target_pid)
Set a timer that sends a message.
IPv6 neighbor discovery message type definitions.
void xtimer_remove(xtimer_t *timer)
remove a timer
Neighbor cache entry as defined in RFC 4861, section 5.1 .
Definition: nc.h:122
xtimer_t nbr_sol_timer
(Re)Transmission timer for neighbor solicitations of this entry and timeout for states.
Definition: nc.h:138
uint16_t type
Type field.
Definition: msg.h:187