]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/include/openils/oils_event.h
LP1831390: Fixing implementation of registerOnTouch
[Evergreen.git] / Open-ILS / include / openils / oils_event.h
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"
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /**
13         @brief Represents an event; typically some kind of error condition.
14 */
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. */
23 };
24 typedef struct _oilsEventStruct oilsEvent;
25
26 oilsEvent* oilsNewEvent( const char* file, int line, const char* event );
27
28 oilsEvent* oilsNewEvent2( const char* file, int line, const char* event,
29                 const jsonObject* payload );
30
31 oilsEvent* oilsNewEvent3( const char* file, int line, const char* event,
32                 const char* perm, int permloc );
33
34 oilsEvent* oilsNewEvent4( const char* file, int line, const char* event,
35                 const char* perm, int permloc, const jsonObject* payload );
36
37 void oilsEventSetPermission( oilsEvent* event, const char* perm, int permloc );
38
39 void oilsEventSetPayload( oilsEvent* event, const jsonObject* payload );
40
41 jsonObject* oilsEventToJSON( oilsEvent* event );
42
43 void oilsEventFree( oilsEvent* event );
44
45 #ifdef __cplusplus
46 }
47 #endif
48
49 #endif