]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
ca5ad760 YW |
2 | #pragma once |
3 | ||
4 | #include "conf-parser.h" | |
5 | #include "dhcp-identifier.h" | |
6 | #include "time-util.h" | |
7 | ||
8 | #define DHCP_ROUTE_METRIC 1024 | |
9 | ||
67c311ab | 10 | typedef struct Link Link; |
256c75fd | 11 | typedef struct Manager Manager; |
22d37e5d | 12 | typedef struct Network Network; |
67c311ab | 13 | |
ca5ad760 YW |
14 | typedef enum DHCPUseDomains { |
15 | DHCP_USE_DOMAINS_NO, | |
16 | DHCP_USE_DOMAINS_YES, | |
17 | DHCP_USE_DOMAINS_ROUTE, | |
18 | _DHCP_USE_DOMAINS_MAX, | |
19 | _DHCP_USE_DOMAINS_INVALID = -1, | |
20 | } DHCPUseDomains; | |
21 | ||
2e5580a8 YW |
22 | typedef enum DHCPOptionDataType { |
23 | DHCP_OPTION_DATA_UINT8, | |
24 | DHCP_OPTION_DATA_UINT16, | |
25 | DHCP_OPTION_DATA_UINT32, | |
26 | DHCP_OPTION_DATA_STRING, | |
27 | DHCP_OPTION_DATA_IPV4ADDRESS, | |
e7d5fe17 | 28 | DHCP_OPTION_DATA_IPV6ADDRESS, |
2e5580a8 YW |
29 | _DHCP_OPTION_DATA_MAX, |
30 | _DHCP_OPTION_DATA_INVALID, | |
31 | } DHCPOptionDataType; | |
32 | ||
ca5ad760 YW |
33 | typedef struct DUID { |
34 | /* Value of Type in [DHCP] section */ | |
35 | DUIDType type; | |
36 | ||
37 | uint8_t raw_data_len; | |
38 | uint8_t raw_data[MAX_DUID_LEN]; | |
39 | usec_t llt_time; | |
40 | } DUID; | |
41 | ||
67c311ab YW |
42 | bool link_dhcp_enabled(Link *link, int family); |
43 | static inline bool link_dhcp4_enabled(Link *link) { | |
44 | return link_dhcp_enabled(link, AF_INET); | |
45 | } | |
46 | static inline bool link_dhcp6_enabled(Link *link) { | |
47 | return link_dhcp_enabled(link, AF_INET6); | |
48 | } | |
49 | ||
22d37e5d YW |
50 | void network_adjust_dhcp(Network *network); |
51 | ||
256c75fd YW |
52 | DUID* link_get_duid(Link *link); |
53 | int link_configure_duid(Link *link); | |
54 | int manager_request_product_uuid(Manager *m, Link *link); | |
55 | ||
ca5ad760 YW |
56 | const char* dhcp_use_domains_to_string(DHCPUseDomains p) _const_; |
57 | DHCPUseDomains dhcp_use_domains_from_string(const char *s) _pure_; | |
58 | ||
2e5580a8 YW |
59 | const char *dhcp_option_data_type_to_string(DHCPOptionDataType d) _const_; |
60 | DHCPOptionDataType dhcp_option_data_type_from_string(const char *d) _pure_; | |
61 | ||
ca5ad760 | 62 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp); |
bdad94d0 | 63 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_route_metric); |
4f7331a8 | 64 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_dns); |
ca5ad760 | 65 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_domains); |
4f7331a8 | 66 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_use_ntp); |
ca5ad760 YW |
67 | CONFIG_PARSER_PROTOTYPE(config_parse_iaid); |
68 | CONFIG_PARSER_PROTOTYPE(config_parse_section_route_table); | |
f37f2a6b | 69 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_user_class); |
ed0d1b2e | 70 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_vendor_class); |
0e96961d | 71 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_send_option); |
35f6a5cb | 72 | CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_request_options); |