aboutsummaryrefslogtreecommitdiff
path: root/globals.c
blob: 7f2cae023ab4eac0a5e6878fae0be171952b74ef (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*

(C) 2009-2011 Mika Ilmaranta <ilmis@nullnet.fi>

License: GPLv2

*/

#include <stdio.h>
#include <syslog.h>

#include "globals.h"
#include "defs.h"

#define LSM_CONFIG_FILE ETCDIR "/lsm.conf"

static char *prog = NULL;
static int cont = TRUE;
static int dump = FALSE;
static int ident = 0;
static int reload_cfg = FALSE;
static int dump_if_list = FALSE;
static char *configfile = LSM_CONFIG_FILE;
static char *pidfile = "/var/run/lsm.pid";
static int nodaemon = 0;
static char *status_str[] = { "down", "up", "unknown", "long_down" };

void set_prog(char *val)
{
	prog = val;
}

char *get_prog(void)
{
	if(prog == NULL) {
		syslog(LOG_ERR, "%s: called with prog unset", __FUNCTION__);
		return("prog unset");
	}

	return(prog);
}

void set_cont(const int val)
{
	cont = val;
}

int get_cont(void)
{
	return(cont);
}

void set_dump(const int val)
{
	dump = val;
}

int get_dump(void)
{
	return(dump);
}

void set_ident(const int val)
{
	ident = val;
}

int get_ident(void)
{
	return(ident);
}

void set_reload_cfg(const int val)
{
	reload_cfg = val;
}

int get_reload_cfg(void)
{
	return(reload_cfg);
}

void set_dump_if_list(const int val)
{
	dump_if_list = val;
}

int get_dump_if_list(void)
{
	return(dump_if_list);
}

void set_configfile(char *val)
{
	configfile = val;
}

char *get_configfile(void)
{
	return(configfile);
}

void set_pidfile(char *val)
{
	pidfile = val;
}

char *get_pidfile(void)
{
	return(pidfile);
}

void set_nodaemon(const int val)
{
	nodaemon = val;
}

int get_nodaemon(void)
{
	return(nodaemon);
}

char *get_status_str(STATUS val)
{
	return(status_str[val]);
}

/* EOF */