ndp_misc.h
Go to the documentation of this file.
1 /**
2  * @file ndp_misc.h
3  * @brief Helper functions for NDP (Neighbor Discovery Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _NDP_MISC_H
32 #define _NDP_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ipv6/ndp.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //NDP related functions
45 
46 void ndpUpdateAddrList(NetInterface *interface);
47 void ndpUpdatePrefixList(NetInterface *interface);
49 
51  const Ipv6Addr *unreachableAddr, Ipv6Addr *addr);
52 
54  const Ipv6Addr *destAddr, const Ipv6Addr *nextHop);
55 
57  const Ipv6Addr *unreachableNextHop, Ipv6Addr *nextHop, bool_t dontRoute);
58 
59 void ndpUpdateNextHop(NetInterface *interface, const Ipv6Addr *nextHop);
60 
61 void ndpAddOption(void *message, size_t *messageLen, uint8_t type,
62  const void *value, size_t length);
63 
64 void *ndpGetOption(uint8_t *options, size_t length, uint8_t type);
65 
66 error_t ndpCheckOptions(const uint8_t *options, size_t length);
67 
68 //C++ guard
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t type
Definition: coap_common.h:176
int bool_t
Definition: compiler_port.h:53
error_t
Error codes.
Definition: error.h:43
Ipv4Addr destAddr
Definition: ipv4.h:299
Ipv6Addr
Definition: ipv6.h:251
Ipv4Addr addr
Definition: nbns_common.h:123
NDP (Neighbor Discovery Protocol)
NdpPrefixInfoOption
Definition: ndp.h:418
void ndpUpdateDefaultRouterList(NetInterface *interface)
Periodically update Default Router List.
Definition: ndp_misc.c:285
void ndpUpdateAddrList(NetInterface *interface)
Manage the lifetime of IPv6 addresses.
Definition: ndp_misc.c:97
void ndpAddOption(void *message, size_t *messageLen, uint8_t type, const void *value, size_t length)
Append an option to a NDP message.
Definition: ndp_misc.c:593
void ndpUpdateNextHop(NetInterface *interface, const Ipv6Addr *nextHop)
Update next-hop field of Destination Cache entries.
Definition: ndp_misc.c:554
void ndpUpdatePrefixList(NetInterface *interface)
Periodically update Prefix List.
Definition: ndp_misc.c:249
void * ndpGetOption(uint8_t *options, size_t length, uint8_t type)
Search a NDP message for a given option.
Definition: ndp_misc.c:641
error_t ndpSelectNextHop(NetInterface *interface, const Ipv6Addr *destAddr, const Ipv6Addr *unreachableNextHop, Ipv6Addr *nextHop, bool_t dontRoute)
Next-hop determination.
Definition: ndp_misc.c:505
error_t ndpCheckOptions(const uint8_t *options, size_t length)
Check NDP message options.
Definition: ndp_misc.c:683
error_t ndpSelectDefaultRouter(NetInterface *interface, const Ipv6Addr *unreachableAddr, Ipv6Addr *addr)
Default Router Selection.
Definition: ndp_misc.c:341
bool_t ndpIsFirstHopRouter(NetInterface *interface, const Ipv6Addr *destAddr, const Ipv6Addr *nextHop)
Check whether an address is the first-hop router for the specified destination.
Definition: ndp_misc.c:443
void ndpParsePrefixInfoOption(NetInterface *interface, NdpPrefixInfoOption *option)
Parse Prefix Information Option.
Definition: ndp_misc.c:54
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
uint8_t length
Definition: tcp.h:368
uint8_t value[]
Definition: tcp.h:369
uint8_t options[]
Definition: tcp.h:357