typedef void (*cmlogBrCallback)(int status, void* arg, cmlogPacket* data);
Constructor for cmlogBrowser.
Destructor for cmlogBrowser. If network connection is established, this closes network connection and clean all resources.
Tries to connect to a CMLOG server 'numConnectionRetries' times. It returns CMLOG_SUCCESS upon connection, and returns CMLOG_ERROR if it fails to connect.
Disconnects this browser from a server. It returns CMLOG_SUCCESS.
Returns 1 for connected browser.
Registers a callback function to this browser. In case of server crash, this function will be called. It returns CMLOG_SUCCESS upon success, and returns CMLOG_ERROR if this callback function is already registered.
This routine is used to query the server to find messages. Currently only four messages are supported. They are ``query'', ``stopQuery'', ``monitorOn []'' and ``monitorOff []'' where []s denote attributes of a CMLOG server. At present there two attributes that can be monitored. One is loggingData which symbolizes currently incoming logging data to the server. Another is allTags that holds all tag strings and corresponding tag values of the server.
The cdevData object 'data' must contain time interval which is specified by ``start'' and ``end'' tagged values. In addition it may contain a tagged item with tag ``numberItems'' to tell a server how many messages a browser wants to retrieve and it may contain a tagged item with tag ``queryMsg'' to tell server to only return messages that satisfy the conditions specified by the query message.
Here is an example that does simple query.
char* rules = ``severity==1 && status == 0''; cdevData data; /* 861759125 represents Tue Apr 22 21:32:45 EDT 1997 */ data.insert (``start'', 861759125); data.insert (``end'', 861759445); data.insert (``numberItems'', 100); data.insert (``queryMsg'', rules); browser.queryCallback (``query'', data, callback, (void *)0);
Returns the socket file descriptor to callers. This socket file descriptor can then be used inside a event loop to monitor network IO of browsers.
Checks network I/O events upto 'seconds' long. If seconds equals to 0.0, it becomes a polling routine. It returns CMLOG_SUCCESS, CMLOG_TIMEOUT, CMLOG_BADIO or CMLOG_IOERROR.
It is very similar to the above. It waits forever for network I/O events. It returns CMLOG_BADIO, CMLOG_IOERROR or CMLOG_SUCCESS.