client.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef NET_DHCPV6_CLIENT_H
21 #define NET_DHCPV6_CLIENT_H
22 
23 #include "byteorder.h"
24 #include "event.h"
25 #include "net/ipv6/addr.h"
26 #include "thread.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #ifndef DHCPV6_CLIENT_STACK_SIZE
36 #define DHCPV6_CLIENT_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
37 #endif
38 
39 #ifndef DHCPV6_CLIENT_PRIORITY
40 #define DHCPV6_CLIENT_PRIORITY (THREAD_PRIORITY_MAIN - 2)
41 #endif
42 
47 #define DHCPV6_CLIENT_DUID_LEN (sizeof(dhcpv6_duid_l2_t) + 8U)
48 #define DHCPV6_CLIENT_BUFLEN (256)
58 #ifndef CONFIG_DHCPV6_CLIENT_PFX_LEASE_MAX
59 #define CONFIG_DHCPV6_CLIENT_PFX_LEASE_MAX (1U)
60 #endif
61 
71 typedef struct __attribute__((packed)) {
74  /* link-layer address follows this header */
76 
77 #if defined(MODULE_AUTO_INIT_DHCPV6_CLIENT) || defined(DOXYGEN)
78 
84 void dhcpv6_client_auto_init(void);
85 #endif /* MODULE_DHCPV6_CLIENT_AUTO_INIT */
86 
97 void dhcpv6_client_init(event_queue_t *event_queue, uint16_t netif);
98 
105 void dhcpv6_client_start(void);
106 
122 void dhcpv6_client_req_ia_pd(unsigned netif, unsigned pfx_len);
141 unsigned dhcpv6_client_get_duid_l2(unsigned netif, dhcpv6_duid_l2_t *duid);
142 
152 void dhcpv6_client_conf_prefix(unsigned netif, const ipv6_addr_t *pfx,
153  unsigned pfx_len, uint32_t valid,
154  uint32_t pref);
155 
165 uint32_t dhcpv6_client_prefix_valid_until(unsigned netif,
166  const ipv6_addr_t *pfx,
167  unsigned pfx_len);
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 #endif /* NET_DHCPV6_CLIENT_H */
175 
dhcpv6_duid_l2_t
DUID based on link-layer address plus time.
Definition: client.h:71
dhcpv6_duid_l2_t::l2type
network_uint16_t l2type
hardware type)
Definition: client.h:73
byteorder.h
Functions to work with different byte orders.
be_uint16_t
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:77
ipv6_addr_t
Data type to represent an IPv6 address.
Definition: addr.h:74
addr.h
Definitions for IPv6 addresses.
event_queue_t
event queue structure
Definition: event.h:150
dhcpv6_client_init
void dhcpv6_client_init(event_queue_t *event_queue, uint16_t netif)
Initializes the client.
dhcpv6_duid_l2_t::type
network_uint16_t type
DHCPV6_DUID_TYPE_L2
Definition: client.h:72
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.
dhcpv6_client_start
void dhcpv6_client_start(void)
Let the server start listening.
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.
dhcpv6_client_auto_init
void dhcpv6_client_auto_init(void)
Auto-initializes the client in its own thread.
dhcpv6_client_req_ia_pd
void dhcpv6_client_req_ia_pd(unsigned netif, unsigned pfx_len)
Configures the client to request prefix delegation for a network interface from a server.
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.