/usr/include/libee/event.h is in libee-dev 0.4.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | /**
* @file event.h
* @brief Representation of an event.
* @class ee_event event.h
*
*//*
*
* Libee - An Event Expression Library inspired by CEE
* Copyright 2010-2012 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of libee.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* A copy of the LGPL v2.1 can be found in the file "COPYING" in this distribution.
*/
#ifndef LIBEE_EVENT_H_INCLUDED
#define LIBEE_EVENT_H_INCLUDED
/**
* The event class.
* This models an actual event as it happens.
*/
struct ee_event {
unsigned objID; /**< a magic number to prevent some memory adressing errors */
ee_ctx ctx; /**< the library context */
struct ee_tagbucket *tags; /**< tags associated with this event */
struct ee_fieldbucket *fields; /**< fields contained in this event */
};
/**
* Constructor for the ee_event object.
*
* @memberof ee_event
* @public
*
* @param[in] ctx associated library context
*
* @return new library context or NULL if an error occured
*/
struct ee_event* ee_newEvent(ee_ctx ctx);
/**
* Create an event from a JSON string.
*
* @memberof ee_event
* @public
*
* @param[in] ctx associated library context
* @param[in] json JSON classical C-string to create event from
*
* @return new library context or NULL if an error occured
*/
struct ee_event* ee_newEventFromJSON(ee_ctx ctx, char *json);
/**
* Destructor for the ee_event object.
*
* @memberof ee_event
* @public
*
* @param event The event to be discarded.
*/
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.
*
* The tag is provided as a string. If no tag bucket exists when
* this method is called, one is created.
*
* <b>This is part of the ezAPI for libee</b>
*
* @memberof ee_event
* @public
*
* @param event event where tag shall be added
* @param tag string representing a tag name. The tag must \b not
* already exist inside the tagbucket. Libee will copy
* the string, so the caller must free it itself if required.
*
* @return 0 on success, something else otherwise.
*/
int ee_addTagToEvent(struct ee_event *event, es_str_t *tag);
/**
* 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.
*
* <b>This is part of the ezAPI for libee</b>
*
* @memberof ee_event
* @public
*
* @param event event where field shall be added
* @param[in] fieldname Name of the field to be added. The field name must \b not
* already exist inside the fieldbucket. Libee will copy
* the field name, so the caller must free it itself if required.
* @param[in] value value of the field to be added.
*
* @return 0 on success, something else otherwise.
*/
int ee_addStrFieldToEvent(struct ee_event *event, char *fieldname, es_str_t *value);
/**
* Add an already constructed field to the event.
*
* @memberof ee_event
* @public
*
* @param event event where field shall be added
* @param[in] field field to be added
*
* @return 0 on success, something else otherwise.
*/
int ee_addFieldToEvent(struct ee_event *event, struct ee_field *field);
/**
* Obtain a field with specified name from given event.
*
* @memberof ee_event
* @public
*
* @param event event to search
* @param[in] str name of field
*
* @return NULL if field was not found (or an error occured);
* pointer to the field otherwise
*/
struct ee_field* ee_getEventField(struct ee_event *event, es_str_t *name);
/**
* Obtain the string representaton of a field with specified name
* from given event. The string representation is build in the current
* default encoding (note: different encodings are NOT yet implemented
* at the time of this writing).
*
* @memberof ee_event
* @public
*
* @param event event to search
* @param[in] name name of field
* @param[out] strVal output string with field representation. If NULL
* a new string is generated, the representation
* is APPENDED to the existing string.
*
* @return 0 (EE_OK), if everything went well, EE_NOTFOUND if the
* field could not be found and something else for other
* errors.
*/
int ee_getEventFieldAsString(struct ee_event *event,
es_str_t *name, es_str_t **strVal);
/**
* Check if an event is classified via a specific tag.
*
* @memberof ee_event
* @public
*
* @param[in] 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);
/**
* Obtain the event's tagbucket.
*
* @memberof ee_event
* @public
*
* @param[in] event event to process
* @param[out] tagbucket associated tagbucket. May be NULL if none is
* associated.
*/
void ee_EventGetTagbucket(struct ee_event *event, struct ee_tagbucket **tagbucket);
/**
* 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.
*
* <b>This is part of the ezAPI for libee</b>
*
* @memberof ee_event
* @public
*
* @param event event to format
* @param[out] str pointer to string with RFC5424 representation, caller must destruct
* @return 0 on success, something else otherwise.
*/
int ee_fmtEventToRFC5424(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.
*
* <b>This is part of the ezAPI for libee</b>
*
* @memberof ee_event
* @public
*
* @param event event to format
* @param[out] str pointer to string with JSON representation, caller must destruct
* @return 0 on success, something else otherwise.
*/
int ee_fmtEventToJSON(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.
*
* <b>This is part of the ezAPI for libee</b>
*
* @memberof ee_event
* @public
*
* @param event event to format
* @param[out] str pointer to string with XML representation, caller must destruct
* @return 0 on success, something else otherwise.
*/
int ee_fmtEventToXML(struct ee_event *event, es_str_t **str);
/**
* 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).
*
* <b>This is part of the ezAPI for libee</b>
*
* @memberof ee_event
* @public
*
* @param event event to format
* @param[out] str pointer to string with XML representation, caller must destruct
* @param[in] extraData string with field names (comma-delimited list)
* @return 0 on success, something else otherwise.
*/
int ee_fmtEventToCSV(struct ee_event *event, es_str_t **str, es_str_t *extraData);
#endif /* #ifndef LIBEE_EVENT_H_INCLUDED */
|