event.h   event.h 
/** /**
* @file event.h * @file event.h
* @brief Representation of an event. * @brief Representation of an event.
* @class ee_event event.h * @class ee_event event.h
* *
*//* *//*
* *
* Libee - An Event Expression Library inspired by CEE * Libee - An Event Expression Library inspired by CEE
* Copyright 2010 by Rainer Gerhards and Adiscon GmbH. * Copyright 2010,2011 by Rainer Gerhards and Adiscon GmbH.
* *
* This file is part of libee. * This file is part of libee.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 66 skipping to change at line 66
* Destructor for the ee_event object. * Destructor for the ee_event object.
* *
* @memberof ee_event * @memberof ee_event
* @public * @public
* *
* @param event The event to be discarded. * @param event The event to be discarded.
*/ */
void ee_deleteEvent(struct ee_event *event); void ee_deleteEvent(struct ee_event *event);
/** /**
* Assign a tag bucket to an event.
*
* A complete tag bucket is assigned to the event. Any previously
* assigned tags are DISCARDED.
*
* @memberof ee_event
* @public
*
* @param event event where tag shall be added
* @param 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.
*
* @return 0 on success, something else otherwise.
*/
int ee_assignTagbucketToEvent(struct ee_event *event, struct ee_tagbucket *
tagbucket);
/**
* Add a tag to the event. * Add a tag to the event.
* *
* The tag is provided as a string. If no tag bucket exists when * The tag is provided as a string. If no tag bucket exists when
* this method is called, one is created. * this method is called, one is created.
* *
* <b>This is part of the ezAPI for libee</b> * <b>This is part of the ezAPI for libee</b>
* *
* @memberof ee_event * @memberof ee_event
* @public * @public
* *
* @param event event where tag shall be added * @param event event where tag shall be added
* @param tag string representing a tag name. The tag must \b not * @param tag string representing a tag name. The tag must \b not
* already exist inside the tagbucket. Libee will copy * already exist inside the tagbucket. Libee will copy
* the string, so the caller must free it itself if required. * the string, so the caller must free it itself if required.
* *
* @return 0 on success, something else otherwise. * @return 0 on success, something else otherwise.
*/ */
int ee_addTagToEvent(struct ee_event *event, char *tag); int ee_addTagToEvent(struct ee_event *event, es_str_t *tag);
/** /**
* Add a string field name-value pair to the event. * Add a string field name-value pair to the event.
* *
* This adds a name-value pair (NVField) to the event. The value must be * 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. * a string value. If no fieldbucket yet exists, one is created.
* *
* <b>This is part of the ezAPI for libee</b> * <b>This is part of the ezAPI for libee</b>
* *
* @memberof ee_event * @memberof ee_event
skipping to change at line 138 skipping to change at line 158
* @return NULL if field was not found (or an error occured); * @return NULL if field was not found (or an error occured);
* pointer to the field otherwise * pointer to the field otherwise
*/ */
static inline struct ee_field* static inline struct ee_field*
ee_getEventField(struct ee_event *event, es_str_t *name) ee_getEventField(struct ee_event *event, es_str_t *name)
{ {
return(ee_getBucketField(event->fields, name)); return(ee_getBucketField(event->fields, name));
} }
/** /**
* Check if an event is classified via a specific tag.
*
* @memberof ee_event
* @public
*
* @param event event to look at
* @param[in] str name of tag
*
* @return 0 if event is not classified with the tag, something
* else otherwise
*/
int ee_EventHasTag(struct ee_event *event, es_str_t *tagname);
/**
* Format an event in syslog RFC 5424 format. * Format an event in syslog RFC 5424 format.
* *
* This method takes an event and creates a new string representation * This method takes an event and creates a new string representation
* in RFC5424 format. The string is passed to the caller, which then * in RFC5424 format. The string is passed to the caller, which then
* is responsible for freeing it. * is responsible for freeing it.
* *
* <b>This is part of the ezAPI for libee</b> * <b>This is part of the ezAPI for libee</b>
* *
* @memberof ee_event * @memberof ee_event
* @public * @public
 End of changes. 4 change blocks. 
2 lines changed or deleted 37 lines changed or added


 libee.h   libee.h 
skipping to change at line 177 skipping to change at line 177
/* some private error codes (always negative) /* some private error codes (always negative)
*/ */
#define E_ERR -1 #define E_ERR -1
#define EE_NOMEM -2 #define EE_NOMEM -2
#define EE_EOF -3 #define EE_EOF -3
#define EE_INVLDFMT -4 #define EE_INVLDFMT -4
#define EE_FIELDHASNAME -5 #define EE_FIELDHASNAME -5
#define EE_TOOMANYVALUES -6 #define EE_TOOMANYVALUES -6
#define EE_WRONGPARSER -7 #define EE_WRONGPARSER -7
#define EE_EINVAL -8 /* invalid value provided on API */
/* some important constants */ /* some important constants */
#define LIBEE_CEE_MAX_VALS_PER_FIELD 255 #define LIBEE_CEE_MAX_VALS_PER_FIELD 255
/**< CEE-defined maximum number of values per field. The /**< CEE-defined maximum number of values per field. The
* current value reflects CEE CLS 0.5.1 * current value reflects CEE CLS 0.5.1
*/ */
#endif /* #ifndef EE_H_INCLUDED */ #endif /* #ifndef EE_H_INCLUDED */
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 tagbucket.h   tagbucket.h 
skipping to change at line 36 skipping to change at line 36
* *
* A copy of the LGPL v2.1 can be found in the file "COPYING" in this distr ibution. * A copy of the LGPL v2.1 can be found in the file "COPYING" in this distr ibution.
*/ */
#ifndef LIBEE_TAGBUCKET_H_INCLUDED #ifndef LIBEE_TAGBUCKET_H_INCLUDED
#define LIBEE_TAGBUCKET_H_INCLUDED #define LIBEE_TAGBUCKET_H_INCLUDED
/** /**
* Internal structure to represent linked list nodes for the tagbucket. * Internal structure to represent linked list nodes for the tagbucket.
*/ */
struct ee_tagbucket_listnode { struct ee_tagbucket_listnode {
char *name; /* TODO: use es_str_t! */ es_str_t *name;
struct ee_tagbucket_listnode *next; struct ee_tagbucket_listnode *next;
}; };
/** /**
* The tagbucket class, a container to store tags. * The tagbucket class, a container to store tags.
*/ */
struct ee_tagbucket { struct ee_tagbucket {
unsigned objID; /**< a magic number to prevent some memory a dressing errors */ unsigned objID; /**< a magic number to prevent some memory a dressing errors */
ee_ctx ctx; /**< associated library context */ ee_ctx ctx; /**< associated library context */
struct ee_tagbucket_listnode *root; /**< root of our tags list */ struct ee_tagbucket_listnode *root; /**< root of our tags list */
struct ee_tagbucket_listnode *tail; /**< list tail to speed up addin g nodes */ struct ee_tagbucket_listnode *tail; /**< list tail to speed up addin g nodes */
unsigned refCount;
}; };
/** /**
* Constructor for the ee_tagbucket object. * Constructor for the ee_tagbucket object.
* *
* @memberof ee_tagbucket * @memberof ee_tagbucket
* @public * @public
* *
* @param[in] ctx the library context to use * @param[in] ctx the library context to use
* *
* @return newly created object or NULL if an error occured * @return newly created object or NULL if an error occured
*/ */
struct ee_tagbucket* ee_newTagbucket(ee_ctx ctx); struct ee_tagbucket* ee_newTagbucket(ee_ctx ctx);
/** /**
* Add an additional reference to the tagbucket. Use this whenever
* an additional part of the code needs a READ-ONLY copy of the
* tag bucket. Note: The delete function checks the reference count and
* only deletes if it is down to zero.
*
* @memberof ee_tagbucket
* @public
*
* @param[in] tagbucket the tagbucket to add ref for
*
* @return address of ref-added tagbucket (for convenience)
*/
struct ee_tagbucket* ee_addRefTagbucket(struct ee_tagbucket *tagbucket);
/**
* Destructor for the ee_tagbucket object. * Destructor for the ee_tagbucket object.
* *
* @memberof ee_tagbucket * @memberof ee_tagbucket
* @public * @public
* *
* @param[in] tagbucket The tagbucket to be discarded. * @param[in] tagbucket The tagbucket to be discarded.
*/ */
void ee_deleteTagbucket(struct ee_tagbucket *tagbucket); void ee_deleteTagbucket(struct ee_tagbucket *tagbucket);
/** /**
* Add a tag (string) to the bucket. * Add a tag (string) to the bucket.
* *
* @memberof ee_tagbucket * @memberof ee_tagbucket
* @public * @public
* *
* @param[in] tagbucket the tagbucket to modify * @param[in] tagbucket the tagbucket to modify
* @param[in] tagname name of the tag to be added * @param[in] tagname name of the tag to be added
* *
* @return 0 on success, something else otherwise * @return 0 on success, something else otherwise
*/ */
int ee_addTagToBucket(struct ee_tagbucket *tagbucket, char *tagname); int ee_addTagToBucket(struct ee_tagbucket *tagbucket, es_str_t *tagname);
/** /**
* Iterate over all tags inside the bucket and call a user-defined function * Check if the tagbucket contains a specific tag.
* on each tag.
* *
* @memberof ee_tagbucket * @memberof ee_tagbucket
* @public * @public
* *
* @param[in] tagbucket the tagbucket to modify * @param[in] tagbucket the tagbucket to check
* @param[in] f function to be called, must accept cookie as first p * @param[in] tagname name of the tag
aram,
* pointer to tag name as second.
* @param[in] cookie cookie to be passed to user-defined function
* *
* @return number of tags processed (= nbr of function calls) * @return 0 if tag not present, something else otherwise
*/ */
void ee_iterateOverBucketTags(struct ee_tagbucket *tagbucket, void(*f)(void *,char *), void *cookie); int ee_BucketHasTag(struct ee_tagbucket *tagbucket, es_str_t *tagname);
#endif /* #ifndef LIBEE_TAGBUCKET_H_INCLUDED */ #endif /* #ifndef LIBEE_TAGBUCKET_H_INCLUDED */
 End of changes. 8 change blocks. 
11 lines changed or deleted 23 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/