Loading...
Searching...
No Matches
_dhcpv6.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
9#pragma once
10
21
22#include <stdint.h>
23
24#include "byteorder.h"
25#include "net/ipv6/addr.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
44#define DHCPV6_ALL_RELAY_AGENTS_AND_SERVERS { 0xff, 0x02, 0x00, 0x00, \
45 0x00, 0x00, 0x00, 0x00, \
46 0x00, 0x00, 0x00, 0x00, \
47 0x00, 0x01, 0x00, 0x02 \
48 }
49
50
57#define DHCPV6_SOL_MAX_DELAY (1U)
58#define DHCPV6_SOL_TIMEOUT (1U)
59#define DHCPV6_SOL_MAX_RT (3600U)
60
61#define DHCPV6_REQ_TIMEOUT (1U)
62#define DHCPV6_REQ_MAX_RT (30U)
63#define DHCPV6_REQ_MAX_RC (10U)
64
65#define DHCPV6_REN_TIMEOUT (10U)
66#define DHCPV6_REN_MAX_RT (600U)
67
68#define DHCPV6_REB_TIMEOUT (10U)
69#define DHCPV6_REB_MAX_RT (600U)
70
71#define DHCPV6_INF_MAX_DELAY (1U)
72#define DHCPV6_INF_TIMEOUT (1U)
73#define DHCPV6_INF_MAX_RT (3600U)
74
75#define DHCPV6_IRT_DEFAULT (86400U)
76#define DHCPV6_IRT_MINIMUM (600U)
77
79
80#define DHCPV6_DUID_MAX_LEN (128U)
81
91typedef struct __attribute__((packed)) {
92 uint8_t type;
93 uint8_t tid[3];
95
101typedef struct __attribute__((packed)) {
102 uint8_t type;
103 uint8_t hop_count;
115
123
124
134typedef struct __attribute__((packed)) {
137 uint8_t data[];
139
147typedef struct __attribute__((packed)) {
150 uint8_t duid[];
152
167
181
192
198typedef struct __attribute__((packed)) {
201 uint8_t value;
203
204
218
224typedef struct __attribute__((packed)) {
227 uint16_t msg[];
229
241
247typedef struct __attribute__((packed)) {
250 uint8_t iid[];
252
265
280
295
307
318
329
335typedef struct __attribute__((packed)) {
338 char mud_string[];
340
350 uint16_t netif);
351
352#ifdef __cplusplus
353}
354#endif
355
#define DHCPV6_DUID_MAX_LEN
maximum length of DUID
Definition _dhcpv6.h:80
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:112
be_uint16_t network_uint16_t
A 16 bit integer in network byte order.
Definition byteorder.h:107
Definitions for IPv6 addresses.
DUID based on link-layer address plus time.
Definition client.h:103
Client/Server message header.
Definition _dhcpv6.h:91
uint8_t tid[3]
transaction ID
Definition _dhcpv6.h:93
uint8_t type
message type (see DHCPv6 messeg types )
Definition _dhcpv6.h:92
DHCPv6 DNS recursive name server option.
Definition _dhcpv6.h:259
network_uint16_t type
DHCPV6_OPT_DNS_RNS
Definition _dhcpv6.h:260
ipv6_addr_t dns_rns[]
addresses of DNS recursive name servers in order of preference
Definition _dhcpv6.h:262
network_uint16_t len
length of dhcpv6_opt_status_t::dns_rns in byte
Definition _dhcpv6.h:261
DHCPv6 client or server identifier option format.
Definition _dhcpv6.h:147
uint8_t duid[]
the DUID of the client or server
Definition _dhcpv6.h:150
network_uint16_t type
DHCPV6_OPT_CID or DHCPV6_OPT_SID
Definition _dhcpv6.h:148
network_uint16_t len
length of dhcpv6_opt_t::duid in byte
Definition _dhcpv6.h:149
DHCPv6 elapsed time option format.
Definition _dhcpv6.h:210
network_uint16_t len
always 2
Definition _dhcpv6.h:212
network_uint16_t elapsed_time
amount of time since client began current DHCPv6 transaction (in cs)
Definition _dhcpv6.h:216
network_uint16_t type
DHCPV6_OPT_ELAPSED_TIME
Definition _dhcpv6.h:211
DHCPv6 identity association for non-temporary addresses (IA_NA) option format.
Definition _dhcpv6.h:159
uint8_t opts[]
IA_NA options.
Definition _dhcpv6.h:165
network_uint32_t t2
DHCPv6 T2 time (in sec)
Definition _dhcpv6.h:164
network_uint32_t t1
DHCPv6 T1 time (in sec)
Definition _dhcpv6.h:163
network_uint16_t type
DHCPV6_OPT_IA_NA
Definition _dhcpv6.h:160
network_uint32_t ia_id
Unique ID for this IA_NA.
Definition _dhcpv6.h:162
network_uint16_t len
12 + length of dhcpv6_opt_ia_na_t::opts in byte
Definition _dhcpv6.h:161
DHCPv6 identity association for prefix delegation option (IA_PD) format.
Definition _dhcpv6.h:272
network_uint32_t ia_id
Unique ID for this IA_PD.
Definition _dhcpv6.h:275
network_uint16_t len
12 + length of dhcpv6_opt_ia_pd_t::opts in byte
Definition _dhcpv6.h:274
network_uint32_t t2
DHCPv6 T2 time (in sec)
Definition _dhcpv6.h:277
uint8_t opts[]
IA_PD options.
Definition _dhcpv6.h:278
network_uint32_t t1
DHCPv6 T1 time (in sec)
Definition _dhcpv6.h:276
network_uint16_t type
DHCPV6_OPT_IA_PD
Definition _dhcpv6.h:273
DHCPv6 IA address option format.
Definition _dhcpv6.h:173
network_uint32_t pref
preferred lifetime (in sec)
Definition _dhcpv6.h:177
network_uint16_t type
DHCPV6_OPT_IAADDR
Definition _dhcpv6.h:174
network_uint16_t len
25 + length of dhcpv6_opt_iapfx_t::opts in byte
Definition _dhcpv6.h:175
uint8_t opts[]
IAprefix options.
Definition _dhcpv6.h:179
network_uint32_t valid
valid lifetime (in sec)
Definition _dhcpv6.h:178
ipv6_addr_t addr
the address
Definition _dhcpv6.h:176
DHCPv6 IA prefix option format.
Definition _dhcpv6.h:286
uint8_t pfx_len
length of dhcpv6_opt_iapfx_t::pfx in bits
Definition _dhcpv6.h:291
network_uint16_t type
DHCPV6_OPT_IAPFX
Definition _dhcpv6.h:287
network_uint32_t pref
preferred lifetime (in sec)
Definition _dhcpv6.h:289
uint8_t opts[]
IAprefix options.
Definition _dhcpv6.h:293
network_uint16_t len
25 + length of dhcpv6_opt_iapfx_t::opts in byte
Definition _dhcpv6.h:288
ipv6_addr_t pfx
the prefix
Definition _dhcpv6.h:292
network_uint32_t valid
valid lifetime (in sec)
Definition _dhcpv6.h:290
DHCPv6 interface-id option.
Definition _dhcpv6.h:247
uint8_t iid[]
opaque interface identifier
Definition _dhcpv6.h:250
network_uint16_t len
length of dhcpv6_opt_iid_t::iid in byte
Definition _dhcpv6.h:249
network_uint16_t type
DHCPV6_OPT_IID
Definition _dhcpv6.h:248
DHCPv6 INF_MAX_RT option format.
Definition _dhcpv6.h:324
network_uint16_t len
always 4
Definition _dhcpv6.h:326
network_uint16_t type
DHCPV6_OPT_IMR
Definition _dhcpv6.h:325
network_uint32_t value
overriding value for INF_MAX_RT (in sec)
Definition _dhcpv6.h:327
DHCPv6 Information Refresh Time option format.
Definition _dhcpv6.h:301
network_uint16_t type
DHCPV6_OPT_IRT
Definition _dhcpv6.h:302
network_uint32_t value
Time duration relative to the current time (in sec)
Definition _dhcpv6.h:304
network_uint16_t len
always 4
Definition _dhcpv6.h:303
MUD URL DHCPv6 option format.
Definition _dhcpv6.h:335
network_uint16_t type
DHCPV6_OPT_MUD_URL
Definition _dhcpv6.h:336
network_uint16_t len
length of the mud_string in octets.
Definition _dhcpv6.h:337
char mud_string[]
MUD URL using the "https" scheme.
Definition _dhcpv6.h:338
DHCPv6 option request option format.
Definition _dhcpv6.h:187
network_uint16_t opt_codes[]
option-code for an option requested by the client
Definition _dhcpv6.h:190
network_uint16_t type
DHCPV6_OPT_ORO
Definition _dhcpv6.h:188
network_uint16_t len
2 * number of dhcpv6_opt_oro_t::opt_codes
Definition _dhcpv6.h:189
DHCPv6 preference option format.
Definition _dhcpv6.h:198
network_uint16_t len
always 1
Definition _dhcpv6.h:200
uint8_t value
preference value for the server
Definition _dhcpv6.h:201
network_uint16_t type
DHCPV6_OPT_PREF
Definition _dhcpv6.h:199
DHCPv6 relay message option.
Definition _dhcpv6.h:224
network_uint16_t len
length of dhcpv6_opt_iid_t::msg in byte
Definition _dhcpv6.h:226
uint16_t msg[]
the relayed message
Definition _dhcpv6.h:227
network_uint16_t type
DHCPV6_OPT_RELAY_MSG
Definition _dhcpv6.h:225
DHCPv6 SOL_MAX_RT option format.
Definition _dhcpv6.h:313
network_uint32_t value
overriding value for SOL_MAX_RT (in sec)
Definition _dhcpv6.h:316
network_uint16_t len
always 4
Definition _dhcpv6.h:315
network_uint16_t type
DHCPV6_OPT_SMR
Definition _dhcpv6.h:314
DHCPv6 status code option format.
Definition _dhcpv6.h:235
network_uint16_t code
status code
Definition _dhcpv6.h:238
char msg[]
UTF-8 encoded text string (not 0-terminated!)
Definition _dhcpv6.h:239
network_uint16_t len
2 + length of dhcpv6_opt_status_t::msg in byte
Definition _dhcpv6.h:237
network_uint16_t type
DHCPV6_OPT_STATUS
Definition _dhcpv6.h:236
General DHCPv6 option format.
Definition _dhcpv6.h:134
network_uint16_t type
option code
Definition _dhcpv6.h:135
uint8_t data[]
option data
Definition _dhcpv6.h:137
network_uint16_t len
length of dhcpv6_opt_t::data in byte
Definition _dhcpv6.h:136
Relay Agents/Server message format.
Definition _dhcpv6.h:101
uint8_t type
message type (see DHCPv6 messeg types )
Definition _dhcpv6.h:102
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:113
uint8_t hop_count
number of relays that have already relayed the message
Definition _dhcpv6.h:103
ipv6_addr_t link_address
optional address to identify the link on which the client is located.
Definition _dhcpv6.h:108
Generic storage DUID.
Definition _dhcpv6.h:119
dhcpv6_duid_l2_t duid_l2
DUID-L2 type.
Definition _dhcpv6.h:121
uint8_t u8[DHCPV6_DUID_MAX_LEN]
array representation
Definition _dhcpv6.h:120
Data type to represent an IPv6 address.
Definition addr.h:67