]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/c-apps/oils_event.h
Added new C event code for handling the auth login events
[Evergreen.git] / Open-ILS / src / c-apps / oils_event.h
1 #include "objson/object.h"
2 #include "opensrf/utils.h"
3 #include "opensrf/log.h"
4 #include "opensrf/osrf_hash.h"
5
6
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 */
14 };
15 typedef struct _oilsEventStruct oilsEvent;
16
17
18 /** Creates a new event.  User is responsible for freeing event with oilsEventFree */
19 oilsEvent* oilsNewEvent( char* event );
20
21 /** Creates a new event with payload.  
22  * User is responsible for freeing event with oilsEventFree */
23 oilsEvent* oilsNewEvent2( char* event, jsonObject* payload );
24
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 );
28
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 );
32
33 /** Sets the permission info for the event */
34 void oilsEventSetPermission( oilsEvent* event, char* perm, int permloc );
35
36 /* Sets the payload for the event */
37 void oilsEventSetPayload( oilsEvent* event, jsonObject* payload );
38
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 );
42
43 /* Parses the events file */
44 void _oilsEventParseEvents();
45
46 /* Frees an event object */
47 void oilsEventFree( oilsEvent* event );
48
49
50