]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd-network/dhcp6-protocol.h
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]
[thirdparty/systemd.git] / src / libsystemd-network / dhcp6-protocol.h
CommitLineData
139b011a
PF
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright (C) 2014 Intel Corporation. All rights reserved.
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
631bbe71
PF
24#include <netinet/ip6.h>
25#include <netinet/udp.h>
26
139b011a
PF
27#include "macro.h"
28#include "sparse-endian.h"
29
30struct DHCP6Message {
31 union {
32 struct {
33 uint8_t type;
34 uint8_t _pad[3];
35 } _packed_;
36 be32_t transaction_id;
37 };
38} _packed_;
39
40typedef struct DHCP6Message DHCP6Message;
41
631bbe71
PF
42#define DHCP6_MIN_OPTIONS_SIZE \
43 1280 - sizeof(struct ip6_hdr) - sizeof(struct udphdr)
44
34e8c5a2
PF
45#define IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT \
46 { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02 } } }
48
139b011a
PF
49enum {
50 DHCP6_PORT_SERVER = 547,
51 DHCP6_PORT_CLIENT = 546,
52};
53
bbfa43ca
PF
54#define DHCP6_INF_TIMEOUT 1 * USEC_PER_SEC
55#define DHCP6_INF_MAX_RT 120 * USEC_PER_SEC
d1b0afe3
PF
56#define DHCP6_SOL_MAX_DELAY 1 * USEC_PER_SEC
57#define DHCP6_SOL_TIMEOUT 1 * USEC_PER_SEC
58#define DHCP6_SOL_MAX_RT 120 * USEC_PER_SEC
7246333c
PF
59#define DHCP6_REQ_TIMEOUT 1 * USEC_PER_SEC
60#define DHCP6_REQ_MAX_RT 120 * USEC_PER_SEC
61#define DHCP6_REQ_MAX_RC 10
3dc34fcc
PF
62#define DHCP6_REN_TIMEOUT 10 * USEC_PER_SEC
63#define DHCP6_REN_MAX_RT 600 * USEC_PER_SEC
64#define DHCP6_REB_TIMEOUT 10 * USEC_PER_SEC
65#define DHCP6_REB_MAX_RT 600 * USEC_PER_SEC
d1b0afe3 66
139b011a
PF
67enum {
68 DHCP6_DUID_LLT = 1,
69 DHCP6_DUID_EN = 2,
70 DHCP6_DUID_LL = 3,
71 DHCP6_DUID_UUID = 4,
72};
73
74enum DHCP6State {
75 DHCP6_STATE_STOPPED = 0,
bbfa43ca 76 DHCP6_STATE_INFORMATION_REQUEST = 1,
d1b0afe3 77 DHCP6_STATE_SOLICITATION = 2,
7246333c 78 DHCP6_STATE_REQUEST = 3,
a34b57c0 79 DHCP6_STATE_BOUND = 4,
3dc34fcc
PF
80 DHCP6_STATE_RENEW = 5,
81 DHCP6_STATE_REBIND = 6,
139b011a
PF
82};
83
84enum {
85 DHCP6_SOLICIT = 1,
86 DHCP6_ADVERTISE = 2,
87 DHCP6_REQUEST = 3,
88 DHCP6_CONFIRM = 4,
89 DHCP6_RENEW = 5,
90 DHCP6_REBIND = 6,
91 DHCP6_REPLY = 7,
92 DHCP6_RELEASE = 8,
93 DHCP6_DECLINE = 9,
94 DHCP6_RECONFIGURE = 10,
95 DHCP6_INFORMATION_REQUEST = 11,
96 DHCP6_RELAY_FORW = 12,
97 DHCP6_RELAY_REPL = 13,
98 _DHCP6_MESSAGE_MAX = 14,
99};
100
101enum {
102 DHCP6_OPTION_CLIENTID = 1,
103 DHCP6_OPTION_SERVERID = 2,
104 DHCP6_OPTION_IA_NA = 3,
105 DHCP6_OPTION_IA_TA = 4,
106 DHCP6_OPTION_IAADDR = 5,
107 DHCP6_OPTION_ORO = 6,
108 DHCP6_OPTION_PREFERENCE = 7,
109 DHCP6_OPTION_ELAPSED_TIME = 8,
110 DHCP6_OPTION_RELAY_MSG = 9,
111 /* option code 10 is unassigned */
112 DHCP6_OPTION_AUTH = 11,
113 DHCP6_OPTION_UNICAST = 12,
114 DHCP6_OPTION_STATUS_CODE = 13,
115 DHCP6_OPTION_RAPID_COMMIT = 14,
116 DHCP6_OPTION_USER_CLASS = 15,
117 DHCP6_OPTION_VENDOR_CLASS = 16,
118 DHCP6_OPTION_VENDOR_OPTS = 17,
119 DHCP6_OPTION_INTERFACE_ID = 18,
120 DHCP6_OPTION_RECONF_MSG = 19,
121 DHCP6_OPTION_RECONF_ACCEPT = 20,
da6fe470
PF
122
123 DHCP6_OPTION_DNS_SERVERS = 23, /* RFC 3646 */
124 DHCP6_OPTION_DOMAIN_LIST = 24, /* RFC 3646 */
125
41e4615d 126 DHCP6_OPTION_SNTP_SERVERS = 31, /* RFC 4075, deprecated */
da6fe470
PF
127
128 /* option code 35 is unassigned */
129
130 DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */
131
132 /* option codes 89-142 are unassigned */
133 /* option codes 144-65535 are unassigned */
139b011a
PF
134};
135
6599680e
PF
136enum {
137 DHCP6_NTP_SUBOPTION_SRV_ADDR = 1,
138 DHCP6_NTP_SUBOPTION_MC_ADDR = 2,
139 DHCP6_NTP_SUBOPTION_SRV_FQDN = 3,
140};
141
139b011a
PF
142enum {
143 DHCP6_STATUS_SUCCESS = 0,
144 DHCP6_STATUS_UNSPEC_FAIL = 1,
145 DHCP6_STATUS_NO_ADDRS_AVAIL = 2,
146 DHCP6_STATUS_NO_BINDING = 3,
147 DHCP6_STATUS_NOT_ON_LINK = 4,
148 DHCP6_STATUS_USE_MULTICAST = 5,
149 _DHCP6_STATUS_MAX = 6,
150};