]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-address.h
Merge pull request #8817 from yuwata/cleanup-nsflags
[thirdparty/systemd.git] / src / network / networkd-address.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2013 Tom Gundersen <teg@jklm.no>
8 ***/
9
10 #include <inttypes.h>
11 #include <stdbool.h>
12
13 #include "conf-parser.h"
14 #include "in-addr-util.h"
15
16 typedef struct Address Address;
17
18 #include "networkd-link.h"
19 #include "networkd-network.h"
20
21 #define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
22
23 typedef struct Network Network;
24 typedef struct Link Link;
25 typedef struct NetworkConfigSection NetworkConfigSection;
26
27 struct Address {
28 Network *network;
29 NetworkConfigSection *section;
30
31 Link *link;
32
33 int family;
34 unsigned char prefixlen;
35 unsigned char scope;
36 uint32_t flags;
37 char *label;
38
39 struct in_addr broadcast;
40 struct ifa_cacheinfo cinfo;
41
42 union in_addr_union in_addr;
43 union in_addr_union in_addr_peer;
44
45 bool ip_masquerade_done:1;
46 bool duplicate_address_detection;
47 bool manage_temporary_address;
48 bool home_address;
49 bool prefix_route;
50 bool autojoin;
51
52 LIST_FIELDS(Address, addresses);
53 };
54
55 int address_new_static(Network *network, const char *filename, unsigned section, Address **ret);
56 int address_new(Address **ret);
57 void address_free(Address *address);
58 int address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
59 int address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
60 int address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
61 int address_update(Address *address, unsigned char flags, unsigned char scope, const struct ifa_cacheinfo *cinfo);
62 int address_drop(Address *address);
63 int address_configure(Address *address, Link *link, sd_netlink_message_handler_t callback, bool update);
64 int address_remove(Address *address, Link *link, sd_netlink_message_handler_t callback);
65 bool address_equal(Address *a1, Address *a2);
66 bool address_is_ready(const Address *a);
67
68 DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
69
70 CONFIG_PARSER_PROTOTYPE(config_parse_address);
71 CONFIG_PARSER_PROTOTYPE(config_parse_broadcast);
72 CONFIG_PARSER_PROTOTYPE(config_parse_label);
73 CONFIG_PARSER_PROTOTYPE(config_parse_lifetime);
74 CONFIG_PARSER_PROTOTYPE(config_parse_address_flags);
75 CONFIG_PARSER_PROTOTYPE(config_parse_address_scope);