1 /* @(#) $Id: eventinfo.h,v 1.37 2009/07/24 18:34:11 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
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
19 #include "decoders/decoder.h"
22 /* Event Information structure */
23 typedef struct _Eventinfo
25 /* Extracted from the event */
33 /* Extracted from the decoders */
50 /* Pointer to the rule that generated it */
51 RuleInfo *generated_rule;
53 /* Pointer to the decoder that matched */
54 OSDecoderInfo *decoder_info;
56 /* Sid node to delete */
57 OSListNode *sid_node_to_delete;
59 /* Extract when the event fires a rule */
64 /* Other internal variables */
75 /* Events List structure */
76 typedef struct _EventNode
79 struct _EventNode *next;
80 struct _EventNode *prev;
85 /** Types of events (from decoders) **/
86 #define UNKNOWN 0 /* Unkown */
87 #define SYSLOG 1 /* syslog messages */
88 #define IDS 2 /* IDS alerts */
89 #define FIREWALL 3 /* Firewall events */
90 #define WEBLOG 7 /* Apache logs */
91 #define SQUID 8 /* Squid logs */
92 #define WINDOWS 9 /* Windows logs */
93 #define HOST_INFO 10 /* Host information logs (from nmap or similar) */
94 #define OSSEC_RL 11 /* Ossec rules */
95 #define OSSEC_ALERT 12 /* Ossec Alerts */
98 /* FTS allowed values */
99 #define FTS_NAME 001000
100 #define FTS_SRCUSER 002000
101 #define FTS_DSTUSER 004000
102 #define FTS_SRCIP 000100
103 #define FTS_DSTIP 000200
104 #define FTS_LOCATION 000400
105 #define FTS_ID 000010
106 #define FTS_DATA 000020
107 #define FTS_SYSTEMNAME 000040
108 #define FTS_DONE 010000
111 /** Functions for events **/
113 /* Search for matches in the last events */
114 Eventinfo *Search_LastEvents(Eventinfo *lf, RuleInfo *currently_rule);
115 Eventinfo *Search_LastSids(Eventinfo *my_lf, RuleInfo *currently_rule);
116 Eventinfo *Search_LastGroups(Eventinfo *my_lf, RuleInfo *currently_rule);
118 /* Zero the eventinfo structure */
119 void Zero_Eventinfo(Eventinfo *lf);
121 /* Free the eventinfo structure */
122 void Free_Eventinfo(Eventinfo *lf);
124 /* Add and event to the list of previous events */
125 void OS_AddEvent(Eventinfo *lf);
127 /* Return the last event from the Event list */
128 EventNode *OS_GetLastEvent();
130 /* Create the event list. Maxsize must be specified */
131 void OS_CreateEventList(int maxsize);
134 /* Pointers to the event decoders */
135 void *SrcUser_FP(Eventinfo *lf, char *field);
136 void *DstUser_FP(Eventinfo *lf, char *field);
137 void *SrcIP_FP(Eventinfo *lf, char *field);
138 void *DstIP_FP(Eventinfo *lf, char *field);
139 void *SrcPort_FP(Eventinfo *lf, char *field);
140 void *DstPort_FP(Eventinfo *lf, char *field);
141 void *Protocol_FP(Eventinfo *lf, char *field);
142 void *Action_FP(Eventinfo *lf, char *field);
143 void *ID_FP(Eventinfo *lf, char *field);
144 void *Url_FP(Eventinfo *lf, char *field);
145 void *Data_FP(Eventinfo *lf, char *field);
146 void *Status_FP(Eventinfo *lf, char *field);
147 void *SystemName_FP(Eventinfo *lf, char *field);
148 void *None_FP(Eventinfo *lf, char *field);
152 #endif /* _EVTINFO__H */