Imported Upstream version 2.5.1
[ossec-hids.git] / src / analysisd / lists.h
1 /* @(#) $Id$ */
2
3 /* Copyright (C) 2009 Trend Micro Inc.
4  * All right reserved.
5  *
6  * This program is a free software; you can redistribute it
7  * and/or modify it under the terms of the GNU General Public
8  * License (version 3) as published by the FSF - Free Software
9  * Foundation
10  */
11
12
13 /* Rules are needed for lists */
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
27 typedef struct ListNode
28 {
29     int loaded;
30     char *cdb_filename;
31     char *txt_filename;
32     struct cdb cdb;
33     struct ListNode *next;
34 }ListNode;
35
36 typedef struct ListRule
37 {
38     int loaded;
39     int field;
40     int lookup_type;
41     OSMatch *matcher;
42     char *filename;
43     ListNode *db;
44     struct ListRule *next;
45 }ListRule;
46
47 /* create the rule list */
48 void OS_CreateListsList();
49 /* Add rule information to the list */
50 int OS_AddList( ListNode *new_listnode );
51 int Lists_OP_LoadList(char *listfile);
52 int OS_DBSearchKey(ListRule *lrule, char *key);
53 int OS_DBSearch(ListRule *lrule, char *key);
54 void OS_ListLoadRules();
55 ListRule *OS_AddListRule(ListRule *first_rule_list, int lookup_type, int field, char *listname, OSMatch *matcher);
56 ListNode *OS_GetFirstList();
57 ListNode *OS_FindList(char *listname);