spot_SOURCES = spotlight.c spotlight_marshalling.c
spot_CFLAGS = -DSPOT_TEST_MAIN
spot_LDADD = $(top_builddir)/libatalk/libatalk.la
+
+moduledir = @UAMS_PATH@
+module_LTLIBRARIES = mod_spotlight.la
+
+mod_spotlight_la_SOURCES = spotlight_module.c
+mod_spotlight_la_CFLAGS = \
+ -DDBUS_API_SUBJECT_TO_CHANGE \
+ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
+mod_spotlight_la_LDFLAGS = \
+ -module -avoid-version \
+ -pthread -L/lib -ltrackerclient -ldbus-glib-1 -ldbus-1 -lpthread -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0
\ No newline at end of file
#include "spotlight.h"
+void *sl_module;
+struct sl_module_export *sl_module_export;
+
/* Helper functions and stuff */
static const char *neststrings[] = {
EC_EXIT;
}
+/**************************************************************************************************
+ * Spotlight module functions
+ **************************************************************************************************/
+
+int sl_mod_load(const char *path)
+{
+ EC_INIT;
+
+ if ((sl_module = mod_open(path)) == NULL) {
+ LOG(log_error, logtype_sl, "sl_mod_load(%s): failed to load: %s", path, mod_error());
+ EC_FAIL;
+ }
+
+ if ((sl_module_export = mod_symbol(sl_module, "sl_mod")) == NULL) {
+ LOG(log_error, logtype_sl, "sl_mod_load(%s): mod_symbol error for symbol %s", path, "sl_mod");
+ EC_FAIL;
+ }
+
+ sl_module_export->sl_mod_init("test");
+
+EC_CLEANUP:
+ EC_EXIT;
+}
+
/**************************************************************************************************
* AFP functions
**************************************************************************************************/
DALLOC_CTX *reply;
EC_NULL( reply = talloc_zero(tmp_ctx, DALLOC_CTX) );
- ret = sl_unpack(query, ibuf + 22);
- dd_dump(query, 0);
- if (ret != 0) {
- LOG(log_error, logtype_sl, "sl_unpack");
- EC_FAIL;
- }
+ EC_NEG1_LOG( sl_unpack(query, ibuf + 22) );
+
char **cmd;
EC_NULL_LOG( cmd = dalloc_get(query, "DALLOC_CTX", 0, "DALLOC_CTX", 0, "char *", 0) );
-
if (STRCMP(*cmd, ==, "fetchPropertiesForContext:")) {
EC_ZERO_LOG( sl_rpc_fetchPropertiesForContext(obj, query, reply, vol) );
} else if (STRCMP(*cmd, ==, "openQueryWithParams:forContext:")) {
}
}
- /* Spotlight RPC status code ? 0 in all traces, we use 0xffffffff for an error, never seen from Apple */
- if (ret == 0)
- memset(rbuf, 0, 4);
- else
- memset(rbuf, 0xff, 4);
+ dd_dump(reply, 0);
+
+ memset(rbuf, 0, 4);
*rbuflen += 4;
int len;
EC_NEG1_LOG( len = sl_pack(reply, rbuf + 4) );
*rbuflen += len;
- dd_dump(reply, 0);
-
break;
}
}
#define SPOTLIGHT_H
#include <stdint.h>
+#include <stdbool.h>
#include <atalk/dalloc.h>
#include <atalk/globals.h>
+/**************************************************************************************************
+ * Spotlight module stuff
+ **************************************************************************************************/
+
+#define SL_MODULE_VERSION 1
+
+struct sl_module_export {
+ int sl_mod_version;
+ int (*sl_mod_init) (void *);
+ int (*sl_mod_start_search)(void *);
+ int (*sl_mod_fetch_result)(void *);
+ int (*sl_mod_end_search) (void *);
+};
+
+extern int sl_mod_load(const char *path);
+
+
+/**************************************************************************************************
+ * Spotlight RPC and marshalling stuff
+ **************************************************************************************************/
+
/* FPSpotlightRPC subcommand codes */
#define SPOTLIGHT_CMD_OPEN 1
#define SPOTLIGHT_CMD_FLAGS 2