chiark / gitweb /
295c22320750c47bf2e97c5714b35a6d84418cf4
[elogind.git] / src / libsystemd-network / dhcp6-lease-internal.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) 2014 Tom Gundersen
9   Copyright (C) 2014 Intel Corporation. All rights reserved.
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
27 #include "refcnt.h"
28
29 #include "sd-dhcp6-lease.h"
30 #include "dhcp6-internal.h"
31
32 struct sd_dhcp6_lease {
33         RefCount n_ref;
34
35         uint8_t *serverid;
36         size_t serverid_len;
37         uint8_t preference;
38
39         DHCP6IA ia;
40
41         DHCP6Address *addr_iter;
42 };
43
44 int dhcp6_lease_clear_timers(DHCP6IA *ia);
45 DHCP6IA *dhcp6_lease_free_ia(DHCP6IA *ia);
46
47 int dhcp6_lease_set_serverid(sd_dhcp6_lease *lease, const uint8_t *id,
48                              size_t len);
49 int dhcp6_lease_get_serverid(sd_dhcp6_lease *lease, uint8_t **id, size_t *len);
50 int dhcp6_lease_set_preference(sd_dhcp6_lease *lease, uint8_t preference);
51 int dhcp6_lease_get_preference(sd_dhcp6_lease *lease, uint8_t *preference);
52 int dhcp6_lease_get_iaid(sd_dhcp6_lease *lease, be32_t *iaid);
53
54 int dhcp6_lease_new(sd_dhcp6_lease **ret);
55
56 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_dhcp6_lease*, sd_dhcp6_lease_unref);
57 #define _cleanup_dhcp6_lease_free_ _cleanup_(sd_dhcp6_lease_unrefp)