2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
23 * @brief main FS functions
24 * @author Christian Grothoff
28 #include "gnunet_fs_service.h"
33 * Setup a connection to the file-sharing service.
35 * @param sched scheduler to use
36 * @param cfg configuration to use
37 * @param client_name unique identifier for this client
38 * @param upcb function to call to notify about FS actions
39 * @param upcb_cls closure for upcb
40 * @param flags specific attributes for fs-operations
41 * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END
42 * @return NULL on error
44 struct GNUNET_FS_Handle *
45 GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
46 const struct GNUNET_CONFIGURATION_Handle *cfg,
47 const char *client_name,
48 GNUNET_FS_ProgressCallback upcb,
50 enum GNUNET_FS_Flags flags,
53 struct GNUNET_FS_Handle *ret;
54 struct GNUNET_CLIENT_Connection *client;
56 client = GNUNET_CLIENT_connect (sched,
61 ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Handle));
64 ret->client_name = GNUNET_strdup (client_name);
66 ret->upcb_cls = upcb_cls;
69 // FIXME: process varargs!
70 // FIXME: setup receive-loop with client
72 // FIXME: deserialize state; use client-name to find master-directory!
73 // Deserialize-Upload:
74 // * read FNs for upload FIs, deserialize each
75 // Deserialize Search:
76 // * read search queries
77 // * for each query, read file with search results
78 // * for each search result with active download, deserialize download
79 // * for each directory search result, check for active downloads of contents
80 // Deserialize Download:
81 // * always part of search???
82 // Deserialize Unindex:
83 // * read FNs for unindex with progress offset
89 * Close our connection with the file-sharing service.
90 * The callback given to GNUNET_FS_start will no longer be
91 * called after this function returns.
93 * @param h handle that was returned from GNUNET_FS_start
96 GNUNET_FS_stop (struct GNUNET_FS_Handle *h)
98 // FIXME: serialize state!? (or is it always serialized???)
99 // FIXME: terminate receive-loop with client
100 GNUNET_CLIENT_disconnect (h->client);
101 GNUNET_free (h->client_name);