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-2022 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.1.8
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 length
Definition: coap_common.h:193
int bool_t
Definition: compiler_port.h:48
__start_packed struct @3 Dhcpv6Message
DHCPv6 message.
__start_packed struct @0 UdpHeader
UDP header.
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
void dhcpv6ClientAddAddr(Dhcpv6ClientContext *context, const Ipv6Addr *addr, uint32_t validLifetime, uint32_t preferredLifetime)
Add an IPv6 address to the IA.
uint32_t preferredLifetime
void dhcpv6ClientParseReply(Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
Parse Reply message.
error_t dhcpv6ClientSendMessage(Dhcpv6ClientContext *context, Dhcpv6MessageType type)
Send Solicit message.
void dhcpv6ClientFlushAddrList(Dhcpv6ClientContext *context)
Flush the list of IPv6 addresses from the IA.
error_t dhcpv6ClientParseIaNaOption(Dhcpv6ClientContext *context, const Dhcpv6Option *option)
Parse IA_NA option.
void dhcpv6ClientDumpConfig(Dhcpv6ClientContext *context)
Dump DHCPv6 configuration for debugging purpose.
IP pseudo header.
Definition: ip.h:98
systime_t dhcpv6ClientTickCounter
void dhcpv6ClientChangeState(Dhcpv6ClientContext *context, Dhcpv6State newState, systime_t delay)
Update DHCPv6 FSM state.
void dhcpv6ClientLinkChangeEvent(Dhcpv6ClientContext *context)
Callback function for link change event.
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.
char_t type
error_t
Error codes.
Definition: error.h:43
void dhcpv6ClientCheckTimeout(Dhcpv6ClientContext *context)
Manage DHCPv6 configuration timeout.
DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
#define Dhcpv6ClientContext
void dhcpv6ClientRemoveAddr(Dhcpv6ClientContext *context, const Ipv6Addr *addr)
Remove an IPv6 address from the IA.
Dhcpv6State
DHCPv6 client FSM states.
void dhcpv6ClientTick(Dhcpv6ClientContext *context)
DHCPv6 client timer handler.
uint32_t systime_t
System time.
__start_packed struct @5 Dhcpv6Option
DHCPv6 option.
error_t dhcpv6ClientGenerateDuid(Dhcpv6ClientContext *context)
Generate client's DUID.
error_t dhcpv6ClientGenerateLinkLocalAddr(Dhcpv6ClientContext *context)
Generate a link-local address.
void dhcpv6ClientParseAdvertise(Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
Parse Advertise message.
Dhcpv6MessageType
DHCPv6 message types.
Definition: dhcpv6_common.h:89
uint8_t message[]
Definition: chap.h:152
uint32_t validLifetime
error_t dhcpv6ClientParseIaAddrOption(Dhcpv6ClientContext *context, const Dhcpv6Option *option)
Parse IA Address option.
Ipv4Addr addr
Definition: nbns_common.h:121
bool_t dhcpv6ClientCheckServerId(Dhcpv6ClientContext *context, Dhcpv6Option *serverIdOption)
Check the Server Identifier option.
TCP/IP stack core.
__start_packed struct @0 Ipv6Addr
IPv6 network address.
uint16_t dhcpv6ClientComputeElapsedTime(Dhcpv6ClientContext *context)
Compute the time elapsed since the client sent the first message.