]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/systemd/sd-dhcp-lease.h
Merge pull request #18007 from fw-strlen/ipv6_masq_and_dnat
[thirdparty/systemd.git] / src / systemd / sd-dhcp-lease.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
fe8db0c5
TG
2#ifndef foosddhcpleasehfoo
3#define foosddhcpleasehfoo
a6cc569e
TG
4
5/***
810adae9 6 Copyright © 2013 Intel Corporation. All rights reserved.
a6cc569e
TG
7 systemd is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version.
11
12 systemd is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with systemd; If not, see <http://www.gnu.org/licenses/>.
19***/
20
2d93c20e 21#include <errno.h>
04c01369 22#include <inttypes.h>
fe8db0c5 23#include <net/ethernet.h>
04c01369
LP
24#include <netinet/in.h>
25#include <sys/types.h>
26
27#include "_sd-common.h"
28
29_SD_BEGIN_DECLARATIONS;
a6cc569e 30
fe8db0c5 31typedef struct sd_dhcp_lease sd_dhcp_lease;
f8693fc7 32typedef struct sd_dhcp_route sd_dhcp_route;
a6cc569e 33
fe8db0c5
TG
34sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease);
35sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease);
74b2466e 36
ddb82ec2
LP
37typedef enum sd_dhcp_lease_server_type {
38 SD_DHCP_LEASE_DNS,
39 SD_DHCP_LEASE_NTP,
40 SD_DHCP_LEASE_SIP,
41 SD_DHCP_LEASE_POP3,
42 SD_DHCP_LEASE_SMTP,
43 SD_DHCP_LEASE_LPR,
44 _SD_DHCP_LEASE_SERVER_TYPE_MAX,
2d93c20e 45 _SD_DHCP_LEASE_SERVER_TYPE_INVALID = -EINVAL,
ddb82ec2 46} sd_dhcp_lease_server_type;
8541db8f 47
fe8db0c5 48int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr);
68ceb9df 49int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime);
0339cd77
LP
50int sd_dhcp_lease_get_t1(sd_dhcp_lease *lease, uint32_t *t1);
51int sd_dhcp_lease_get_t2(sd_dhcp_lease *lease, uint32_t *t2);
52int sd_dhcp_lease_get_broadcast(sd_dhcp_lease *lease, struct in_addr *addr);
fe8db0c5 53int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr);
f8862395 54int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, const struct in_addr **addr);
8e34a618 55int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr);
0ad853bc 56int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr);
ddb82ec2 57int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_server_type what, const struct in_addr **addr);
a2ba62c7
LP
58int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr);
59int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr);
299d578f 60int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr);
ddb82ec2
LP
61int sd_dhcp_lease_get_pop3(sd_dhcp_lease *lease, const struct in_addr **addr);
62int sd_dhcp_lease_get_smtp(sd_dhcp_lease *lease, const struct in_addr **addr);
63int sd_dhcp_lease_get_lpr(sd_dhcp_lease *lease, const struct in_addr **addr);
fe8db0c5
TG
64int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu);
65int sd_dhcp_lease_get_domainname(sd_dhcp_lease *lease, const char **domainname);
b85bc551 66int sd_dhcp_lease_get_search_domains(sd_dhcp_lease *lease, char ***domains);
fe8db0c5 67int sd_dhcp_lease_get_hostname(sd_dhcp_lease *lease, const char **hostname);
ce78df79 68int sd_dhcp_lease_get_root_path(sd_dhcp_lease *lease, const char **root_path);
f8693fc7 69int sd_dhcp_lease_get_routes(sd_dhcp_lease *lease, sd_dhcp_route ***routes);
0339cd77
LP
70int sd_dhcp_lease_get_vendor_specific(sd_dhcp_lease *lease, const void **data, size_t *data_len);
71int sd_dhcp_lease_get_client_id(sd_dhcp_lease *lease, const void **client_id, size_t *client_id_len);
8eb9058d 72int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone);
74b2466e 73
f8693fc7
BG
74int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination);
75int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length);
76int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway);
cf6f5bb5 77int sd_dhcp_route_get_option(sd_dhcp_route *route);
f8693fc7 78
4afd3348
LP
79_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref);
80
04c01369
LP
81_SD_END_DECLARATIONS;
82
fe8db0c5 83#endif