libee 0.3.0
Public Member Functions | Data Fields

ee_event Class Reference

#include <event.h>

Collaboration diagram for ee_event:
Collaboration graph
[legend]

Public Member Functions

struct ee_event ee_newEvent (ee_ctx ctx)
void  ee_deleteEvent (struct ee_event *event)
int  ee_assignTagbucketToEvent (struct ee_event *event, struct ee_tagbucket *tagbucket)
int  ee_addTagToEvent (struct ee_event *event, es_str_t *tag)
int  ee_addStrFieldToEvent (struct ee_event *event, char *fieldname, es_str_t *value)
int  ee_addFieldToEvent (struct ee_event *event, struct ee_field *field)
static struct ee_field ee_getEventField (struct ee_event *event, es_str_t *name)
int  ee_EventHasTag (struct ee_event *event, es_str_t *tagname)
int  ee_fmtEventToRFC5424 (struct ee_event *event, es_str_t **str)
int  ee_fmtEventToJSON (struct ee_event *event, es_str_t **str)
int  ee_fmtEventToXML (struct ee_event *event, es_str_t **str)
int  ee_fmtEventToCSV (struct ee_event *event, es_str_t **str, es_str_t *extraData)

Data Fields

unsigned  objID
ee_ctx  ctx
struct ee_tagbucket tags
struct ee_fieldbucket fields

Detailed Description

The event class. This models an actual event as it happens.


Member Function Documentation

int ee_addFieldToEvent ( struct ee_event event,
struct ee_field field 
)

Add an already constructed field to the event.

Parameters:
event event where field shall be added
[in] field field to be added
Returns:
0 on success, something else otherwise.
int ee_addStrFieldToEvent ( struct ee_event event,
char *  fieldname,
es_str_t *  value 
)

Add a string field name-value pair to the event.

This adds a name-value pair (NVField) to the event. The value must be a string value. If no fieldbucket yet exists, one is created.

This is part of the ezAPI for libee

Parameters:
event event where field shall be added
[in] fieldname Name of the field to be added. The field name must not already exist inside the fieldbucket. Libee will copy the field name, so the caller must free it itself if required.
[in] value value of the field to be added.
Returns:
0 on success, something else otherwise.
int ee_addTagToEvent ( struct ee_event event,
es_str_t *  tag 
)

Add a tag to the event.

The tag is provided as a string. If no tag bucket exists when this method is called, one is created.

This is part of the ezAPI for libee

Parameters:
event event where tag shall be added
tag string representing a tag name. The tag must not already exist inside the tagbucket. Libee will copy the string, so the caller must free it itself if required.
Returns:
0 on success, something else otherwise.
int ee_assignTagbucketToEvent ( struct ee_event event,
struct ee_tagbucket tagbucket 
)

Assign a tag bucket to an event.

A complete tag bucket is assigned to the event. Any previously assigned tags are DISCARDED.

Parameters:
event event where tag shall be added
tagbucket already-created tag bucket to be assigned to event. The caller ceases control of this bucket. In particular, we may destruct it at any time. If the caller intends to continue access the tagbucket, it must properly create a duplicate.
Returns:
0 on success, something else otherwise.
void ee_deleteEvent ( struct ee_event event )

Destructor for the ee_event object.

Parameters:
event The event to be discarded.
int ee_EventHasTag ( struct ee_event event,
es_str_t *  tagname 
)

Check if an event is classified via a specific tag.

Parameters:
event event to look at
[in] str name of tag
Returns:
0 if event is not classified with the tag, something else otherwise
int ee_fmtEventToCSV ( struct ee_event event,
es_str_t **  str,
es_str_t *  extraData 
)

Format an event to CSV format.

This method takes an event and creates a new string representation in CSV format. The string is passed to the caller, which then is responsible for freeing it. Note that this methods needs a string specifying field names and order (as they shall be written to the output).

This is part of the ezAPI for libee

Parameters:
event event to format
[out] str pointer to string with XML representation, caller must destruct
[in] extraData string with field names (comma-delimited list)
Returns:
0 on success, something else otherwise.
int ee_fmtEventToJSON ( struct ee_event event,
es_str_t **  str 
)

Format an event in JSON format.

This method takes an event and creates a new string representation in JSON format. The string is passed to the caller, which then is responsible for freeing it.

This is part of the ezAPI for libee

Parameters:
event event to format
[out] str pointer to string with JSON representation, caller must destruct
Returns:
0 on success, something else otherwise.
int ee_fmtEventToRFC5424 ( struct ee_event event,
es_str_t **  str 
)

Format an event in syslog RFC 5424 format.

This method takes an event and creates a new string representation in RFC5424 format. The string is passed to the caller, which then is responsible for freeing it.

This is part of the ezAPI for libee

Parameters:
event event to format
[out] str pointer to string with RFC5424 representation, caller must destruct
Returns:
0 on success, something else otherwise.
int ee_fmtEventToXML ( struct ee_event event,
es_str_t **  str 
)

Format an event in XML format.

This method takes an event and creates a new string representation in XML format. The string is passed to the caller, which then is responsible for freeing it.

This is part of the ezAPI for libee

Parameters:
event event to format
[out] str pointer to string with XML representation, caller must destruct
Returns:
0 on success, something else otherwise.
static struct ee_field * ee_getEventField ( struct ee_event event,
es_str_t *  name 
) [read]

Obtain a field with specified name from given event.

Parameters:
event event to search
[in] str name of field
Returns:
NULL if field was not found (or an error occured); pointer to the field otherwise
struct ee_event * ee_newEvent ( ee_ctx  ctx ) [read]

Constructor for the ee_event object.

Parameters:
[in] ctx associated library context
Returns:
new library context or NULL if an error occured

Field Documentation

the library context

fields contained in this event

unsigned objID

a magic number to prevent some memory adressing errors

struct ee_tagbucket* tags

tags associated with this event


The documentation for this class was generated from the following file: