aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_test_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-02-22 10:09:38 +0000
committerChristian Grothoff <christian@grothoff.org>2010-02-22 10:09:38 +0000
commit94706428e8d7067cac7dec5d04ccc1cf99a56af5 (patch)
tree3da776fd1ff6e24b8353278ae510b4c6acf919f5 /src/fs/fs_test_lib.h
parent6e62186491decd07bcf6f083c2404712cb572787 (diff)
downloadgnunet-94706428e8d7067cac7dec5d04ccc1cf99a56af5.tar.gz
gnunet-94706428e8d7067cac7dec5d04ccc1cf99a56af5.zip
fix leak, rename
Diffstat (limited to 'src/fs/fs_test_lib.h')
-rw-r--r--src/fs/fs_test_lib.h161
1 files changed, 161 insertions, 0 deletions
diff --git a/src/fs/fs_test_lib.h b/src/fs/fs_test_lib.h
new file mode 100644
index 000000000..b9bbf7480
--- /dev/null
+++ b/src/fs/fs_test_lib.h
@@ -0,0 +1,161 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 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 2, 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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file fs/test_fs_lib.h
23 * @brief library routines for testing FS publishing and downloading
24 * with multiple peers; 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 TEST_FS_LIB_H
30#define TEST_FS_LIB_H
31
32#include "gnunet_util_lib.h"
33#include "gnunet_fs_service.h"
34
35/**
36 * Handle for a daemon started for testing FS.
37 */
38struct GNUNET_FS_TestDaemon;
39
40
41/**
42 * Start daemons for testing.
43 *
44 * @param sched scheduler to use
45 * @param timeout if this operation cannot be completed within the
46 * given period, call the continuation with an error code
47 * @param total number of daemons to start
48 * @param daemons array of 'total' entries to be initialized
49 * (array must already be allocated, will be filled)
50 * @param cont function to call when done
51 * @param cont_cls closure for cont
52 */
53void
54GNUNET_FS_TEST_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
55 struct GNUNET_TIME_Relative timeout,
56 unsigned int total,
57 struct GNUNET_FS_TestDaemon **daemons,
58 GNUNET_SCHEDULER_Task cont,
59 void *cont_cls);
60
61
62/**
63 * Connect two daemons for testing.
64 *
65 * @param sched scheduler to use
66 * @param daemon1 first daemon to connect
67 * @param daemon2 second first daemon to connect
68 * @param timeout if this operation cannot be completed within the
69 * given period, call the continuation with an error code
70 * @param cont function to call when done
71 * @param cont_cls closure for cont
72 */
73void
74GNUNET_FS_TEST_daemons_connect (struct GNUNET_SCHEDULER_Handle *sched,
75 struct GNUNET_FS_TestDaemon *daemon1,
76 struct GNUNET_FS_TestDaemon *daemon2,
77 struct GNUNET_TIME_Relative timeout,
78 GNUNET_SCHEDULER_Task cont,
79 void *cont_cls);
80
81
82/**
83 * Stop daemons used for testing.
84 *
85 * @param sched scheduler to use
86 * @param total number of daemons to stop
87 * @param daemons array with the daemons (values will be clobbered)
88 */
89void
90GNUNET_FS_TEST_daemons_stop (struct GNUNET_SCHEDULER_Handle *sched,
91 unsigned int total,
92 struct GNUNET_FS_TestDaemon **daemons);
93
94
95/**
96 * Function signature.
97 *
98 * @param cls closure (user defined)
99 * @param uri a URI, NULL for errors
100 */
101typedef void
102(*GNUNET_FS_TEST_UriContinuation)(void *cls,
103 const struct GNUNET_FS_Uri *uri);
104
105
106/**
107 * Publish a file at the given daemon.
108 *
109 * @param sched scheduler to use
110 * @param daemon where to publish
111 * @param timeout if this operation cannot be completed within the
112 * given period, call the continuation with an error code
113 * @param anonymity option for publication
114 * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
115 * GNUNET_SYSERR for simulation
116 * @param size size of the file to publish
117 * @param seed seed to use for file generation
118 * @param verbose how verbose to be in reporting
119 * @param cont function to call when done
120 * @param cont_cls closure for cont
121 */
122void
123GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched,
124 struct GNUNET_FS_TestDaemon *daemon,
125 struct GNUNET_TIME_Relative timeout,
126 uint32_t anonymity,
127 int do_index,
128 uint64_t size,
129 uint32_t seed,
130 unsigned int verbose,
131 GNUNET_FS_TEST_UriContinuation cont,
132 void *cont_cls);
133
134
135/**
136 * Perform test download.
137 *
138 * @param sched scheduler to use
139 * @param daemon which peer to download from
140 * @param timeout if this operation cannot be completed within the
141 * given period, call the continuation with an error code
142 * @param anonymity option for download
143 * @param seed used for file validation
144 * @param verbose how verbose to be in reporting
145 * @param cont function to call when done
146 * @param cont_cls closure for cont
147 */
148void
149GNUNET_FS_TEST_download (struct GNUNET_SCHEDULER_Handle *sched,
150 struct GNUNET_FS_TestDaemon *daemon,
151 struct GNUNET_TIME_Relative timeout,
152 uint32_t anonymity,
153 uint32_t seed,
154 const struct GNUNET_FS_Uri *uri,
155 unsigned int verbose,
156 GNUNET_SCHEDULER_Task cont,
157 void *cont_cls);
158
159
160
161#endif