Loading...
Searching...
No Matches

DHCPv6 client definitions. More...

Detailed Description

DHCPv6 client definitions.

Author
Martine Lenders m.len.nosp@m.ders.nosp@m.@fu-b.nosp@m.erli.nosp@m.n.de

Definition in file client.h.

#include "byteorder.h"
#include "event.h"
#include "net/ipv6/addr.h"
#include "thread.h"
+ Include dependency graph for client.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dhcpv6_duid_l2_t
 DUID based on link-layer address plus time. More...
 

Macros

#define DHCPV6_CLIENT_DUID_LEN   (sizeof(dhcpv6_duid_l2_t) + 8U)
 Static length of the DUID.
 
#define DHCPV6_CLIENT_BUFLEN   (256)
 default length for send and receive buffer
 
#define CONFIG_DHCPV6_CLIENT_PFX_LEASE_MAX   (1U)
 Maximum number of prefix leases to be stored.
 
#define CONFIG_DHCPV6_CLIENT_ADDR_LEASE_MAX   (1U)
 Maximum number of address leases to be stored.
 
#define DHCPV6_CLIENT_ADDRS_NUMOF   ((int)(CONFIG_DHCPV6_CLIENT_ADDR_LEASE_MAX))
 Number of addresses needed for using DHCPv6 IA_NA.
 
#define CONFIG_DHCPV6_CLIENT_MUD_URL   "https://example.org"
 MUD URL (must use the https:// scheme) For more info, see the definitions below.
 

Functions

int dhcpv6_client_req_ia_na (unsigned netif)
 Configures the client to request non-temporary addresses for a network interface from a server.
 

Auto-initialization parameters

#define DHCPV6_CLIENT_STACK_SIZE   (THREAD_STACKSIZE_DEFAULT)
 stack size
 
#define DHCPV6_CLIENT_PRIORITY   (THREAD_PRIORITY_MAIN - 2)
 priority
 

DHCPv6 Manufacturer Usage Description (MUD) URL option definitions

See also
RFC 8520, section 10
#define DHCPV6_CLIENT_SEND_BUFLEN   (DHCPV6_CLIENT_BUFLEN + 256)
 Length for the send buffer if a MUD URL is included in the DHCP client's packets.
 
#define MAX_MUD_URL_LENGTH   (0xFF - sizeof(dhcpv6_opt_mud_url_t))
 Maximal length of a MUD URL.
 
enum  { DHCPV6_CLIENT_CONF_MODE_INACTIVE , DHCPV6_CLIENT_CONF_MODE_STATEFUL , DHCPV6_CLIENT_CONF_MODE_STATELESS }
 Definition of DHCPv6 client configuration modes. More...
 
void dhcpv6_client_set_conf_mode (uint8_t configuration_mode)
 Changes the DHCPv6 client's configuration mode.
 
uint8_t dhcpv6_client_get_conf_mode (void)
 Retrieves the DHCPv6 client's current configuration mode.
 

DHCPv6 unique identifier (DUID) definitions

See also
RFC 8415, section 11
void dhcpv6_client_auto_init (void)
 Auto-initializes the client in its own thread.
 
void dhcpv6_client_init (event_queue_t *event_queue, uint16_t netif)
 Initializes the client.
 
void dhcpv6_client_start (void)
 Let the server start listening.
 

Configuration functions

int dhcpv6_client_req_ia_pd (unsigned netif, unsigned pfx_len)
 Configures the client to request prefix delegation for a network interface from a server.
 

Stack-specific functions

These functions need to be provided by the network-stack implementation.

unsigned dhcpv6_client_get_duid_l2 (unsigned netif, dhcpv6_duid_l2_t *duid)
 Get the link-layer address DUID for the client.
 
void dhcpv6_client_conf_prefix (unsigned netif, const ipv6_addr_t *pfx, unsigned pfx_len, uint32_t valid, uint32_t pref)
 Configures a prefix delegation lease that is provided by the server.
 
static void dhcpv6_client_conf_addr (unsigned netif, const ipv6_addr_t *addr, uint32_t valid, uint32_t pref)
 Configures a address lease that is provided by the server.
 
bool dhcpv6_client_check_ia_na (unsigned netif)
 Checks if the given network interface is configured to use DHCPv6 IA_NA.
 
uint32_t dhcpv6_client_prefix_valid_until (unsigned netif, const ipv6_addr_t *pfx, unsigned pfx_len)
 Determines how long the prefix delegation lease is still valid.
 
static uint32_t dhcpv6_client_addr_valid_until (unsigned netif, const ipv6_addr_t *addr)
 Determines how long the address lease is still valid.
 

Macro Definition Documentation

◆ DHCPV6_CLIENT_SEND_BUFLEN

#define DHCPV6_CLIENT_SEND_BUFLEN   (DHCPV6_CLIENT_BUFLEN + 256)

Length for the send buffer if a MUD URL is included in the DHCP client's packets.

Note
Only (re)defined by the dhcpv6_client_mud_url pseudo-module.

Definition at line 281 of file client.h.

◆ MAX_MUD_URL_LENGTH

#define MAX_MUD_URL_LENGTH   (0xFF - sizeof(dhcpv6_opt_mud_url_t))

Maximal length of a MUD URL.

Definition at line 289 of file client.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition of DHCPv6 client configuration modes.

Definition at line 294 of file client.h.

Function Documentation

◆ dhcpv6_client_addr_valid_until()

static uint32_t dhcpv6_client_addr_valid_until ( unsigned  netif,
const ipv6_addr_t addr 
)
inlinestatic

Determines how long the address lease is still valid.

Parameters
[in]netifNetwork interface the address was for.
[in]addrThe assigned address.
Returns
Remaining valid lifetime of the address lease in seconds.

Definition at line 260 of file client.h.

◆ dhcpv6_client_check_ia_na()

bool dhcpv6_client_check_ia_na ( unsigned  netif)

Checks if the given network interface is configured to use DHCPv6 IA_NA.

Parameters
[in]netifNetwork interface to check.
Returns
true, if the network interface is set up for IA_NA.

◆ dhcpv6_client_conf_addr()

static void dhcpv6_client_conf_addr ( unsigned  netif,
const ipv6_addr_t addr,
uint32_t  valid,
uint32_t  pref 
)
inlinestatic

Configures a address lease that is provided by the server.

Parameters
[in]netifNetwork interface the address was for.
[in]addrThe assigned address.
[in]validValid lifetime of the address.
[in]prefPreferred lifetime of the address.

Definition at line 223 of file client.h.

◆ dhcpv6_client_conf_prefix()

void dhcpv6_client_conf_prefix ( unsigned  netif,
const ipv6_addr_t pfx,
unsigned  pfx_len,
uint32_t  valid,
uint32_t  pref 
)

Configures a prefix delegation lease that is provided by the server.

Parameters
[in]netifNetwork interface the prefix delegation was for.
[in]pfxPrefix for the prefix delegation.
[in]pfx_lenLength of pfx in bits.
[in]validValid lifetime of the prefix delegation.
[in]prefPreferred lifetime of the prefix delegation.

◆ dhcpv6_client_get_conf_mode()

uint8_t dhcpv6_client_get_conf_mode ( void  )

Retrieves the DHCPv6 client's current configuration mode.

Returns
The current configuration mode.

◆ dhcpv6_client_get_duid_l2()

unsigned dhcpv6_client_get_duid_l2 ( unsigned  netif,
dhcpv6_duid_l2_t duid 
)

Get the link-layer address DUID for the client.

Parameters
[in]netifThe network interface the client is bound to. May be SOCK_ADDR_ANY_NETIF for any interface.
[out]duidThe resulting DUID.
Returns
length of the duid on success.
0, on error.

◆ dhcpv6_client_prefix_valid_until()

uint32_t dhcpv6_client_prefix_valid_until ( unsigned  netif,
const ipv6_addr_t pfx,
unsigned  pfx_len 
)

Determines how long the prefix delegation lease is still valid.

Parameters
[in]netifNetwork interface the prefix delegation was for.
[in]pfxPrefix of the prefix delegation
[in]pfx_lenLength of pfx in bits.
Returns
Remaining valid lifetime of the prefix delegation lease in seconds.

◆ dhcpv6_client_set_conf_mode()

void dhcpv6_client_set_conf_mode ( uint8_t  configuration_mode)

Changes the DHCPv6 client's configuration mode.

Parameters
[in]configuration_modeThe new configuration mode.