| 1 |
#ifndef MTEEVENT_H |
| 2 |
#define MTEEVENT_H |
| 3 |
|
| 4 |
#include "disman/event/mteTrigger.h" |
| 5 |
|
| 6 |
/* |
| 7 |
* Values for mteEventActions field |
| 8 |
*/ |
| 9 |
#define MTE_EVENT_NOTIFICATION 0x80 /* mteEventActions values */ |
| 10 |
#define MTE_EVENT_SET 0x40 |
| 11 |
|
| 12 |
/* |
| 13 |
* Flags relating to the mteEventTable.... |
| 14 |
*/ |
| 15 |
#define MTE_EVENT_FLAG_ENABLED 0x01 /* for mteEventEnabled */ |
| 16 |
#define MTE_EVENT_FLAG_ACTIVE 0x02 /* for mteEventEntryStatus */ |
| 17 |
#define MTE_EVENT_FLAG_FIXED 0x04 /* for snmpd.conf persistence */ |
| 18 |
#define MTE_EVENT_FLAG_VALID 0x08 /* for row creation/undo */ |
| 19 |
|
| 20 |
/* |
| 21 |
* ...and to the mteEventSetTable |
| 22 |
*/ |
| 23 |
#define MTE_SET_FLAG_OBJWILD 0x10 /* for mteEventSetObjectWildcard */ |
| 24 |
#define MTE_SET_FLAG_CTXWILD 0x20 /* for mteEventSetContextNameWildcard */ |
| 25 |
|
| 26 |
|
| 27 |
/* |
| 28 |
* All Event-MIB OCTET STRING objects are either short (32-character) |
| 29 |
* tags, or SnmpAdminString/similar values (i.e. 255 characters) |
| 30 |
*/ |
| 31 |
#define MTE_STR1_LEN 32 |
| 32 |
#define MTE_STR2_LEN 255 |
| 33 |
|
| 34 |
/* |
| 35 |
* Data structure for a (combined) event row |
| 36 |
* Covers both Notification and Set events |
| 37 |
*/ |
| 38 |
struct mteEvent { |
| 39 |
/* |
| 40 |
* Index values |
| 41 |
*/ |
| 42 |
char mteOwner[MTE_STR1_LEN+1]; |
| 43 |
char mteEName[MTE_STR1_LEN+1]; |
| 44 |
|
| 45 |
/* |
| 46 |
* Column values for the main mteEventTable |
| 47 |
*/ |
| 48 |
char mteEventComment[MTE_STR2_LEN+1]; |
| 49 |
u_char mteEventActions; |
| 50 |
|
| 51 |
/* |
| 52 |
* Column values for Notification events (mteEventNotificationTable) |
| 53 |
*/ |
| 54 |
oid mteNotification[MAX_OID_LEN]; |
| 55 |
size_t mteNotification_len; |
| 56 |
char mteNotifyOwner[ MTE_STR1_LEN+1]; |
| 57 |
char mteNotifyObjects[MTE_STR1_LEN+1]; |
| 58 |
|
| 59 |
/* |
| 60 |
* Column values for Set events (mteEventSetTable) |
| 61 |
*/ |
| 62 |
oid mteSetOID[MAX_OID_LEN]; |
| 63 |
size_t mteSetOID_len; |
| 64 |
long mteSetValue; |
| 65 |
char mteSetTarget[ MTE_STR2_LEN+1]; |
| 66 |
char mteSetContext[MTE_STR2_LEN+1]; |
| 67 |
|
| 68 |
netsnmp_session *session; |
| 69 |
long flags; |
| 70 |
}; |
| 71 |
|
| 72 |
/* |
| 73 |
* Container structure for the (combined) mteEvent*Tables, |
| 74 |
* and routine to create this. |
| 75 |
*/ |
| 76 |
extern netsnmp_tdata *event_table_data; |
| 77 |
extern void init_event_table_data(void); |
| 78 |
|
| 79 |
void init_mteEvent(void); |
| 80 |
void mteEvent_removeEntry(netsnmp_tdata_row *row); |
| 81 |
netsnmp_tdata_row *mteEvent_createEntry(const char *mteOwner, |
| 82 |
const char *mteEventName, int fixed); |
| 83 |
int mteEvent_fire( char *owner, char *event, |
| 84 |
struct mteTrigger *trigger, |
| 85 |
oid *suffix, size_t s_len ); |
| 86 |
|
| 87 |
#endif /* MTEEVENT_H */ |