2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2015-08-27 13:59:06 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2018-05-22 13:10:17 +02:00
|
|
|
#include "conf-parser.h"
|
2015-08-27 13:59:06 +02:00
|
|
|
#include "in-addr-util.h"
|
|
|
|
|
|
|
|
typedef struct Address Address;
|
|
|
|
|
|
|
|
#include "networkd-link.h"
|
2015-11-18 22:46:33 +01:00
|
|
|
#include "networkd-network.h"
|
2019-03-01 05:27:47 +01:00
|
|
|
#include "networkd-util.h"
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
#define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
|
|
|
|
|
2016-04-29 04:52:04 +02:00
|
|
|
typedef struct Network Network;
|
|
|
|
typedef struct Link Link;
|
2017-02-15 05:30:35 +01:00
|
|
|
typedef struct NetworkConfigSection NetworkConfigSection;
|
2016-04-29 04:52:04 +02:00
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
struct Address {
|
|
|
|
Network *network;
|
2017-02-15 05:30:35 +01:00
|
|
|
NetworkConfigSection *section;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2015-09-23 01:53:29 +02:00
|
|
|
Link *link;
|
|
|
|
|
2015-08-27 13:59:06 +02:00
|
|
|
int family;
|
|
|
|
unsigned char prefixlen;
|
|
|
|
unsigned char scope;
|
|
|
|
uint32_t flags;
|
|
|
|
char *label;
|
|
|
|
|
|
|
|
struct in_addr broadcast;
|
|
|
|
struct ifa_cacheinfo cinfo;
|
|
|
|
|
|
|
|
union in_addr_union in_addr;
|
|
|
|
union in_addr_union in_addr_peer;
|
|
|
|
|
2015-09-30 14:01:44 +02:00
|
|
|
bool ip_masquerade_done:1;
|
2016-10-08 13:05:41 +02:00
|
|
|
bool duplicate_address_detection;
|
|
|
|
bool manage_temporary_address;
|
|
|
|
bool home_address;
|
|
|
|
bool prefix_route;
|
|
|
|
bool autojoin;
|
2015-08-27 13:59:06 +02:00
|
|
|
|
|
|
|
LIST_FIELDS(Address, addresses);
|
|
|
|
};
|
|
|
|
|
2015-09-21 15:53:40 +02:00
|
|
|
int address_new(Address **ret);
|
2015-08-27 13:59:06 +02:00
|
|
|
void address_free(Address *address);
|
2015-09-30 14:01:44 +02:00
|
|
|
int address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
2015-10-01 21:14:06 +02:00
|
|
|
int address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
2015-09-23 01:53:29 +02:00
|
|
|
int address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
|
2016-06-03 19:54:35 +02:00
|
|
|
int address_update(Address *address, unsigned char flags, unsigned char scope, const struct ifa_cacheinfo *cinfo);
|
2015-09-24 15:25:20 +02:00
|
|
|
int address_drop(Address *address);
|
2018-11-28 21:06:52 +01:00
|
|
|
int address_configure(Address *address, Link *link, link_netlink_message_handler_t callback, bool update);
|
|
|
|
int address_remove(Address *address, Link *link, link_netlink_message_handler_t callback);
|
2015-08-27 13:59:06 +02:00
|
|
|
bool address_equal(Address *a1, Address *a2);
|
2015-09-28 13:30:10 +02:00
|
|
|
bool address_is_ready(const Address *a);
|
2019-03-01 05:27:47 +01:00
|
|
|
int address_section_verify(Address *a);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2019-03-01 05:27:47 +01:00
|
|
|
DEFINE_NETWORK_SECTION_FUNCTIONS(Address, address_free);
|
2015-08-27 13:59:06 +02:00
|
|
|
|
2018-05-22 13:10:17 +02:00
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_address);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_broadcast);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_label);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_lifetime);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_address_flags);
|
|
|
|
CONFIG_PARSER_PROTOTYPE(config_parse_address_scope);
|