[2] | 1 | |
---|
| 2 | |
---|
| 3 | |
---|
[28] | 4 | |
---|
[2] | 5 | |
---|
[28] | 6 | |
---|
[2] | 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; |
---|
[10] | 53 | unsigned short mask; |
---|
[2] | 54 | ValuesPtr next; |
---|
| 55 | } ValuesType; |
---|
| 56 | |
---|
| 57 | typedef struct RuleDef * RuleDefPtr; |
---|
| 58 | typedef struct RuleDef { |
---|
| 59 | unsigned short fieldType; |
---|
| 60 | ValuesPtr value; |
---|
| 61 | unsigned short check; |
---|
| 62 | unsigned short operator; |
---|
| 63 | RuleDefPtr next; |
---|
| 64 | RuleDefPtr prev; |
---|
| 65 | } RuleDefType; |
---|
| 66 | |
---|
| 67 | typedef struct Rules * RulesPtr; |
---|
| 68 | typedef struct Rules { |
---|
| 69 | char * ruleName; |
---|
| 70 | unsigned short id; |
---|
| 71 | unsigned short type; |
---|
| 72 | struct tm begin; |
---|
| 73 | struct tm end; |
---|
| 74 | unsigned short aggEnabled; |
---|
| 75 | RuleDefPtr def; |
---|
| 76 | FieldPtr fieldToRecord; |
---|
| 77 | RemoteHostPtr host; |
---|
| 78 | FilePtr fileName; |
---|
| 79 | DbPtr db; |
---|
| 80 | RulesPtr next; |
---|
| 81 | RulesPtr prev; |
---|
| 82 | } RulesType; |
---|
| 83 | |
---|
| 84 | void printRuleDef(RuleDefPtr); |
---|
| 85 | void printRule(RulesPtr); |
---|
| 86 | unsigned short getNewId(RulesPtr); |
---|
| 87 | void freeValue(ValuesPtr); |
---|
| 88 | void freeRuleDef(RuleDefPtr); |
---|
| 89 | void freeRule(RulesPtr); |
---|
| 90 | RulesPtr delRule(RulesPtr, RulesPtr); |
---|
| 91 | RulesPtr getRules(RulesPtr, char*); |
---|
| 92 | RulesPtr getLightRules(RulesPtr, char *); |
---|
| 93 | FilePtr addFileDef(FilePtr, char *, char *); |
---|
| 94 | RemoteHostPtr addRemoteHostDef(RemoteHostPtr, char *, char *); |
---|
| 95 | DbPtr addDataBase(DbPtr, char *, char *); |
---|
| 96 | RuleDefPtr addRuleDef(RuleDefPtr, char *); |
---|
| 97 | FieldPtr addFields(FieldPtr, char *); |
---|
| 98 | ValuesPtr addValue(ValuesPtr, unsigned short, char *); |
---|
| 99 | ValuesPtr addAddress(ValuesPtr, unsigned short, char *); |
---|
| 100 | ValuesPtr addV6Address(ValuesPtr, unsigned short, char *); |
---|
| 101 | ValuesPtr addCValue(ValuesPtr, unsigned short, char *); |
---|
| 102 | |
---|
| 103 | #endif |
---|