]>
Commit | Line | Data |
---|---|---|
e3169126 PF |
1 | #pragma once |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
b553817c | 6 | Copyright (C) 2014-2015 Intel Corporation. All rights reserved. |
e3169126 PF |
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 <net/ethernet.h> | |
f12abb48 PF |
23 | #include <netinet/in.h> |
24 | ||
f12abb48 | 25 | #include "sd-event.h" |
07630cea | 26 | |
f12abb48 | 27 | #include "list.h" |
a9aff361 | 28 | #include "macro.h" |
07630cea | 29 | #include "sparse-endian.h" |
f12abb48 PF |
30 | |
31 | typedef struct DHCP6Address DHCP6Address; | |
32 | ||
33 | struct DHCP6Address { | |
34 | LIST_FIELDS(DHCP6Address, addresses); | |
35 | ||
36 | struct { | |
37 | struct in6_addr address; | |
38 | be32_t lifetime_preferred; | |
39 | be32_t lifetime_valid; | |
ee3a5027 | 40 | } iaaddr _packed_; |
f12abb48 PF |
41 | }; |
42 | ||
43 | struct DHCP6IA { | |
44 | uint16_t type; | |
45 | struct { | |
46 | be32_t id; | |
47 | be32_t lifetime_t1; | |
48 | be32_t lifetime_t2; | |
49 | } _packed_; | |
50 | sd_event_source *timeout_t1; | |
51 | sd_event_source *timeout_t2; | |
52 | ||
53 | LIST_HEAD(DHCP6Address, addresses); | |
54 | }; | |
55 | ||
56 | typedef struct DHCP6IA DHCP6IA; | |
e3169126 | 57 | |
bd9a7221 ZJS |
58 | #define log_dhcp6_client_errno(p, error, fmt, ...) log_internal(LOG_DEBUG, error, __FILE__, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__) |
59 | #define log_dhcp6_client(p, fmt, ...) log_dhcp6_client_errno(p, 0, fmt, ##__VA_ARGS__) | |
e3169126 | 60 | |
f12ed3bf PF |
61 | int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code, |
62 | size_t optlen, const void *optval); | |
63 | int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia); | |
8006aa32 | 64 | int dhcp6_option_append_fqdn(uint8_t **buf, size_t *buflen, const char *fqdn); |
f12ed3bf PF |
65 | int dhcp6_option_parse(uint8_t **buf, size_t *buflen, uint16_t *optcode, |
66 | size_t *optlen, uint8_t **optvalue); | |
c6affce8 PF |
67 | int dhcp6_option_parse_ia(uint8_t **buf, size_t *buflen, uint16_t iatype, |
68 | DHCP6IA *ia); | |
b553817c PF |
69 | int dhcp6_option_parse_ip6addrs(uint8_t *optval, uint16_t optlen, |
70 | struct in6_addr **addrs, size_t count, | |
71 | size_t *allocated); | |
f96ccab7 PF |
72 | int dhcp6_option_parse_domainname(const uint8_t *optval, uint16_t optlen, |
73 | char ***str_arr); | |
34e8c5a2 PF |
74 | |
75 | int dhcp6_network_bind_udp_socket(int index, struct in6_addr *address); | |
76 | int dhcp6_network_send_udp_socket(int s, struct in6_addr *address, | |
77 | const void *packet, size_t len); | |
a9aff361 PF |
78 | |
79 | const char *dhcp6_message_type_to_string(int s) _const_; | |
80 | int dhcp6_message_type_from_string(const char *s) _pure_; | |
631bbe71 PF |
81 | const char *dhcp6_message_status_to_string(int s) _const_; |
82 | int dhcp6_message_status_from_string(const char *s) _pure_; |