]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd-network/dhcp6-protocol.h
DHCP DUID, IAID configuration options
[thirdparty/systemd.git] / src / libsystemd-network / dhcp6-protocol.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright (C) 2014 Intel Corporation. All rights reserved.
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <netinet/ip6.h>
23 #include <netinet/udp.h>
24
25 #include "macro.h"
26 #include "sparse-endian.h"
27
28 struct DHCP6Message {
29 union {
30 struct {
31 uint8_t type;
32 uint8_t _pad[3];
33 } _packed_;
34 be32_t transaction_id;
35 };
36 } _packed_;
37
38 typedef struct DHCP6Message DHCP6Message;
39
40 #define DHCP6_MIN_OPTIONS_SIZE \
41 1280 - sizeof(struct ip6_hdr) - sizeof(struct udphdr)
42
43 #define IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT \
44 { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02 } } }
46
47 enum {
48 DHCP6_PORT_SERVER = 547,
49 DHCP6_PORT_CLIENT = 546,
50 };
51
52 #define DHCP6_INF_TIMEOUT 1 * USEC_PER_SEC
53 #define DHCP6_INF_MAX_RT 120 * USEC_PER_SEC
54 #define DHCP6_SOL_MAX_DELAY 1 * USEC_PER_SEC
55 #define DHCP6_SOL_TIMEOUT 1 * USEC_PER_SEC
56 #define DHCP6_SOL_MAX_RT 120 * USEC_PER_SEC
57 #define DHCP6_REQ_TIMEOUT 1 * USEC_PER_SEC
58 #define DHCP6_REQ_MAX_RT 120 * USEC_PER_SEC
59 #define DHCP6_REQ_MAX_RC 10
60 #define DHCP6_REN_TIMEOUT 10 * USEC_PER_SEC
61 #define DHCP6_REN_MAX_RT 600 * USEC_PER_SEC
62 #define DHCP6_REB_TIMEOUT 10 * USEC_PER_SEC
63 #define DHCP6_REB_MAX_RT 600 * USEC_PER_SEC
64
65 enum DHCP6State {
66 DHCP6_STATE_STOPPED = 0,
67 DHCP6_STATE_INFORMATION_REQUEST = 1,
68 DHCP6_STATE_SOLICITATION = 2,
69 DHCP6_STATE_REQUEST = 3,
70 DHCP6_STATE_BOUND = 4,
71 DHCP6_STATE_RENEW = 5,
72 DHCP6_STATE_REBIND = 6,
73 };
74
75 enum {
76 DHCP6_SOLICIT = 1,
77 DHCP6_ADVERTISE = 2,
78 DHCP6_REQUEST = 3,
79 DHCP6_CONFIRM = 4,
80 DHCP6_RENEW = 5,
81 DHCP6_REBIND = 6,
82 DHCP6_REPLY = 7,
83 DHCP6_RELEASE = 8,
84 DHCP6_DECLINE = 9,
85 DHCP6_RECONFIGURE = 10,
86 DHCP6_INFORMATION_REQUEST = 11,
87 DHCP6_RELAY_FORW = 12,
88 DHCP6_RELAY_REPL = 13,
89 _DHCP6_MESSAGE_MAX = 14,
90 };
91
92 enum {
93 DHCP6_NTP_SUBOPTION_SRV_ADDR = 1,
94 DHCP6_NTP_SUBOPTION_MC_ADDR = 2,
95 DHCP6_NTP_SUBOPTION_SRV_FQDN = 3,
96 };
97
98 enum {
99 DHCP6_STATUS_SUCCESS = 0,
100 DHCP6_STATUS_UNSPEC_FAIL = 1,
101 DHCP6_STATUS_NO_ADDRS_AVAIL = 2,
102 DHCP6_STATUS_NO_BINDING = 3,
103 DHCP6_STATUS_NOT_ON_LINK = 4,
104 DHCP6_STATUS_USE_MULTICAST = 5,
105 _DHCP6_STATUS_MAX = 6,
106 };