00001 #ifndef __rmEvent_h_ 00002 #define __rmEvent_h_ 00003 00004 #include <queue> 00005 #include <string> 00006 #include <posix_evlog.h> 00007 00008 #include <ResourceMonitor/ResourceMonitorTypes.h> 00009 00010 #include "rmClientError.h" 00011 #include "rmSysInfo.h" 00012 00013 typedef enum _EventType 00014 { 00015 THRESHOLD, 00016 THRESHOLDCANCEL, 00017 LEAKYBUCKET, 00018 00019 SUBSYSTEM, 00020 RESOURCE, 00021 } EventType; 00022 00023 typedef enum _EventName 00024 { 00025 SUBSYSTEM_ADDED, 00026 SUBSYSTEM_REMOVED, 00027 RESOURCE_ADDED, 00028 RESOURCE_REMOVED, 00029 DATACAPTURE_ADDED, 00030 DATACAPTURE_REMOVED 00031 } EventName; 00032 00038 class rmEvent 00039 { 00040 public: 00041 00042 rmEvent(subsystemInfo * aSubsystemInfo, 00043 resourceInfo * aResourceInfo, 00044 dataCaptureInfo * aDataCaptureInfo) : 00045 mSubsystemInfo(aSubsystemInfo), 00046 mResourceInfo(aResourceInfo), 00047 mDataCaptureInfo(aDataCaptureInfo) {} 00048 00049 virtual ~rmEvent(){posix_log_notify_remove(mSystemNotifyHandle);} 00050 00051 int init(); 00052 00054 void addEvent(posix_log_recid_t aRecID, unsigned long aMonID); 00055 00057 void processEvents(); 00058 00059 private: 00060 00061 int getEventType(posix_log_recid_t aRecID, long & aType); 00062 00063 int getEventText(posix_log_recid_t aRecID, char * * aText); 00064 00065 int sendMonitorEvent(EventType aType, eventData & aEvent); 00066 00067 int processSystemEvent(EventType aType, eventData & aEvent); 00068 00069 int sendSubSystemEvent(EventName aEvent, uuid_t aUUID); 00070 00071 int sendResourceEvent(EventName aEvent, uuid_t aUUID, unsigned long aID, string aName); 00072 00073 int sendPluginEvent(EventName aEvent, uuid_t aUUID, unsigned long aID, string aName); 00074 00075 queue<eventData> mEventQueue; 00076 00077 bool mUpdating; 00078 00079 posix_log_notify_t mSystemNotifyHandle; 00080 00081 subsystemInfo * mSubsystemInfo; 00082 resourceInfo * mResourceInfo; 00083 dataCaptureInfo * mDataCaptureInfo; 00084 }; 00085 00086 #endif // __rmEvent_h_