1 #include "objson/object.h"
2 #include "opensrf/utils.h"
3 #include "opensrf/log.h"
4 #include "opensrf/osrf_hash.h"
7 /* OILS Event structure */
8 struct _oilsEventStruct {
9 char* event; /* the event name */
10 char* perm; /* the permission error name */
11 int permloc; /* the permission location id */
12 jsonObject* payload; /* the payload */
13 jsonObject* json; /* the event as a jsonObject */
15 typedef struct _oilsEventStruct oilsEvent;
18 /** Creates a new event. User is responsible for freeing event with oilsEventFree */
19 oilsEvent* oilsNewEvent( char* event );
21 /** Creates a new event with payload.
22 * User is responsible for freeing event with oilsEventFree */
23 oilsEvent* oilsNewEvent2( char* event, jsonObject* payload );
25 /** Creates a new event with permission and permission location.
26 * User is responsible for freeing event with oilsEventFree */
27 oilsEvent* oilsNewEvent3( char* event, char* perm, int permloc );
29 /** Creates a new event with permission, permission location, and payload.
30 * User is responsible for freeing event with oilsEventFree */
31 oilsEvent* oilsNewEvent4( char* event, char* perm, int permloc, jsonObject* payload );
33 /** Sets the permission info for the event */
34 void oilsEventSetPermission( oilsEvent* event, char* perm, int permloc );
36 /* Sets the payload for the event */
37 void oilsEventSetPayload( oilsEvent* event, jsonObject* payload );
39 /** Creates the JSON associated with an event. The JSON should NOT be
40 * freed by the user. It will be freed by oilsEventFree */
41 jsonObject* oilsEventToJSON( oilsEvent* event );
43 /* Parses the events file */
44 void _oilsEventParseEvents();
46 /* Frees an event object */
47 void oilsEventFree( oilsEvent* event );