ndp_misc.h File Reference

Helper functions for NDP (Neighbor Discovery Protocol) More...

#include "core/net.h"
#include "ipv6/ndp.h"

Go to the source code of this file.

Functions

void ndpParsePrefixInfoOption (NetInterface *interface, NdpPrefixInfoOption *option)
 Parse Prefix Information Option. More...
 
void ndpUpdateAddrList (NetInterface *interface)
 Manage the lifetime of IPv6 addresses. More...
 
void ndpUpdatePrefixList (NetInterface *interface)
 Periodically update Prefix List. More...
 
void ndpUpdateDefaultRouterList (NetInterface *interface)
 Periodically update Default Router List. More...
 
error_t ndpSelectDefaultRouter (NetInterface *interface, const Ipv6Addr *unreachableAddr, Ipv6Addr *addr)
 Default Router Selection. More...
 
bool_t ndpIsFirstHopRouter (NetInterface *interface, const Ipv6Addr *destAddr, const Ipv6Addr *nextHop)
 Check whether an address is the first-hop router for the specified destination. More...
 
error_t ndpSelectNextHop (NetInterface *interface, const Ipv6Addr *destAddr, const Ipv6Addr *unreachableNextHop, Ipv6Addr *nextHop, bool_t dontRoute)
 Next-hop determination. More...
 
void ndpUpdateNextHop (NetInterface *interface, const Ipv6Addr *nextHop)
 Update next-hop field of Destination Cache entries. More...
 
void ndpAddOption (void *message, size_t *messageLen, uint8_t type, const void *value, size_t length)
 Append an option to a NDP message. More...
 
void * ndpGetOption (uint8_t *options, size_t length, uint8_t type)
 Search a NDP message for a given option. More...
 
error_t ndpCheckOptions (const uint8_t *options, size_t length)
 Check NDP message options. More...
 

Detailed Description

Helper functions for NDP (Neighbor Discovery Protocol)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file ndp_misc.h.

Function Documentation

◆ ndpAddOption()

void ndpAddOption ( void *  message,
size_t *  messageLen,
uint8_t  type,
const void *  value,
size_t  length 
)

Append an option to a NDP message.

Parameters
[in]messagePointer to the NDP message
[in,out]messageLenLength of the entire message
[in]typeOption type
[in]valueOption value
[in]lengthLength of the option value

Definition at line 605 of file ndp_misc.c.

◆ ndpCheckOptions()

error_t ndpCheckOptions ( const uint8_t *  options,
size_t  length 
)

Check NDP message options.

Parameters
[in]optionsPointer to the Options field
[in]lengthLength of the Options field
Returns
Error code

Definition at line 696 of file ndp_misc.c.

◆ ndpGetOption()

void* ndpGetOption ( uint8_t *  options,
size_t  length,
uint8_t  type 
)

Search a NDP message for a given option.

Parameters
[in]optionsPointer to the Options field
[in]lengthLength of the Options field
[in]typeType of the option to find
Returns
If the specified option is found, a pointer to the corresponding option is returned. Otherwise NULL pointer is returned

Definition at line 653 of file ndp_misc.c.

◆ ndpIsFirstHopRouter()

bool_t ndpIsFirstHopRouter ( NetInterface interface,
const Ipv6Addr destAddr,
const Ipv6Addr nextHop 
)

Check whether an address is the first-hop router for the specified destination.

Parameters
[in]interfaceUnderlying network interface
[in]destAddrDestination address
[in]nextHopFirst-hop address to be checked
Returns
TRUE if the address is the first-hop router, else FALSE

Definition at line 455 of file ndp_misc.c.

◆ ndpParsePrefixInfoOption()

void ndpParsePrefixInfoOption ( NetInterface interface,
NdpPrefixInfoOption option 
)

Parse Prefix Information Option.

Parameters
[in]interfaceUnderlying network interface
[in]optionPointer to the Prefix Information option

Definition at line 55 of file ndp_misc.c.

◆ ndpSelectDefaultRouter()

error_t ndpSelectDefaultRouter ( NetInterface interface,
const Ipv6Addr unreachableAddr,
Ipv6Addr addr 
)

Default Router Selection.

Parameters
[in]interfaceUnderlying network interface
[in]unreachableAddrIPv6 address of the unreachable router (optional parameter)
[out]addrIPv6 address of the default router to be used
Returns
Error code

Definition at line 353 of file ndp_misc.c.

◆ ndpSelectNextHop()

error_t ndpSelectNextHop ( NetInterface interface,
const Ipv6Addr destAddr,
const Ipv6Addr unreachableNextHop,
Ipv6Addr nextHop,
bool_t  dontRoute 
)

Next-hop determination.

Parameters
[in]interfaceUnderlying network interface
[in]destAddrDestination address
[in]unreachableNextHopAddress of the unreachable next-hop (optional parameter)
[out]nextHopNext-hop address to be used
[in]dontRouteDo not send the packet via a router
Returns
Error code

Definition at line 517 of file ndp_misc.c.

◆ ndpUpdateAddrList()

void ndpUpdateAddrList ( NetInterface interface)

Manage the lifetime of IPv6 addresses.

Parameters
[in]interfaceUnderlying network interface

Definition at line 98 of file ndp_misc.c.

◆ ndpUpdateDefaultRouterList()

void ndpUpdateDefaultRouterList ( NetInterface interface)

Periodically update Default Router List.

Parameters
[in]interfaceUnderlying network interface

Definition at line 297 of file ndp_misc.c.

◆ ndpUpdateNextHop()

void ndpUpdateNextHop ( NetInterface interface,
const Ipv6Addr unreachableNextHop 
)

Update next-hop field of Destination Cache entries.

Parameters
[in]interfaceUnderlying network interface
[in]unreachableNextHopAddress of the unreachable next-hop

Definition at line 566 of file ndp_misc.c.

◆ ndpUpdatePrefixList()

void ndpUpdatePrefixList ( NetInterface interface)

Periodically update Prefix List.

Parameters
[in]interfaceUnderlying network interface

Definition at line 261 of file ndp_misc.c.