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
41 struct GNUNET_FS_Handle *
42 GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
43 const struct GNUNET_CONFIGURATION_Handle *cfg,
44 const char *client_name,
45 GNUNET_FS_ProgressCallback upcb,
48 struct GNUNET_FS_Handle *ret;
49 struct GNUNET_CLIENT_Connection *client;
51 client = GNUNET_CLIENT_connect (sched,
56 ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Handle));
59 ret->client_name = GNUNET_strdup (client_name);
61 ret->upcb_cls = upcb_cls;
63 // FIXME: setup receive-loop with client
64 // FIXME: deserialize state; use client-name to find master-directory!
65 // Deserialize-Upload:
66 // * read FNs for upload FIs, deserialize each
67 // Deserialize Search:
68 // * read search queries
69 // * for each query, read file with search results
70 // * for each search result with active download, deserialize download
71 // * for each directory search result, check for active downloads of contents
72 // Deserialize Download:
73 // * always part of search???
74 // Deserialize Unindex:
75 // * read FNs for unindex with progress offset
81 * Close our connection with the file-sharing service.
82 * The callback given to GNUNET_FS_start will no longer be
83 * called after this function returns.
85 * @param h handle that was returned from GNUNET_FS_start
88 GNUNET_FS_stop (struct GNUNET_FS_Handle *h)
90 // FIXME: serialize state!? (or is it always serialized???)
91 // FIXME: terminate receive-loop with client
92 GNUNET_CLIENT_disconnect (h->client);
93 GNUNET_free (h->client_name);