1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2013 Tom Gundersen <teg@jklm.no>
13 #include "in-addr-util.h"
15 typedef struct Address Address
;
17 #include "networkd-link.h"
18 #include "networkd-network.h"
20 #define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
22 typedef struct Network Network
;
23 typedef struct Link Link
;
24 typedef struct NetworkConfigSection NetworkConfigSection
;
28 NetworkConfigSection
*section
;
33 unsigned char prefixlen
;
38 struct in_addr broadcast
;
39 struct ifa_cacheinfo cinfo
;
41 union in_addr_union in_addr
;
42 union in_addr_union in_addr_peer
;
44 bool ip_masquerade_done
:1;
45 bool duplicate_address_detection
;
46 bool manage_temporary_address
;
51 LIST_FIELDS(Address
, addresses
);
54 int address_new_static(Network
*network
, const char *filename
, unsigned section
, Address
**ret
);
55 int address_new(Address
**ret
);
56 void address_free(Address
*address
);
57 int address_add_foreign(Link
*link
, int family
, const union in_addr_union
*in_addr
, unsigned char prefixlen
, Address
**ret
);
58 int address_add(Link
*link
, int family
, const union in_addr_union
*in_addr
, unsigned char prefixlen
, Address
**ret
);
59 int address_get(Link
*link
, int family
, const union in_addr_union
*in_addr
, unsigned char prefixlen
, Address
**ret
);
60 int address_update(Address
*address
, unsigned char flags
, unsigned char scope
, const struct ifa_cacheinfo
*cinfo
);
61 int address_drop(Address
*address
);
62 int address_configure(Address
*address
, Link
*link
, sd_netlink_message_handler_t callback
, bool update
);
63 int address_remove(Address
*address
, Link
*link
, sd_netlink_message_handler_t callback
);
64 bool address_equal(Address
*a1
, Address
*a2
);
65 bool address_is_ready(const Address
*a
);
67 DEFINE_TRIVIAL_CLEANUP_FUNC(Address
*, address_free
);
68 #define _cleanup_address_free_ _cleanup_(address_freep)
70 int config_parse_address(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
);
71 int config_parse_broadcast(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
);
72 int config_parse_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
);
73 int config_parse_lifetime(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
);
74 int config_parse_address_flags(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
);
75 int config_parse_address_scope(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
);