Loading...
Searching...
No Matches
_dhcpv6.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include <stdint.h>
20
21#include "byteorder.h"
22#include "net/ipv6/addr.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
41#define DHCPV6_ALL_RELAY_AGENTS_AND_SERVERS { 0xff, 0x02, 0x00, 0x00, \
42 0x00, 0x00, 0x00, 0x00, \
43 0x00, 0x00, 0x00, 0x00, \
44 0x00, 0x01, 0x00, 0x02 \
45 }
46
47
54#define DHCPV6_SOL_MAX_DELAY (1U)
55#define DHCPV6_SOL_TIMEOUT (1U)
56#define DHCPV6_SOL_MAX_RT (3600U)
57
58#define DHCPV6_REQ_TIMEOUT (1U)
59#define DHCPV6_REQ_MAX_RT (30U)
60#define DHCPV6_REQ_MAX_RC (10U)
61
62#define DHCPV6_REN_TIMEOUT (10U)
63#define DHCPV6_REN_MAX_RT (600U)
64
65#define DHCPV6_REB_TIMEOUT (10U)
66#define DHCPV6_REB_MAX_RT (600U)
67
68#define DHCPV6_INF_MAX_DELAY (1U)
69#define DHCPV6_INF_TIMEOUT (1U)
70#define DHCPV6_INF_MAX_RT (3600U)
71
72#define DHCPV6_IRT_DEFAULT (86400U)
73#define DHCPV6_IRT_MINIMUM (600U)
74
76
77#define DHCPV6_DUID_MAX_LEN (128U)
78
88typedef struct __attribute__((packed)) {
89 uint8_t type;
90 uint8_t tid[3];
92
98typedef struct __attribute__((packed)) {
99 uint8_t type;
100 uint8_t hop_count;
112
120
121
131typedef struct __attribute__((packed)) {
134 uint8_t data[];
136
144typedef struct __attribute__((packed)) {
147 uint8_t duid[];
149
164
178
189
195typedef struct __attribute__((packed)) {
198 uint8_t value;
200
201
215
221typedef struct __attribute__((packed)) {
224 uint16_t msg[];
226
238
244typedef struct __attribute__((packed)) {
247 uint8_t iid[];
249
262
277
292
304
315
326
332typedef struct __attribute__((packed)) {
335 char mud_string[];
337
347 uint16_t netif);
348
349#ifdef __cplusplus
350}
351#endif
352
#define DHCPV6_DUID_MAX_LEN
maximum length of DUID
Definition _dhcpv6.h:77
void dhcpv6_client_dns_rns_conf(const dhcpv6_opt_dns_rns_t *opt, uint16_t netif)
Configures a DNS recursive name server provided by the server.
Functions to work with different byte orders.
be_uint32_t network_uint32_t
A 32 bit integer in network byte order.
Definition byteorder.h:97
be_uint16_t network_uint16_t
A 16 bit integer in network byte order.
Definition byteorder.h:92
Definitions for IPv6 addresses.
DUID based on link-layer address plus time.
Definition client.h:100
Client/Server message header.
Definition _dhcpv6.h:88
uint8_t tid[3]
transaction ID
Definition _dhcpv6.h:90
uint8_t type
message type (see DHCPv6 messeg types )
Definition _dhcpv6.h:89
DHCPv6 DNS recursive name server option.
Definition _dhcpv6.h:256
network_uint16_t type
DHCPV6_OPT_DNS_RNS
Definition _dhcpv6.h:257
ipv6_addr_t dns_rns[]
addresses of DNS recursive name servers in order of preference
Definition _dhcpv6.h:259
network_uint16_t len
length of dhcpv6_opt_status_t::dns_rns in byte
Definition _dhcpv6.h:258
DHCPv6 client or server identifier option format.
Definition _dhcpv6.h:144
uint8_t duid[]
the DUID of the client or server
Definition _dhcpv6.h:147
network_uint16_t type
DHCPV6_OPT_CID or DHCPV6_OPT_SID
Definition _dhcpv6.h:145
network_uint16_t len
length of dhcpv6_opt_t::duid in byte
Definition _dhcpv6.h:146
DHCPv6 elapsed time option format.
Definition _dhcpv6.h:207
network_uint16_t len
always 2
Definition _dhcpv6.h:209
network_uint16_t elapsed_time
amount of time since client began current DHCPv6 transaction (in cs)
Definition _dhcpv6.h:213
network_uint16_t type
DHCPV6_OPT_ELAPSED_TIME
Definition _dhcpv6.h:208
DHCPv6 identity association for non-temporary addresses (IA_NA) option format.
Definition _dhcpv6.h:156
uint8_t opts[]
IA_NA options.
Definition _dhcpv6.h:162
network_uint32_t t2
DHCPv6 T2 time (in sec)
Definition _dhcpv6.h:161
network_uint32_t t1
DHCPv6 T1 time (in sec)
Definition _dhcpv6.h:160
network_uint16_t type
DHCPV6_OPT_IA_NA
Definition _dhcpv6.h:157
network_uint32_t ia_id
Unique ID for this IA_NA.
Definition _dhcpv6.h:159
network_uint16_t len
12 + length of dhcpv6_opt_ia_na_t::opts in byte
Definition _dhcpv6.h:158
DHCPv6 identity association for prefix delegation option (IA_PD) format.
Definition _dhcpv6.h:269
network_uint32_t ia_id
Unique ID for this IA_PD.
Definition _dhcpv6.h:272
network_uint16_t len
12 + length of dhcpv6_opt_ia_pd_t::opts in byte
Definition _dhcpv6.h:271
network_uint32_t t2
DHCPv6 T2 time (in sec)
Definition _dhcpv6.h:274
uint8_t opts[]
IA_PD options.
Definition _dhcpv6.h:275
network_uint32_t t1
DHCPv6 T1 time (in sec)
Definition _dhcpv6.h:273
network_uint16_t type
DHCPV6_OPT_IA_PD
Definition _dhcpv6.h:270
DHCPv6 IA address option format.
Definition _dhcpv6.h:170
network_uint32_t pref
preferred lifetime (in sec)
Definition _dhcpv6.h:174
network_uint16_t type
DHCPV6_OPT_IAADDR
Definition _dhcpv6.h:171
network_uint16_t len
25 + length of dhcpv6_opt_iapfx_t::opts in byte
Definition _dhcpv6.h:172
uint8_t opts[]
IAprefix options.
Definition _dhcpv6.h:176
network_uint32_t valid
valid lifetime (in sec)
Definition _dhcpv6.h:175
ipv6_addr_t addr
the address
Definition _dhcpv6.h:173
DHCPv6 IA prefix option format.
Definition _dhcpv6.h:283
uint8_t pfx_len
length of dhcpv6_opt_iapfx_t::pfx in bits
Definition _dhcpv6.h:288
network_uint16_t type
DHCPV6_OPT_IAPFX
Definition _dhcpv6.h:284
network_uint32_t pref
preferred lifetime (in sec)
Definition _dhcpv6.h:286
uint8_t opts[]
IAprefix options.
Definition _dhcpv6.h:290
network_uint16_t len
25 + length of dhcpv6_opt_iapfx_t::opts in byte
Definition _dhcpv6.h:285
ipv6_addr_t pfx
the prefix
Definition _dhcpv6.h:289
network_uint32_t valid
valid lifetime (in sec)
Definition _dhcpv6.h:287
DHCPv6 interface-id option.
Definition _dhcpv6.h:244
uint8_t iid[]
opaque interface identifier
Definition _dhcpv6.h:247
network_uint16_t len
length of dhcpv6_opt_iid_t::iid in byte
Definition _dhcpv6.h:246
network_uint16_t type
DHCPV6_OPT_IID
Definition _dhcpv6.h:245
DHCPv6 INF_MAX_RT option format.
Definition _dhcpv6.h:321
network_uint16_t len
always 4
Definition _dhcpv6.h:323
network_uint16_t type
DHCPV6_OPT_IMR
Definition _dhcpv6.h:322
network_uint32_t value
overriding value for INF_MAX_RT (in sec)
Definition _dhcpv6.h:324
DHCPv6 Information Refresh Time option format.
Definition _dhcpv6.h:298
network_uint16_t type
DHCPV6_OPT_IRT
Definition _dhcpv6.h:299
network_uint32_t value
Time duration relative to the current time (in sec)
Definition _dhcpv6.h:301
network_uint16_t len
always 4
Definition _dhcpv6.h:300
MUD URL DHCPv6 option format.
Definition _dhcpv6.h:332
network_uint16_t type
DHCPV6_OPT_MUD_URL
Definition _dhcpv6.h:333
network_uint16_t len
length of the mud_string in octets.
Definition _dhcpv6.h:334
char mud_string[]
MUD URL using the "https" scheme.
Definition _dhcpv6.h:335
DHCPv6 option request option format.
Definition _dhcpv6.h:184
network_uint16_t opt_codes[]
option-code for an option requested by the client
Definition _dhcpv6.h:187
network_uint16_t type
DHCPV6_OPT_ORO
Definition _dhcpv6.h:185
network_uint16_t len
2 * number of dhcpv6_opt_oro_t::opt_codes
Definition _dhcpv6.h:186
DHCPv6 preference option format.
Definition _dhcpv6.h:195
network_uint16_t len
always 1
Definition _dhcpv6.h:197
uint8_t value
preference value for the server
Definition _dhcpv6.h:198
network_uint16_t type
DHCPV6_OPT_PREF
Definition _dhcpv6.h:196
DHCPv6 relay message option.
Definition _dhcpv6.h:221
network_uint16_t len
length of dhcpv6_opt_iid_t::msg in byte
Definition _dhcpv6.h:223
uint16_t msg[]
the relayed message
Definition _dhcpv6.h:224
network_uint16_t type
DHCPV6_OPT_RELAY_MSG
Definition _dhcpv6.h:222
DHCPv6 SOL_MAX_RT option format.
Definition _dhcpv6.h:310
network_uint32_t value
overriding value for SOL_MAX_RT (in sec)
Definition _dhcpv6.h:313
network_uint16_t len
always 4
Definition _dhcpv6.h:312
network_uint16_t type
DHCPV6_OPT_SMR
Definition _dhcpv6.h:311
DHCPv6 status code option format.
Definition _dhcpv6.h:232
network_uint16_t code
status code
Definition _dhcpv6.h:235
char msg[]
UTF-8 encoded text string (not 0-terminated!)
Definition _dhcpv6.h:236
network_uint16_t len
2 + length of dhcpv6_opt_status_t::msg in byte
Definition _dhcpv6.h:234
network_uint16_t type
DHCPV6_OPT_STATUS
Definition _dhcpv6.h:233
General DHCPv6 option format.
Definition _dhcpv6.h:131
network_uint16_t type
option code
Definition _dhcpv6.h:132
uint8_t data[]
option data
Definition _dhcpv6.h:134
network_uint16_t len
length of dhcpv6_opt_t::data in byte
Definition _dhcpv6.h:133
Relay Agents/Server message format.
Definition _dhcpv6.h:98
uint8_t type
message type (see DHCPv6 messeg types )
Definition _dhcpv6.h:99
ipv6_addr_t peer_address
The address of the client or relay agent from which the message to be relayed was received.
Definition _dhcpv6.h:110
uint8_t hop_count
number of relays that have already relayed the message
Definition _dhcpv6.h:100
ipv6_addr_t link_address
optional address to identify the link on which the client is located.
Definition _dhcpv6.h:105
Generic storage DUID.
Definition _dhcpv6.h:116
dhcpv6_duid_l2_t duid_l2
DUID-L2 type.
Definition _dhcpv6.h:118
uint8_t u8[DHCPV6_DUID_MAX_LEN]
array representation
Definition _dhcpv6.h:117
Data type to represent an IPv6 address.
Definition addr.h:64