]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/c-apps/oils_event.h
added pid and basic stacktrace to the C event handler
[Evergreen.git] / Open-ILS / src / c-apps / oils_event.h
1 #ifndef OILS_EVENT_HEADER
2 #define OILS_EVENT_HEADER
3 #include "objson/object.h"
4 #include "opensrf/utils.h"
5 #include "opensrf/log.h"
6 #include "opensrf/osrf_hash.h"
7
8
9 /* OILS Event structure */
10 struct _oilsEventStruct {
11         char* event;                    /* the event name */
12         char* perm;                             /* the permission error name */
13         int permloc;                    /* the permission location id */
14         jsonObject* payload;    /* the payload */
15         jsonObject* json;               /* the event as a jsonObject */
16         char* file;
17         int line;
18 };
19 typedef struct _oilsEventStruct oilsEvent;
20
21
22 /** Creates a new event.  User is responsible for freeing event with oilsEventFree */
23 oilsEvent* oilsNewEvent( char* file, int line, char* event );
24
25 /** Creates a new event with payload.  
26  * User is responsible for freeing event with oilsEventFree */
27 oilsEvent* oilsNewEvent2( char* file, int line, char* event, jsonObject* payload );
28
29 /** Creates a new event with permission and permission location.  
30  * User is responsible for freeing event with oilsEventFree */
31 oilsEvent* oilsNewEvent3( char* file, int line, char* event, char* perm, int permloc );
32
33 /** Creates a new event with permission, permission location, and payload.  
34  * User is responsible for freeing event with oilsEventFree */
35 oilsEvent* oilsNewEvent4( char* file, int line, 
36                 char* event, char* perm, int permloc, jsonObject* payload );
37
38 /** Sets the permission info for the event */
39 void oilsEventSetPermission( oilsEvent* event, char* perm, int permloc );
40
41 /* Sets the payload for the event 
42  * This clones the payload, so the user is responsible
43  * for handling the payload object's memory
44  * */
45 void oilsEventSetPayload( oilsEvent* event, jsonObject* payload );
46
47 /** Creates the JSON associated with an event.  The JSON should NOT be
48  * freed by the user.  It will be freed by oilsEventFree */
49 jsonObject* oilsEventToJSON( oilsEvent* event );
50
51 /* Parses the events file */
52 void _oilsEventParseEvents();
53
54 /* Frees an event object */
55 void oilsEventFree( oilsEvent* event );
56
57
58
59 #endif