summaryrefslogtreecommitdiff
path: root/agent/mibgroup/disman/mteTriggerTable.h
blob: c427602c2894a8514941f22c8af66eb7f2343cca (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/*
 * This file was generated by mib2c and is intended for use as a mib module
 * for the ucd-snmp snmpd agent. 
 */


#ifndef _MIBGROUP_MTETRIGGERTABLE_H
#define _MIBGROUP_MTETRIGGERTABLE_H


/*
 * we may use header_complex from the header_complex module 
 */


config_require(header_complex)
config_require(utilities/iquery)

#ifndef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
config_error(disman/mteTriggerTable depends on the Callback transport)
#endif

    /*
     * our storage structure(s) 
     */
     struct mteTriggerTable_data {


         char           *mteOwner;
         size_t          mteOwnerLen;
         char           *mteTriggerName;
         size_t          mteTriggerNameLen;
         char           *mteTriggerComment;
         size_t          mteTriggerCommentLen;
         char           *mteTriggerTest;
         size_t          mteTriggerTestLen;
         long            mteTriggerSampleType;
         oid            *mteTriggerValueID;
         size_t          mteTriggerValueIDLen;
         long            mteTriggerValueIDWildcard;
         char           *mteTriggerTargetTag;
         size_t          mteTriggerTargetTagLen;
         char           *mteTriggerContextName;
         size_t          mteTriggerContextNameLen;
         long            mteTriggerContextNameWildcard;
         unsigned long   mteTriggerFrequency;
         char           *mteTriggerObjectsOwner;
         size_t          mteTriggerObjectsOwnerLen;
         char           *mteTriggerObjects;
         size_t          mteTriggerObjectsLen;
         long            mteTriggerEnabled;
         long            mteTriggerEntryStatus;

         /*
          * delta table 
          */
         oid            *mteTriggerDeltaDiscontinuityID;
         size_t          mteTriggerDeltaDiscontinuityIDLen;
         long            mteTriggerDeltaDiscontinuityIDWildcard;
         long            mteTriggerDeltaDiscontinuityIDType;
         unsigned long   prevDiscoTicks;
         unsigned long   prevUptimeTicks;

         /*
          * existence table 
          */
         char           *mteTriggerExistenceTest;
         size_t          mteTriggerExistenceTestLen;
         char           *mteTriggerExistenceStartup;
         size_t          mteTriggerExistenceStartupLen;
         char           *mteTriggerExistenceObjectsOwner;
         size_t          mteTriggerExistenceObjectsOwnerLen;
         char           *mteTriggerExistenceObjects;
         size_t          mteTriggerExistenceObjectsLen;
         char           *mteTriggerExistenceEventOwner;
         size_t          mteTriggerExistenceEventOwnerLen;
         char           *mteTriggerExistenceEvent;
         size_t          mteTriggerExistenceEventLen;

         /*
          * boolean table 
          */
         long            mteTriggerBooleanComparison;
         long            mteTriggerBooleanValue;
         long            mteTriggerBooleanStartup;
         char           *mteTriggerBooleanObjectsOwner;
         size_t          mteTriggerBooleanObjectsOwnerLen;
         char           *mteTriggerBooleanObjects;
         size_t          mteTriggerBooleanObjectsLen;
         char           *mteTriggerBooleanEventOwner;
         size_t          mteTriggerBooleanEventOwnerLen;
         char           *mteTriggerBooleanEvent;
         size_t          mteTriggerBooleanEventLen;

         /*
          * threshold table 
          */
         long            mteTriggerThresholdStartup;
         long            mteTriggerThresholdRising;
         long            mteTriggerThresholdFalling;
         long            mteTriggerThresholdDeltaRising;
         long            mteTriggerThresholdDeltaFalling;
         char           *mteTriggerThresholdObjectsOwner;
         size_t          mteTriggerThresholdObjectsOwnerLen;
         char           *mteTriggerThresholdObjects;
         size_t          mteTriggerThresholdObjectsLen;
         char           *mteTriggerThresholdRisingEventOwner;
         size_t          mteTriggerThresholdRisingEventOwnerLen;
         char           *mteTriggerThresholdRisingEvent;
         size_t          mteTriggerThresholdRisingEventLen;
         char           *mteTriggerThresholdFallingEventOwner;
         size_t          mteTriggerThresholdFallingEventOwnerLen;
         char           *mteTriggerThresholdFallingEvent;
         size_t          mteTriggerThresholdFallingEventLen;
         char           *mteTriggerThresholdDeltaRisingEventOwner;
         size_t          mteTriggerThresholdDeltaRisingEventOwnerLen;
         char           *mteTriggerThresholdDeltaRisingEvent;
         size_t          mteTriggerThresholdDeltaRisingEventLen;
         char           *mteTriggerThresholdDeltaFallingEventOwner;
         size_t          mteTriggerThresholdDeltaFallingEventOwnerLen;
         char           *mteTriggerThresholdDeltaFallingEvent;
         size_t          mteTriggerThresholdDeltaFallingEventLen;

         /*
          * internal variables 
          */
         int             storageType;
         unsigned int    alarmreg;
         int             lastboolresult;
         int             started;
         long            lastvalue;
         struct header_complex_index *hc_storage, *hc_storage_old;
         unsigned long   threshold_state;

         /*
          * pdu auth contents 
          */
         long            have_copied_auth_info;
         long            pdu_version;
         long            pdu_securityModel;
         long            pdu_securityLevel;
         void           *pdu_transport;
         size_t          pdu_transportLen;
         const oid      *pdu_tDomain;
         size_t          pdu_tDomainLen;
         u_char         *pdu_community;
         size_t          pdu_community_len;
         char           *pdu_contextName;
         size_t          pdu_contextNameLen;
         char           *pdu_securityName;
         size_t          pdu_securityNameLen;
     };

     struct last_state {
         long           *value;
         char            lastbool;
         char            lastthreshold;
     };


/*
 * enum definitions from the covered mib sections 
 */







#define MTETRIGGERTEST_EXISTENCE                 0x80
#define MTETRIGGERTEST_BOOLEAN                   0x40
#define MTETRIGGERTEST_THRESHOLD                 0x20

#define MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE       1
#define MTETRIGGERSAMPLETYPE_DELTAVALUE          2


/*
 * What's wrong with using the regular TruthValue definitions TV_TRUE 
 * and TV_FALSE (snmp-tc.h) which are up to 77% shorter?  
 */

#define MTETRIGGERVALUEIDWILDCARD_TRUE           1
#define MTETRIGGERVALUEIDWILDCARD_FALSE          2



#define MTETRIGGERCONTEXTNAMEWILDCARD_TRUE       1
#define MTETRIGGERCONTEXTNAMEWILDCARD_FALSE      2




#define MTETRIGGERENABLED_TRUE                   1
#define MTETRIGGERENABLED_FALSE                  2

#define MTE_NOTSTARTED 0
#define MTE_STARTED 1

#define MTE_THRESHOLD_BEGIN  0
#define MTE_THRESHOLD_HIGH   1
#define MTE_THRESHOLD_LOW    2

/*
 * Just the first (MTE-specific) groups of errors defined here;
 * others are numerically equal to the regular SNMP errors.  
 */

#define MTE_FAILURE_LOCALRESOURCELACK		-1
#define MTE_FAILURE_BADDESTINATION		-2
#define MTE_FAILURE_DESTINATIONUNREACHABLE	-3
#define MTE_FAILURE_NORESPONSE			-4
#define MTE_FAILURE_BADTYPE			-5
#define MTE_FAILURE_SAMPLEOVERRUN		-6


/*
 * function prototypes 
 */


     void            init_mteTriggerTable(void);
     FindVarMethod   var_mteTriggerTable;
     void            parse_mteTriggerTable(const char *, char *);
     void            parse_simple_monitor(const char *, char *);
     void            parse_default_monitors(const char *, char *);
     SNMPCallback    store_mteTriggerTable;
     netsnmp_pdu    *mte_get_response(struct mteTriggerTable_data *,
                                      netsnmp_pdu *);

#ifndef NETSNMP_NO_WRITE_SUPPORT
     WriteMethod     write_mteTriggerComment;
     WriteMethod     write_mteTriggerTest;
     WriteMethod     write_mteTriggerSampleType;
     WriteMethod     write_mteTriggerValueID;
     WriteMethod     write_mteTriggerValueIDWildcard;
     WriteMethod     write_mteTriggerTargetTag;
     WriteMethod     write_mteTriggerContextName;
     WriteMethod     write_mteTriggerContextNameWildcard;
     WriteMethod     write_mteTriggerFrequency;
     WriteMethod     write_mteTriggerObjectsOwner;
     WriteMethod     write_mteTriggerObjects;
     WriteMethod     write_mteTriggerEnabled;
     WriteMethod     write_mteTriggerEntryStatus;
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

     void            mte_enable_trigger(struct mteTriggerTable_data *item);
     void            mte_disable_trigger(struct mteTriggerTable_data
                                         *item);
     SNMPAlarmCallback mte_run_trigger;

#endif                          /* _MIBGROUP_MTETRIGGERTABLE_H */