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-link.h"
71d35b6b5563817dfbe757ab9e3b9f018b2db491Thomas Hindoe Paaboel Andersen#include "networkd-network.h"
71d35b6b5563817dfbe757ab9e3b9f018b2db491Thomas Hindoe Paaboel Andersen#include "networkd.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
cf1d700da3fe04cd4c27980a292301694be3b05fTom Gundersen Link *link;
cf1d700da3fe04cd4c27980a292301694be3b05fTom Gundersen
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
adda1ed94a04742ddacdc76dfa311816e1ed9f68Tom Gundersen bool ip_masquerade_done:1;
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering LIST_FIELDS(Address, addresses);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering};
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poettering
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringint address_new_static(Network *network, unsigned section, Address **ret);
f0213e3796b4dd66e546e2de4d677db319f9171bTom Gundersenint address_new(Address **ret);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringvoid address_free(Address *address);
adda1ed94a04742ddacdc76dfa311816e1ed9f68Tom Gundersenint address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
c4a03a5669af8abd752bff9084c29683ae78e11eTom Gundersenint address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
cf1d700da3fe04cd4c27980a292301694be3b05fTom Gundersenint address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
36c32f6120a0c3fe19be5aeaa1926e179e8c29baTom Gundersenint address_update(Address *address, unsigned char flags, unsigned char scope, struct ifa_cacheinfo *cinfo);
91b5f997316ddc77d26f9a7a5e24c335484586bdTom Gundersenint address_drop(Address *address);
6666907869fb3bc7fe6a6025540db5b887c7a78bTom Gundersenint address_configure(Address *address, Link *link, sd_netlink_message_handler_t callback, bool update);
91b5f997316ddc77d26f9a7a5e24c335484586bdTom Gundersenint address_remove(Address *address, Link *link, sd_netlink_message_handler_t callback);
fc2f9534d07db2b185c02b1961428b53daf1986eLennart Poetteringbool address_equal(Address *a1, Address *a2);
ce6c77ebf12f80c807ad7589a1fb565fabc6a543Tom Gundersenbool address_is_ready(const Address *a);
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);