summaryrefslogtreecommitdiff
path: root/agent/mibgroup/disman/expr/expExpression.h
blob: 282e2bf6f83930bd007c6765aed06ddeb3a44cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef EXPEXPRESSION_H
#define EXPEXPRESSION_H

#include "disman/expr/exp_enum.h"

    /*
     * Flags relating to the expression table ....
     */
#define EXP_FLAG_ACTIVE  0x01    /* for expExpressionEntryStatus */
#define EXP_FLAG_FIXED   0x02    /* for snmpd.conf persistence   */
#define EXP_FLAG_VALID   0x04    /* for row creation/undo        */
#define EXP_FLAG_SYSUT   0x08    /* sysUpTime.0 discontinuity    */

    /*
     * Standard lengths for various Expression-MIB OCTET STRING objects:
     *   short tags                   ( 32 characters)
     *   SnmpAdminString-style values (255 characters)
     *   "long" DisplayString values (1024 characters)
     */
#define EXP_STR1_LEN	32
#define EXP_STR2_LEN	255
#define EXP_STR3_LEN	1024

/*
 * Data structure for an expression row.
 * Covers both expExpressionTable and expErrorTable
 */
struct expExpression {
    /*
     * Index values 
     */
    char            expOwner[ EXP_STR1_LEN+1 ];
    char            expName[  EXP_STR1_LEN+1 ];

    /*
     * Column values for the main expExpressionTable
     */
    char            expExpression[ EXP_STR3_LEN+1 ];
    char            expComment[    EXP_STR2_LEN+1 ];
    oid             expPrefix[     MAX_OID_LEN ];
    size_t          expPrefix_len;
    long            expValueType;
    long            expDeltaInterval;
    u_long          expErrorCount;

    /*
     * Column values for the expExpressionErrorTable
     */
    u_long          expErrorTime;
    long            expErrorIndex;
    long            expErrorCode;
    oid             expErrorInstance[ MAX_OID_LEN ];
    size_t          expErrorInst_len;

    unsigned int    alarm;
    netsnmp_session *session;
    netsnmp_variable_list *pvars;  /* expPrefix values */
    long            sysUpTime;
    long            count;
    long            flags;
};


  /*
   * Container structure for the expExpressionTable,
   * and initialisation routine to create this.
   */
extern netsnmp_tdata *expr_table_data;
extern void      init_expr_table_data(void);

/*
 * function declarations
 */
void             init_expExpression(void);

struct expExpression *expExpression_createEntry(const char *, const char *, int);
netsnmp_tdata_row    *expExpression_createRow(const char *, const char *, int);
void                  expExpression_removeEntry(   netsnmp_tdata_row *);

struct expExpression *expExpression_getEntry(const char *, const char *);
struct expExpression *expExpression_getFirstEntry( void );
struct expExpression *expExpression_getNextEntry(const char *, const char *);

void                  expExpression_enable(  struct expExpression *);
void                  expExpression_disable( struct expExpression *);

void                  expExpression_getData(   unsigned int, void *);
void                  expExpression_evaluate(struct expExpression *);
long                  expExpression_getNumEntries(int);

#endif                          /* EXPEXPRESSIONTABLE_H */