Merge commit 'v2.5.1'
[ossec-hids.git] / src / analysisd / lists.h
diff --git a/src/analysisd/lists.h b/src/analysisd/lists.h
new file mode 100644 (file)
index 0000000..a17cbe7
--- /dev/null
@@ -0,0 +1,57 @@
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 3) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+/* Rules are needed for lists */
+
+#include "cdb/cdb.h"
+#include "cdb/uint32.h"
+
+#define LR_STRING_MATCH 0
+#define LR_STRING_NOT_MATCH 1
+#define LR_STRING_MATCH_VALUE 2
+
+#define LR_ADDRESS_MATCH 10
+#define LR_ADDRESS_NOT_MATCH 11
+#define LR_ADDRESS_MATCH_VALUE 12
+
+
+typedef struct ListNode
+{
+    int loaded;
+    char *cdb_filename;
+    char *txt_filename;
+    struct cdb cdb;
+    struct ListNode *next;
+}ListNode;
+
+typedef struct ListRule
+{
+    int loaded;
+    int field;
+    int lookup_type;
+    OSMatch *matcher;
+    char *filename;
+    ListNode *db;
+    struct ListRule *next;
+}ListRule;
+
+/* create the rule list */
+void OS_CreateListsList();
+/* Add rule information to the list */
+int OS_AddList( ListNode *new_listnode );
+int Lists_OP_LoadList(char *listfile);
+int OS_DBSearchKey(ListRule *lrule, char *key);
+int OS_DBSearch(ListRule *lrule, char *key);
+void OS_ListLoadRules();
+ListRule *OS_AddListRule(ListRule *first_rule_list, int lookup_type, int field, char *listname, OSMatch *matcher);
+ListNode *OS_GetFirstList();
+ListNode *OS_FindList(char *listname);