#include <atalk/byteorder.h>
#include <atalk/netatalk_conf.h>
#include <atalk/volume.h>
+#include <atalk/queue.h>
#include "spotlight.h"
-void *sl_module;
-struct sl_module_export *sl_module_export;
-
+static void *sl_module;
+static struct sl_module_export *sl_module_export;
+static q_t *sl_queries;
/* Helper functions and stuff */
static const char *neststrings[] = {
LOG(log_debug, logtype_sl, "sl_rpc_openQuery: %s", *sl_query);
+ enqueue(sl_queries, query);
+
EC_CLEANUP:
EC_EXIT;
}
{
EC_INIT;
+ sl_queries = queue_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;
DALLOC_CTX *ca_cnids;
} sl_cnids_t; /* an array of CNID */
+/**************************************************************************************************
+ * Some helper stuff dealing with queries
+ **************************************************************************************************/
+
+typedef struct {
+ time_t slq_time; /* timestamp where we received this query */
+ uint64_t slq_ctx1; /* client context 1 */
+ uint64_t slq_ctx2; /* client context 2 */
+ DALLOC_CTX *slq_query; /* the complete query as unmarshalled in openQuery */
+ const char *sql_qstring; /* the Spotlight query string */
+ DALLOC_CTX *slq_reqinfo; /* array with requested metadata */
+} slq_t;
+
+/**************************************************************************************************
+ * Function declarations
+ **************************************************************************************************/
+
extern int afp_spotlight_rpc(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen);
extern int sl_pack(DALLOC_CTX *query, char *buf);
extern int sl_unpack(DALLOC_CTX *query, const char *buf);