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 | #ifndef RULES_MGMT_H |
---|
26 | #define RULES_MGMT_H |
---|
27 | |
---|
28 | #include <unistd.h> |
---|
29 | #include <stdio.h> |
---|
30 | #include <string.h> |
---|
31 | #include <time.h> |
---|
32 | #include <stdlib.h> |
---|
33 | #include <errno.h> |
---|
34 | #include <sys/ioctl.h> |
---|
35 | #include <sys/types.h> |
---|
36 | #include <sys/socket.h> |
---|
37 | #include <netinet/in.h> |
---|
38 | #include <arpa/inet.h> |
---|
39 | #include <netdb.h> |
---|
40 | #include <linux/types.h> |
---|
41 | #include "remote_output.h" |
---|
42 | #include "fields_mgmt.h" |
---|
43 | |
---|
44 | typedef struct Values * ValuesPtr; |
---|
45 | typedef struct Values { |
---|
46 | unsigned short valueLength; |
---|
47 | union storage { |
---|
48 | unsigned char cvalue; |
---|
49 | unsigned short svalue; |
---|
50 | unsigned long lvalue; |
---|
51 | uint32_t tabAdd6[4]; |
---|
52 | } stor; |
---|
53 | ValuesPtr next; |
---|
54 | } ValuesType; |
---|
55 | |
---|
56 | typedef struct RuleDef * RuleDefPtr; |
---|
57 | typedef struct RuleDef { |
---|
58 | unsigned short fieldType; |
---|
59 | ValuesPtr value; |
---|
60 | unsigned short check; |
---|
61 | unsigned short operator; |
---|
62 | RuleDefPtr next; |
---|
63 | RuleDefPtr prev; |
---|
64 | } RuleDefType; |
---|
65 | |
---|
66 | typedef struct Rules * RulesPtr; |
---|
67 | typedef struct Rules { |
---|
68 | char * ruleName; |
---|
69 | unsigned short id; |
---|
70 | unsigned short type; |
---|
71 | struct tm begin; |
---|
72 | struct tm end; |
---|
73 | unsigned short aggEnabled; |
---|
74 | RuleDefPtr def; |
---|
75 | FieldPtr fieldToRecord; |
---|
76 | RemoteHostPtr host; |
---|
77 | FilePtr fileName; |
---|
78 | DbPtr db; |
---|
79 | RulesPtr next; |
---|
80 | RulesPtr prev; |
---|
81 | } RulesType; |
---|
82 | |
---|
83 | void printRuleDef(RuleDefPtr); |
---|
84 | void printRule(RulesPtr); |
---|
85 | unsigned short getNewId(RulesPtr); |
---|
86 | void freeValue(ValuesPtr); |
---|
87 | void freeRuleDef(RuleDefPtr); |
---|
88 | void freeRule(RulesPtr); |
---|
89 | RulesPtr delRule(RulesPtr, RulesPtr); |
---|
90 | RulesPtr getRules(RulesPtr, char*); |
---|
91 | RulesPtr getLightRules(RulesPtr, char *); |
---|
92 | FilePtr addFileDef(FilePtr, char *, char *); |
---|
93 | RemoteHostPtr addRemoteHostDef(RemoteHostPtr, char *, char *); |
---|
94 | DbPtr addDataBase(DbPtr, char *, char *); |
---|
95 | RuleDefPtr addRuleDef(RuleDefPtr, char *); |
---|
96 | FieldPtr addFields(FieldPtr, char *); |
---|
97 | ValuesPtr addValue(ValuesPtr, unsigned short, char *); |
---|
98 | ValuesPtr addAddress(ValuesPtr, unsigned short, char *); |
---|
99 | ValuesPtr addV6Address(ValuesPtr, unsigned short, char *); |
---|
100 | ValuesPtr addCValue(ValuesPtr, unsigned short, char *); |
---|
101 | |
---|
102 | #endif |
---|