dhcpv6_client_misc.h
Go to the documentation of this file.
1 /**
2  * @file dhcpv6_client_misc.h
3  * @brief Helper functions for DHCPv6 client
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 _DHCPV6_CLIENT_MISC_H
32 #define _DHCPV6_CLIENT_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "dhcpv6/dhcpv6_client.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //Tick counter to handle periodic operations
45 
46 //DHCPv6 client related functions
49 
52 
54  const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader,
55  const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary,
56  void *param);
57 
59  const Dhcpv6Message *message, size_t length);
60 
62  const Dhcpv6Message *message, size_t length);
63 
65  const Dhcpv6Option *option);
66 
68  const Dhcpv6Option *option);
69 
71  uint32_t validLifetime, uint32_t preferredLifetime);
72 
74 
76 
79 
81  Dhcpv6Option *serverIdOption);
82 
84 
86 
88  Dhcpv6State newState, systime_t delay);
89 
91 
92 //C++ guard
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t type
Definition: coap_common.h:176
int bool_t
Definition: compiler_port.h:53
DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)
Dhcpv6State
DHCPv6 client FSM states.
#define Dhcpv6ClientContext
void dhcpv6ClientTick(Dhcpv6ClientContext *context)
DHCPv6 client timer handler.
systime_t dhcpv6ClientTickCounter
uint16_t dhcpv6ClientComputeElapsedTime(Dhcpv6ClientContext *context)
Compute the time elapsed since the client sent the first message.
error_t dhcpv6ClientGenerateLinkLocalAddr(Dhcpv6ClientContext *context)
Generate a link-local address.
void dhcpv6ClientAddAddr(Dhcpv6ClientContext *context, const Ipv6Addr *addr, uint32_t validLifetime, uint32_t preferredLifetime)
Add an IPv6 address to the IA.
void dhcpv6ClientDumpConfig(Dhcpv6ClientContext *context)
Dump DHCPv6 configuration for debugging purpose.
void dhcpv6ClientLinkChangeEvent(Dhcpv6ClientContext *context)
Callback function for link change event.
void dhcpv6ClientRemoveAddr(Dhcpv6ClientContext *context, const Ipv6Addr *addr)
Remove an IPv6 address from the IA.
void dhcpv6ClientCheckTimeout(Dhcpv6ClientContext *context)
Manage DHCPv6 configuration timeout.
void dhcpv6ClientChangeState(Dhcpv6ClientContext *context, Dhcpv6State newState, systime_t delay)
Update DHCPv6 FSM state.
void dhcpv6ClientFlushAddrList(Dhcpv6ClientContext *context)
Flush the list of IPv6 addresses from the IA.
void dhcpv6ClientParseAdvertise(Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
Parse Advertise message.
error_t dhcpv6ClientSendMessage(Dhcpv6ClientContext *context, Dhcpv6MessageType type)
Send Solicit message.
error_t dhcpv6ClientParseIaAddrOption(Dhcpv6ClientContext *context, const Dhcpv6Option *option)
Parse IA Address option.
bool_t dhcpv6ClientCheckServerId(Dhcpv6ClientContext *context, Dhcpv6Option *serverIdOption)
Check the Server Identifier option.
error_t dhcpv6ClientParseIaNaOption(Dhcpv6ClientContext *context, const Dhcpv6Option *option)
Parse IA_NA option.
void dhcpv6ClientParseReply(Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
Parse Reply message.
error_t dhcpv6ClientGenerateDuid(Dhcpv6ClientContext *context)
Generate client's DUID.
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.
Dhcpv6Option
uint32_t preferredLifetime
uint32_t validLifetime
Dhcpv6Message
Dhcpv6MessageType
DHCPv6 message types.
Definition: dhcpv6_common.h:89
error_t
Error codes.
Definition: error.h:43
Ipv6Addr
Definition: ipv6.h:251
Ipv4Addr addr
Definition: nbns_common.h:123
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
#define NetRxAncillary
Definition: net_misc.h:40
uint32_t systime_t
System time.
IP pseudo header.
Definition: ip.h:99
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t length
Definition: tcp.h:368
UdpHeader
Definition: udp.h:85