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-2019 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 1.9.6
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, uint_t flags);
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 length
Definition: dtls_misc.h:149
int bool_t
Definition: compiler_port.h:49
error_t ndpCheckOptions(const uint8_t *options, size_t length)
Check NDP message options.
Definition: ndp_misc.c:687
void ndpUpdateAddrList(NetInterface *interface)
Manage the lifetime of IPv6 addresses.
Definition: ndp_misc.c:97
void ndpParsePrefixInfoOption(NetInterface *interface, NdpPrefixInfoOption *option)
Parse Prefix Information Option.
Definition: ndp_misc.c:54
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:597
MacAddr destAddr
Definition: ethernet.h:192
void ndpUpdateDefaultRouterList(NetInterface *interface)
Periodically update Default Router List.
Definition: ndp_misc.c:287
__start_packed struct @197 NdpPrefixInfoOption
Prefix Information option (PIO)
char_t type
error_t
Error codes.
Definition: error.h:42
#define NetInterface
Definition: net.h:36
uint8_t options[]
Definition: tcp.h:320
error_t ndpSelectDefaultRouter(NetInterface *interface, const Ipv6Addr *unreachableAddr, Ipv6Addr *addr)
Default Router Selection.
Definition: ndp_misc.c:343
__start_packed struct @179 Ipv6Addr
IPv6 network address.
NDP (Neighbor Discovery Protocol)
uint8_t flags
Definition: tcp.h:314
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:445
uint8_t message[]
Definition: chap.h:152
Ipv4Addr addr
Definition: nbns_common.h:121
void ndpUpdatePrefixList(NetInterface *interface)
Periodically update Prefix List.
Definition: ndp_misc.c:251
uint8_t value[]
Definition: dtls_misc.h:150
unsigned int uint_t
Definition: compiler_port.h:45
TCP/IP stack core.
void ndpUpdateNextHop(NetInterface *interface, const Ipv6Addr *nextHop)
Update next-hop field of Destination Cache entries.
Definition: ndp_misc.c:558
error_t ndpSelectNextHop(NetInterface *interface, const Ipv6Addr *destAddr, const Ipv6Addr *unreachableNextHop, Ipv6Addr *nextHop, uint_t flags)
Next-hop determination.
Definition: ndp_misc.c:506
void * ndpGetOption(uint8_t *options, size_t length, uint8_t type)
Find a specified option in a NDP message.
Definition: ndp_misc.c:645