dhcp6-protocol.h revision bbfa43ca37df0718287c25a8e39ee7477ebf33f6
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#pragma once
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering/***
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering This file is part of systemd.
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering Copyright (C) 2014 Intel Corporation. All rights reserved.
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering systemd is free software; you can redistribute it and/or modify it
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering under the terms of the GNU Lesser General Public License as published by
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering (at your option) any later version.
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering systemd is distributed in the hope that it will be useful, but
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering Lesser General Public License for more details.
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering You should have received a copy of the GNU Lesser General Public License
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering***/
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#include <netinet/ip6.h>
4871690d9e32608bbd9b18505b5326c2079c9690Allin Cottrell#include <netinet/udp.h>
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#include "macro.h"
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering#include "sparse-endian.h"
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringstruct DHCP6Message {
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering union {
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering struct {
d025f1e4dca8fc1436aff76f9e6185fe3e728daaZbigniew Jędrzejewski-Szmek uint8_t type;
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering uint8_t _pad[3];
0b452006de98294d1690f045f6ea2f7f6630ec3bRonny Chevalier } _packed_;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering be32_t transaction_id;
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering };
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering} _packed_;
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringtypedef struct DHCP6Message DHCP6Message;
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_MIN_OPTIONS_SIZE \
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering 1280 - sizeof(struct ip6_hdr) - sizeof(struct udphdr)
3b3154df7e2773332bb814e167187367a0ccae4aLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT \
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
3b97fcbd28f92a1e51887fef5de8844a89bde523Lennart Poettering 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02 } } }
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringenum {
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_PORT_SERVER = 547,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_PORT_CLIENT = 546,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering};
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_INF_TIMEOUT 1 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_INF_MAX_RT 120 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_SOL_MAX_DELAY 1 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_SOL_TIMEOUT 1 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_SOL_MAX_RT 120 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REQ_TIMEOUT 1 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REQ_MAX_RT 120 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REQ_MAX_RC 10
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REN_TIMEOUT 10 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REN_MAX_RT 600 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REB_TIMEOUT 10 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering#define DHCP6_REB_MAX_RT 600 * USEC_PER_SEC
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringenum {
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek DHCP6_DUID_LLT = 1,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_DUID_EN = 2,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_DUID_LL = 3,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_DUID_UUID = 4,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering};
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringenum DHCP6State {
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATE_STOPPED = 0,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATE_INFORMATION_REQUEST = 1,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATE_SOLICITATION = 2,
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek DHCP6_STATE_REQUEST = 3,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATE_BOUND = 4,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATE_RENEW = 5,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATE_REBIND = 6,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering};
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringenum {
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_SOLICIT = 1,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_ADVERTISE = 2,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_REQUEST = 3,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_CONFIRM = 4,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_RENEW = 5,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_REBIND = 6,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_REPLY = 7,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_RELEASE = 8,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_DECLINE = 9,
56f64d95763a799ba4475daf44d8e9f72a1bd474Michal Schmidt DHCP6_RECONFIGURE = 10,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_INFORMATION_REQUEST = 11,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_RELAY_FORW = 12,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_RELAY_REPL = 13,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering _DHCP6_MESSAGE_MAX = 14,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering};
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringenum {
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_CLIENTID = 1,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_SERVERID = 2,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_IA_NA = 3,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_IA_TA = 4,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_IAADDR = 5,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_ORO = 6,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_PREFERENCE = 7,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_ELAPSED_TIME = 8,
3b3154df7e2773332bb814e167187367a0ccae4aLennart Poettering DHCP6_OPTION_RELAY_MSG = 9,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering /* option code 10 is unassigned */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_AUTH = 11,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_UNICAST = 12,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_STATUS_CODE = 13,
e9f600f2fb4b0df55c7a8fb4b4d09f9979997223Lennart Poettering DHCP6_OPTION_RAPID_COMMIT = 14,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_USER_CLASS = 15,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_VENDOR_CLASS = 16,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_VENDOR_OPTS = 17,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_INTERFACE_ID = 18,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_RECONF_MSG = 19,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_RECONF_ACCEPT = 20,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_DNS_SERVERS = 23, /* RFC 3646 */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_DOMAIN_LIST = 24, /* RFC 3646 */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_SNTP_SERVERS = 31, /* RFC 4075 */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering /* option code 35 is unassigned */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_OPTION_NTP_SERVER = 56, /* RFC 5908 */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering /* option codes 89-142 are unassigned */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering /* option codes 144-65535 are unassigned */
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering};
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poetteringenum {
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATUS_SUCCESS = 0,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATUS_UNSPEC_FAIL = 1,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATUS_NO_ADDRS_AVAIL = 2,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATUS_NO_BINDING = 3,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATUS_NOT_ON_LINK = 4,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering DHCP6_STATUS_USE_MULTICAST = 5,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering _DHCP6_STATUS_MAX = 6,
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering};
ef63833d532dd86bdba63211e6a1363cbb3ef61dLennart Poettering