]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/spotlight.h
Dispatch queries to Tracker and get results
[netatalk.git] / etc / afpd / spotlight.h
index b845a47c986319ff159a275706d2c2f12361a7f2..adcac14d411e269dd0f7ce6b5bdd4ed9750fe107 100644 (file)
@@ -65,12 +65,39 @@ typedef bool           sl_bool_t;     /* a boolean, we avoid bool_t as it's a de
 typedef struct timeval sl_time_t;     /* a boolean, we avoid bool_t as it's a define for something else */
 typedef struct {
     char sl_uuid[16];
-}                      sl_uuid_t;     /* a UUID                                                         */
+}  sl_uuid_t;                         /* a UUID                                                         */
 typedef struct {
     uint16_t   ca_unkn1;
     uint32_t   ca_context;
     DALLOC_CTX *ca_cnids;
-}                      sl_cnids_t;    /* an array of CNID                                               */
+}  sl_cnids_t;                        /* an array of CNIDs                                              */
+
+/**************************************************************************************************
+ * Some helper stuff dealing with queries
+ **************************************************************************************************/
+
+/* Internal query state */
+typedef enum {
+    SLQ_STATE_NEW      = 1,           /* Query received from client                                     */
+    SLQ_STATE_RUNNING  = 2,           /* Query dispatched to Tracker                                    */
+    SLQ_STATE_DONE     = 3,           /* Tracker finished                                               */
+    SLQ_STATE_END      = 4            /* Query results returned to client                               */
+} slq_state_t;
+
+/* Internal query data structure */
+typedef struct {
+    slq_state_t    slq_state;         /* State                                                          */
+    time_t         slq_time;          /* timestamp where we received this query                         */
+    uint64_t       slq_ctx1;          /* client context 1                                               */
+    uint64_t       slq_ctx2;          /* client context 2                                               */
+    const char     *slq_qstring;      /* the Spotlight query string                                     */
+    DALLOC_CTX     *slq_reqinfo;      /* array with requested metadata                                  */
+    void           *slq_tracker_cursor; /* Tracker query result cursor                                  */
+} 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);