]> git.proxmox.com Git - systemd.git/blame - src/libsystemd-network/dhcp6-internal.h
Imported Upstream version 218
[systemd.git] / src / libsystemd-network / dhcp6-internal.h
CommitLineData
e842803a
MB
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
24#include <net/ethernet.h>
25#include <netinet/in.h>
26
27#include "sparse-endian.h"
28#include "sd-event.h"
29#include "list.h"
30#include "macro.h"
31
32typedef struct DHCP6Address DHCP6Address;
33
34struct DHCP6Address {
35 LIST_FIELDS(DHCP6Address, addresses);
36
37 struct {
38 struct in6_addr address;
39 be32_t lifetime_preferred;
40 be32_t lifetime_valid;
5eef597e 41 } iaaddr _packed_;
e842803a
MB
42};
43
44struct DHCP6IA {
45 uint16_t type;
46 struct {
47 be32_t id;
48 be32_t lifetime_t1;
49 be32_t lifetime_t2;
50 } _packed_;
51 sd_event_source *timeout_t1;
52 sd_event_source *timeout_t2;
53
54 LIST_HEAD(DHCP6Address, addresses);
55};
56
57typedef struct DHCP6IA DHCP6IA;
58
f47781d8 59#define log_dhcp6_client(p, fmt, ...) log_internal(LOG_DEBUG, 0, __FILE__, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__)
e842803a
MB
60
61int dhcp_network_icmp6_bind_router_solicitation(int index);
62int dhcp_network_icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr);
63
64int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code,
65 size_t optlen, const void *optval);
66int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia);
67int dhcp6_option_parse(uint8_t **buf, size_t *buflen, uint16_t *optcode,
68 size_t *optlen, uint8_t **optvalue);
69int dhcp6_option_parse_ia(uint8_t **buf, size_t *buflen, uint16_t iatype,
70 DHCP6IA *ia);
71
72int dhcp6_network_bind_udp_socket(int index, struct in6_addr *address);
73int dhcp6_network_send_udp_socket(int s, struct in6_addr *address,
74 const void *packet, size_t len);
75
76const char *dhcp6_message_type_to_string(int s) _const_;
77int dhcp6_message_type_from_string(const char *s) _pure_;
78const char *dhcp6_message_status_to_string(int s) _const_;
79int dhcp6_message_status_from_string(const char *s) _pure_;