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  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _NDP_MISC_H
30 #define _NDP_MISC_H
31 
32 //Dependencies
33 #include "core/net.h"
34 #include "ipv6/ndp.h"
35 
36 //C++ guard
37 #ifdef __cplusplus
38  extern "C" {
39 #endif
40 
41 //NDP related functions
43 
44 void ndpUpdateAddrList(NetInterface *interface);
45 void ndpUpdatePrefixList(NetInterface *interface);
47 
49  const Ipv6Addr *unreachableAddr, Ipv6Addr *addr);
50 
52  const Ipv6Addr *destAddr, const Ipv6Addr *nextHop);
53 
55  const Ipv6Addr *unreachableNextHop, Ipv6Addr *nextHop);
56 
57 void ndpUpdateNextHop(NetInterface *interface, const Ipv6Addr *nextHop);
58 
59 void ndpAddOption(void *message, size_t *messageLen, uint8_t type,
60  const void *value, size_t length);
61 
62 void *ndpGetOption(uint8_t *options, size_t length, uint8_t type);
63 
64 error_t ndpCheckOptions(const uint8_t *options, size_t length);
65 
66 //C++ guard
67 #ifdef __cplusplus
68  }
69 #endif
70 
71 #endif
uint8_t options[]
Definition: tcp.h:318
TCP/IP stack core.
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
uint8_t message[]
Definition: chap.h:150
error_t ndpSelectNextHop(NetInterface *interface, const Ipv6Addr *destAddr, const Ipv6Addr *unreachableNextHop, Ipv6Addr *nextHop)
Next-hop determination.
Definition: ndp_misc.c:503
void * ndpGetOption(uint8_t *options, size_t length, uint8_t type)
Find a specified option in a NDP message.
Definition: ndp_misc.c:636
__start_packed struct @183 Ipv6Addr
IPv6 network address.
char_t type
void ndpUpdateDefaultRouterList(NetInterface *interface)
Periodically update Default Router List.
Definition: ndp_misc.c:285
void ndpUpdatePrefixList(NetInterface *interface)
Periodically update Prefix List.
Definition: ndp_misc.c:249
void ndpParsePrefixInfoOption(NetInterface *interface, NdpPrefixInfoOption *option)
Parse Prefix Information Option.
Definition: ndp_misc.c:52
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:588
__start_packed struct @201 NdpPrefixInfoOption
Prefix Information option (PIO)
error_t
Error codes.
Definition: error.h:40
#define NetInterface
Definition: net.h:34
uint8_t value[]
Definition: dtls_misc.h:141
NDP (Neighbor Discovery Protocol)
error_t ndpCheckOptions(const uint8_t *options, size_t length)
Check NDP message options.
Definition: ndp_misc.c:678
void ndpUpdateAddrList(NetInterface *interface)
Manage the lifetime of IPv6 addresses.
Definition: ndp_misc.c:95
uint8_t length
Definition: dtls_misc.h:140
void ndpUpdateNextHop(NetInterface *interface, const Ipv6Addr *nextHop)
Update next-hop field of Destination Cache entries.
Definition: ndp_misc.c:549
error_t ndpSelectDefaultRouter(NetInterface *interface, const Ipv6Addr *unreachableAddr, Ipv6Addr *addr)
Default Router Selection.
Definition: ndp_misc.c:341
int bool_t
Definition: compiler_port.h:47
Ipv4Addr addr
Definition: nbns_common.h:119
MacAddr destAddr
Definition: ethernet.h:180