#include "fs.h"
-
/**
* Setup a connection to the file-sharing service.
*
* @param client_name unique identifier for this client
* @param upcb function to call to notify about FS actions
* @param upcb_cls closure for upcb
+ * @param flags specific attributes for fs-operations
+ * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END
+ * @return NULL on error
*/
struct GNUNET_FS_Handle *
GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *client_name,
GNUNET_FS_ProgressCallback upcb,
- void *upcb_cls)
+ void *upcb_cls,
+ enum GNUNET_FS_Flags flags,
+ ...)
{
- return NULL;
+ struct GNUNET_FS_Handle *ret;
+ struct GNUNET_CLIENT_Connection *client;
+
+ client = GNUNET_CLIENT_connect (sched,
+ "fs",
+ cfg);
+ if (NULL == client)
+ return NULL;
+ ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Handle));
+ ret->sched = sched;
+ ret->cfg = cfg;
+ ret->client_name = GNUNET_strdup (client_name);
+ ret->upcb = upcb;
+ ret->upcb_cls = upcb_cls;
+ ret->client = client;
+ ret->flags = flags;
+ // FIXME: process varargs!
+ // FIXME: setup receive-loop with client
+
+ // FIXME: deserialize state; use client-name to find master-directory!
+ // Deserialize-Upload:
+ // * read FNs for upload FIs, deserialize each
+ // Deserialize Search:
+ // * read search queries
+ // * for each query, read file with search results
+ // * for each search result with active download, deserialize download
+ // * for each directory search result, check for active downloads of contents
+ // Deserialize Download:
+ // * always part of search???
+ // Deserialize Unindex:
+ // * read FNs for unindex with progress offset
+ return ret;
}
void
GNUNET_FS_stop (struct GNUNET_FS_Handle *h)
{
+ // FIXME: serialize state!? (or is it always serialized???)
+ // FIXME: terminate receive-loop with client
+ GNUNET_CLIENT_disconnect (h->client);
+ GNUNET_free (h->client_name);
+ GNUNET_free (h);
}
+
/* end of fs.c */