]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd-dhcp/dhcp-lease.h
sd-dhcp-client: split sd_dhcp_lease from sd_dhcp_client
[thirdparty/systemd.git] / src / libsystemd-dhcp / dhcp-lease.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright (C) 2013 Intel Corporation. All rights reserved.
9 Copyright (C) 2014 Tom Gundersen
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 ***/
24
25 #include <stdint.h>
26 #include <linux/if_packet.h>
27
28 #include "socket-util.h"
29 #include "refcnt.h"
30
31 #include "dhcp-protocol.h"
32
33 #include "sd-dhcp-client.h"
34
35 struct sd_dhcp_lease {
36 RefCount n_ref;
37
38 uint32_t t1;
39 uint32_t t2;
40 uint32_t lifetime;
41 be32_t address;
42 be32_t server_address;
43 be32_t subnet_mask;
44 be32_t router;
45 struct in_addr *dns;
46 size_t dns_size;
47 uint16_t mtu;
48 char *domainname;
49 char *hostname;
50 };
51
52 int dhcp_lease_new(sd_dhcp_lease **ret);
53 int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option,
54 void *user_data);
55
56 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_dhcp_lease*, sd_dhcp_lease_unref);
57 #define _cleanup_dhcp_lease_unref_ _cleanup_(sd_dhcp_lease_unrefp)