sd-dhcp6-lease.c revision fab15fec2413bbc15dc7c24724ec82e371c966ba
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek This file is part of systemd.
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek Copyright (C) 2014 Tom Gundersen
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek Copyright (C) 2014 Intel Corporation. All rights reserved.
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek (at your option) any later version.
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek#include "dhcp6-lease-internal.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poetteringint dhcp6_lease_clear_timers(DHCP6IA *ia) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek ia->timeout_t1 = sd_event_source_unref(ia->timeout_t1);
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek ia->timeout_t2 = sd_event_source_unref(ia->timeout_t2);
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint dhcp6_lease_ia_rebind_expire(const DHCP6IA *ia, uint32_t *expire) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek LIST_FOREACH(addresses, addr, ia->addresses) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek t = be32toh(addr->iaaddr.lifetime_valid);
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-SzmekDHCP6IA *dhcp6_lease_free_ia(DHCP6IA *ia) {
ae691c1d9382995ea7e28317f5c37023229c27eeZbigniew Jędrzejewski-Szmek LIST_REMOVE(addresses, ia->addresses, address);
ae691c1d9382995ea7e28317f5c37023229c27eeZbigniew Jędrzejewski-Szmekint dhcp6_lease_set_serverid(sd_dhcp6_lease *lease, const uint8_t *id,
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek lease->serverid = memdup(id, len);
ae691c1d9382995ea7e28317f5c37023229c27eeZbigniew Jędrzejewski-Szmekint dhcp6_lease_get_serverid(sd_dhcp6_lease *lease, uint8_t **id, size_t *len) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint dhcp6_lease_set_preference(sd_dhcp6_lease *lease, uint8_t preference) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint dhcp6_lease_get_preference(sd_dhcp6_lease *lease, uint8_t *preference) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek assert_return(preference, -EINVAL);
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek *preference = lease->preference;
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint dhcp6_lease_set_rapid_commit(sd_dhcp6_lease *lease) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint dhcp6_lease_get_rapid_commit(sd_dhcp6_lease *lease, bool *rapid_commit) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek assert_return(rapid_commit, -EINVAL);
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek *rapid_commit = lease->rapid_commit;
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint dhcp6_lease_get_iaid(sd_dhcp6_lease *lease, be32_t *iaid) {
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmekint sd_dhcp6_lease_get_next_address(sd_dhcp6_lease *lease,
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek assert_return(lifetime_preferred, -EINVAL);
8fb494435889dcb9e1c09b8c7220e47bab717bf9Zbigniew Jędrzejewski-Szmek assert_return(lifetime_valid, -EINVAL);
sizeof(struct in6_addr));
return -ENOMSG;
if (lease)
return lease;
return NULL;
if (!lease)
return -ENOMEM;