Move handling of address/netmask pairs from ifquery into library.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-10-14 01:23:23 +02:00
parent 17a410b87c
commit 02324bebd5
3 changed files with 56 additions and 45 deletions

View file

@ -32,9 +32,6 @@ struct lif_address {
int domain;
};
extern bool lif_address_parse(struct lif_address *address, const char *presentation);
extern bool lif_address_unparse(const struct lif_address *address, char *buf, size_t buflen, bool with_netmask);
/*
* Interfaces are contained in a dictionary, with the interfaces mapped by
* interface name to their `struct lif_interface`.
@ -68,6 +65,10 @@ struct lif_interface {
#define LIF_INTERFACE_COLLECTION_FOREACH_SAFE(iter, iter_next, collection) \
LIF_DICT_FOREACH_SAFE((iter), (iter_next), (collection))
extern bool lif_address_parse(struct lif_address *address, const char *presentation);
extern bool lif_address_unparse(const struct lif_address *address, char *buf, size_t buflen, bool with_netmask);
extern bool lif_address_format_cidr(struct lif_interface *iface, struct lif_dict_entry *entry, char *buf, size_t buflen);
extern void lif_interface_init(struct lif_interface *interface, const char *ifname);
extern bool lif_interface_address_add(struct lif_interface *interface, const char *address);
extern void lif_interface_address_delete(struct lif_interface *interface, const char *address);