2020-07-20 13:42:16 +00:00
|
|
|
/*
|
|
|
|
* libifupdown/state.h
|
|
|
|
* Purpose: state management
|
|
|
|
*
|
|
|
|
* Copyright (c) 2020 Ariadne Conill <ariadne@dereferenced.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* This software is provided 'as is' and without any warranty, express or
|
|
|
|
* implied. In no event shall the authors be liable for any damages arising
|
|
|
|
* from the use of this software.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIBIFUPDOWN_STATE_H__GUARD
|
|
|
|
#define LIBIFUPDOWN_STATE_H__GUARD
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2020-10-21 14:15:52 +00:00
|
|
|
#include <stdbool.h>
|
2020-07-20 13:42:16 +00:00
|
|
|
#include "libifupdown/interface.h"
|
|
|
|
|
2020-09-08 20:59:58 +00:00
|
|
|
struct lif_state_record {
|
|
|
|
char *mapped_if;
|
|
|
|
size_t refcount;
|
2020-10-21 14:15:52 +00:00
|
|
|
|
|
|
|
bool is_explicit;
|
2020-09-08 20:59:58 +00:00
|
|
|
};
|
|
|
|
|
2020-07-20 14:19:23 +00:00
|
|
|
extern bool lif_state_read(struct lif_dict *state, FILE *f);
|
|
|
|
extern bool lif_state_read_path(struct lif_dict *state, const char *path);
|
2020-07-20 13:42:16 +00:00
|
|
|
extern void lif_state_upsert(struct lif_dict *state, const char *ifname, struct lif_interface *iface);
|
2020-09-08 21:05:02 +00:00
|
|
|
extern void lif_state_ref_if(struct lif_dict *state, const char *ifname, struct lif_interface *iface);
|
|
|
|
extern void lif_state_unref_if(struct lif_dict *state, const char *ifname, struct lif_interface *iface);
|
2020-07-20 13:42:16 +00:00
|
|
|
extern void lif_state_delete(struct lif_dict *state, const char *ifname);
|
|
|
|
extern void lif_state_write(const struct lif_dict *state, FILE *f);
|
2020-07-20 14:19:23 +00:00
|
|
|
extern bool lif_state_write_path(const struct lif_dict *state, const char *path);
|
2020-07-20 13:45:39 +00:00
|
|
|
extern struct lif_interface *lif_state_lookup(struct lif_dict *state, struct lif_dict *if_collection, const char *ifname);
|
2020-07-24 10:48:50 +00:00
|
|
|
extern bool lif_state_sync(struct lif_dict *state, struct lif_dict *if_collection);
|
2020-07-20 13:42:16 +00:00
|
|
|
|
|
|
|
#endif
|