]> git.ipfire.org Git - network.git/blame - src/networkd/config.h
networkd: Change config read functions to not create a new instance
[network.git] / src / networkd / config.h
CommitLineData
6b666d62
MT
1/*#############################################################################
2# #
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2023 IPFire Network Development Team #
5# #
6# This program is free software: you can redistribute it and/or modify #
7# it under the terms of the GNU General Public License as published by #
8# the Free Software Foundation, either version 3 of the License, or #
9# (at your option) any later version. #
10# #
11# This program is distributed in the hope that it will be useful, #
12# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14# GNU General Public License for more details. #
15# #
16# You should have received a copy of the GNU General Public License #
17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
18# #
19#############################################################################*/
20
21#ifndef NETWORKD_CONFIG_H
22#define NETWORKD_CONFIG_H
23
e4eebc6e
MT
24#include <stdio.h>
25
4237caa2
MT
26#define NETWORK_CONFIG_KEY_MAX_LENGTH 128
27#define NETWORK_CONFIG_VALUE_MAX_LENGTH 2048
28
6b666d62
MT
29struct nw_config;
30
31int nw_config_create(struct nw_config** config);
32
33struct nw_config* nw_config_ref(struct nw_config* config);
34struct nw_config* nw_config_unref(struct nw_config* config);
35
91915f80
MT
36int nw_config_flush(struct nw_config* config);
37
3239c3b1
MT
38int nw_config_readf(struct nw_config* config, FILE* f);
39int nw_config_read(struct nw_config* config, const char* path);
c81a6335 40
d3dfdb77
MT
41int nw_config_writef(struct nw_config* config, FILE* f);
42int nw_config_write(struct nw_config* config, const char* path);
43
4237caa2
MT
44int nw_config_del(struct nw_config* config, const char* key);
45
46int nw_config_set(struct nw_config* config, const char* key, const char* value);
47
d39683a6
MT
48const char* nw_config_get(struct nw_config* config, const char* key);
49unsigned int nw_config_get_unsigned_int(struct nw_config* config, const char* key);
50
6b666d62 51#endif /* NETWORKD_CONFIG_H */