Branch data Line data Source code
1 : : /* SPDX-License-Identifier: LGPL-2.1+ */ 2 : : #pragma once 3 : : 4 : : #include <inttypes.h> 5 : : #include <stdbool.h> 6 : : 7 : : #include "conf-parser.h" 8 : : #include "in-addr-util.h" 9 : : 10 : : typedef struct Address Address; 11 : : 12 : : #include "networkd-link.h" 13 : : #include "networkd-network.h" 14 : : #include "networkd-util.h" 15 : : 16 : : #define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU 17 : : 18 : : typedef struct Network Network; 19 : : typedef struct Link Link; 20 : : typedef struct NetworkConfigSection NetworkConfigSection; 21 : : 22 : : struct Address { 23 : : Network *network; 24 : : NetworkConfigSection *section; 25 : : 26 : : Link *link; 27 : : 28 : : int family; 29 : : unsigned char prefixlen; 30 : : unsigned char scope; 31 : : uint32_t flags; 32 : : char *label; 33 : : 34 : : struct in_addr broadcast; 35 : : struct ifa_cacheinfo cinfo; 36 : : 37 : : union in_addr_union in_addr; 38 : : union in_addr_union in_addr_peer; 39 : : 40 : : bool ip_masquerade_done:1; 41 : : bool duplicate_address_detection; 42 : : bool manage_temporary_address; 43 : : bool home_address; 44 : : bool prefix_route; 45 : : bool autojoin; 46 : : 47 : : LIST_FIELDS(Address, addresses); 48 : : }; 49 : : 50 : : int address_new(Address **ret); 51 : : void address_free(Address *address); 52 : : int address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret); 53 : : int address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret); 54 : : int address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret); 55 : : int address_update(Address *address, unsigned char flags, unsigned char scope, const struct ifa_cacheinfo *cinfo); 56 : : int address_drop(Address *address); 57 : : int address_configure(Address *address, Link *link, link_netlink_message_handler_t callback, bool update); 58 : : int address_remove(Address *address, Link *link, link_netlink_message_handler_t callback); 59 : : bool address_equal(Address *a1, Address *a2); 60 : : bool address_is_ready(const Address *a); 61 : : int address_section_verify(Address *a); 62 : : 63 [ + + + - ]: 356 : DEFINE_NETWORK_SECTION_FUNCTIONS(Address, address_free); 64 : : 65 : : CONFIG_PARSER_PROTOTYPE(config_parse_address); 66 : : CONFIG_PARSER_PROTOTYPE(config_parse_broadcast); 67 : : CONFIG_PARSER_PROTOTYPE(config_parse_label); 68 : : CONFIG_PARSER_PROTOTYPE(config_parse_lifetime); 69 : : CONFIG_PARSER_PROTOTYPE(config_parse_address_flags); 70 : : CONFIG_PARSER_PROTOTYPE(config_parse_address_scope);