]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ | |
2 | #pragma once | |
3 | ||
4 | /*** | |
5 | Copyright © 2014-2015 Intel Corporation. All rights reserved. | |
6 | ***/ | |
7 | ||
8 | #include <net/ethernet.h> | |
9 | #include <netinet/in.h> | |
10 | ||
11 | #include "sd-dhcp6-client.h" | |
12 | ||
13 | #include "dhcp-duid-internal.h" | |
14 | #include "dhcp6-option.h" | |
15 | #include "dhcp6-protocol.h" | |
16 | #include "forward.h" | |
17 | #include "network-common.h" | |
18 | #include "sparse-endian.h" | |
19 | ||
20 | /* what to request from the server, addresses (IA_NA) and/or prefixes (IA_PD) */ | |
21 | typedef 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 | ||
27 | struct sd_dhcp6_client { | |
28 | unsigned n_ref; | |
29 | ||
30 | int ifindex; | |
31 | char *ifname; | |
32 | ||
33 | struct in6_addr local_address; | |
34 | struct hw_addr_data hw_addr; | |
35 | uint16_t arp_type; | |
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; | |
44 | int fd; | |
45 | ||
46 | sd_device *dev; | |
47 | ||
48 | DHCP6State state; | |
49 | bool information_request; | |
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 | ||
57 | bool iaid_set; | |
58 | DHCP6IA ia_na; | |
59 | DHCP6IA ia_pd; | |
60 | DHCP6RequestIA request_ia; | |
61 | sd_dhcp_duid duid; | |
62 | be16_t *req_opts; | |
63 | size_t n_req_opts; | |
64 | char *fqdn; | |
65 | char *mudurl; | |
66 | char **user_class; | |
67 | char **vendor_class; | |
68 | OrderedHashmap *extra_options; | |
69 | OrderedSet *vendor_options; | |
70 | bool rapid_commit; | |
71 | ||
72 | struct sd_dhcp6_lease *lease; | |
73 | ||
74 | sd_dhcp6_client_callback_t callback; | |
75 | void *userdata; | |
76 | sd_dhcp6_client_callback_t state_callback; | |
77 | void *state_userdata; | |
78 | bool send_release; | |
79 | }; | |
80 | ||
81 | int dhcp6_network_bind_udp_socket(int ifindex, const struct in6_addr *address); | |
82 | int dhcp6_network_send_udp_socket(int s, const struct in6_addr *address, const void *packet, size_t len); | |
83 | ||
84 | int dhcp6_client_send_message(sd_dhcp6_client *client); | |
85 | int dhcp6_client_set_transaction_id(sd_dhcp6_client *client, uint32_t transaction_id); | |
86 | ||
87 | #define log_dhcp6_client_errno(client, error, fmt, ...) \ | |
88 | log_interface_prefix_full_errno( \ | |
89 | "DHCPv6 client: ", \ | |
90 | sd_dhcp6_client, client, \ | |
91 | error, fmt, ##__VA_ARGS__) | |
92 | #define log_dhcp6_client(client, fmt, ...) \ | |
93 | log_interface_prefix_full_errno_zerook( \ | |
94 | "DHCPv6 client: ", \ | |
95 | sd_dhcp6_client, client, \ | |
96 | 0, fmt, ##__VA_ARGS__) |