new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / analysisd / decoders / decoder.h
1 /* Copyright (C) 2009 Trend Micro Inc.
2  * All rights reserved.
3  *
4  * This program is a free software; you can redistribute it
5  * and/or modify it under the terms of the GNU General Public
6  * License (version 2) as published by the FSF - Free Software
7  * Foundation.
8  */
9
10 #ifndef __DECODER_H
11 #define __DECODER_H
12
13 #include "shared.h"
14 #include "os_regex/os_regex.h"
15
16 #define AFTER_PARENT    0x001   /* 1   */
17 #define AFTER_PREMATCH  0x002   /* 2   */
18 #define AFTER_PREVREGEX 0x004   /* 4   */
19 #define AFTER_ERROR     0x010
20
21 struct _Eventinfo;
22
23
24 /* Decoder structure */
25 typedef struct {
26     u_int8_t  get_next;
27     u_int8_t  type;
28     u_int8_t  use_own_name;
29
30     u_int16_t id;
31     u_int16_t regex_offset;
32     u_int16_t prematch_offset;
33
34     int fts;
35     int accumulate;
36     char *parent;
37     char *name;
38     char *ftscomment;
39     char **fields;
40
41
42
43     OSRegex *regex;
44     OSRegex *prematch;
45     OSMatch *program_name;
46
47     OSPcre2 *pcre2;
48     OSPcre2 *prematch_pcre2;
49     OSPcre2 *program_name_pcre2;
50
51     void (*plugindecoder)(void *lf);
52     void* (**order)(struct _Eventinfo *, char *, int);
53 } OSDecoderInfo;
54
55 /* List structure */
56 typedef struct _OSDecoderNode {
57     struct _OSDecoderNode *next;
58     struct _OSDecoderNode *child;
59     OSDecoderInfo *osdecoder;
60 } OSDecoderNode;
61
62 /* Functions to Create the list, add a osdecoder to the
63  * list and to get the first osdecoder
64  */
65 void OS_CreateOSDecoderList(void);
66 int OS_AddOSDecoder(OSDecoderInfo *pi);
67 OSDecoderNode *OS_GetFirstOSDecoder(const char *pname);
68 int getDecoderfromlist(const char *name);
69 char *GetGeoInfobyIP(char *ip_addr);
70 int SetDecodeXML(void);
71 void HostinfoInit(void);
72 void SyscheckInit(void);
73 void RootcheckInit(void);
74
75 int ReadDecodeXML(const char *file);
76
77 #endif
78