-fix
[oweals/gnunet.git] / src / fs / fs_test_lib.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2010, 2012 Christian Grothoff (and other contributing authors)
4
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 3, or (at your
8      option) any later version.
9
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.
14
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file fs/fs_test_lib.h
23  * @brief library routines for testing FS publishing and downloading;
24  *        this code is limited to flat files
25  *        and no keywords (those functions can be tested with
26  *        single-peer setups; this is for testing routing).
27  * @author Christian Grothoff
28  */
29 #ifndef FS_TEST_LIB_H
30 #define FS_TEST_LIB_H
31
32 #include "gnunet_util_lib.h"
33 #include "gnunet_fs_service.h"
34 #include "gnunet_testbed_service.h"
35
36
37 /**
38  * Function signature.
39  *
40  * @param cls closure (user defined)
41  * @param uri a URI, NULL for errors
42  * @param fn name of the file on disk to be removed upon
43  *           completion, or NULL for inserted files (also NULL on error)
44  */
45 typedef void
46 (*GNUNET_FS_TEST_UriContinuation) (void *cls,
47                                    const struct GNUNET_FS_Uri *uri,
48                                    const char *fn);
49
50
51 /**
52  * Publish a file at the given daemon.
53  *
54  * @param peer where to publish
55  * @param timeout if this operation cannot be completed within the
56  *                given period, call the continuation with an error code
57  * @param anonymity option for publication
58  * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion,
59  *                #GNUNET_SYSERR for simulation
60  * @param size size of the file to publish
61  * @param seed seed to use for file generation
62  * @param verbose how verbose to be in reporting
63  * @param cont function to call when done
64  * @param cont_cls closure for @a cont
65  */
66 void
67 GNUNET_FS_TEST_publish (struct GNUNET_TESTBED_Peer *peer,
68                         struct GNUNET_TIME_Relative timeout,
69                         uint32_t anonymity,
70                         int do_index,
71                         uint64_t size,
72                         uint32_t seed,
73                         unsigned int verbose,
74                         GNUNET_FS_TEST_UriContinuation cont,
75                         void *cont_cls);
76
77
78 /**
79  * Perform test download.
80  *
81  * @param peer which peer to download from
82  * @param timeout if this operation cannot be completed within the
83  *                given period, call the continuation with an error code
84  * @param anonymity option for download
85  * @param seed used for file validation
86  * @param uri URI of file to download (CHK/LOC only)
87  * @param verbose how verbose to be in reporting
88  * @param cont function to call when done
89  * @param cont_cls closure for @a cont
90  */
91 void
92 GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer,
93                          struct GNUNET_TIME_Relative timeout,
94                          uint32_t anonymity,
95                          uint32_t seed,
96                          const struct GNUNET_FS_Uri *uri,
97                          unsigned int verbose,
98                          GNUNET_SCHEDULER_TaskCallback cont,
99                          void *cont_cls);
100
101
102
103 #endif