1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosddhcpclienthfoo
3 #define foosddhcpclienthfoo
6 Copyright © 2013 Intel Corporation. All rights reserved.
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.
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.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <https://www.gnu.org/licenses/>.
24 #include "_sd-common.h"
26 _SD_BEGIN_DECLARATIONS
;
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
;
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,
42 SD_DHCP_CLIENT_EVENT_SELECTING
= 5,
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. */
47 typedef struct sd_dhcp_client sd_dhcp_client
;
49 typedef int (*sd_dhcp_client_callback_t
)(sd_dhcp_client
*client
, int event
, void *userdata
);
50 int sd_dhcp_client_set_callback(
51 sd_dhcp_client
*client
,
52 sd_dhcp_client_callback_t cb
,
55 int sd_dhcp_client_set_request_option(
56 sd_dhcp_client
*client
,
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
,
64 int sd_dhcp_client_set_ifindex(
65 sd_dhcp_client
*client
,
67 int sd_dhcp_client_set_ifname(
68 sd_dhcp_client
*client
,
69 const char *interface_name
);
70 int sd_dhcp_client_get_ifname(sd_dhcp_client
*client
, const char **ret
);
71 int sd_dhcp_client_set_mac(
72 sd_dhcp_client
*client
,
73 const uint8_t *hw_addr
,
74 const uint8_t *bcast_addr
,
77 int sd_dhcp_client_get_client_id(
78 sd_dhcp_client
*client
,
79 const sd_dhcp_client_id
**ret
);
80 int sd_dhcp_client_set_client_id(
81 sd_dhcp_client
*client
,
85 __extension__
int sd_dhcp_client_set_iaid_duid_llt(
86 sd_dhcp_client
*client
,
90 __extension__
int sd_dhcp_client_set_iaid_duid_ll(
91 sd_dhcp_client
*client
,
94 __extension__
int sd_dhcp_client_set_iaid_duid_en(
95 sd_dhcp_client
*client
,
98 __extension__
int sd_dhcp_client_set_iaid_duid_uuid(
99 sd_dhcp_client
*client
,
102 __extension__
int sd_dhcp_client_set_iaid_duid_raw(
103 sd_dhcp_client
*client
,
109 __extension__
int sd_dhcp_client_set_rapid_commit(
110 sd_dhcp_client
*client
,
112 int sd_dhcp_client_set_mtu(
113 sd_dhcp_client
*client
,
115 int sd_dhcp_client_set_max_attempts(
116 sd_dhcp_client
*client
,
118 int sd_dhcp_client_set_client_port(
119 sd_dhcp_client
*client
,
121 int sd_dhcp_client_set_port(
122 sd_dhcp_client
*client
,
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
,
130 int sd_dhcp_client_set_mud_url(
131 sd_dhcp_client
*client
,
133 int sd_dhcp_client_set_user_class(
134 sd_dhcp_client
*client
,
135 char * const *user_class
);
136 int sd_dhcp_client_get_lease(
137 sd_dhcp_client
*client
,
138 sd_dhcp_lease
**ret
);
139 int sd_dhcp_client_set_service_type(
140 sd_dhcp_client
*client
,
142 int sd_dhcp_client_set_socket_priority(
143 sd_dhcp_client
*client
,
145 int sd_dhcp_client_set_fallback_lease_lifetime(
146 sd_dhcp_client
*client
,
147 uint64_t fallback_lease_lifetime
);
148 int sd_dhcp_client_set_bootp(
149 sd_dhcp_client
*client
,
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
);
155 int sd_dhcp_client_is_running(sd_dhcp_client
*client
);
156 int sd_dhcp_client_stop(sd_dhcp_client
*client
);
157 int sd_dhcp_client_start(sd_dhcp_client
*client
);
158 int sd_dhcp_client_send_release(sd_dhcp_client
*client
);
159 int sd_dhcp_client_send_decline(sd_dhcp_client
*client
);
160 int sd_dhcp_client_send_renew(sd_dhcp_client
*client
);
161 int sd_dhcp_client_set_ipv6_connectivity(sd_dhcp_client
*client
, int have
);
162 int sd_dhcp_client_interrupt_ipv6_only_mode(sd_dhcp_client
*client
);
164 sd_dhcp_client
*sd_dhcp_client_ref(sd_dhcp_client
*client
);
165 sd_dhcp_client
*sd_dhcp_client_unref(sd_dhcp_client
*client
);
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
);
171 int sd_dhcp_client_attach_event(
172 sd_dhcp_client
*client
,
175 int sd_dhcp_client_detach_event(sd_dhcp_client
*client
);
176 sd_event
*sd_dhcp_client_get_event(sd_dhcp_client
*client
);
177 int sd_dhcp_client_attach_device(sd_dhcp_client
*client
, sd_device
*dev
);
179 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client
, sd_dhcp_client_unref
);
181 _SD_END_DECLARATIONS
;