| 1 |
#ifndef EXPEXPRESSION_H |
| 2 |
#define EXPEXPRESSION_H |
| 3 |
|
| 4 |
#include "disman/expr/exp_enum.h" |
| 5 |
|
| 6 |
/* |
| 7 |
* Flags relating to the expression table .... |
| 8 |
*/ |
| 9 |
#define EXP_FLAG_ACTIVE 0x01 /* for expExpressionEntryStatus */ |
| 10 |
#define EXP_FLAG_FIXED 0x02 /* for snmpd.conf persistence */ |
| 11 |
#define EXP_FLAG_VALID 0x04 /* for row creation/undo */ |
| 12 |
#define EXP_FLAG_SYSUT 0x08 /* sysUpTime.0 discontinuity */ |
| 13 |
|
| 14 |
/* |
| 15 |
* Standard lengths for various Expression-MIB OCTET STRING objects: |
| 16 |
* short tags ( 32 characters) |
| 17 |
* SnmpAdminString-style values (255 characters) |
| 18 |
* "long" DisplayString values (1024 characters) |
| 19 |
*/ |
| 20 |
#define EXP_STR1_LEN 32 |
| 21 |
#define EXP_STR2_LEN 255 |
| 22 |
#define EXP_STR3_LEN 1024 |
| 23 |
|
| 24 |
/* |
| 25 |
* Data structure for an expression row. |
| 26 |
* Covers both expExpressionTable and expErrorTable |
| 27 |
*/ |
| 28 |
struct expExpression { |
| 29 |
/* |
| 30 |
* Index values |
| 31 |
*/ |
| 32 |
char expOwner[ EXP_STR1_LEN+1 ]; |
| 33 |
char expName[ EXP_STR1_LEN+1 ]; |
| 34 |
|
| 35 |
/* |
| 36 |
* Column values for the main expExpressionTable |
| 37 |
*/ |
| 38 |
char expExpression[ EXP_STR3_LEN+1 ]; |
| 39 |
char expComment[ EXP_STR2_LEN+1 ]; |
| 40 |
oid expPrefix[ MAX_OID_LEN ]; |
| 41 |
size_t expPrefix_len; |
| 42 |
long expValueType; |
| 43 |
long expDeltaInterval; |
| 44 |
u_long expErrorCount; |
| 45 |
|
| 46 |
/* |
| 47 |
* Column values for the expExpressionErrorTable |
| 48 |
*/ |
| 49 |
u_long expErrorTime; |
| 50 |
long expErrorIndex; |
| 51 |
long expErrorCode; |
| 52 |
oid expErrorInstance[ MAX_OID_LEN ]; |
| 53 |
size_t expErrorInst_len; |
| 54 |
|
| 55 |
unsigned int alarm; |
| 56 |
netsnmp_session *session; |
| 57 |
netsnmp_variable_list *pvars; /* expPrefix values */ |
| 58 |
long sysUpTime; |
| 59 |
long count; |
| 60 |
long flags; |
| 61 |
}; |
| 62 |
|
| 63 |
|
| 64 |
/* |
| 65 |
* Container structure for the expExpressionTable, |
| 66 |
* and initialisation routine to create this. |
| 67 |
*/ |
| 68 |
extern netsnmp_tdata *expr_table_data; |
| 69 |
extern void init_expr_table_data(void); |
| 70 |
|
| 71 |
/* |
| 72 |
* function declarations |
| 73 |
*/ |
| 74 |
void init_expExpression(void); |
| 75 |
|
| 76 |
struct expExpression *expExpression_createEntry(const char *, const char *, int); |
| 77 |
netsnmp_tdata_row *expExpression_createRow(const char *, const char *, int); |
| 78 |
void expExpression_removeEntry( netsnmp_tdata_row *); |
| 79 |
|
| 80 |
struct expExpression *expExpression_getEntry(const char *, const char *); |
| 81 |
struct expExpression *expExpression_getFirstEntry( void ); |
| 82 |
struct expExpression *expExpression_getNextEntry(const char *, const char *); |
| 83 |
|
| 84 |
void expExpression_enable( struct expExpression *); |
| 85 |
void expExpression_disable( struct expExpression *); |
| 86 |
|
| 87 |
void expExpression_getData( unsigned int, void *); |
| 88 |
void expExpression_evaluate(struct expExpression *); |
| 89 |
long expExpression_getNumEntries(int); |
| 90 |
|
| 91 |
#endif /* EXPEXPRESSIONTABLE_H */ |