]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
011feef8 PF |
2 | #ifndef foosddhcpclienthfoo |
3 | #define foosddhcpclienthfoo | |
4 | ||
5 | /*** | |
810adae9 | 6 | Copyright © 2013 Intel Corporation. All rights reserved. |
011feef8 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 | |
85fce6f4 | 19 | along with systemd; If not, see <https://www.gnu.org/licenses/>. |
011feef8 PF |
20 | ***/ |
21 | ||
8217ed5e | 22 | #include <stdbool.h> |
011feef8 | 23 | |
1cf40697 | 24 | #include "_sd-common.h" |
d3d8ac2f | 25 | |
04c01369 LP |
26 | _SD_BEGIN_DECLARATIONS; |
27 | ||
5cdf13c7 DDM |
28 | struct in_addr; |
29 | ||
30 | typedef struct sd_device sd_device; | |
31 | typedef struct sd_dhcp_client_id sd_dhcp_client_id; | |
32 | typedef struct sd_dhcp_lease sd_dhcp_lease; | |
33 | typedef struct sd_dhcp_option sd_dhcp_option; | |
34 | typedef struct sd_event sd_event; | |
35 | ||
3e3d8f78 | 36 | enum { |
03748142 DH |
37 | SD_DHCP_CLIENT_EVENT_STOP = 0, |
38 | SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1, | |
39 | SD_DHCP_CLIENT_EVENT_IP_CHANGE = 2, | |
40 | SD_DHCP_CLIENT_EVENT_EXPIRED = 3, | |
41 | SD_DHCP_CLIENT_EVENT_RENEW = 4, | |
727b5734 | 42 | SD_DHCP_CLIENT_EVENT_SELECTING = 5, |
5476cb98 JJ |
43 | SD_DHCP_CLIENT_EVENT_TRANSIENT_FAILURE = 6 /* Sent when we have not received a reply after the first few attempts. |
44 | * The client may want to start acquiring link-local addresses. */ | |
3e3d8f78 PF |
45 | }; |
46 | ||
011feef8 PF |
47 | typedef struct sd_dhcp_client sd_dhcp_client; |
48 | ||
727b5734 | 49 | typedef int (*sd_dhcp_client_callback_t)(sd_dhcp_client *client, int event, void *userdata); |
4b558378 ZJS |
50 | int sd_dhcp_client_set_callback( |
51 | sd_dhcp_client *client, | |
52 | sd_dhcp_client_callback_t cb, | |
53 | void *userdata); | |
54 | ||
55 | int sd_dhcp_client_set_request_option( | |
56 | sd_dhcp_client *client, | |
57 | uint8_t option); | |
58 | int sd_dhcp_client_set_request_address( | |
59 | sd_dhcp_client *client, | |
60 | const struct in_addr *last_address); | |
61 | int sd_dhcp_client_set_request_broadcast( | |
62 | sd_dhcp_client *client, | |
63 | int broadcast); | |
2f8e7633 | 64 | int sd_dhcp_client_set_ifindex( |
4b558378 ZJS |
65 | sd_dhcp_client *client, |
66 | int interface_index); | |
61a9fa8f YW |
67 | int sd_dhcp_client_set_ifname( |
68 | sd_dhcp_client *client, | |
69 | const char *interface_name); | |
5977b71f | 70 | int sd_dhcp_client_get_ifname(sd_dhcp_client *client, const char **ret); |
4b558378 ZJS |
71 | int sd_dhcp_client_set_mac( |
72 | sd_dhcp_client *client, | |
7e5c25b2 | 73 | const uint8_t *hw_addr, |
14b66dbc | 74 | const uint8_t *bcast_addr, |
4b558378 ZJS |
75 | size_t addr_len, |
76 | uint16_t arp_type); | |
6efa51f8 YW |
77 | int sd_dhcp_client_get_client_id( |
78 | sd_dhcp_client *client, | |
79 | const sd_dhcp_client_id **ret); | |
4b558378 ZJS |
80 | int sd_dhcp_client_set_client_id( |
81 | sd_dhcp_client *client, | |
82 | uint8_t type, | |
83 | const uint8_t *data, | |
84 | size_t data_len); | |
53488ea3 | 85 | __extension__ int sd_dhcp_client_set_iaid_duid_llt( |
4b558378 | 86 | sd_dhcp_client *client, |
8217ed5e | 87 | bool iaid_set, |
4b558378 | 88 | uint32_t iaid, |
53488ea3 YW |
89 | uint64_t llt_time); |
90 | __extension__ int sd_dhcp_client_set_iaid_duid_ll( | |
91 | sd_dhcp_client *client, | |
92 | bool iaid_set, | |
93 | uint32_t iaid); | |
94 | __extension__ int sd_dhcp_client_set_iaid_duid_en( | |
95 | sd_dhcp_client *client, | |
96 | bool iaid_set, | |
97 | uint32_t iaid); | |
98 | __extension__ int sd_dhcp_client_set_iaid_duid_uuid( | |
99 | sd_dhcp_client *client, | |
100 | bool iaid_set, | |
101 | uint32_t iaid); | |
102 | __extension__ int sd_dhcp_client_set_iaid_duid_raw( | |
7e90a499 | 103 | sd_dhcp_client *client, |
8217ed5e | 104 | bool iaid_set, |
7e90a499 | 105 | uint32_t iaid, |
53488ea3 YW |
106 | uint16_t duid_type, |
107 | const uint8_t *duid, | |
108 | size_t duid_len); | |
808b65a0 RP |
109 | __extension__ int sd_dhcp_client_set_rapid_commit( |
110 | sd_dhcp_client *client, | |
111 | bool rapid_commit); | |
4b558378 ZJS |
112 | int sd_dhcp_client_set_mtu( |
113 | sd_dhcp_client *client, | |
114 | uint32_t mtu); | |
715cedfb SS |
115 | int sd_dhcp_client_set_max_attempts( |
116 | sd_dhcp_client *client, | |
117 | uint64_t attempt); | |
9faed222 SS |
118 | int sd_dhcp_client_set_client_port( |
119 | sd_dhcp_client *client, | |
120 | uint16_t port); | |
ea932bd3 MI |
121 | int sd_dhcp_client_set_port( |
122 | sd_dhcp_client *client, | |
123 | uint16_t port); | |
4b558378 ZJS |
124 | int sd_dhcp_client_set_hostname( |
125 | sd_dhcp_client *client, | |
126 | const char *hostname); | |
127 | int sd_dhcp_client_set_vendor_class_identifier( | |
128 | sd_dhcp_client *client, | |
129 | const char *vci); | |
d11d4a64 SS |
130 | int sd_dhcp_client_set_mud_url( |
131 | sd_dhcp_client *client, | |
132 | const char *mudurl); | |
af1c0de0 SS |
133 | int sd_dhcp_client_set_user_class( |
134 | sd_dhcp_client *client, | |
e4336c0a | 135 | char * const *user_class); |
4b558378 ZJS |
136 | int sd_dhcp_client_get_lease( |
137 | sd_dhcp_client *client, | |
138 | sd_dhcp_lease **ret); | |
afe42aef SC |
139 | int sd_dhcp_client_set_service_type( |
140 | sd_dhcp_client *client, | |
141 | int type); | |
ea577968 | 142 | int sd_dhcp_client_set_socket_priority( |
143 | sd_dhcp_client *client, | |
144 | int so_priority); | |
4c0b8d56 SS |
145 | int sd_dhcp_client_set_fallback_lease_lifetime( |
146 | sd_dhcp_client *client, | |
5fde4d37 | 147 | uint64_t fallback_lease_lifetime); |
4ad29bad CF |
148 | int sd_dhcp_client_set_bootp( |
149 | sd_dhcp_client *client, | |
150 | int bootp); | |
a6cc569e | 151 | |
7354900d DW |
152 | int sd_dhcp_client_add_option(sd_dhcp_client *client, sd_dhcp_option *v); |
153 | int sd_dhcp_client_add_vendor_option(sd_dhcp_client *client, sd_dhcp_option *v); | |
cb29c156 | 154 | |
041ea9f9 | 155 | int sd_dhcp_client_is_running(sd_dhcp_client *client); |
bbdf06d9 | 156 | int sd_dhcp_client_stop(sd_dhcp_client *client); |
46a66b79 | 157 | int sd_dhcp_client_start(sd_dhcp_client *client); |
1501b429 | 158 | int sd_dhcp_client_send_release(sd_dhcp_client *client); |
0f3ff4ea | 159 | int sd_dhcp_client_send_decline(sd_dhcp_client *client); |
1c9a2e26 | 160 | int sd_dhcp_client_send_renew(sd_dhcp_client *client); |
a91b888f | 161 | int sd_dhcp_client_set_ipv6_connectivity(sd_dhcp_client *client, int have); |
0bc30a20 | 162 | int sd_dhcp_client_interrupt_ipv6_only_mode(sd_dhcp_client *client); |
e5b04c8d PF |
163 | |
164 | sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client); | |
165 | sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client); | |
166 | ||
db3d2358 | 167 | /* NOTE: anonymize parameter is used to initialize PRL memory with different |
168 | * options when using RFC7844 Anonymity Profiles */ | |
169 | int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize); | |
b25ef18b | 170 | |
4b558378 ZJS |
171 | int sd_dhcp_client_attach_event( |
172 | sd_dhcp_client *client, | |
173 | sd_event *event, | |
174 | int64_t priority); | |
b25ef18b TG |
175 | int sd_dhcp_client_detach_event(sd_dhcp_client *client); |
176 | sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client); | |
be615f7c | 177 | int sd_dhcp_client_attach_device(sd_dhcp_client *client, sd_device *dev); |
011feef8 | 178 | |
4afd3348 LP |
179 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref); |
180 | ||
04c01369 LP |
181 | _SD_END_DECLARATIONS; |
182 | ||
011feef8 | 183 | #endif |