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