~ubuntu-branches/ubuntu/karmic/rsyslog/karmic-200908151517

« back to all changes in this revision

Viewing changes to vmop.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2008-04-23 16:46:39 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080423164639-5acmt8a4vpxjgnxw
Tags: 3.14.2-3
* debian/rsyslog-doc.install
  - Fix a typo in the install path of the dia files. Closes: #477489
    Thanks to Justin B Rye for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The vmop object.
 
2
 *
 
3
 * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
 
4
 *
 
5
 * This file is part of rsyslog.
 
6
 *
 
7
 * Rsyslog is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation, either version 3 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * Rsyslog is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with Rsyslog.  If not, see <http://www.gnu.org/licenses/>.
 
19
 *
 
20
 * A copy of the GPL can be found in the file "COPYING" in this distribution.
 
21
 */
 
22
#ifndef INCLUDED_VMOP_H
 
23
#define INCLUDED_VMOP_H
 
24
 
 
25
#include "ctok_token.h"
 
26
 
 
27
/* machine instructions types */
 
28
typedef enum {   /* do NOT start at 0 to detect uninitialized types after calloc() */
 
29
        opcode_INVALID = 0,
 
30
        /* for simplicity of debugging and reading dumps, we use the same IDs
 
31
         * that the tokenizer uses where this applicable.
 
32
         */
 
33
        opcode_OR    = ctok_OR,
 
34
        opcode_AND   = ctok_AND,
 
35
        opcode_STRADD= ctok_STRADD,
 
36
        opcode_PLUS  = ctok_PLUS,
 
37
        opcode_MINUS = ctok_MINUS,
 
38
        opcode_TIMES = ctok_TIMES,       /* "*" */
 
39
        opcode_DIV   = ctok_DIV,
 
40
        opcode_MOD   = ctok_MOD,
 
41
        opcode_NOT   = ctok_NOT,
 
42
        opcode_CMP_EQ          = ctok_CMP_EQ, /* all compare operations must be in a row */
 
43
        opcode_CMP_NEQ         = ctok_CMP_NEQ,
 
44
        opcode_CMP_LT          = ctok_CMP_LT,
 
45
        opcode_CMP_GT          = ctok_CMP_GT,
 
46
        opcode_CMP_LTEQ        = ctok_CMP_LTEQ,
 
47
        opcode_CMP_CONTAINS    = ctok_CMP_CONTAINS,
 
48
        opcode_CMP_STARTSWITH  = ctok_CMP_STARTSWITH,
 
49
        opcode_CMP_CONTAINSI   = ctok_CMP_CONTAINSI,
 
50
        opcode_CMP_STARTSWITHI = ctok_CMP_STARTSWITHI,
 
51
        opcode_CMP_GTEQ        = ctok_CMP_GTEQ, /* end compare operations */
 
52
        /* here we start our own codes */
 
53
        opcode_POP             = 1000,   /* requires var operand to receive result */
 
54
        opcode_PUSHSYSVAR      = 1001,   /* requires var operand */
 
55
        opcode_PUSHMSGVAR      = 1002,   /* requires var operand */
 
56
        opcode_PUSHCONSTANT    = 1003,   /* requires var operand */
 
57
        opcode_UNARY_MINUS     = 1010,
 
58
        opcode_END_PROG        = 1011
 
59
} opcode_t;
 
60
 
 
61
 
 
62
/* the vmop object */
 
63
typedef struct vmop_s {
 
64
        BEGINobjInstance;       /* Data to implement generic object - MUST be the first data element! */
 
65
        opcode_t opcode;
 
66
        union {
 
67
                var_t *pVar;
 
68
                /* TODO: add function pointer */
 
69
        } operand;
 
70
        struct vmop_s *pNext; /* next operation or NULL, if end of program (logically this belongs to vmprg) */
 
71
} vmop_t;
 
72
 
 
73
 
 
74
/* interfaces */
 
75
BEGINinterface(vmop) /* name must also be changed in ENDinterface macro! */
 
76
        INTERFACEObjDebugPrint(vmop);
 
77
        rsRetVal (*Construct)(vmop_t **ppThis);
 
78
        rsRetVal (*ConstructFinalize)(vmop_t __attribute__((unused)) *pThis);
 
79
        rsRetVal (*Destruct)(vmop_t **ppThis);
 
80
        rsRetVal (*SetOpcode)(vmop_t *pThis, opcode_t opcode);
 
81
        rsRetVal (*SetVar)(vmop_t *pThis, var_t *pVar);
 
82
        rsRetVal (*Opcode2Str)(vmop_t *pThis, uchar **ppName);
 
83
ENDinterface(vmop)
 
84
#define vmopCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
 
85
 
 
86
/* the remaining prototypes */
 
87
PROTOTYPEObj(vmop);
 
88
 
 
89
#endif /* #ifndef INCLUDED_VMOP_H */