Imported Upstream version 2.5.1
[ossec-hids.git] / src / analysisd / decoders / decoder.h
1 /* @(#) $Id$ */
2
3 /* Copyright (C) 2009 Trend Micro Inc.
4  * All rights 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 2) as published by the FSF - Free Software
9  * Foundation.
10  *
11  * License details at the LICENSE file included with OSSEC or 
12  * online at: http://www.ossec.net/en/licensing.html
13  */
14
15
16 #ifndef __DECODER_H
17
18 #define __DECODER_H
19
20
21 /* We need the eventinfo and os_regex in here */
22 #include "shared.h"
23 #include "os_regex/os_regex.h"
24
25 #define AFTER_PARENT    0x001   /* 1   */
26 #define AFTER_PREMATCH  0x002   /* 2   */
27 #define AFTER_PREVREGEX 0x004   /* 4   */ 
28 #define AFTER_ERROR     0x010   
29
30
31
32 /* Decoder structure */
33 typedef struct
34 {
35     u_int8_t  get_next;
36     u_int8_t  type;
37     u_int8_t  use_own_name;
38
39     u_int16_t id;
40     u_int16_t regex_offset;
41     u_int16_t prematch_offset;
42     
43     int fts;
44     char *parent;
45     char *name;
46     char *ftscomment;
47     
48     OSRegex *regex;
49     OSRegex *prematch;
50     OSMatch *program_name;
51     
52     void (*plugindecoder)(void *lf);
53     void (**order)(void *lf, char *field);
54 }OSDecoderInfo;
55
56 /* List structure */
57 typedef struct _OSDecoderNode
58 {
59     struct _OSDecoderNode *next;
60     struct _OSDecoderNode *child;
61     OSDecoderInfo *osdecoder;
62 }OSDecoderNode;
63
64
65
66 /* Functions to Create the list, Add a osdecoder to the
67  * list and to get the first osdecoder.
68  */
69 void OS_CreateOSDecoderList();
70 int OS_AddOSDecoder(OSDecoderInfo *pi);
71 OSDecoderNode *OS_GetFirstOSDecoder(char *pname);
72 int getDecoderfromlist(char *name);
73
74
75 #endif
76
77 /* EOF */