cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

db_structs.h
Go to the documentation of this file.
1 #ifndef CFENGINE_DB_STRUCTS_H
2 #define CFENGINE_DB_STRUCTS_H
3 
4 // All structs needed for cf-check pretty printing
5 // Structs from libutils are included normally via headers
6 // Structs from libpromises are duplicated; cf-check doesn't use libpromises
7 
8 #include <statistics.h>
9 // typedef struct
10 // {
11 // double q;
12 // double expect;
13 // double var;
14 // double dq;
15 // } QPoint;
16 
17 // Struct used for quality entries in /var/cfengine/state/cf_lastseen.lmdb:
18 typedef struct
19 {
20  time_t lastseen;
22 } KeyHostSeen; // Keep in sync with lastseen.h
23 
24 // Struct used for lock entries in /var/cfengine/state/cf_lock.lmdb:
25 typedef struct
26 {
27  pid_t pid;
28  time_t time;
30 } LockData; // Keep in sync with cf3.defs.h
31 
32 #define OBSERVABLES_APPLY(apply_macro) \
33  apply_macro(users) \
34  apply_macro(rootprocs) \
35  apply_macro(otherprocs) \
36  apply_macro(diskfree) \
37  apply_macro(loadavg) \
38  apply_macro(netbiosns_in) \
39  apply_macro(netbiosns_out) \
40  apply_macro(netbiosdgm_in) \
41  apply_macro(netbiosdgm_out) \
42  apply_macro(netbiosssn_in) \
43  apply_macro(netbiosssn_out) \
44  apply_macro(imap_in) \
45  apply_macro(imap_out) \
46  apply_macro(cfengine_in) \
47  apply_macro(cfengine_out) \
48  apply_macro(nfsd_in) \
49  apply_macro(nfsd_out) \
50  apply_macro(smtp_in) \
51  apply_macro(smtp_out) \
52  apply_macro(www_in) \
53  apply_macro(www_out) \
54  apply_macro(ftp_in) \
55  apply_macro(ftp_out) \
56  apply_macro(ssh_in) \
57  apply_macro(ssh_out) \
58  apply_macro(wwws_in) \
59  apply_macro(wwws_out) \
60  apply_macro(icmp_in) \
61  apply_macro(icmp_out) \
62  apply_macro(udp_in) \
63  apply_macro(udp_out) \
64  apply_macro(dns_in) \
65  apply_macro(dns_out) \
66  apply_macro(tcpsyn_in) \
67  apply_macro(tcpsyn_out) \
68  apply_macro(tcpack_in) \
69  apply_macro(tcpack_out) \
70  apply_macro(tcpfin_in) \
71  apply_macro(tcpfin_out) \
72  apply_macro(tcpmisc_in) \
73  apply_macro(tcpmisc_out) \
74  apply_macro(webaccess) \
75  apply_macro(weberrors) \
76  apply_macro(syslog) \
77  apply_macro(messages) \
78  apply_macro(temp0) \
79  apply_macro(temp1) \
80  apply_macro(temp2) \
81  apply_macro(temp3) \
82  apply_macro(cpuall) \
83  apply_macro(cpu0) \
84  apply_macro(cpu1) \
85  apply_macro(cpu2) \
86  apply_macro(cpu3) \
87  apply_macro(microsoft_ds_in) \
88  apply_macro(microsoft_ds_out) \
89  apply_macro(www_alt_in) \
90  apply_macro(www_alt_out) \
91  apply_macro(imaps_in) \
92  apply_macro(imaps_out) \
93  apply_macro(ldap_in) \
94  apply_macro(ldap_out) \
95  apply_macro(ldaps_in) \
96  apply_macro(ldaps_out) \
97  apply_macro(mongo_in) \
98  apply_macro(mongo_out) \
99  apply_macro(mysql_in) \
100  apply_macro(mysql_out) \
101  apply_macro(postgresql_in) \
102  apply_macro(postgresql_out) \
103  apply_macro(ipp_in) \
104  apply_macro(ipp_out) \
105  apply_macro(spare)
106 
107 // Macros to apply to each element:
108 
109 // Double # useful for creating an identifier, expands to ob_postgresql_in,
110 #define GENERATE_OB_ENUM(OB_NAME) ob_##OB_NAME,
111 // Single # useful for creating string literals, expands to: "postgresql_in",
112 #define GENERATE_OB_STRING(OB_NAME) #OB_NAME,
113 
114 // Use apply macro to generate enum and string array
115 
116 typedef enum Observable
117 {
120 
121 static const char *const observable_strings[] =
122 {
124 };
125 
126 // Not the actual count, just the room we set aside in struct (and LMDB):
127 #define CF_OBSERVABLES 100
128 
129 typedef struct Averages
130 {
131  time_t last_seen;
133 } Averages; // Keep in sync with cf3.defs.h
134 
135 typedef enum
136 {
137  CONTEXT_STATE_POLICY_RESET, /* Policy when trying to add already defined persistent states */
139 } PersistentClassPolicy; // Keep in sync with cf3.defs.h
140 
141 typedef struct
142 {
143  unsigned int expires;
145  char tags[]; // variable length, must be zero terminated
146 } PersistentClassInfo; // Keep in sync with cf3.defs.h
147 // Note that tags array does not increase the sizeof() this struct
148 // It allows us to index bytes after the policy variable (plus padding)
149 // As far as C is concerned, tags can be zero length,
150 // we do however require that it is at least 1 (NUL) byte
151 
152 #endif
PersistentClassPolicy
Definition: db_structs.h:136
@ CONTEXT_STATE_POLICY_RESET
Definition: db_structs.h:137
@ CONTEXT_STATE_POLICY_PRESERVE
Definition: db_structs.h:138
#define GENERATE_OB_ENUM(OB_NAME)
Definition: db_structs.h:110
#define CF_OBSERVABLES
Definition: db_structs.h:127
struct Averages Averages
static const char *const observable_strings[]
Definition: db_structs.h:121
#define OBSERVABLES_APPLY(apply_macro)
Definition: db_structs.h:32
Observable
Definition: db_structs.h:117
@ observables_max
Definition: db_structs.h:118
#define GENERATE_OB_STRING(OB_NAME)
Definition: db_structs.h:112
#define NULL
Definition: getopt1.c:56
QPoint Q[100]
Definition: db_structs.h:132
time_t last_seen
Definition: db_structs.h:131
time_t lastseen
Definition: db_structs.h:20
QPoint Q
Definition: db_structs.h:21
time_t time
Definition: db_structs.h:28
time_t process_start_time
Definition: db_structs.h:29
pid_t pid
Definition: db_structs.h:27
PersistentClassPolicy policy
Definition: db_structs.h:144
unsigned int expires
Definition: db_structs.h:143