139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt#pragma once
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt/***
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt This file is part of systemd.
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt Copyright (C) 2014 Intel Corporation. All rights reserved.
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt systemd is free software; you can redistribute it and/or modify it
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt under the terms of the GNU Lesser General Public License as published by
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt the Free Software Foundation; either version 2.1 of the License, or
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt (at your option) any later version.
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt systemd is distributed in the hope that it will be useful, but
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt WITHOUT ANY WARRANTY; without even the implied warranty of
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt Lesser General Public License for more details.
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt You should have received a copy of the GNU Lesser General Public License
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt along with systemd; If not, see <http://www.gnu.org/licenses/>.
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt***/
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
631bbe71298ec892f77f44f94feb612646fe6853Patrik Flykt#include <netinet/ip6.h>
631bbe71298ec892f77f44f94feb612646fe6853Patrik Flykt#include <netinet/udp.h>
631bbe71298ec892f77f44f94feb612646fe6853Patrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt#include "macro.h"
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt#include "sparse-endian.h"
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flyktstruct DHCP6Message {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt union {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt struct {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt uint8_t type;
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt uint8_t _pad[3];
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt } _packed_;
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt be32_t transaction_id;
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt };
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt} _packed_;
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykttypedef struct DHCP6Message DHCP6Message;
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
631bbe71298ec892f77f44f94feb612646fe6853Patrik Flykt#define DHCP6_MIN_OPTIONS_SIZE \
631bbe71298ec892f77f44f94feb612646fe6853Patrik Flykt 1280 - sizeof(struct ip6_hdr) - sizeof(struct udphdr)
631bbe71298ec892f77f44f94feb612646fe6853Patrik Flykt
34e8c5a23cd1c53ef3c1169388dabe1f6dfd7319Patrik Flykt#define IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT \
34e8c5a23cd1c53ef3c1169388dabe1f6dfd7319Patrik Flykt { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
34e8c5a23cd1c53ef3c1169388dabe1f6dfd7319Patrik Flykt 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02 } } }
34e8c5a23cd1c53ef3c1169388dabe1f6dfd7319Patrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flyktenum {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_PORT_SERVER = 547,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_PORT_CLIENT = 546,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt};
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
bbfa43ca37df0718287c25a8e39ee7477ebf33f6Patrik Flykt#define DHCP6_INF_TIMEOUT 1 * USEC_PER_SEC
bbfa43ca37df0718287c25a8e39ee7477ebf33f6Patrik Flykt#define DHCP6_INF_MAX_RT 120 * USEC_PER_SEC
d1b0afe3653b4316a6361d204169620726d468a0Patrik Flykt#define DHCP6_SOL_MAX_DELAY 1 * USEC_PER_SEC
d1b0afe3653b4316a6361d204169620726d468a0Patrik Flykt#define DHCP6_SOL_TIMEOUT 1 * USEC_PER_SEC
d1b0afe3653b4316a6361d204169620726d468a0Patrik Flykt#define DHCP6_SOL_MAX_RT 120 * USEC_PER_SEC
7246333cb803b03440d3bd0bdaa233564d09b5aePatrik Flykt#define DHCP6_REQ_TIMEOUT 1 * USEC_PER_SEC
7246333cb803b03440d3bd0bdaa233564d09b5aePatrik Flykt#define DHCP6_REQ_MAX_RT 120 * USEC_PER_SEC
7246333cb803b03440d3bd0bdaa233564d09b5aePatrik Flykt#define DHCP6_REQ_MAX_RC 10
3dc34fcc97b41f8b7b019027225b121dfbb9871dPatrik Flykt#define DHCP6_REN_TIMEOUT 10 * USEC_PER_SEC
3dc34fcc97b41f8b7b019027225b121dfbb9871dPatrik Flykt#define DHCP6_REN_MAX_RT 600 * USEC_PER_SEC
3dc34fcc97b41f8b7b019027225b121dfbb9871dPatrik Flykt#define DHCP6_REB_TIMEOUT 10 * USEC_PER_SEC
3dc34fcc97b41f8b7b019027225b121dfbb9871dPatrik Flykt#define DHCP6_REB_MAX_RT 600 * USEC_PER_SEC
d1b0afe3653b4316a6361d204169620726d468a0Patrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flyktenum {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_DUID_LLT = 1,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_DUID_EN = 2,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_DUID_LL = 3,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_DUID_UUID = 4,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt};
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flyktenum DHCP6State {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATE_STOPPED = 0,
bbfa43ca37df0718287c25a8e39ee7477ebf33f6Patrik Flykt DHCP6_STATE_INFORMATION_REQUEST = 1,
d1b0afe3653b4316a6361d204169620726d468a0Patrik Flykt DHCP6_STATE_SOLICITATION = 2,
7246333cb803b03440d3bd0bdaa233564d09b5aePatrik Flykt DHCP6_STATE_REQUEST = 3,
a34b57c0d43b8bf819ccd4f62c314b41b625454dPatrik Flykt DHCP6_STATE_BOUND = 4,
3dc34fcc97b41f8b7b019027225b121dfbb9871dPatrik Flykt DHCP6_STATE_RENEW = 5,
3dc34fcc97b41f8b7b019027225b121dfbb9871dPatrik Flykt DHCP6_STATE_REBIND = 6,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt};
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flyktenum {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_SOLICIT = 1,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_ADVERTISE = 2,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_REQUEST = 3,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_CONFIRM = 4,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_RENEW = 5,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_REBIND = 6,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_REPLY = 7,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_RELEASE = 8,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_DECLINE = 9,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_RECONFIGURE = 10,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_INFORMATION_REQUEST = 11,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_RELAY_FORW = 12,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_RELAY_REPL = 13,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt _DHCP6_MESSAGE_MAX = 14,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt};
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt
6599680e2d33597f0f11a99e1c3c957b42418568Patrik Flyktenum {
6599680e2d33597f0f11a99e1c3c957b42418568Patrik Flykt DHCP6_NTP_SUBOPTION_SRV_ADDR = 1,
6599680e2d33597f0f11a99e1c3c957b42418568Patrik Flykt DHCP6_NTP_SUBOPTION_MC_ADDR = 2,
6599680e2d33597f0f11a99e1c3c957b42418568Patrik Flykt DHCP6_NTP_SUBOPTION_SRV_FQDN = 3,
6599680e2d33597f0f11a99e1c3c957b42418568Patrik Flykt};
6599680e2d33597f0f11a99e1c3c957b42418568Patrik Flykt
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flyktenum {
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATUS_SUCCESS = 0,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATUS_UNSPEC_FAIL = 1,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATUS_NO_ADDRS_AVAIL = 2,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATUS_NO_BINDING = 3,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATUS_NOT_ON_LINK = 4,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt DHCP6_STATUS_USE_MULTICAST = 5,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt _DHCP6_STATUS_MAX = 6,
139b011ab81ccea1d51f09e0261a1c390115c6ffPatrik Flykt};