705fde74c72251358308e5147055f2d0e596f375
[oweals/gnunet.git] / src / fs / fs_test_lib.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2010, 2012 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your 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      Affero General Public License for more details.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20  * @file fs/fs_test_lib.h
21  * @brief library routines for testing FS publishing and downloading;
22  *        this code is limited to flat files
23  *        and no keywords (those functions can be tested with
24  *        single-peer setups; this is for testing routing).
25  * @author Christian Grothoff
26  */
27 #ifndef FS_TEST_LIB_H
28 #define FS_TEST_LIB_H
29
30 #include "gnunet_util_lib.h"
31 #include "gnunet_fs_service.h"
32 #include "gnunet_testbed_service.h"
33
34
35 /**
36  * Function signature.
37  *
38  * @param cls closure (user defined)
39  * @param uri a URI, NULL for errors
40  * @param fn name of the file on disk to be removed upon
41  *           completion, or NULL for inserted files (also NULL on error)
42  */
43 typedef void
44 (*GNUNET_FS_TEST_UriContinuation) (void *cls,
45                                    const struct GNUNET_FS_Uri *uri,
46                                    const char *fn);
47
48
49 /**
50  * Publish a file at the given daemon.
51  *
52  * @param peer where to publish
53  * @param timeout if this operation cannot be completed within the
54  *                given period, call the continuation with an error code
55  * @param anonymity option for publication
56  * @param do_index #GNUNET_YES for index, #GNUNET_NO for insertion,
57  *                #GNUNET_SYSERR for simulation
58  * @param size size of the file to publish
59  * @param seed seed to use for file generation
60  * @param verbose how verbose to be in reporting
61  * @param cont function to call when done
62  * @param cont_cls closure for @a cont
63  */
64 void
65 GNUNET_FS_TEST_publish (struct GNUNET_TESTBED_Peer *peer,
66                         struct GNUNET_TIME_Relative timeout,
67                         uint32_t anonymity,
68                         int do_index,
69                         uint64_t size,
70                         uint32_t seed,
71                         unsigned int verbose,
72                         GNUNET_FS_TEST_UriContinuation cont,
73                         void *cont_cls);
74
75
76 /**
77  * Perform test download.
78  *
79  * @param peer which peer to download from
80  * @param timeout if this operation cannot be completed within the
81  *                given period, call the continuation with an error code
82  * @param anonymity option for download
83  * @param seed used for file validation
84  * @param uri URI of file to download (CHK/LOC only)
85  * @param verbose how verbose to be in reporting
86  * @param cont function to call when done
87  * @param cont_cls closure for @a cont
88  */
89 void
90 GNUNET_FS_TEST_download (struct GNUNET_TESTBED_Peer *peer,
91                          struct GNUNET_TIME_Relative timeout,
92                          uint32_t anonymity,
93                          uint32_t seed,
94                          const struct GNUNET_FS_Uri *uri,
95                          unsigned int verbose,
96                          GNUNET_SCHEDULER_TaskCallback cont,
97                          void *cont_cls);
98
99
100
101 #endif