[open-ils-commits] r8062 - in trunk/Open-ILS/src/c-apps: . openils
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 14 15:21:59 EST 2007
Author: dbs
Date: 2007-11-14 15:05:15 -0500 (Wed, 14 Nov 2007)
New Revision: 8062
Added:
trunk/Open-ILS/src/c-apps/openils/
trunk/Open-ILS/src/c-apps/openils/idl_fieldmapper.h
trunk/Open-ILS/src/c-apps/openils/oils_constants.h
trunk/Open-ILS/src/c-apps/openils/oils_event.h
trunk/Open-ILS/src/c-apps/openils/oils_idl.h
trunk/Open-ILS/src/c-apps/openils/oils_utils.h
Removed:
trunk/Open-ILS/src/c-apps/idl_fieldmapper.h
trunk/Open-ILS/src/c-apps/oils_constants.h
trunk/Open-ILS/src/c-apps/oils_event.h
trunk/Open-ILS/src/c-apps/oils_idl.h
trunk/Open-ILS/src/c-apps/oils_utils.h
Modified:
trunk/Open-ILS/src/c-apps/Makefile
trunk/Open-ILS/src/c-apps/oils_auth.c
trunk/Open-ILS/src/c-apps/oils_cstore.c
trunk/Open-ILS/src/c-apps/oils_dataloader.c
trunk/Open-ILS/src/c-apps/oils_event.c
trunk/Open-ILS/src/c-apps/oils_fetch.c
trunk/Open-ILS/src/c-apps/oils_idl-core.c
trunk/Open-ILS/src/c-apps/oils_utils.c
Log:
Avoid tempdir trickery for c-apps and use consistent header includes.
Modified: trunk/Open-ILS/src/c-apps/Makefile
===================================================================
--- trunk/Open-ILS/src/c-apps/Makefile 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/Makefile 2007-11-14 20:05:15 UTC (rev 8062)
@@ -6,70 +6,66 @@
all: liboils_idl.so oils_auth.so oils_cstore.so oils_rstore.so oils_dataloader
#all: oils_auth.so
-oils_event.o: oils_event.c oils_event.h
-oils_utils.o: oils_utils.c oils_utils.h idl_fieldmapper.h
+oils_event.o: oils_event.c
+oils_utils.o: oils_utils.c
oils_auth.o: oils_auth.c
-oils_fetch.o: oils_fetch.c oils_utils.h
-oils_cstore.o: oils_cstore.c oils_utils.h
+oils_fetch.o: oils_fetch.c
+oils_cstore.o: oils_cstore.c
oils_dataloader.o: oils_dataloader.c
oils_dataloader: oils_dataloader.o
@echo $@
- $(CC) $(LDLIBS) $(LDFLAGS) -loils_idl -loils_utils oils_dataloader.o -o $(TMP)/$@
+ $(CC) $(LDLIBS) $(LDFLAGS) -loils_idl -loils_utils oils_dataloader.o -o $@
oils_cstore.so: oils_cstore.o liboils_utils.so liboils_idl.so
@echo $@
- $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) -loils_idl -ldbi -loils_utils -ldbdpgsql oils_cstore.o -o $(TMP)/$@
+ $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) -loils_idl -ldbi -loils_utils -ldbdpgsql oils_cstore.o -o $@
-oils_rstore.o: oils_cstore.c oils_utils.h
+oils_rstore.o: oils_cstore.c
$(CC) $(CFLAGS) -I$(TMP) -DRSTORE -c -o $@ oils_cstore.c
oils_rstore.so: oils_rstore.o liboils_utils.so liboils_idl.so
@echo $@
- $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) -loils_idl -ldbi -ldbdpgsql oils_rstore.o -o $(TMP)/$@
+ $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) -loils_idl -ldbi -ldbdpgsql oils_rstore.o -o $@
oils_fetch.so: oils_fetch.o liboils_utils.so
@echo $@
- $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) -ldbi -ldbdpgsql -loils_utils oils_fetch.o -o $(TMP)/$@
+ $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) -ldbi -ldbdpgsql -loils_utils oils_fetch.o -o $@
-oils_idl-core.o: oils_idl-core.c oils_idl.h
+oils_idl-core.o: oils_idl-core.c
liboils_idl.so: oils_idl-core.o
@echo $@
$(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) oils_idl-core.o -o $@
- cp $@ $(TMP)/
- mkdir -p $(TMP)/openils/
- cp oils_idl.h $(TMP)/openils/
- cp idl_fieldmapper.h $(TMP)/openils/
+# cp $@ $(TMP)/
+# mkdir -p $(TMP)/openils/
+# cp oils_idl.h $(TMP)/openils/
+# cp idl_fieldmapper.h $(TMP)/openils/
oils_auth.so: oils_auth.o liboils_utils.so
@echo $@
- $(CC) -shared -W1 $(CFLAGS) $(LDLIBS) $(LDFLAGS) -loils_utils -loils_idl oils_auth.o -o $(TMP)/$@
+ $(CC) -shared -W1 $(CFLAGS) $(LDLIBS) $(LDFLAGS) -loils_utils -loils_idl oils_auth.o -o $@
-liboils_utils.so: oils_utils.o oils_event.o oils_constants.h
+liboils_utils.so: oils_utils.o oils_event.o
@echo $@
$(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) oils_utils.o oils_event.o -o $@
- cp $@ $(TMP)/
- mkdir -p $(TMP)/openils/
- cp oils_event.h $(TMP)/openils/
- cp oils_utils.h $(TMP)/openils/
- cp oils_constants.h $(TMP)/openils/
+# cp $@ $(TMP)/
+# mkdir -p $(TMP)/openils/
+# cp oils_event.h $(TMP)/openils/
+# cp oils_utils.h $(TMP)/openils/
+# cp oils_constants.h $(TMP)/openils/
install:
@echo $@;
- cp $(TMP)/oils_auth.so $(LIBDIR)/
+ cp oils_auth.so $(LIBDIR)/
#cp $(TMP)/oils_fetch.so $(LIBDIR)/
- cp $(TMP)/oils_cstore.so $(LIBDIR)/
- cp $(TMP)/oils_rstore.so $(LIBDIR)/
- cp $(TMP)/liboils_utils.so $(LIBDIR)/
- cp $(TMP)/liboils_idl.so $(LIBDIR)/
- cp $(TMP)/oils_dataloader $(BINDIR)/
+ cp oils_cstore.so $(LIBDIR)/
+ cp oils_rstore.so $(LIBDIR)/
+ cp liboils_utils.so $(LIBDIR)/
+ cp liboils_idl.so $(LIBDIR)/
+ cp oils_dataloader $(BINDIR)/
mkdir -p $(INCDIR)/
- cp oils_utils.h $(INCDIR)
- cp oils_idl.h $(INCDIR)
- cp oils_event.h $(INCDIR)
- cp oils_constants.h $(INCDIR)
- cp idl_fieldmapper.h $(INCDIR)
+ cp openils/*.h $(INCDIR)/
clean:
@echo $@;
Deleted: trunk/Open-ILS/src/c-apps/idl_fieldmapper.h
===================================================================
--- trunk/Open-ILS/src/c-apps/idl_fieldmapper.h 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/idl_fieldmapper.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,18 +0,0 @@
-/* This set of macros will emulate the old style libfieldmapper api
- * using the new liboils_idl interface. You MUST initiallize liboils_idl!
- */
-
-#ifndef FIELDMAPPER_API
-
-#ifndef OILS_IDL_API
-#include "oils_idl.h"
-#endif
-
-#define FIELDMAPPER_API
-
-#define fm_pton(x,y) oilsIDL_pton(x,y)
-#define fm_ntop(x,y) oilsIDL_ntop(x,y)
-#define isFieldmapper(x) oilsIDL_classIsFieldmapper(x)
-
-#endif
-
Modified: trunk/Open-ILS/src/c-apps/oils_auth.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_auth.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_auth.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -3,9 +3,9 @@
#include "opensrf/osrf_settings.h"
#include "objson/object.h"
#include "opensrf/log.h"
-#include "oils_utils.h"
-#include "oils_constants.h"
-#include "oils_event.h"
+#include "openils/oils_utils.h"
+#include "openils/oils_constants.h"
+#include "openils/oils_event.h"
#define OILS_AUTH_CACHE_PRFX "oils_auth_"
Deleted: trunk/Open-ILS/src/c-apps/oils_constants.h
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_constants.h 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_constants.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,14 +0,0 @@
-
-
-/* Settings ------------------------------------------------------ */
-#define OILS_ORG_SETTING_OPAC_TIMEOUT "auth.opac_timeout"
-#define OILS_ORG_SETTING_STAFF_TIMEOUT "auth.staff_timeout"
-#define OILS_ORG_SETTING_TEMP_TIMEOUT "auth.temp_timeout"
-
-
-/* Events ------------------------------------------------------ */
-#define OILS_EVENT_SUCCESS "SUCCESS"
-#define OILS_EVENT_AUTH_FAILED "LOGIN_FAILED"
-#define OILS_EVENT_PERM_FAILURE "PERM_FAILURE"
-#define OILS_EVENT_NO_SESSION "NO_SESSION"
-
Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -4,7 +4,7 @@
#include "opensrf/utils.h"
#include "objson/object.h"
#include "opensrf/log.h"
-#include "oils_idl.h"
+#include "openils/oils_idl.h"
#include <dbi/dbi.h>
#include <time.h>
Modified: trunk/Open-ILS/src/c-apps/oils_dataloader.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_dataloader.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_dataloader.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -6,8 +6,8 @@
#include <stdio.h>
-#include "oils_idl.h"
-#include "oils_utils.h"
+#include "openils/oils_idl.h"
+#include "openils/oils_utils.h"
#define CSTORE "open-ils.cstore"
#define APPNAME "oils_dataloader"
Modified: trunk/Open-ILS/src/c-apps/oils_event.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_event.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_event.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,4 +1,4 @@
-#include "oils_event.h"
+#include "openils/oils_event.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
#include "opensrf/osrf_settings.h"
Deleted: trunk/Open-ILS/src/c-apps/oils_event.h
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_event.h 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_event.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,59 +0,0 @@
-#ifndef OILS_EVENT_HEADER
-#define OILS_EVENT_HEADER
-#include "objson/object.h"
-#include "opensrf/utils.h"
-#include "opensrf/log.h"
-#include "opensrf/osrf_hash.h"
-
-
-/* OILS Event structure */
-struct _oilsEventStruct {
- char* event; /* the event name */
- char* perm; /* the permission error name */
- int permloc; /* the permission location id */
- jsonObject* payload; /* the payload */
- jsonObject* json; /* the event as a jsonObject */
- char* file;
- int line;
-};
-typedef struct _oilsEventStruct oilsEvent;
-
-
-/** Creates a new event. User is responsible for freeing event with oilsEventFree */
-oilsEvent* oilsNewEvent( char* file, int line, char* event );
-
-/** Creates a new event with payload.
- * User is responsible for freeing event with oilsEventFree */
-oilsEvent* oilsNewEvent2( char* file, int line, char* event, jsonObject* payload );
-
-/** Creates a new event with permission and permission location.
- * User is responsible for freeing event with oilsEventFree */
-oilsEvent* oilsNewEvent3( char* file, int line, char* event, char* perm, int permloc );
-
-/** Creates a new event with permission, permission location, and payload.
- * User is responsible for freeing event with oilsEventFree */
-oilsEvent* oilsNewEvent4( char* file, int line,
- char* event, char* perm, int permloc, jsonObject* payload );
-
-/** Sets the permission info for the event */
-void oilsEventSetPermission( oilsEvent* event, char* perm, int permloc );
-
-/* Sets the payload for the event
- * This clones the payload, so the user is responsible
- * for handling the payload object's memory
- * */
-void oilsEventSetPayload( oilsEvent* event, jsonObject* payload );
-
-/** Creates the JSON associated with an event. The JSON should NOT be
- * freed by the user. It will be freed by oilsEventFree */
-jsonObject* oilsEventToJSON( oilsEvent* event );
-
-/* Parses the events file */
-void _oilsEventParseEvents();
-
-/* Frees an event object */
-void oilsEventFree( oilsEvent* event );
-
-
-
-#endif
Modified: trunk/Open-ILS/src/c-apps/oils_fetch.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_fetch.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_fetch.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -3,9 +3,9 @@
#include "opensrf/osrf_settings.h"
#include "objson/object.h"
#include "opensrf/log.h"
-#include "oils_utils.h"
-#include "oils_constants.h"
-#include "oils_event.h"
+#include "openils/oils_utils.h"
+#include "openils/oils_constants.h"
+#include "openils/oils_event.h"
#include <dbi/dbi.h>
#include <openils/fieldmapper_lookup.h>
Modified: trunk/Open-ILS/src/c-apps/oils_idl-core.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_idl-core.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_idl-core.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,4 +1,4 @@
-#include "oils_idl.h"
+#include "openils/oils_idl.h"
/*
* vim:noet:ts=4:
*/
Deleted: trunk/Open-ILS/src/c-apps/oils_idl.h
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_idl.h 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_idl.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,51 +0,0 @@
-#include "opensrf/log.h"
-#include "opensrf/utils.h"
-#include "opensrf/osrf_hash.h"
-
-#ifndef OILS_IDL_API
-#define OILS_IDL_API
-
-osrfHash* oilsIDLInit( char* );
-osrfHash* oilsIDL();
-osrfHash* oilsIDLFindPath( char*, ... );
-
-/* The oilsIDL hash looks like this:
-
-{ aws : {
- classname : "aws",
- fieldmapper : "actor::workstation",
- tablename : "actor.workstation", optional
- sequence : "actor.workstation_id_seq", optional
- primarykey : "id",
- virtual : "true", optional, "true" | "false"
- fields : {
- isnew : {
- name : "isnew",
- array_position : "0",
- virtual : "true", "true" | "false"
- primitive : "number" optional, JSON primitive (number, string, array,
- object, bool)
- },
- ...
- },
- links : {
- record : {
- field : "owning_lib", field above that links to another class
- rel_type : "has_a", link type, "has_a" | "has_many" | "might_have"
- class : "aou", the foreign class that is linked
- key : "id", the foreign class's key that creates the link to "field"
- map : [] osrfStringArray used by cstore in "has_many" rel_types to
- point through a linking class
- },
- ...
- },
- ...
-}
-
-*/
-
-int oilsIDL_classIsFieldmapper(char*);
-char * oilsIDL_pton(char *, int);
-int oilsIDL_ntop(char *, char *);
-
-#endif
Modified: trunk/Open-ILS/src/c-apps/oils_utils.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_utils.c 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_utils.c 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,5 +1,5 @@
-#include "oils_utils.h"
-#include "oils_idl.h"
+#include "openils/oils_utils.h"
+#include "openils/oils_idl.h"
osrfHash* oilsInitIDL(char* idl_filename) {
Deleted: trunk/Open-ILS/src/c-apps/oils_utils.h
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_utils.h 2007-11-14 16:18:20 UTC (rev 8061)
+++ trunk/Open-ILS/src/c-apps/oils_utils.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -1,111 +0,0 @@
-#include "objson/object.h"
-#include "opensrf/log.h"
-
-// XXX replacing this with liboils_idl implementation
-// #include "openils/fieldmapper_lookup.h"
-
-#include "openils/idl_fieldmapper.h"
-
-#include "oils_event.h"
-#include "oils_constants.h"
-#include "opensrf/osrf_app_session.h"
-#include "opensrf/osrf_settings.h"
-
-/**
- Loads the IDL. Returns NULL on failure
- or a pointer to the IDL data structure on success.
- @param idl_filename If not provided, we'll fetch the
- filename from the settings server
- */
-osrfHash* oilsInitIDL( char* idl_filename );
-
-/**
- Returns the string value for field 'field' in the given object.
- This method calls jsonObjectToSimpleString so numbers will be
- returned as strings.
- @param object The object to inspect
- @param field The field whose value is requsted
- @return The string at the given position, if none exists,
- then NULL is returned. The caller must free the returned string
- */
-char* oilsFMGetString( jsonObject* object, char* field );
-
-
-/**
- Returns the jsonObject found at the specified field in the
- given object.
- @param object The object to inspect
- @param field The field whose value is requsted
- @return The found object or NULL if none exists. Do NOT free the
- returned object.
- */
-jsonObject* oilsFMGetObject( jsonObject* object, char* field );
-
-/**
- Sets the given field in the given object to the given string
- @param object The object to update
- @param field The field to change
- @param string The new data
- @return 0 if the field was updated successfully, -1 on error
- */
-int oilsFMSetString( jsonObject* object, char* field, char* string );
-
-/**
- * Returns the data stored in the id field of the object if it exists
- * returns -1 if the id field or the id value is not found
- */
-long oilsFMGetObjectId( jsonObject* obj );
-
-
-/**
- * Checks if the user has each permission at the given org unit
- * Passing in a -1 for the orgid means to use the top level org unit
- * The first permission that fails causes the corresponding permission
- * failure event to be returned
- * returns NULL if all permissions succeed
- */
-oilsEvent* oilsUtilsCheckPerms( int userid, int orgid, char* permissions[], int size );
-
-
-/**
- * Performs a single request and returns the resulting data
- * Caller is responsible for freeing the returned response object
- */
-jsonObject* oilsUtilsQuickReq( char* service, char* method, jsonObject* params );
-
-jsonObject* oilsUtilsStorageReq( char* method, jsonObject* params );
-
-jsonObject* oilsUtilsCStoreReq( char* method, jsonObject* params );
-
-/**
- * Searches the storage server for a user with the given username
- * Caller is responsible for freeing the returned object
- */
-jsonObject* oilsUtilsFetchUserByUsername( char* name );
-
-
-/**
- * Returns the setting value
- * Caller must free the returned string
- */
-char* oilsUtilsFetchOrgSetting( int orgid, char* setting );
-
-
-/**
- * Logs into the auth server with the given username and password
- * @return The authtoken string which must be de-allocated by the caller
- */
-char* oilsUtilsLogin( char* uname, char* passwd, char* type, int orgId );
-
-
-/**
- * Fetches the requested workstation object by id
- */
-jsonObject* oilsUtilsFetchWorkstation( long id );
-
-jsonObject* oilsUtilsFetchUserByBarcode(char* barcode);
-
-jsonObject* oilsUtilsFetchWorkstationByName( char* name );
-
-
-int oilsUtilsIsDBTrue( char* val );
Copied: trunk/Open-ILS/src/c-apps/openils/idl_fieldmapper.h (from rev 8061, trunk/Open-ILS/src/c-apps/idl_fieldmapper.h)
===================================================================
--- trunk/Open-ILS/src/c-apps/openils/idl_fieldmapper.h (rev 0)
+++ trunk/Open-ILS/src/c-apps/openils/idl_fieldmapper.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -0,0 +1,18 @@
+/* This set of macros will emulate the old style libfieldmapper api
+ * using the new liboils_idl interface. You MUST initiallize liboils_idl!
+ */
+
+#ifndef FIELDMAPPER_API
+
+#ifndef OILS_IDL_API
+#include "oils_idl.h"
+#endif
+
+#define FIELDMAPPER_API
+
+#define fm_pton(x,y) oilsIDL_pton(x,y)
+#define fm_ntop(x,y) oilsIDL_ntop(x,y)
+#define isFieldmapper(x) oilsIDL_classIsFieldmapper(x)
+
+#endif
+
Copied: trunk/Open-ILS/src/c-apps/openils/oils_constants.h (from rev 8061, trunk/Open-ILS/src/c-apps/oils_constants.h)
===================================================================
--- trunk/Open-ILS/src/c-apps/openils/oils_constants.h (rev 0)
+++ trunk/Open-ILS/src/c-apps/openils/oils_constants.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -0,0 +1,14 @@
+
+
+/* Settings ------------------------------------------------------ */
+#define OILS_ORG_SETTING_OPAC_TIMEOUT "auth.opac_timeout"
+#define OILS_ORG_SETTING_STAFF_TIMEOUT "auth.staff_timeout"
+#define OILS_ORG_SETTING_TEMP_TIMEOUT "auth.temp_timeout"
+
+
+/* Events ------------------------------------------------------ */
+#define OILS_EVENT_SUCCESS "SUCCESS"
+#define OILS_EVENT_AUTH_FAILED "LOGIN_FAILED"
+#define OILS_EVENT_PERM_FAILURE "PERM_FAILURE"
+#define OILS_EVENT_NO_SESSION "NO_SESSION"
+
Copied: trunk/Open-ILS/src/c-apps/openils/oils_event.h (from rev 8061, trunk/Open-ILS/src/c-apps/oils_event.h)
===================================================================
--- trunk/Open-ILS/src/c-apps/openils/oils_event.h (rev 0)
+++ trunk/Open-ILS/src/c-apps/openils/oils_event.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -0,0 +1,59 @@
+#ifndef OILS_EVENT_HEADER
+#define OILS_EVENT_HEADER
+#include "objson/object.h"
+#include "opensrf/utils.h"
+#include "opensrf/log.h"
+#include "opensrf/osrf_hash.h"
+
+
+/* OILS Event structure */
+struct _oilsEventStruct {
+ char* event; /* the event name */
+ char* perm; /* the permission error name */
+ int permloc; /* the permission location id */
+ jsonObject* payload; /* the payload */
+ jsonObject* json; /* the event as a jsonObject */
+ char* file;
+ int line;
+};
+typedef struct _oilsEventStruct oilsEvent;
+
+
+/** Creates a new event. User is responsible for freeing event with oilsEventFree */
+oilsEvent* oilsNewEvent( char* file, int line, char* event );
+
+/** Creates a new event with payload.
+ * User is responsible for freeing event with oilsEventFree */
+oilsEvent* oilsNewEvent2( char* file, int line, char* event, jsonObject* payload );
+
+/** Creates a new event with permission and permission location.
+ * User is responsible for freeing event with oilsEventFree */
+oilsEvent* oilsNewEvent3( char* file, int line, char* event, char* perm, int permloc );
+
+/** Creates a new event with permission, permission location, and payload.
+ * User is responsible for freeing event with oilsEventFree */
+oilsEvent* oilsNewEvent4( char* file, int line,
+ char* event, char* perm, int permloc, jsonObject* payload );
+
+/** Sets the permission info for the event */
+void oilsEventSetPermission( oilsEvent* event, char* perm, int permloc );
+
+/* Sets the payload for the event
+ * This clones the payload, so the user is responsible
+ * for handling the payload object's memory
+ * */
+void oilsEventSetPayload( oilsEvent* event, jsonObject* payload );
+
+/** Creates the JSON associated with an event. The JSON should NOT be
+ * freed by the user. It will be freed by oilsEventFree */
+jsonObject* oilsEventToJSON( oilsEvent* event );
+
+/* Parses the events file */
+void _oilsEventParseEvents();
+
+/* Frees an event object */
+void oilsEventFree( oilsEvent* event );
+
+
+
+#endif
Copied: trunk/Open-ILS/src/c-apps/openils/oils_idl.h (from rev 8061, trunk/Open-ILS/src/c-apps/oils_idl.h)
===================================================================
--- trunk/Open-ILS/src/c-apps/openils/oils_idl.h (rev 0)
+++ trunk/Open-ILS/src/c-apps/openils/oils_idl.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -0,0 +1,51 @@
+#include "opensrf/log.h"
+#include "opensrf/utils.h"
+#include "opensrf/osrf_hash.h"
+
+#ifndef OILS_IDL_API
+#define OILS_IDL_API
+
+osrfHash* oilsIDLInit( char* );
+osrfHash* oilsIDL();
+osrfHash* oilsIDLFindPath( char*, ... );
+
+/* The oilsIDL hash looks like this:
+
+{ aws : {
+ classname : "aws",
+ fieldmapper : "actor::workstation",
+ tablename : "actor.workstation", optional
+ sequence : "actor.workstation_id_seq", optional
+ primarykey : "id",
+ virtual : "true", optional, "true" | "false"
+ fields : {
+ isnew : {
+ name : "isnew",
+ array_position : "0",
+ virtual : "true", "true" | "false"
+ primitive : "number" optional, JSON primitive (number, string, array,
+ object, bool)
+ },
+ ...
+ },
+ links : {
+ record : {
+ field : "owning_lib", field above that links to another class
+ rel_type : "has_a", link type, "has_a" | "has_many" | "might_have"
+ class : "aou", the foreign class that is linked
+ key : "id", the foreign class's key that creates the link to "field"
+ map : [] osrfStringArray used by cstore in "has_many" rel_types to
+ point through a linking class
+ },
+ ...
+ },
+ ...
+}
+
+*/
+
+int oilsIDL_classIsFieldmapper(char*);
+char * oilsIDL_pton(char *, int);
+int oilsIDL_ntop(char *, char *);
+
+#endif
Copied: trunk/Open-ILS/src/c-apps/openils/oils_utils.h (from rev 8061, trunk/Open-ILS/src/c-apps/oils_utils.h)
===================================================================
--- trunk/Open-ILS/src/c-apps/openils/oils_utils.h (rev 0)
+++ trunk/Open-ILS/src/c-apps/openils/oils_utils.h 2007-11-14 20:05:15 UTC (rev 8062)
@@ -0,0 +1,111 @@
+#include "objson/object.h"
+#include "opensrf/log.h"
+
+// XXX replacing this with liboils_idl implementation
+// #include "openils/fieldmapper_lookup.h"
+
+#include "openils/idl_fieldmapper.h"
+
+#include "oils_event.h"
+#include "oils_constants.h"
+#include "opensrf/osrf_app_session.h"
+#include "opensrf/osrf_settings.h"
+
+/**
+ Loads the IDL. Returns NULL on failure
+ or a pointer to the IDL data structure on success.
+ @param idl_filename If not provided, we'll fetch the
+ filename from the settings server
+ */
+osrfHash* oilsInitIDL( char* idl_filename );
+
+/**
+ Returns the string value for field 'field' in the given object.
+ This method calls jsonObjectToSimpleString so numbers will be
+ returned as strings.
+ @param object The object to inspect
+ @param field The field whose value is requsted
+ @return The string at the given position, if none exists,
+ then NULL is returned. The caller must free the returned string
+ */
+char* oilsFMGetString( jsonObject* object, char* field );
+
+
+/**
+ Returns the jsonObject found at the specified field in the
+ given object.
+ @param object The object to inspect
+ @param field The field whose value is requsted
+ @return The found object or NULL if none exists. Do NOT free the
+ returned object.
+ */
+jsonObject* oilsFMGetObject( jsonObject* object, char* field );
+
+/**
+ Sets the given field in the given object to the given string
+ @param object The object to update
+ @param field The field to change
+ @param string The new data
+ @return 0 if the field was updated successfully, -1 on error
+ */
+int oilsFMSetString( jsonObject* object, char* field, char* string );
+
+/**
+ * Returns the data stored in the id field of the object if it exists
+ * returns -1 if the id field or the id value is not found
+ */
+long oilsFMGetObjectId( jsonObject* obj );
+
+
+/**
+ * Checks if the user has each permission at the given org unit
+ * Passing in a -1 for the orgid means to use the top level org unit
+ * The first permission that fails causes the corresponding permission
+ * failure event to be returned
+ * returns NULL if all permissions succeed
+ */
+oilsEvent* oilsUtilsCheckPerms( int userid, int orgid, char* permissions[], int size );
+
+
+/**
+ * Performs a single request and returns the resulting data
+ * Caller is responsible for freeing the returned response object
+ */
+jsonObject* oilsUtilsQuickReq( char* service, char* method, jsonObject* params );
+
+jsonObject* oilsUtilsStorageReq( char* method, jsonObject* params );
+
+jsonObject* oilsUtilsCStoreReq( char* method, jsonObject* params );
+
+/**
+ * Searches the storage server for a user with the given username
+ * Caller is responsible for freeing the returned object
+ */
+jsonObject* oilsUtilsFetchUserByUsername( char* name );
+
+
+/**
+ * Returns the setting value
+ * Caller must free the returned string
+ */
+char* oilsUtilsFetchOrgSetting( int orgid, char* setting );
+
+
+/**
+ * Logs into the auth server with the given username and password
+ * @return The authtoken string which must be de-allocated by the caller
+ */
+char* oilsUtilsLogin( char* uname, char* passwd, char* type, int orgId );
+
+
+/**
+ * Fetches the requested workstation object by id
+ */
+jsonObject* oilsUtilsFetchWorkstation( long id );
+
+jsonObject* oilsUtilsFetchUserByBarcode(char* barcode);
+
+jsonObject* oilsUtilsFetchWorkstationByName( char* name );
+
+
+int oilsUtilsIsDBTrue( char* val );
More information about the open-ils-commits
mailing list