]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd-network/dhcp6-internal.h
man/systemd-sysext: list ephemeral/ephemeral-import in the list of options
[thirdparty/systemd.git] / src / libsystemd-network / dhcp6-internal.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
e3169126
PF
2#pragma once
3
4/***
810adae9 5 Copyright © 2014-2015 Intel Corporation. All rights reserved.
e3169126
PF
6***/
7
8#include <net/ethernet.h>
f12abb48
PF
9#include <netinet/in.h>
10
35388783 11#include "sd-dhcp6-client.h"
07630cea 12
97c3506d 13#include "dhcp-duid-internal.h"
3f09d563 14#include "dhcp6-option.h"
16de849f 15#include "dhcp6-protocol.h"
5cdf13c7 16#include "forward.h"
5977b71f 17#include "network-common.h"
07630cea 18#include "sparse-endian.h"
e3169126 19
65ece4c8
YW
20/* what to request from the server, addresses (IA_NA) and/or prefixes (IA_PD) */
21typedef enum DHCP6RequestIA {
22 DHCP6_REQUEST_IA_NA = 1 << 0,
23 DHCP6_REQUEST_IA_TA = 1 << 1, /* currently not used */
24 DHCP6_REQUEST_IA_PD = 1 << 2,
25} DHCP6RequestIA;
26
3f09d563 27struct sd_dhcp6_client {
65ece4c8
YW
28 unsigned n_ref;
29
65ece4c8
YW
30 int ifindex;
31 char *ifname;
3f09d563 32
65ece4c8 33 struct in6_addr local_address;
1978efb9 34 struct hw_addr_data hw_addr;
65ece4c8 35 uint16_t arp_type;
3f09d563
YW
36
37 sd_event *event;
38 sd_event_source *receive_message;
39 sd_event_source *timeout_resend;
40 sd_event_source *timeout_expire;
41 sd_event_source *timeout_t1;
42 sd_event_source *timeout_t2;
43 int event_priority;
65ece4c8 44 int fd;
3f09d563 45
793178b9
YW
46 sd_device *dev;
47
3f09d563 48 DHCP6State state;
65ece4c8 49 bool information_request;
3f09d563
YW
50 usec_t information_request_time_usec;
51 usec_t information_refresh_time_usec;
52 be32_t transaction_id;
53 usec_t transaction_start;
54 usec_t retransmit_time;
55 uint8_t retransmit_count;
56
65ece4c8 57 bool iaid_set;
3f09d563
YW
58 DHCP6IA ia_na;
59 DHCP6IA ia_pd;
60 DHCP6RequestIA request_ia;
97c3506d 61 sd_dhcp_duid duid;
65ece4c8 62 be16_t *req_opts;
2f53b311 63 size_t n_req_opts;
65ece4c8
YW
64 char *fqdn;
65 char *mudurl;
66 char **user_class;
67 char **vendor_class;
65ece4c8 68 OrderedHashmap *extra_options;
9e4dee4c 69 OrderedSet *vendor_options;
4397967f 70 bool rapid_commit;
65ece4c8 71
3f09d563
YW
72 struct sd_dhcp6_lease *lease;
73
74 sd_dhcp6_client_callback_t callback;
75 void *userdata;
fd9b7f5b 76 sd_dhcp6_client_callback_t state_callback;
77 void *state_userdata;
b895aa5f 78 bool send_release;
3f09d563 79};
34e8c5a2 80
dea17a08
YW
81int dhcp6_network_bind_udp_socket(int ifindex, const struct in6_addr *address);
82int dhcp6_network_send_udp_socket(int s, const struct in6_addr *address, const void *packet, size_t len);
a9aff361 83
7b53d3ea 84int dhcp6_client_send_message(sd_dhcp6_client *client);
6f3fc861 85int dhcp6_client_set_transaction_id(sd_dhcp6_client *client, uint32_t transaction_id);
8d71f2b3 86
a0c2541b 87#define log_dhcp6_client_errno(client, error, fmt, ...) \
00dd6d77 88 log_interface_prefix_full_errno( \
a0c2541b 89 "DHCPv6 client: ", \
5977b71f 90 sd_dhcp6_client, client, \
a0c2541b
ZJS
91 error, fmt, ##__VA_ARGS__)
92#define log_dhcp6_client(client, fmt, ...) \
00dd6d77
ZJS
93 log_interface_prefix_full_errno_zerook( \
94 "DHCPv6 client: ", \
5977b71f 95 sd_dhcp6_client, client, \
00dd6d77 96 0, fmt, ##__VA_ARGS__)