common.hpp 1.34 KB
Newer Older
Swann Perarnau's avatar
Swann Perarnau committed
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
#ifndef  __COMMON_HPP__
#define __COMMON_HPP__

#include <sys/types.h>
#include <sys/stat.h>

#include "defaults.hpp"

#if 0
#include "acl.hpp"
#include "argo_container.hpp"
#include "container_manager.hpp"

#include "aggregatelogger.hpp"
#endif

#include <stdexcept>
#include <string.h>
#include <errno.h>
#include <syslog.h>
#include <stdint.h>
#include <sys/types.h>

#include <string>
#include <vector>

using std::string;
using std::vector;


#define UID_INVALID	(uid_t)(-1)

typedef uint32_t Log_dest; //Can be ored with the values below
#define LOG_DEST_DEV_NULL	0
#define LOG_DEST_SYSLOG	1
#define LOG_DEST_STDERR	2
#define LOG_DEST_FILE	4


typedef uint32_t Log_type;
#define LOG_TYPE_INVALID	0
#define LOG_TYPE_INFO	1
#define LOG_TYPE_WARNING	2
#define LOG_TYPE_ERROR		4
#define LOG_TYPE_DEBUG		8

#define LOG_TYPE_ALL	0xf

#define ADD_LOG_TYPE(type0,type_to_add)\
	(LOG_TYPE_ALL & ((type0) | (type_to_add)))
#define SUBSTRACT_LOG_TYPE(type0,type_to_remove)\
	(LOG_TYPE_ALL & ((type0) & (~type_to_remove)))

enum Error_behavior
{
	ON_ERROR_STOP,
	ON_ERROR_CONTINUE
};

enum Activation
{
	ACTIVATION_UNDEFINED,
	ACTIVATION_ENABLED,
	ACTIVATION_DISABLED
};

struct Args
{
	Error_behavior error_behavior;
};

extern Args args;


class ILogger;
extern ILogger* logger;

class Acl;
extern Acl* acl;

extern uid_t ruid;
extern uid_t euid;

#endif //__COMMON_HPP__