--- /dev/null
+/*#############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2023 IPFire Network Development Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#include <stdlib.h>
+
+#include "config.h"
+
+struct nw_config {
+ int nrefs;
+};
+
+static void nw_config_free(struct nw_config* config) {
+ free(config);
+}
+
+int nw_config_create(struct nw_config** config) {
+ struct nw_config* c = calloc(1, sizeof(*c));
+ if (!c)
+ return 1;
+
+ // Initialize reference counter
+ c->nrefs = 1;
+
+ *config = c;
+
+ return 0;
+}
+
+struct nw_config* nw_config_ref(struct nw_config* config) {
+ config->nrefs++;
+
+ return config;
+}
+
+struct nw_config* nw_config_unref(struct nw_config* config) {
+ if (--config->nrefs > 0)
+ return config;
+
+ nw_config_free(config);
+ return NULL;
+}
--- /dev/null
+/*#############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2023 IPFire Network Development Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#ifndef NETWORKD_CONFIG_H
+#define NETWORKD_CONFIG_H
+
+struct nw_config;
+
+int nw_config_create(struct nw_config** config);
+
+struct nw_config* nw_config_ref(struct nw_config* config);
+struct nw_config* nw_config_unref(struct nw_config* config);
+
+#endif /* NETWORKD_CONFIG_H */