networkd-address.h revision cf1d700da3fe04cd4c27980a292301694be3b05f
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#pragma once
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/***
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering This file is part of systemd.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Copyright 2013 Tom Gundersen <teg@jklm.no>
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is free software; you can redistribute it and/or modify it
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering under the terms of the GNU Lesser General Public License as published by
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering (at your option) any later version.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is distributed in the hope that it will be useful, but
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Lesser General Public License for more details.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering You should have received a copy of the GNU Lesser General Public License
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering***/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#include <inttypes.h>
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include <stdbool.h>
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
f48e75cb9a8112d35855c44a156934f2ee0edb2eLennart Poettering#include "in-addr-util.h"
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poetteringtypedef struct Address Address;
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#include "networkd.h"
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#include "networkd-network.h"
eef46c372f64f40dd75415b2c504c73138719c8dLennart Poettering#include "networkd-link.h"
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poetteringstruct Address {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Network *network;
9d12709626bccc0cae677a7035f62efe6aabb4abLennart Poettering unsigned section;
f2cbe59e113f08549949a76ac5b9b3972df4cc30Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering Link *link;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering int family;
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering unsigned char prefixlen;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering unsigned char scope;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering uint32_t flags;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering char *label;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering struct in_addr broadcast;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering struct ifa_cacheinfo cinfo;
0b452006de98294d1690f045f6ea2f7f6630ec3bRonny Chevalier
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering union in_addr_union in_addr;
24882e06c135584f16f31ba8a00fecde8b7f6fadLennart Poettering union in_addr_union in_addr_peer;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering bool ip_masquerade_done;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering LIST_FIELDS(Address, addresses);
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering};
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_new_static(Network *network, unsigned section, Address **ret);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_new(Address **ret);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringvoid address_free(Address *address);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_add(Link *link, Address *address);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersenint address_configure(Address *address, Link *link, sd_netlink_message_handler_t callback);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_update(Address *address, Link *link, sd_netlink_message_handler_t callback);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_drop(Address *address, Link *link, sd_netlink_message_handler_t callback);
d21ed1ead18d16d35c30299a69d3366847f8a039Lennart Poetteringint address_establish(Address *address, Link *link);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint address_release(Address *address, Link *link);
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poetteringbool address_equal(Address *a1, Address *a2);
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering
d8f52ed25a9edce75fda5251c977b7898e33887eLennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering#define _cleanup_address_free_ _cleanup_(address_freep)
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart 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);
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart 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);
6e18cc9fa078d2a967251017ddb5baefb104b720Lennart 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);
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering