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