]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ | |
2 | #ifndef foosddhcpclienthfoo | |
3 | #define foosddhcpclienthfoo | |
4 | ||
5 | /*** | |
6 | Copyright © 2013 Intel Corporation. All rights reserved. | |
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 <https://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
22 | #include <stdbool.h> | |
23 | ||
24 | #include "_sd-common.h" | |
25 | ||
26 | _SD_BEGIN_DECLARATIONS; | |
27 | ||
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 | ||
36 | enum { | |
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. */ | |
45 | }; | |
46 | ||
47 | typedef struct sd_dhcp_client sd_dhcp_client; | |
48 | ||
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, | |
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); | |
64 | int sd_dhcp_client_set_ifindex( | |
65 | sd_dhcp_client *client, | |
66 | int interface_index); | |
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, | |
75 | size_t addr_len, | |
76 | uint16_t arp_type); | |
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, | |
82 | uint8_t type, | |
83 | const uint8_t *data, | |
84 | size_t data_len); | |
85 | __extension__ int sd_dhcp_client_set_iaid_duid_llt( | |
86 | sd_dhcp_client *client, | |
87 | bool iaid_set, | |
88 | uint32_t iaid, | |
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( | |
103 | sd_dhcp_client *client, | |
104 | bool iaid_set, | |
105 | uint32_t iaid, | |
106 | uint16_t duid_type, | |
107 | const uint8_t *duid, | |
108 | size_t duid_len); | |
109 | __extension__ int sd_dhcp_client_set_rapid_commit( | |
110 | sd_dhcp_client *client, | |
111 | bool rapid_commit); | |
112 | int sd_dhcp_client_set_mtu( | |
113 | sd_dhcp_client *client, | |
114 | uint32_t mtu); | |
115 | int sd_dhcp_client_set_max_attempts( | |
116 | sd_dhcp_client *client, | |
117 | uint64_t attempt); | |
118 | int sd_dhcp_client_set_client_port( | |
119 | sd_dhcp_client *client, | |
120 | uint16_t port); | |
121 | int sd_dhcp_client_set_port( | |
122 | sd_dhcp_client *client, | |
123 | uint16_t port); | |
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); | |
130 | int sd_dhcp_client_set_mud_url( | |
131 | sd_dhcp_client *client, | |
132 | const char *mudurl); | |
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, | |
141 | int type); | |
142 | int sd_dhcp_client_set_socket_priority( | |
143 | sd_dhcp_client *client, | |
144 | int so_priority); | |
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, | |
150 | int bootp); | |
151 | ||
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); | |
154 | ||
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); | |
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 | ||
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); | |
170 | ||
171 | int sd_dhcp_client_attach_event( | |
172 | sd_dhcp_client *client, | |
173 | sd_event *event, | |
174 | int64_t priority); | |
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); | |
178 | ||
179 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref); | |
180 | ||
181 | _SD_END_DECLARATIONS; | |
182 | ||
183 | #endif |