Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

eventLog Class Reference

#include <eventLog.h>

Inheritance diagram for eventLog:

IBaseAccessor List of all members.

Public Methods

 eventLog (eventQuery *aEventQuery)
virtual ~eventLog ()
size_t getCount () const
EventLoggetElement (unsigned long aID)
int addElement (const EventLog &aElement, unsigned long aID)
int newElement (const EventLog &aElement, unsigned long &aID)
int addDefaultElement (unsigned long aID)
int removeElement (unsigned long aID)
int modifyElement (unsigned long aID, const EventLog &aElement)
unsigned long getNewId (void)
int setInteger32 (RMAttribute aName, unsigned long aID, long aValue)
int setUnsigned64 (RMAttribute aName, unsigned long aID, u_int64_t aValue)
int setUUIDString (RMAttribute aName, unsigned long aID, char *aUUIDStr)
bool elementIsReady (const EventLog &aElement) const
int getUnsigned64 (RMAttribute aName, unsigned long aID, u_int64_t &aValue)
int getUUIDString (RMAttribute aName, unsigned long aID, char *aUUIDStr)
int getUUID (RMAttribute aName, unsigned long aID, uuid_t aUUID)
unsigned long getMaxId (void)
int findExactId (unsigned long aID)
int init ()
 initialization. More...

const EventLoggetConstElement (unsigned long aID)
 get a element in const form. More...

int findId (unsigned long aID)
 find a record with recid == aID. More...

int getNextId (unsigned long aID, unsigned long &aNextID)
 find the record right after the record whose recid == aID. More...

int getInteger32 (RMAttribute aName, unsigned long aID, long &aValue)
 get the value of int32 attribute of a event log record. More...

int getUnsigned (RMAttribute aName, unsigned long aID, unsigned long &aValue)
 get the value of unsigned attribute of a event log record. More...

int getString (RMAttribute aName, unsigned long aID, char *&aBuf)
 get the string attribute of an event log record. More...

int getBinary (RMAttribute aName, unsigned long aID, char *&aBuf, unsigned long &aLength)
 get the binary attribute of an event log record. More...

int setString (RMAttribute aName, unsigned long aID, char *aBuf)
 set the string value of an attribute. More...

int setUnsigned (RMAttribute aName, unsigned long aID, unsigned long aValue)
 set the unsigned value of an attribute. More...


Private Methods

int SearchAndReadLog (enum SearchOption aMethod, unsigned long aID, unsigned long &aNextID)
 search and read a record log based on aMethod and aID. More...


Private Attributes

string mLogFilePath
 default log file path. More...

posix_logd_t mLog
 the log file descriptor. More...

unsigned long mDefaultQuery
 default query. More...

EventLog mLastEntry
 last entry. More...

eventQuerymEventQuery

Detailed Description

eventLog is the class that used to access all the event log records.

Remarks:
eventLog is different from all the other classes in this library because it is not inherited from rmBaseArray class. It implements the rmBaseArray() class interface. But all the functions are re-implemented here because of the unique requirement for this class.

Definition at line 38 of file eventLog.h.


Constructor & Destructor Documentation

eventLog::eventLog eventQuery   aEventQuery
 

Default constructor for eventLog.

Definition at line 10 of file eventLog.cpp.

References mDefaultQuery, mEventQuery, and mLogFilePath.

eventLog::~eventLog   [virtual]
 

Default destructor.

Definition at line 22 of file eventLog.cpp.

References mLog.


Member Function Documentation

int eventLog::addDefaultElement unsigned long    aID [inline, virtual]
 

Implements IBaseAccessor.

Definition at line 63 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::addElement const EventLog   aElement,
unsigned long    aID
[inline]
 

Definition at line 53 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

bool eventLog::elementIsReady const EventLog   aElement const [inline]
 

Definition at line 98 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::findExactId unsigned long    aID [inline, virtual]
 

Implements IBaseAccessor.

Definition at line 123 of file eventLog.h.

References findId.

int eventLog::findId unsigned long    aID
 

find a record with recid == aID.

Test if a particular record which recid == aID is in the log file or not.

Parameters:
aID  The unique id for this element. In this case aID should equal to recid of this particular record.
Returns:
RMCLIENT_SUCCESS if the record is found. or other error codes if not.

Definition at line 91 of file eventLog.cpp.

References FIND_ID, and SearchAndReadLog.

Referenced by findExactId, and getConstElement.

int eventLog::getBinary RMAttribute    aName,
unsigned long    aID,
char *&    aBuf,
unsigned long &    aLength
[virtual]
 

get the binary attribute of an event log record.

Get the binary data of an event record.

Parameters:
aName  The name of the attribute.
aID  The recid.
aBuf  The char pointer for the buffer.
aLength  The length of the buffer.
Remarks:
This function allocates buffer. So caller should call free() after done with the data.

Implements IBaseAccessor.

Definition at line 302 of file eventLog.cpp.

References EventLog::data, EventLog::entry, EVENTLOG_BINARY, getConstElement, RMAttribute, RMCLIENT_ERROR_LOG, RMCLIENT_ERROR_MEMORY, RMCLIENT_ERROR_NOSUCHNAME, and RMCLIENT_SUCCESS.

const EventLog * eventLog::getConstElement unsigned long    aID
 

get a element in const form.

get an element in const form.

Parameters:
aID  The unique id for this element. In this case aID should equal to recid of this particular record.
Returns:
NULL if failure. or a const pointer to the element if sucess.

Definition at line 65 of file eventLog.cpp.

References EventLog::entry, findId, and mLastEntry.

Referenced by getBinary, getInteger32, getString, and getUnsigned.

size_t eventLog::getCount   const [inline, virtual]
 

Implements IBaseAccessor.

Definition at line 44 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

EventLog* eventLog::getElement unsigned long    aID [inline]
 

Definition at line 49 of file eventLog.h.

int eventLog::getInteger32 RMAttribute    aName,
unsigned long    aID,
long &    aValue
[virtual]
 

get the value of int32 attribute of a event log record.

Get the integer value of an attribute.

See also:
rmBaseArray::getInteger32()

Implements IBaseAccessor.

Definition at line 121 of file eventLog.cpp.

References EventLog::entry, EVENTLOG_FACILITY, EVENTLOG_FORMAT, EVENTLOG_SEVERITY, EVENTLOG_TYPE, getConstElement, RMAttribute, RMCLIENT_ERROR_LOG, RMCLIENT_ERROR_NOSUCHNAME, and RMCLIENT_SUCCESS.

unsigned long eventLog::getMaxId void    [inline]
 

Definition at line 118 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

unsigned long eventLog::getNewId void    [inline, virtual]
 

Implements IBaseAccessor.

Definition at line 78 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::getNextId unsigned long    aID,
unsigned long &    aNextID
[virtual]
 

find the record right after the record whose recid == aID.

Get the very next record whose recid == aID. If successful, the recid of the next record will be stored in aNextID.

Parameters:
aID  The recid of the record.
aNextID  The recid of the very next record.
Returns:
RMCLIENT_SUCCESS if the record is found. or other error codes if not

Implements IBaseAccessor.

Definition at line 109 of file eventLog.cpp.

References FIND_NEXT_ID, and SearchAndReadLog.

int eventLog::getString RMAttribute    aName,
unsigned long    aID,
char *&    aBuf
[virtual]
 

get the string attribute of an event log record.

Get string value of the record.

See also:
rmBaseArray::getString().

Implements IBaseAccessor.

Definition at line 226 of file eventLog.cpp.

References EventLog::data, EventLog::entry, EVENTLOG_DEFAULTFILE, EVENTLOG_STRING, EVENTLOG_TIMESTAMP, getConstElement, mLogFilePath, RMAttribute, RMCLIENT_ERROR_LOG, RMCLIENT_ERROR_MEMORY, RMCLIENT_ERROR_NOSUCHNAME, and RMCLIENT_SUCCESS.

int eventLog::getUnsigned RMAttribute    aName,
unsigned long    aID,
unsigned long &    aValue
[virtual]
 

get the value of unsigned attribute of a event log record.

Get the unsigned value of an attribute.

See also:
rmBaseArray::getUnsigned();

Implements IBaseAccessor.

Definition at line 164 of file eventLog.cpp.

References EventLog::entry, EVENTLOG_DEFAULTQUERY, EVENTLOG_FLAG, EVENTLOG_GID, EVENTLOG_PGID, EVENTLOG_PID, EVENTLOG_PROCESSOR, EVENTLOG_SIZE, EVENTLOG_THREAD, EVENTLOG_UID, getConstElement, mDefaultQuery, RMAttribute, RMCLIENT_ERROR_LOG, RMCLIENT_ERROR_NOSUCHNAME, and RMCLIENT_SUCCESS.

int eventLog::getUnsigned64 RMAttribute    aName,
unsigned long    aID,
u_int64_t &    aValue
[inline, virtual]
 

Implements IBaseAccessor.

Definition at line 103 of file eventLog.h.

References RMAttribute, and RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::getUUID RMAttribute    aName,
unsigned long    aID,
uuid_t    aUUID
[inline, virtual]
 

Implements IBaseAccessor.

Definition at line 113 of file eventLog.h.

References RMAttribute, and RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::getUUIDString RMAttribute    aName,
unsigned long    aID,
char *    aUUIDStr
[inline, virtual]
 

Implements IBaseAccessor.

Definition at line 108 of file eventLog.h.

References RMAttribute, and RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::init  
 

initialization.

Initializes the mLog by opening the event log file specified in mLogFilePath. If mLogFilePath is empty, then default system event log file should be opened.

Returns:
RMCLIENT_SUCCESS if successful. RMCLIENT_ERROR_LOG_OPEN if log open failed.

Definition at line 38 of file eventLog.cpp.

References mLog, mLogFilePath, RMCLIENT_ERROR_LOG_OPEN, and RMCLIENT_SUCCESS.

Referenced by rmClient::init.

int eventLog::modifyElement unsigned long    aID,
const EventLog   aElement
[inline]
 

Definition at line 73 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::newElement const EventLog   aElement,
unsigned long &    aID
[inline]
 

Definition at line 58 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::removeElement unsigned long    aID [inline, virtual]
 

Implements IBaseAccessor.

Definition at line 68 of file eventLog.h.

References RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::SearchAndReadLog enum SearchOption    aMethod,
unsigned long    aID,
unsigned long &    aNextID
[private]
 

search and read a record log based on aMethod and aID.

Search the event log and find the record and read the record into mLastEntry for later access.

Definition at line 399 of file eventLog.cpp.

References EventLog::data, EventLog::entry, FIND_ID, rmBaseArray< EventQuery >::getConstElement, mDefaultQuery, mEventQuery, mLastEntry, mLog, EventQuery::qstr, RMCLIENT_ERROR_LOG, RMCLIENT_ERROR_LOG_READ, RMCLIENT_ERROR_LOG_SEEK, RMCLIENT_ERROR_MEMORY, RMCLIENT_ERROR_QUERY, RMCLIENT_ERROR_QUERY_CREATE, RMCLIENT_SUCCESS, and SearchOption.

Referenced by findId, and getNextId.

int eventLog::setInteger32 RMAttribute    aName,
unsigned long    aID,
long    aValue
[inline, virtual]
 

Implements IBaseAccessor.

Definition at line 83 of file eventLog.h.

References RMAttribute, and RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::setString RMAttribute    aName,
unsigned long    aID,
char *    aBuf
[virtual]
 

set the string value of an attribute.

Set string of an attribute.

See also:
rmBaseArray::setString().

Implements IBaseAccessor.

Definition at line 341 of file eventLog.cpp.

References EVENTLOG_DEFAULTFILE, mLog, mLogFilePath, RMAttribute, RMCLIENT_ERROR_LOG_CLOSE, RMCLIENT_ERROR_LOG_OPEN, RMCLIENT_ERROR_NOSUCHNAME, and RMCLIENT_SUCCESS.

int eventLog::setUnsigned RMAttribute    aName,
unsigned long    aID,
unsigned long    aValue
[virtual]
 

set the unsigned value of an attribute.

Set unsigned value of an attribute.

See also:
rmBaseArray::setUnsigned()

Implements IBaseAccessor.

Definition at line 373 of file eventLog.cpp.

References EVENTLOG_DEFAULTQUERY, EVENTQUERY, mDefaultQuery, RMAttribute, RMCLIENT_ERROR_NOSUCHNAME, RMCLIENT_ERROR_NOSUCHVALUE, and RMCLIENT_SUCCESS.

int eventLog::setUnsigned64 RMAttribute    aName,
unsigned long    aID,
u_int64_t    aValue
[inline, virtual]
 

Implements IBaseAccessor.

Definition at line 88 of file eventLog.h.

References RMAttribute, and RMCLIENT_ERROR_NOT_IMPLEMENTED.

int eventLog::setUUIDString RMAttribute    aName,
unsigned long    aID,
char *    aUUIDStr
[inline, virtual]
 

Implements IBaseAccessor.

Definition at line 93 of file eventLog.h.

References RMAttribute, and RMCLIENT_ERROR_NOT_IMPLEMENTED.


Member Data Documentation

unsigned long eventLog::mDefaultQuery [private]
 

default query.

Definition at line 170 of file eventLog.h.

Referenced by eventLog, getUnsigned, SearchAndReadLog, and setUnsigned.

eventQuery* eventLog::mEventQuery [private]
 

Definition at line 175 of file eventLog.h.

Referenced by eventLog, and SearchAndReadLog.

EventLog eventLog::mLastEntry [private]
 

last entry.

Definition at line 173 of file eventLog.h.

Referenced by getConstElement, and SearchAndReadLog.

posix_logd_t eventLog::mLog [private]
 

the log file descriptor.

Definition at line 167 of file eventLog.h.

Referenced by init, SearchAndReadLog, setString, and ~eventLog.

string eventLog::mLogFilePath [private]
 

default log file path.

Definition at line 164 of file eventLog.h.

Referenced by eventLog, getString, init, and setString.


The documentation for this class was generated from the following files:
Generated on Tue Sep 10 16:46:34 2002 for ResourceMonitorSNMPSubagent by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002