]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
011feef8 PF |
2 | #ifndef foosddhcpclienthfoo |
3 | #define foosddhcpclienthfoo | |
4 | ||
5 | /*** | |
011feef8 PF |
6 | Copyright (C) 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 <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
04c01369 | 22 | #include <inttypes.h> |
46a66b79 | 23 | #include <net/ethernet.h> |
04c01369 LP |
24 | #include <netinet/in.h> |
25 | #include <sys/types.h> | |
011feef8 | 26 | |
fe8db0c5 | 27 | #include "sd-dhcp-lease.h" |
71d35b6b | 28 | #include "sd-event.h" |
d3d8ac2f | 29 | |
04c01369 LP |
30 | #include "_sd-common.h" |
31 | ||
32 | _SD_BEGIN_DECLARATIONS; | |
33 | ||
3e3d8f78 | 34 | enum { |
03748142 DH |
35 | SD_DHCP_CLIENT_EVENT_STOP = 0, |
36 | SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1, | |
37 | SD_DHCP_CLIENT_EVENT_IP_CHANGE = 2, | |
38 | SD_DHCP_CLIENT_EVENT_EXPIRED = 3, | |
39 | SD_DHCP_CLIENT_EVENT_RENEW = 4, | |
3e3d8f78 PF |
40 | }; |
41 | ||
22805d92 BG |
42 | enum { |
43 | SD_DHCP_OPTION_PAD = 0, | |
44 | SD_DHCP_OPTION_SUBNET_MASK = 1, | |
45 | SD_DHCP_OPTION_TIME_OFFSET = 2, | |
46 | SD_DHCP_OPTION_ROUTER = 3, | |
47 | SD_DHCP_OPTION_DOMAIN_NAME_SERVER = 6, | |
48 | SD_DHCP_OPTION_HOST_NAME = 12, | |
49 | SD_DHCP_OPTION_BOOT_FILE_SIZE = 13, | |
50 | SD_DHCP_OPTION_DOMAIN_NAME = 15, | |
51 | SD_DHCP_OPTION_ROOT_PATH = 17, | |
52 | SD_DHCP_OPTION_ENABLE_IP_FORWARDING = 19, | |
53 | SD_DHCP_OPTION_ENABLE_IP_FORWARDING_NL = 20, | |
54 | SD_DHCP_OPTION_POLICY_FILTER = 21, | |
55 | SD_DHCP_OPTION_INTERFACE_MDR = 22, | |
56 | SD_DHCP_OPTION_INTERFACE_TTL = 23, | |
57 | SD_DHCP_OPTION_INTERFACE_MTU_AGING_TIMEOUT = 24, | |
58 | SD_DHCP_OPTION_INTERFACE_MTU = 26, | |
59 | SD_DHCP_OPTION_BROADCAST = 28, | |
19b8398f | 60 | /* Windows 10 option to send when Anonymize=true */ |
61 | SD_DHCP_OPTION_ROUTER_DISCOVER = 31, | |
22805d92 BG |
62 | SD_DHCP_OPTION_STATIC_ROUTE = 33, |
63 | SD_DHCP_OPTION_NTP_SERVER = 42, | |
64 | SD_DHCP_OPTION_VENDOR_SPECIFIC = 43, | |
19b8398f | 65 | /* Windows 10 option to send when Anonymize=true */ |
66 | SD_DHCP_OPTION_NETBIOS_NAMESERVER = 44, | |
67 | /* Windows 10 option to send when Anonymize=true */ | |
68 | SD_DHCP_OPTION_NETBIOS_NODETYPE = 46, | |
69 | /* Windows 10 option to send when Anonymize=true */ | |
70 | SD_DHCP_OPTION_NETBIOS_SCOPE = 47, | |
22805d92 BG |
71 | SD_DHCP_OPTION_REQUESTED_IP_ADDRESS = 50, |
72 | SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME = 51, | |
73 | SD_DHCP_OPTION_OVERLOAD = 52, | |
74 | SD_DHCP_OPTION_MESSAGE_TYPE = 53, | |
75 | SD_DHCP_OPTION_SERVER_IDENTIFIER = 54, | |
76 | SD_DHCP_OPTION_PARAMETER_REQUEST_LIST = 55, | |
77 | SD_DHCP_OPTION_ERROR_MESSAGE = 56, | |
78 | SD_DHCP_OPTION_MAXIMUM_MESSAGE_SIZE = 57, | |
79 | SD_DHCP_OPTION_RENEWAL_T1_TIME = 58, | |
80 | SD_DHCP_OPTION_REBINDING_T2_TIME = 59, | |
81 | SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER = 60, | |
82 | SD_DHCP_OPTION_CLIENT_IDENTIFIER = 61, | |
af1c0de0 | 83 | SD_DHCP_OPTION_USER_CLASS = 77, |
22805d92 BG |
84 | SD_DHCP_OPTION_FQDN = 81, |
85 | SD_DHCP_OPTION_NEW_POSIX_TIMEZONE = 100, | |
86 | SD_DHCP_OPTION_NEW_TZDB_TIMEZONE = 101, | |
b85bc551 | 87 | SD_DHCP_OPTION_DOMAIN_SEARCH_LIST = 119, |
22805d92 BG |
88 | SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE = 121, |
89 | SD_DHCP_OPTION_PRIVATE_BASE = 224, | |
19b8398f | 90 | /* Windows 10 option to send when Anonymize=true */ |
91 | SD_DHCP_OPTION_PRIVATE_CLASSLESS_STATIC_ROUTE = 249, | |
92 | /* Windows 10 option to send when Anonymize=true */ | |
93 | SD_DHCP_OPTION_PRIVATE_PROXY_AUTODISCOVERY = 252, | |
22805d92 BG |
94 | SD_DHCP_OPTION_PRIVATE_LAST = 254, |
95 | SD_DHCP_OPTION_END = 255, | |
96 | }; | |
97 | ||
011feef8 PF |
98 | typedef struct sd_dhcp_client sd_dhcp_client; |
99 | ||
4b558378 ZJS |
100 | typedef void (*sd_dhcp_client_callback_t)(sd_dhcp_client *client, int event, void *userdata); |
101 | int sd_dhcp_client_set_callback( | |
102 | sd_dhcp_client *client, | |
103 | sd_dhcp_client_callback_t cb, | |
104 | void *userdata); | |
105 | ||
106 | int sd_dhcp_client_set_request_option( | |
107 | sd_dhcp_client *client, | |
108 | uint8_t option); | |
109 | int sd_dhcp_client_set_request_address( | |
110 | sd_dhcp_client *client, | |
111 | const struct in_addr *last_address); | |
112 | int sd_dhcp_client_set_request_broadcast( | |
113 | sd_dhcp_client *client, | |
114 | int broadcast); | |
2f8e7633 | 115 | int sd_dhcp_client_set_ifindex( |
4b558378 ZJS |
116 | sd_dhcp_client *client, |
117 | int interface_index); | |
118 | int sd_dhcp_client_set_mac( | |
119 | sd_dhcp_client *client, | |
120 | const uint8_t *addr, | |
121 | size_t addr_len, | |
122 | uint16_t arp_type); | |
123 | int sd_dhcp_client_set_client_id( | |
124 | sd_dhcp_client *client, | |
125 | uint8_t type, | |
126 | const uint8_t *data, | |
127 | size_t data_len); | |
128 | int sd_dhcp_client_set_iaid_duid( | |
129 | sd_dhcp_client *client, | |
130 | uint32_t iaid, | |
131 | uint16_t duid_type, | |
f7a92d1a | 132 | const void *duid, |
4b558378 | 133 | size_t duid_len); |
dace710c YW |
134 | int sd_dhcp_client_set_duid( |
135 | sd_dhcp_client *client, | |
136 | uint16_t duid_type, | |
137 | const void *duid, | |
138 | size_t duid_len); | |
4b558378 ZJS |
139 | int sd_dhcp_client_get_client_id( |
140 | sd_dhcp_client *client, | |
141 | uint8_t *type, | |
142 | const uint8_t **data, | |
143 | size_t *data_len); | |
144 | int sd_dhcp_client_set_mtu( | |
145 | sd_dhcp_client *client, | |
146 | uint32_t mtu); | |
9faed222 SS |
147 | int sd_dhcp_client_set_client_port( |
148 | sd_dhcp_client *client, | |
149 | uint16_t port); | |
4b558378 ZJS |
150 | int sd_dhcp_client_set_hostname( |
151 | sd_dhcp_client *client, | |
152 | const char *hostname); | |
153 | int sd_dhcp_client_set_vendor_class_identifier( | |
154 | sd_dhcp_client *client, | |
155 | const char *vci); | |
af1c0de0 SS |
156 | int sd_dhcp_client_set_user_class( |
157 | sd_dhcp_client *client, | |
158 | const char* const *user_class); | |
4b558378 ZJS |
159 | int sd_dhcp_client_get_lease( |
160 | sd_dhcp_client *client, | |
161 | sd_dhcp_lease **ret); | |
a6cc569e | 162 | |
bbdf06d9 | 163 | int sd_dhcp_client_stop(sd_dhcp_client *client); |
46a66b79 | 164 | int sd_dhcp_client_start(sd_dhcp_client *client); |
e5b04c8d PF |
165 | |
166 | sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client); | |
167 | sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client); | |
168 | ||
db3d2358 | 169 | /* NOTE: anonymize parameter is used to initialize PRL memory with different |
170 | * options when using RFC7844 Anonymity Profiles */ | |
171 | int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize); | |
b25ef18b | 172 | |
4b558378 ZJS |
173 | int sd_dhcp_client_attach_event( |
174 | sd_dhcp_client *client, | |
175 | sd_event *event, | |
176 | int64_t priority); | |
b25ef18b TG |
177 | int sd_dhcp_client_detach_event(sd_dhcp_client *client); |
178 | sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client); | |
011feef8 | 179 | |
4afd3348 LP |
180 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref); |
181 | ||
04c01369 LP |
182 | _SD_END_DECLARATIONS; |
183 | ||
011feef8 | 184 | #endif |