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