1 #ifndef OILS_EVENT_HEADER
2 #define OILS_EVENT_HEADER
3 #include "opensrf/osrf_json.h"
4 #include "opensrf/utils.h"
5 #include "opensrf/log.h"
6 #include "opensrf/osrf_hash.h"
13 @brief Represents an event; typically some kind of error condition.
15 struct _oilsEventStruct {
16 char* event; /**< Event name. */
17 char* perm; /**< Permission error name. */
18 int permloc; /**< Permission location id. */
19 jsonObject* payload; /**< Payload. */
20 jsonObject* json; /**< The event as a jsonObject. */
21 char* file; /**< Name of source file where event was created. */
22 int line; /**< Line number in source file where event was created. */
24 typedef struct _oilsEventStruct oilsEvent;
26 oilsEvent* oilsNewEvent( const char* file, int line, const char* event );
28 oilsEvent* oilsNewEvent2( const char* file, int line, const char* event,
29 const jsonObject* payload );
31 oilsEvent* oilsNewEvent3( const char* file, int line, const char* event,
32 const char* perm, int permloc );
34 oilsEvent* oilsNewEvent4( const char* file, int line, const char* event,
35 const char* perm, int permloc, const jsonObject* payload );
37 void oilsEventSetPermission( oilsEvent* event, const char* perm, int permloc );
39 void oilsEventSetPayload( oilsEvent* event, const jsonObject* payload );
41 jsonObject* oilsEventToJSON( oilsEvent* event );
43 void oilsEventFree( oilsEvent* event );