]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/c-apps/oils_event.h
fixing case of only negated words
[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 };
17 typedef struct _oilsEventStruct oilsEvent;
18
19
20 /** Creates a new event.  User is responsible for freeing event with oilsEventFree */
21 oilsEvent* oilsNewEvent( char* event );
22
23 /** Creates a new event with payload.  
24  * User is responsible for freeing event with oilsEventFree */
25 oilsEvent* oilsNewEvent2( char* event, jsonObject* payload );
26
27 /** Creates a new event with permission and permission location.  
28  * User is responsible for freeing event with oilsEventFree */
29 oilsEvent* oilsNewEvent3( char* event, char* perm, int permloc );
30
31 /** Creates a new event with permission, permission location, and payload.  
32  * User is responsible for freeing event with oilsEventFree */
33 oilsEvent* oilsNewEvent4( char* event, char* perm, int permloc, jsonObject* payload );
34
35 /** Sets the permission info for the event */
36 void oilsEventSetPermission( oilsEvent* event, char* perm, int permloc );
37
38 /* Sets the payload for the event 
39  * This clones the payload, so the user is responsible
40  * for handling the payload object's memory
41  * */
42 void oilsEventSetPayload( oilsEvent* event, jsonObject* payload );
43
44 /** Creates the JSON associated with an event.  The JSON should NOT be
45  * freed by the user.  It will be freed by oilsEventFree */
46 jsonObject* oilsEventToJSON( oilsEvent* event );
47
48 /* Parses the events file */
49 void _oilsEventParseEvents();
50
51 /* Frees an event object */
52 void oilsEventFree( oilsEvent* event );
53
54
55
56 #endif