]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-address-label.h
networkd: add support for address label
[thirdparty/systemd.git] / src / network / networkd-address-label.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2017 Susant Sahani
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <inttypes.h>
23 #include <stdbool.h>
24
25 #include "in-addr-util.h"
26
27 typedef struct AddressLabel AddressLabel;
28
29 #include "networkd-link.h"
30 #include "networkd-network.h"
31
32 typedef struct Network Network;
33 typedef struct Link Link;
34 typedef struct NetworkConfigSection NetworkConfigSection;
35
36 struct AddressLabel {
37 Network *network;
38 Link *link;
39 NetworkConfigSection *section;
40
41 int family;
42 unsigned char prefixlen;
43 uint32_t label;
44
45 union in_addr_union in_addr;
46
47 LIST_FIELDS(AddressLabel, labels);
48 };
49
50 int address_label_new(AddressLabel **ret);
51 void address_label_free(AddressLabel *label);
52
53 DEFINE_TRIVIAL_CLEANUP_FUNC(AddressLabel*, address_label_free);
54 #define _cleanup_address_label_free_ _cleanup_(address_label_freep)
55
56 int address_label_configure(AddressLabel *address, Link *link, sd_netlink_message_handler_t callback, bool update);
57
58 int config_parse_address_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);
59 int config_parse_address_label_prefix(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);