]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd-network/dhcp-lease-internal.h
man/systemd-sysext: list ephemeral/ephemeral-import in the list of options
[thirdparty/systemd.git] / src / libsystemd-network / dhcp-lease-internal.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
a6cc569e
TG
2#pragma once
3
4/***
810adae9 5 Copyright © 2013 Intel Corporation. All rights reserved.
a6cc569e
TG
6***/
7
5cdf13c7 8#include "sd-dhcp-lease.h"
a6cc569e 9
d59a2b3b 10#include "dhcp-client-id-internal.h"
8664ded7 11#include "dhcp-option.h"
5cdf13c7 12#include "forward.h"
71d35b6b 13#include "list.h"
a6cc569e 14
e1ea665e
EY
15struct sd_dhcp_route {
16 struct in_addr dst_addr;
17 struct in_addr gw_addr;
1caa12d0 18 unsigned char dst_prefixlen;
e1ea665e
EY
19};
20
7e753d9d
AC
21struct sd_dhcp_raw_option {
22 LIST_FIELDS(struct sd_dhcp_raw_option, options);
23
24 uint8_t tag;
25 uint8_t length;
26 void *data;
27};
28
a6cc569e 29struct sd_dhcp_lease {
86514214 30 unsigned n_ref;
a6cc569e 31
0339cd77 32 /* each 0 if unset */
5fde4d37
YW
33 usec_t t1;
34 usec_t t2;
35 usec_t lifetime;
a93538e8 36 triple_timestamp timestamp;
a91b888f 37 usec_t ipv6_only_preferred_usec;
0339cd77
LP
38
39 /* each 0 if unset */
a6cc569e
TG
40 be32_t address;
41 be32_t server_address;
8e34a618 42 be32_t next_server;
0339cd77
LP
43
44 bool have_subnet_mask;
45 be32_t subnet_mask;
46
47 bool have_broadcast;
f5c0c00f 48 be32_t broadcast;
0339cd77 49
f8862395
TH
50 struct in_addr *router;
51 size_t router_size;
52
808b65a0
RP
53 bool rapid_commit;
54
ddb82ec2 55 DHCPServerData servers[_SD_DHCP_LEASE_SERVER_TYPE_MAX];
50018bfa 56
25c33e35
RP
57 sd_dns_resolver *dnr;
58 size_t n_dnr;
59
32f8a613
YW
60 struct sd_dhcp_route *static_routes;
61 size_t n_static_routes;
62 struct sd_dhcp_route *classless_routes;
63 size_t n_classless_routes;
0339cd77
LP
64
65 uint16_t mtu; /* 0 if unset */
66
a6cc569e 67 char *domainname;
b85bc551 68 char **search_domains;
a6cc569e 69 char *hostname;
ce78df79 70 char *root_path;
7040fd38 71 char *captive_portal;
0339cd77 72
d59a2b3b 73 sd_dhcp_client_id client_id;
0339cd77 74
e4735228 75 void *vendor_specific;
e43a8393 76 size_t vendor_specific_len;
0339cd77 77
8eb9058d 78 char *timezone;
0339cd77 79
dbdcaca3
YW
80 uint8_t sixrd_ipv4masklen;
81 uint8_t sixrd_prefixlen;
82 struct in6_addr sixrd_prefix;
83 struct in_addr *sixrd_br_addresses;
84 size_t sixrd_n_br_addresses;
85
7e753d9d 86 LIST_HEAD(struct sd_dhcp_raw_option, private_options);
a6cc569e
TG
87};
88
89int dhcp_lease_new(sd_dhcp_lease **ret);
a6cc569e 90
0339cd77 91int dhcp_lease_parse_options(uint8_t code, uint8_t len, const void *option, void *userdata);
b85bc551 92int dhcp_lease_parse_search_domains(const uint8_t *option, size_t len, char ***domains);
0339cd77 93int dhcp_lease_insert_private_option(sd_dhcp_lease *lease, uint8_t tag, const void *data, uint8_t len);
9e64dd72 94
905d0ea7 95void dhcp_lease_set_timestamp(sd_dhcp_lease *lease, const triple_timestamp *timestamp);
0339cd77 96int dhcp_lease_set_default_subnet_mask(sd_dhcp_lease *lease);
d59a2b3b 97int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const sd_dhcp_client_id *client_id);
db849df5
YW
98
99#define dhcp_lease_unref_and_replace(a, b) \
100 unref_and_replace_full(a, b, sd_dhcp_lease_ref, sd_dhcp_lease_unref)