networkd-address.h revision fc2f9534d07db2b185c02b1961428b53daf1986e
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#pragma once
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering/***
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering This file is part of systemd.
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering Copyright 2013 Tom Gundersen <teg@jklm.no>
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering systemd is free software; you can redistribute it and/or modify it
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering under the terms of the GNU Lesser General Public License as published by
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering (at your option) any later version.
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering systemd is distributed in the hope that it will be useful, but
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering Lesser General Public License for more details.
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering You should have received a copy of the GNU Lesser General Public License
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering***/
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#include <inttypes.h>
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#include <stdbool.h>
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#include "in-addr-util.h"
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringtypedef struct Address Address;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#include "networkd.h"
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#include "networkd-network.h"
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#include "networkd-link.h"
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringstruct Address {
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering Network *network;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering unsigned section;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering int family;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering unsigned char prefixlen;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering unsigned char scope;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering uint32_t flags;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering char *label;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering struct in_addr broadcast;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering struct ifa_cacheinfo cinfo;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering union in_addr_union in_addr;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering union in_addr_union in_addr_peer;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering bool ip_masquerade_done;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering LIST_FIELDS(Address, addresses);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering};
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_new_static(Network *network, unsigned section, Address **ret);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_new_dynamic(Address **ret);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringvoid address_free(Address *address);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_configure(Address *address, Link *link, sd_netlink_message_handler_t callback);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_update(Address *address, Link *link, sd_netlink_message_handler_t callback);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_drop(Address *address, Link *link, sd_netlink_message_handler_t callback);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_establish(Address *address, Link *link);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_release(Address *address, Link *link);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringbool address_equal(Address *a1, Address *a2);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering#define _cleanup_address_free_ _cleanup_(address_freep)
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint config_parse_address(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint config_parse_broadcast(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint config_parse_label(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);