new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / analysisd / lists.h
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All right reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 3) as published by the FSF - Free Software
7  * Foundation
8  */
9
10 /* Rules are needed for lists */
11
12 #ifndef __LISTS_H
13 #define __LISTS_H
14
15 #include "cdb/cdb.h"
16 #include "cdb/uint32.h"
17
18 #define LR_STRING_MATCH 0
19 #define LR_STRING_NOT_MATCH 1
20 #define LR_STRING_MATCH_VALUE 2
21
22 #define LR_ADDRESS_MATCH 10
23 #define LR_ADDRESS_NOT_MATCH 11
24 #define LR_ADDRESS_MATCH_VALUE 12
25
26 typedef struct ListNode {
27     int loaded;
28     char *cdb_filename;
29     char *txt_filename;
30     struct cdb cdb;
31     struct ListNode *next;
32 } ListNode;
33
34 typedef struct ListRule {
35     int loaded;
36     int field;
37     int lookup_type;
38     OSMatch *matcher;
39     char *filename;
40     ListNode *db;
41     struct ListRule *next;
42 } ListRule;
43
44 /* Create the rule list */
45 void OS_CreateListsList(void);
46
47 /* Add rule information to the list */
48 int OS_AddList( ListNode *new_listnode );
49
50 int Lists_OP_LoadList(char *listfile);
51
52 int OS_DBSearchKey(ListRule *lrule, char *key);
53
54 int OS_DBSearch(ListRule *lrule, char *key);
55
56 void OS_ListLoadRules(void);
57
58 ListRule *OS_AddListRule(ListRule *first_rule_list, int lookup_type, int field, char *listname, OSMatch *matcher);
59
60 ListNode *OS_GetFirstList(void);
61
62 ListNode *OS_FindList(const char *listname);
63
64 void Lists_OP_CreateLists(void);
65
66 #endif /* __LISTS_H */
67