Helper functions for DHCPv6 client. More...
#include "core/net.h"
#include "ipv6/ipv6.h"
#include "ipv6/ipv6_misc.h"
#include "ipv6/ndp.h"
#include "dhcpv6/dhcpv6_client.h"
#include "dhcpv6/dhcpv6_client_fsm.h"
#include "dhcpv6/dhcpv6_client_misc.h"
#include "dhcpv6/dhcpv6_common.h"
#include "dhcpv6/dhcpv6_debug.h"
#include "dns/dns_common.h"
#include "date_time.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL DHCPV6_TRACE_LEVEL |
Functions | |
void | dhcpv6ClientTick (Dhcpv6ClientContext *context) |
DHCPv6 client timer handler. More... | |
void | dhcpv6ClientLinkChangeEvent (Dhcpv6ClientContext *context) |
Callback function for link change event. More... | |
error_t | dhcpv6ClientSendMessage (Dhcpv6ClientContext *context, Dhcpv6MessageType type) |
Send Solicit message. More... | |
void | dhcpv6ClientProcessMessage (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary, void *param) |
Process incoming DHCPv6 message. More... | |
void | dhcpv6ClientParseAdvertise (Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length) |
Parse Advertise message. More... | |
void | dhcpv6ClientParseReply (Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length) |
Parse Reply message. More... | |
error_t | dhcpv6ClientParseIaNaOption (Dhcpv6ClientContext *context, const Dhcpv6Option *option) |
Parse IA_NA option. More... | |
error_t | dhcpv6ClientParseIaAddrOption (Dhcpv6ClientContext *context, const Dhcpv6Option *option) |
Parse IA Address option. More... | |
void | dhcpv6ClientAddAddr (Dhcpv6ClientContext *context, const Ipv6Addr *addr, uint32_t validLifetime, uint32_t preferredLifetime) |
Add an IPv6 address to the IA. More... | |
void | dhcpv6ClientRemoveAddr (Dhcpv6ClientContext *context, const Ipv6Addr *addr) |
Remove an IPv6 address from the IA. More... | |
void | dhcpv6ClientFlushAddrList (Dhcpv6ClientContext *context) |
Flush the list of IPv6 addresses from the IA. More... | |
error_t | dhcpv6ClientGenerateDuid (Dhcpv6ClientContext *context) |
Generate client's DUID. More... | |
error_t | dhcpv6ClientGenerateLinkLocalAddr (Dhcpv6ClientContext *context) |
Generate a link-local address. More... | |
bool_t | dhcpv6ClientCheckServerId (Dhcpv6ClientContext *context, Dhcpv6Option *serverIdOption) |
Check the Server Identifier option. More... | |
void | dhcpv6ClientCheckTimeout (Dhcpv6ClientContext *context) |
Manage DHCPv6 configuration timeout. More... | |
uint16_t | dhcpv6ClientComputeElapsedTime (Dhcpv6ClientContext *context) |
Compute the time elapsed since the client sent the first message. More... | |
void | dhcpv6ClientChangeState (Dhcpv6ClientContext *context, Dhcpv6State newState, systime_t delay) |
Update DHCPv6 FSM state. More... | |
void | dhcpv6ClientDumpConfig (Dhcpv6ClientContext *context) |
Dump DHCPv6 configuration for debugging purpose. More... | |
Variables | |
systime_t | dhcpv6ClientTickCounter |
Detailed Description
Helper functions for DHCPv6 client.
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.
- Version
- 2.4.4
Definition in file dhcpv6_client_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL DHCPV6_TRACE_LEVEL |
Definition at line 32 of file dhcpv6_client_misc.c.
Function Documentation
◆ dhcpv6ClientAddAddr()
void dhcpv6ClientAddAddr | ( | Dhcpv6ClientContext * | context, |
const Ipv6Addr * | addr, | ||
uint32_t | validLifetime, | ||
uint32_t | preferredLifetime | ||
) |
Add an IPv6 address to the IA.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] addr IPv6 address to be added [in] validLifetime Valid lifetime, in seconds [in] preferredLifetime Preferred lifetime, in seconds
Definition at line 1250 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientChangeState()
void dhcpv6ClientChangeState | ( | Dhcpv6ClientContext * | context, |
Dhcpv6State | newState, | ||
systime_t | delay | ||
) |
Update DHCPv6 FSM state.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] newState New DHCPv6 state to switch to [in] delay Initial delay
Definition at line 1575 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientCheckServerId()
bool_t dhcpv6ClientCheckServerId | ( | Dhcpv6ClientContext * | context, |
Dhcpv6Option * | serverIdOption | ||
) |
Check the Server Identifier option.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] serverIdOption Pointer to the Server Identifier option
- Returns
- TRUE if the option matches the server's DUID, else FALSE
Definition at line 1475 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientCheckTimeout()
void dhcpv6ClientCheckTimeout | ( | Dhcpv6ClientContext * | context | ) |
Manage DHCPv6 configuration timeout.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
Definition at line 1501 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientComputeElapsedTime()
uint16_t dhcpv6ClientComputeElapsedTime | ( | Dhcpv6ClientContext * | context | ) |
Compute the time elapsed since the client sent the first message.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
- Returns
- The elapsed time expressed in hundredths of a second
Definition at line 1542 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientDumpConfig()
void dhcpv6ClientDumpConfig | ( | Dhcpv6ClientContext * | context | ) |
Dump DHCPv6 configuration for debugging purpose.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
Definition at line 1641 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientFlushAddrList()
void dhcpv6ClientFlushAddrList | ( | Dhcpv6ClientContext * | context | ) |
Flush the list of IPv6 addresses from the IA.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
Definition at line 1346 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientGenerateDuid()
error_t dhcpv6ClientGenerateDuid | ( | Dhcpv6ClientContext * | context | ) |
Generate client's DUID.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
- Returns
- Error code
Definition at line 1381 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientGenerateLinkLocalAddr()
error_t dhcpv6ClientGenerateLinkLocalAddr | ( | Dhcpv6ClientContext * | context | ) |
Generate a link-local address.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
- Returns
- Error code
Definition at line 1424 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientLinkChangeEvent()
void dhcpv6ClientLinkChangeEvent | ( | Dhcpv6ClientContext * | context | ) |
Callback function for link change event.
- Parameters
-
[in] context Pointer to the DHCPv6 client context
Definition at line 177 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientParseAdvertise()
void dhcpv6ClientParseAdvertise | ( | Dhcpv6ClientContext * | context, |
const Dhcpv6Message * | message, | ||
size_t | length | ||
) |
Parse Advertise message.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] message Pointer to the incoming message to parse [in] length Length of the incoming message
Definition at line 518 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientParseIaAddrOption()
error_t dhcpv6ClientParseIaAddrOption | ( | Dhcpv6ClientContext * | context, |
const Dhcpv6Option * | option | ||
) |
Parse IA Address option.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] option Pointer to the IA Address option to parse
- Returns
- Error code
Definition at line 1188 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientParseIaNaOption()
error_t dhcpv6ClientParseIaNaOption | ( | Dhcpv6ClientContext * | context, |
const Dhcpv6Option * | option | ||
) |
Parse IA_NA option.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] option Pointer to the IA_NA option to parse
- Returns
- Error code
Definition at line 1074 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientParseReply()
void dhcpv6ClientParseReply | ( | Dhcpv6ClientContext * | context, |
const Dhcpv6Message * | message, | ||
size_t | length | ||
) |
Parse Reply message.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] message Pointer to the incoming message to parse [in] length Length of the incoming message
Definition at line 694 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientProcessMessage()
void dhcpv6ClientProcessMessage | ( | NetInterface * | interface, |
const IpPseudoHeader * | pseudoHeader, | ||
const UdpHeader * | udpHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset, | ||
const NetRxAncillary * | ancillary, | ||
void * | param | ||
) |
Process incoming DHCPv6 message.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader UDP pseudo header [in] udpHeader UDP header [in] buffer Multi-part buffer containing the incoming DHCPv6 message [in] offset Offset to the first byte of the DHCPv6 message [in] ancillary Additional options passed to the stack along with the packet [in] param Pointer to the DHCPv6 client context
Definition at line 459 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientRemoveAddr()
void dhcpv6ClientRemoveAddr | ( | Dhcpv6ClientContext * | context, |
const Ipv6Addr * | addr | ||
) |
Remove an IPv6 address from the IA.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] addr IPv6 address to be removed
Definition at line 1308 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientSendMessage()
error_t dhcpv6ClientSendMessage | ( | Dhcpv6ClientContext * | context, |
Dhcpv6MessageType | type | ||
) |
Send Solicit message.
- Parameters
-
[in] context Pointer to the DHCPv6 client context [in] type DHCPv6 message type
- Returns
- Error code
Definition at line 253 of file dhcpv6_client_misc.c.
◆ dhcpv6ClientTick()
void dhcpv6ClientTick | ( | Dhcpv6ClientContext * | context | ) |
DHCPv6 client timer handler.
This routine must be periodically called by the TCP/IP stack to manage DHCPv6 client operation
- Parameters
-
[in] context Pointer to the DHCPv6 client context
Definition at line 71 of file dhcpv6_client_misc.c.
Variable Documentation
◆ dhcpv6ClientTickCounter
systime_t dhcpv6ClientTickCounter |
Definition at line 52 of file dhcpv6_client_misc.c.