summaryrefslogtreecommitdiffstats
path: root/PICA_nodeconfig.h
blob: 13ca79b3f93120e049286ce3451d793e5c273b08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
	(c) Copyright  2012 - 2018 Anton Sviridenko
	https://picapica.im

	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 <https://www.gnu.org/licenses/>.
*/

#ifndef PICA_NODECONFIG_H
#define PICA_NODECONFIG_H

#ifndef PICA_INSTALLPREFIX
#define PICA_INSTALLPREFIX "/usr"
#endif

#ifndef PICA_SYSCONFDIR
#define PICA_SYSCONFDIR "/etc"
#endif

#ifndef PICA_LOCALSTATEDIR
#define PICA_LOCALSTATEDIR "/var"
#endif

#define PICA_NODECONFIG_DEF_ANNOUNCED_ADDR "autoconfigure"
#define PICA_NODECONFIG_DEF_LISTEN_PORT "2299"
#define PICA_NODECONFIG_DEF_NODES_DB_FILE PICA_LOCALSTATEDIR"/lib/pica-node/nodelist.db"
#define PICA_NODECONFIG_DEF_CONFIG_FILE PICA_SYSCONFDIR"/pica-node.conf"
#define PICA_NODECONFIG_DEF_DH_PARAM_FILE PICA_INSTALLPREFIX"/share/pica-node/dhparam4096.pem"

struct nodeconfig
{
	char			*announced_addr;
	char 			*listen_port;
	char 			*nodes_db_file;
	char			*config_file;
	char			*dh_param_file;
	int 			disable_reserved_addrs;
//int			conn_speed_limit;
};

extern struct nodeconfig nodecfg;

int PICA_nodeconfig_load(const char *config_file);

#endif