summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-05-07 12:06:50 +0000
committerBart Polot <bart@net.in.tum.de>2014-05-07 12:06:50 +0000
commitbe4c79e4cd4a8f118c5577874f0c95e253359595 (patch)
tree7fd74fb0cf6921c4e35a43f2593396bb4805f154 /src/fs
parent15ccd7a167bcce0dde4331092975a6401393610f (diff)
downloadgnunet-be4c79e4cd4a8f118c5577874f0c95e253359595.tar.gz
gnunet-be4c79e4cd4a8f118c5577874f0c95e253359595.zip
Rename mesh->cadet
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_api.c2
-rw-r--r--src/fs/gnunet-service-fs.c16
-rw-r--r--src/fs/gnunet-service-fs_mesh.h40
-rw-r--r--src/fs/gnunet-service-fs_mesh_client.c304
-rw-r--r--src/fs/gnunet-service-fs_mesh_server.c180
-rw-r--r--src/fs/gnunet-service-fs_pr.c66
-rw-r--r--src/fs/gnunet-service-fs_pr.h4
-rw-r--r--src/fs/test_fs_download.c6
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c6
9 files changed, 312 insertions, 312 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 148ec4bb9..43a1235f6 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -1762,7 +1762,7 @@ write_download_request (struct GNUNET_BIO_WriteHandle *wh,
1762/** 1762/**
1763 * Read a download request tree. 1763 * Read a download request tree.
1764 * 1764 *
1765 * @param rh mesh to read from 1765 * @param rh cadet to read from
1766 * @return value the download request read from disk, NULL on error 1766 * @return value the download request read from disk, NULL on error
1767 */ 1767 */
1768static struct DownloadRequest * 1768static struct DownloadRequest *
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 0e38d0dc9..59786bae8 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -43,7 +43,7 @@
43#include "gnunet-service-fs_pr.h" 43#include "gnunet-service-fs_pr.h"
44#include "gnunet-service-fs_push.h" 44#include "gnunet-service-fs_push.h"
45#include "gnunet-service-fs_put.h" 45#include "gnunet-service-fs_put.h"
46#include "gnunet-service-fs_mesh.h" 46#include "gnunet-service-fs_cadet.h"
47#include "fs.h" 47#include "fs.h"
48 48
49/** 49/**
@@ -412,10 +412,10 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr,
412 { 412 {
413 case GNUNET_BLOCK_TYPE_FS_DBLOCK: 413 case GNUNET_BLOCK_TYPE_FS_DBLOCK:
414 case GNUNET_BLOCK_TYPE_FS_IBLOCK: 414 case GNUNET_BLOCK_TYPE_FS_IBLOCK:
415 /* the above block types MAY be available via 'mesh' */ 415 /* the above block types MAY be available via 'cadet' */
416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
417 "Considering mesh-based download for block\n"); 417 "Considering cadet-based download for block\n");
418 GSF_mesh_lookup_ (pr); 418 GSF_cadet_lookup_ (pr);
419 break; 419 break;
420 case GNUNET_BLOCK_TYPE_FS_UBLOCK: 420 case GNUNET_BLOCK_TYPE_FS_UBLOCK:
421 /* the above block types are in the DHT */ 421 /* the above block types are in the DHT */
@@ -475,8 +475,8 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client,
475static void 475static void
476shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 476shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
477{ 477{
478 GSF_mesh_stop_client (); 478 GSF_cadet_stop_client ();
479 GSF_mesh_stop_server (); 479 GSF_cadet_stop_server ();
480 if (NULL != GSF_core) 480 if (NULL != GSF_core)
481 { 481 {
482 GNUNET_CORE_disconnect (GSF_core); 482 GNUNET_CORE_disconnect (GSF_core);
@@ -646,8 +646,8 @@ main_init (struct GNUNET_SERVER_Handle *server,
646 GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters, 646 GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters,
647 NULL); 647 NULL);
648 datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); 648 datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE);
649 GSF_mesh_start_server (); 649 GSF_cadet_start_server ();
650 GSF_mesh_start_client (); 650 GSF_cadet_start_client ();
651 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 651 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
652 NULL); 652 NULL);
653 return GNUNET_OK; 653 return GNUNET_OK;
diff --git a/src/fs/gnunet-service-fs_mesh.h b/src/fs/gnunet-service-fs_mesh.h
index 5decb242a..ddf367668 100644
--- a/src/fs/gnunet-service-fs_mesh.h
+++ b/src/fs/gnunet-service-fs_mesh.h
@@ -19,21 +19,21 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_mesh.h 22 * @file fs/gnunet-service-fs_cadet.h
23 * @brief non-anonymous file-transfer 23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_SERVICE_FS_MESH_H 26#ifndef GNUNET_SERVICE_FS_CADET_H
27#define GNUNET_SERVICE_FS_MESH_H 27#define GNUNET_SERVICE_FS_CADET_H
28 28
29/** 29/**
30 * Handle for a request that is going out via mesh API. 30 * Handle for a request that is going out via cadet API.
31 */ 31 */
32struct GSF_MeshRequest; 32struct GSF_CadetRequest;
33 33
34 34
35/** 35/**
36 * Function called with a reply from the mesh. 36 * Function called with a reply from the cadet.
37 * 37 *
38 * @param cls closure 38 * @param cls closure
39 * @param type type of the block, ANY on error 39 * @param type type of the block, ANY on error
@@ -41,7 +41,7 @@ struct GSF_MeshRequest;
41 * @param data_size number of bytes in 'data', 0 on error 41 * @param data_size number of bytes in 'data', 0 on error
42 * @param data reply block data, NULL on error 42 * @param data reply block data, NULL on error
43 */ 43 */
44typedef void (*GSF_MeshReplyProcessor)(void *cls, 44typedef void (*GSF_CadetReplyProcessor)(void *cls,
45 enum GNUNET_BLOCK_Type type, 45 enum GNUNET_BLOCK_Type type,
46 struct GNUNET_TIME_Absolute expiration, 46 struct GNUNET_TIME_Absolute expiration,
47 size_t data_size, 47 size_t data_size,
@@ -58,11 +58,11 @@ typedef void (*GSF_MeshReplyProcessor)(void *cls,
58 * @param proc_cls closure for 'proc' 58 * @param proc_cls closure for 'proc'
59 * @return handle to cancel the operation 59 * @return handle to cancel the operation
60 */ 60 */
61struct GSF_MeshRequest * 61struct GSF_CadetRequest *
62GSF_mesh_query (const struct GNUNET_PeerIdentity *target, 62GSF_cadet_query (const struct GNUNET_PeerIdentity *target,
63 const struct GNUNET_HashCode *query, 63 const struct GNUNET_HashCode *query,
64 enum GNUNET_BLOCK_Type type, 64 enum GNUNET_BLOCK_Type type,
65 GSF_MeshReplyProcessor proc, void *proc_cls); 65 GSF_CadetReplyProcessor proc, void *proc_cls);
66 66
67 67
68/** 68/**
@@ -72,34 +72,34 @@ GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
72 * @param sr request to cancel 72 * @param sr request to cancel
73 */ 73 */
74void 74void
75GSF_mesh_query_cancel (struct GSF_MeshRequest *sr); 75GSF_cadet_query_cancel (struct GSF_CadetRequest *sr);
76 76
77 77
78/** 78/**
79 * Initialize subsystem for non-anonymous file-sharing. 79 * Initialize subsystem for non-anonymous file-sharing.
80 */ 80 */
81void 81void
82GSF_mesh_start_server (void); 82GSF_cadet_start_server (void);
83 83
84 84
85/** 85/**
86 * Shutdown subsystem for non-anonymous file-sharing. 86 * Shutdown subsystem for non-anonymous file-sharing.
87 */ 87 */
88void 88void
89GSF_mesh_stop_server (void); 89GSF_cadet_stop_server (void);
90 90
91/** 91/**
92 * Initialize subsystem for non-anonymous file-sharing. 92 * Initialize subsystem for non-anonymous file-sharing.
93 */ 93 */
94void 94void
95GSF_mesh_start_client (void); 95GSF_cadet_start_client (void);
96 96
97 97
98/** 98/**
99 * Shutdown subsystem for non-anonymous file-sharing. 99 * Shutdown subsystem for non-anonymous file-sharing.
100 */ 100 */
101void 101void
102GSF_mesh_stop_client (void); 102GSF_cadet_stop_client (void);
103 103
104 104
105GNUNET_NETWORK_STRUCT_BEGIN 105GNUNET_NETWORK_STRUCT_BEGIN
@@ -107,11 +107,11 @@ GNUNET_NETWORK_STRUCT_BEGIN
107/** 107/**
108 * Query from one peer, asking the other for CHK-data. 108 * Query from one peer, asking the other for CHK-data.
109 */ 109 */
110struct MeshQueryMessage 110struct CadetQueryMessage
111{ 111{
112 112
113 /** 113 /**
114 * Type is GNUNET_MESSAGE_TYPE_FS_MESH_QUERY. 114 * Type is GNUNET_MESSAGE_TYPE_FS_CADET_QUERY.
115 */ 115 */
116 struct GNUNET_MessageHeader header; 116 struct GNUNET_MessageHeader header;
117 117
@@ -129,13 +129,13 @@ struct MeshQueryMessage
129 129
130 130
131/** 131/**
132 * Reply to a MeshQueryMessage. 132 * Reply to a CadetQueryMessage.
133 */ 133 */
134struct MeshReplyMessage 134struct CadetReplyMessage
135{ 135{
136 136
137 /** 137 /**
138 * Type is GNUNET_MESSAGE_TYPE_FS_MESH_REPLY. 138 * Type is GNUNET_MESSAGE_TYPE_FS_CADET_REPLY.
139 */ 139 */
140 struct GNUNET_MessageHeader header; 140 struct GNUNET_MessageHeader header;
141 141
diff --git a/src/fs/gnunet-service-fs_mesh_client.c b/src/fs/gnunet-service-fs_mesh_client.c
index 95e370274..dde7aba48 100644
--- a/src/fs/gnunet-service-fs_mesh_client.c
+++ b/src/fs/gnunet-service-fs_mesh_client.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_mesh_client.c 22 * @file fs/gnunet-service-fs_cadet_client.c
23 * @brief non-anonymous file-transfer 23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
@@ -30,12 +30,12 @@
30#include "platform.h" 30#include "platform.h"
31#include "gnunet_constants.h" 31#include "gnunet_constants.h"
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_mesh_service.h" 33#include "gnunet_cadet_service.h"
34#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
35#include "gnunet_applications.h" 35#include "gnunet_applications.h"
36#include "gnunet-service-fs.h" 36#include "gnunet-service-fs.h"
37#include "gnunet-service-fs_indexing.h" 37#include "gnunet-service-fs_indexing.h"
38#include "gnunet-service-fs_mesh.h" 38#include "gnunet-service-fs_cadet.h"
39 39
40 40
41/** 41/**
@@ -45,36 +45,36 @@
45 45
46 46
47/** 47/**
48 * Handle for a mesh to another peer. 48 * Handle for a cadet to another peer.
49 */ 49 */
50struct MeshHandle; 50struct CadetHandle;
51 51
52 52
53/** 53/**
54 * Handle for a request that is going out via mesh API. 54 * Handle for a request that is going out via cadet API.
55 */ 55 */
56struct GSF_MeshRequest 56struct GSF_CadetRequest
57{ 57{
58 58
59 /** 59 /**
60 * DLL. 60 * DLL.
61 */ 61 */
62 struct GSF_MeshRequest *next; 62 struct GSF_CadetRequest *next;
63 63
64 /** 64 /**
65 * DLL. 65 * DLL.
66 */ 66 */
67 struct GSF_MeshRequest *prev; 67 struct GSF_CadetRequest *prev;
68 68
69 /** 69 /**
70 * Which mesh is this request associated with? 70 * Which cadet is this request associated with?
71 */ 71 */
72 struct MeshHandle *mh; 72 struct CadetHandle *mh;
73 73
74 /** 74 /**
75 * Function to call with the result. 75 * Function to call with the result.
76 */ 76 */
77 GSF_MeshReplyProcessor proc; 77 GSF_CadetReplyProcessor proc;
78 78
79 /** 79 /**
80 * Closure for 'proc' 80 * Closure for 'proc'
@@ -100,22 +100,22 @@ struct GSF_MeshRequest
100 100
101 101
102/** 102/**
103 * Handle for a mesh to another peer. 103 * Handle for a cadet to another peer.
104 */ 104 */
105struct MeshHandle 105struct CadetHandle
106{ 106{
107 /** 107 /**
108 * Head of DLL of pending requests on this mesh. 108 * Head of DLL of pending requests on this cadet.
109 */ 109 */
110 struct GSF_MeshRequest *pending_head; 110 struct GSF_CadetRequest *pending_head;
111 111
112 /** 112 /**
113 * Tail of DLL of pending requests on this mesh. 113 * Tail of DLL of pending requests on this cadet.
114 */ 114 */
115 struct GSF_MeshRequest *pending_tail; 115 struct GSF_CadetRequest *pending_tail;
116 116
117 /** 117 /**
118 * Map from query to `struct GSF_MeshRequest`s waiting for 118 * Map from query to `struct GSF_CadetRequest`s waiting for
119 * a reply. 119 * a reply.
120 */ 120 */
121 struct GNUNET_CONTAINER_MultiHashMap *waiting_map; 121 struct GNUNET_CONTAINER_MultiHashMap *waiting_map;
@@ -123,29 +123,29 @@ struct MeshHandle
123 /** 123 /**
124 * Channel to the other peer. 124 * Channel to the other peer.
125 */ 125 */
126 struct GNUNET_MESH_Channel *channel; 126 struct GNUNET_CADET_Channel *channel;
127 127
128 /** 128 /**
129 * Handle for active write operation, or NULL. 129 * Handle for active write operation, or NULL.
130 */ 130 */
131 struct GNUNET_MESH_TransmitHandle *wh; 131 struct GNUNET_CADET_TransmitHandle *wh;
132 132
133 /** 133 /**
134 * Which peer does this mesh go to? 134 * Which peer does this cadet go to?
135 */ 135 */
136 struct GNUNET_PeerIdentity target; 136 struct GNUNET_PeerIdentity target;
137 137
138 /** 138 /**
139 * Task to kill inactive meshs (we keep them around for 139 * Task to kill inactive cadets (we keep them around for
140 * a few seconds to give the application a chance to give 140 * a few seconds to give the application a chance to give
141 * us another query). 141 * us another query).
142 */ 142 */
143 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 143 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
144 144
145 /** 145 /**
146 * Task to reset meshs that had errors (asynchronously, 146 * Task to reset cadets that had errors (asynchronously,
147 * as we may not be able to do it immediately during a 147 * as we may not be able to do it immediately during a
148 * callback from the mesh API). 148 * callback from the cadet API).
149 */ 149 */
150 GNUNET_SCHEDULER_TaskIdentifier reset_task; 150 GNUNET_SCHEDULER_TaskIdentifier reset_task;
151 151
@@ -153,36 +153,36 @@ struct MeshHandle
153 153
154 154
155/** 155/**
156 * Mesh channel for creating outbound channels. 156 * Cadet channel for creating outbound channels.
157 */ 157 */
158static struct GNUNET_MESH_Handle *mesh_handle; 158static struct GNUNET_CADET_Handle *cadet_handle;
159 159
160/** 160/**
161 * Map from peer identities to 'struct MeshHandles' with mesh 161 * Map from peer identities to 'struct CadetHandles' with cadet
162 * channels to those peers. 162 * channels to those peers.
163 */ 163 */
164static struct GNUNET_CONTAINER_MultiPeerMap *mesh_map; 164static struct GNUNET_CONTAINER_MultiPeerMap *cadet_map;
165 165
166 166
167/* ********************* client-side code ************************* */ 167/* ********************* client-side code ************************* */
168 168
169 169
170/** 170/**
171 * Transmit pending requests via the mesh. 171 * Transmit pending requests via the cadet.
172 * 172 *
173 * @param mh mesh to process 173 * @param mh cadet to process
174 */ 174 */
175static void 175static void
176transmit_pending (struct MeshHandle *mh); 176transmit_pending (struct CadetHandle *mh);
177 177
178 178
179/** 179/**
180 * Iterator called on each entry in a waiting map to 180 * Iterator called on each entry in a waiting map to
181 * move it back to the pending list. 181 * move it back to the pending list.
182 * 182 *
183 * @param cls the `struct MeshHandle` 183 * @param cls the `struct CadetHandle`
184 * @param key the key of the entry in the map (the query) 184 * @param key the key of the entry in the map (the query)
185 * @param value the `struct GSF_MeshRequest` to move to pending 185 * @param value the `struct GSF_CadetRequest` to move to pending
186 * @return #GNUNET_YES (continue to iterate) 186 * @return #GNUNET_YES (continue to iterate)
187 */ 187 */
188static int 188static int
@@ -190,8 +190,8 @@ move_to_pending (void *cls,
190 const struct GNUNET_HashCode *key, 190 const struct GNUNET_HashCode *key,
191 void *value) 191 void *value)
192{ 192{
193 struct MeshHandle *mh = cls; 193 struct CadetHandle *mh = cls;
194 struct GSF_MeshRequest *sr = value; 194 struct GSF_CadetRequest *sr = value;
195 195
196 GNUNET_assert (GNUNET_YES == 196 GNUNET_assert (GNUNET_YES ==
197 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map, 197 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map,
@@ -206,94 +206,94 @@ move_to_pending (void *cls,
206 206
207 207
208/** 208/**
209 * We had a serious error, tear down and re-create mesh from scratch. 209 * We had a serious error, tear down and re-create cadet from scratch.
210 * 210 *
211 * @param mh mesh to reset 211 * @param mh cadet to reset
212 */ 212 */
213static void 213static void
214reset_mesh (struct MeshHandle *mh) 214reset_cadet (struct CadetHandle *mh)
215{ 215{
216 struct GNUNET_MESH_Channel *channel = mh->channel; 216 struct GNUNET_CADET_Channel *channel = mh->channel;
217 217
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
219 "Resetting mesh channel to %s\n", 219 "Resetting cadet channel to %s\n",
220 GNUNET_i2s (&mh->target)); 220 GNUNET_i2s (&mh->target));
221 mh->channel = NULL; 221 mh->channel = NULL;
222 if (NULL != channel) 222 if (NULL != channel)
223 GNUNET_MESH_channel_destroy (channel); 223 GNUNET_CADET_channel_destroy (channel);
224 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, 224 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
225 &move_to_pending, 225 &move_to_pending,
226 mh); 226 mh);
227 mh->channel = GNUNET_MESH_channel_create (mesh_handle, 227 mh->channel = GNUNET_CADET_channel_create (cadet_handle,
228 mh, 228 mh,
229 &mh->target, 229 &mh->target,
230 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, 230 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
231 GNUNET_MESH_OPTION_RELIABLE); 231 GNUNET_CADET_OPTION_RELIABLE);
232 transmit_pending (mh); 232 transmit_pending (mh);
233} 233}
234 234
235 235
236/** 236/**
237 * Task called when it is time to destroy an inactive mesh channel. 237 * Task called when it is time to destroy an inactive cadet channel.
238 * 238 *
239 * @param cls the `struct MeshHandle` to tear down 239 * @param cls the `struct CadetHandle` to tear down
240 * @param tc scheduler context, unused 240 * @param tc scheduler context, unused
241 */ 241 */
242static void 242static void
243mesh_timeout (void *cls, 243cadet_timeout (void *cls,
244 const struct GNUNET_SCHEDULER_TaskContext *tc) 244 const struct GNUNET_SCHEDULER_TaskContext *tc)
245{ 245{
246 struct MeshHandle *mh = cls; 246 struct CadetHandle *mh = cls;
247 struct GNUNET_MESH_Channel *tun; 247 struct GNUNET_CADET_Channel *tun;
248 248
249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
250 "Timeout on mesh channel to %s\n", 250 "Timeout on cadet channel to %s\n",
251 GNUNET_i2s (&mh->target)); 251 GNUNET_i2s (&mh->target));
252 mh->timeout_task = GNUNET_SCHEDULER_NO_TASK; 252 mh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
253 tun = mh->channel; 253 tun = mh->channel;
254 mh->channel = NULL; 254 mh->channel = NULL;
255 GNUNET_MESH_channel_destroy (tun); 255 GNUNET_CADET_channel_destroy (tun);
256} 256}
257 257
258 258
259/** 259/**
260 * Task called when it is time to reset an mesh. 260 * Task called when it is time to reset an cadet.
261 * 261 *
262 * @param cls the `struct MeshHandle` to tear down 262 * @param cls the `struct CadetHandle` to tear down
263 * @param tc scheduler context, unused 263 * @param tc scheduler context, unused
264 */ 264 */
265static void 265static void
266reset_mesh_task (void *cls, 266reset_cadet_task (void *cls,
267 const struct GNUNET_SCHEDULER_TaskContext *tc) 267 const struct GNUNET_SCHEDULER_TaskContext *tc)
268{ 268{
269 struct MeshHandle *mh = cls; 269 struct CadetHandle *mh = cls;
270 270
271 mh->reset_task = GNUNET_SCHEDULER_NO_TASK; 271 mh->reset_task = GNUNET_SCHEDULER_NO_TASK;
272 reset_mesh (mh); 272 reset_cadet (mh);
273} 273}
274 274
275 275
276/** 276/**
277 * We had a serious error, tear down and re-create mesh from scratch, 277 * We had a serious error, tear down and re-create cadet from scratch,
278 * but do so asynchronously. 278 * but do so asynchronously.
279 * 279 *
280 * @param mh mesh to reset 280 * @param mh cadet to reset
281 */ 281 */
282static void 282static void
283reset_mesh_async (struct MeshHandle *mh) 283reset_cadet_async (struct CadetHandle *mh)
284{ 284{
285 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task) 285 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
286 GNUNET_SCHEDULER_cancel (mh->reset_task); 286 GNUNET_SCHEDULER_cancel (mh->reset_task);
287 mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_mesh_task, 287 mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_cadet_task,
288 mh); 288 mh);
289} 289}
290 290
291 291
292/** 292/**
293 * Functions of this signature are called whenever we are ready to transmit 293 * Functions of this signature are called whenever we are ready to transmit
294 * query via a mesh. 294 * query via a cadet.
295 * 295 *
296 * @param cls the struct MeshHandle for which we did the write call 296 * @param cls the struct CadetHandle for which we did the write call
297 * @param size the number of bytes that can be written to @a buf 297 * @param size the number of bytes that can be written to @a buf
298 * @param buf where to write the message 298 * @param buf where to write the message
299 * @return number of bytes written to @a buf 299 * @return number of bytes written to @a buf
@@ -303,23 +303,23 @@ transmit_sqm (void *cls,
303 size_t size, 303 size_t size,
304 void *buf) 304 void *buf)
305{ 305{
306 struct MeshHandle *mh = cls; 306 struct CadetHandle *mh = cls;
307 struct MeshQueryMessage sqm; 307 struct CadetQueryMessage sqm;
308 struct GSF_MeshRequest *sr; 308 struct GSF_CadetRequest *sr;
309 309
310 mh->wh = NULL; 310 mh->wh = NULL;
311 if (NULL == buf) 311 if (NULL == buf)
312 { 312 {
313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
314 "Mesh channel to %s failed during transmission attempt, rebuilding\n", 314 "Cadet channel to %s failed during transmission attempt, rebuilding\n",
315 GNUNET_i2s (&mh->target)); 315 GNUNET_i2s (&mh->target));
316 reset_mesh_async (mh); 316 reset_cadet_async (mh);
317 return 0; 317 return 0;
318 } 318 }
319 sr = mh->pending_head; 319 sr = mh->pending_head;
320 if (NULL == sr) 320 if (NULL == sr)
321 return 0; 321 return 0;
322 GNUNET_assert (size >= sizeof (struct MeshQueryMessage)); 322 GNUNET_assert (size >= sizeof (struct CadetQueryMessage));
323 GNUNET_CONTAINER_DLL_remove (mh->pending_head, 323 GNUNET_CONTAINER_DLL_remove (mh->pending_head,
324 mh->pending_tail, 324 mh->pending_tail,
325 sr); 325 sr);
@@ -330,16 +330,16 @@ transmit_sqm (void *cls,
330 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 330 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
331 sr->was_transmitted = GNUNET_YES; 331 sr->was_transmitted = GNUNET_YES;
332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
333 "Sending query for %s via mesh to %s\n", 333 "Sending query for %s via cadet to %s\n",
334 GNUNET_h2s (&sr->query), 334 GNUNET_h2s (&sr->query),
335 GNUNET_i2s (&mh->target)); 335 GNUNET_i2s (&mh->target));
336 sqm.header.size = htons (sizeof (sqm)); 336 sqm.header.size = htons (sizeof (sqm));
337 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_MESH_QUERY); 337 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_QUERY);
338 sqm.type = htonl (sr->type); 338 sqm.type = htonl (sr->type);
339 sqm.query = sr->query; 339 sqm.query = sr->query;
340 memcpy (buf, &sqm, sizeof (sqm)); 340 memcpy (buf, &sqm, sizeof (sqm));
341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
342 "Successfully transmitted %u bytes via mesh to %s\n", 342 "Successfully transmitted %u bytes via cadet to %s\n",
343 (unsigned int) size, 343 (unsigned int) size,
344 GNUNET_i2s (&mh->target)); 344 GNUNET_i2s (&mh->target));
345 transmit_pending (mh); 345 transmit_pending (mh);
@@ -348,20 +348,20 @@ transmit_sqm (void *cls,
348 348
349 349
350/** 350/**
351 * Transmit pending requests via the mesh. 351 * Transmit pending requests via the cadet.
352 * 352 *
353 * @param mh mesh to process 353 * @param mh cadet to process
354 */ 354 */
355static void 355static void
356transmit_pending (struct MeshHandle *mh) 356transmit_pending (struct CadetHandle *mh)
357{ 357{
358 if (NULL == mh->channel) 358 if (NULL == mh->channel)
359 return; 359 return;
360 if (NULL != mh->wh) 360 if (NULL != mh->wh)
361 return; 361 return;
362 mh->wh = GNUNET_MESH_notify_transmit_ready (mh->channel, GNUNET_YES /* allow cork */, 362 mh->wh = GNUNET_CADET_notify_transmit_ready (mh->channel, GNUNET_YES /* allow cork */,
363 GNUNET_TIME_UNIT_FOREVER_REL, 363 GNUNET_TIME_UNIT_FOREVER_REL,
364 sizeof (struct MeshQueryMessage), 364 sizeof (struct CadetQueryMessage),
365 &transmit_sqm, mh); 365 &transmit_sqm, mh);
366} 366}
367 367
@@ -405,7 +405,7 @@ struct HandleReplyClosure
405 * 405 *
406 * @param cls the `struct HandleReplyClosure` 406 * @param cls the `struct HandleReplyClosure`
407 * @param key the key of the entry in the map (the query) 407 * @param key the key of the entry in the map (the query)
408 * @param value the `struct GSF_MeshRequest` to handle result for 408 * @param value the `struct GSF_CadetRequest` to handle result for
409 * @return #GNUNET_YES (continue to iterate) 409 * @return #GNUNET_YES (continue to iterate)
410 */ 410 */
411static int 411static int
@@ -414,7 +414,7 @@ handle_reply (void *cls,
414 void *value) 414 void *value)
415{ 415{
416 struct HandleReplyClosure *hrc = cls; 416 struct HandleReplyClosure *hrc = cls;
417 struct GSF_MeshRequest *sr = value; 417 struct GSF_CadetRequest *sr = value;
418 418
419 sr->proc (sr->proc_cls, 419 sr->proc (sr->proc_cls,
420 hrc->type, 420 hrc->type,
@@ -422,7 +422,7 @@ handle_reply (void *cls,
422 hrc->data_size, 422 hrc->data_size,
423 hrc->data); 423 hrc->data);
424 sr->proc = NULL; 424 sr->proc = NULL;
425 GSF_mesh_query_cancel (sr); 425 GSF_cadet_query_cancel (sr);
426 hrc->found = GNUNET_YES; 426 hrc->found = GNUNET_YES;
427 return GNUNET_YES; 427 return GNUNET_YES;
428} 428}
@@ -432,7 +432,7 @@ handle_reply (void *cls,
432 * Functions with this signature are called whenever a complete reply 432 * Functions with this signature are called whenever a complete reply
433 * is received. 433 * is received.
434 * 434 *
435 * @param cls closure with the `struct MeshHandle` 435 * @param cls closure with the `struct CadetHandle`
436 * @param channel channel handle 436 * @param channel channel handle
437 * @param channel_ctx channel context 437 * @param channel_ctx channel context
438 * @param message the actual message 438 * @param message the actual message
@@ -440,26 +440,26 @@ handle_reply (void *cls,
440 */ 440 */
441static int 441static int
442reply_cb (void *cls, 442reply_cb (void *cls,
443 struct GNUNET_MESH_Channel *channel, 443 struct GNUNET_CADET_Channel *channel,
444 void **channel_ctx, 444 void **channel_ctx,
445 const struct GNUNET_MessageHeader *message) 445 const struct GNUNET_MessageHeader *message)
446{ 446{
447 struct MeshHandle *mh = *channel_ctx; 447 struct CadetHandle *mh = *channel_ctx;
448 const struct MeshReplyMessage *srm; 448 const struct CadetReplyMessage *srm;
449 struct HandleReplyClosure hrc; 449 struct HandleReplyClosure hrc;
450 uint16_t msize; 450 uint16_t msize;
451 enum GNUNET_BLOCK_Type type; 451 enum GNUNET_BLOCK_Type type;
452 struct GNUNET_HashCode query; 452 struct GNUNET_HashCode query;
453 453
454 msize = ntohs (message->size); 454 msize = ntohs (message->size);
455 if (sizeof (struct MeshReplyMessage) > msize) 455 if (sizeof (struct CadetReplyMessage) > msize)
456 { 456 {
457 GNUNET_break_op (0); 457 GNUNET_break_op (0);
458 reset_mesh_async (mh); 458 reset_cadet_async (mh);
459 return GNUNET_SYSERR; 459 return GNUNET_SYSERR;
460 } 460 }
461 srm = (const struct MeshReplyMessage *) message; 461 srm = (const struct CadetReplyMessage *) message;
462 msize -= sizeof (struct MeshReplyMessage); 462 msize -= sizeof (struct CadetReplyMessage);
463 type = (enum GNUNET_BLOCK_Type) ntohl (srm->type); 463 type = (enum GNUNET_BLOCK_Type) ntohl (srm->type);
464 if (GNUNET_YES != 464 if (GNUNET_YES !=
465 GNUNET_BLOCK_get_key (GSF_block_ctx, 465 GNUNET_BLOCK_get_key (GSF_block_ctx,
@@ -468,20 +468,20 @@ reply_cb (void *cls,
468 { 468 {
469 GNUNET_break_op (0); 469 GNUNET_break_op (0);
470 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 470 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
471 "Received bogus reply of type %u with %u bytes via mesh from peer %s\n", 471 "Received bogus reply of type %u with %u bytes via cadet from peer %s\n",
472 type, 472 type,
473 msize, 473 msize,
474 GNUNET_i2s (&mh->target)); 474 GNUNET_i2s (&mh->target));
475 reset_mesh_async (mh); 475 reset_cadet_async (mh);
476 return GNUNET_SYSERR; 476 return GNUNET_SYSERR;
477 } 477 }
478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
479 "Received reply `%s' via mesh from peer %s\n", 479 "Received reply `%s' via cadet from peer %s\n",
480 GNUNET_h2s (&query), 480 GNUNET_h2s (&query),
481 GNUNET_i2s (&mh->target)); 481 GNUNET_i2s (&mh->target));
482 GNUNET_MESH_receive_done (channel); 482 GNUNET_CADET_receive_done (channel);
483 GNUNET_STATISTICS_update (GSF_stats, 483 GNUNET_STATISTICS_update (GSF_stats,
484 gettext_noop ("# replies received via mesh"), 1, 484 gettext_noop ("# replies received via cadet"), 1,
485 GNUNET_NO); 485 GNUNET_NO);
486 hrc.data = &srm[1]; 486 hrc.data = &srm[1];
487 hrc.data_size = msize; 487 hrc.data_size = msize;
@@ -495,7 +495,7 @@ reply_cb (void *cls,
495 if (GNUNET_NO == hrc.found) 495 if (GNUNET_NO == hrc.found)
496 { 496 {
497 GNUNET_STATISTICS_update (GSF_stats, 497 GNUNET_STATISTICS_update (GSF_stats,
498 gettext_noop ("# replies received via mesh dropped"), 1, 498 gettext_noop ("# replies received via cadet dropped"), 1,
499 GNUNET_NO); 499 GNUNET_NO);
500 return GNUNET_OK; 500 return GNUNET_OK;
501 } 501 }
@@ -504,16 +504,16 @@ reply_cb (void *cls,
504 504
505 505
506/** 506/**
507 * Get (or create) a mesh to talk to the given peer. 507 * Get (or create) a cadet to talk to the given peer.
508 * 508 *
509 * @param target peer we want to communicate with 509 * @param target peer we want to communicate with
510 */ 510 */
511static struct MeshHandle * 511static struct CadetHandle *
512get_mesh (const struct GNUNET_PeerIdentity *target) 512get_cadet (const struct GNUNET_PeerIdentity *target)
513{ 513{
514 struct MeshHandle *mh; 514 struct CadetHandle *mh;
515 515
516 mh = GNUNET_CONTAINER_multipeermap_get (mesh_map, 516 mh = GNUNET_CONTAINER_multipeermap_get (cadet_map,
517 target); 517 target);
518 if (NULL != mh) 518 if (NULL != mh)
519 { 519 {
@@ -525,26 +525,26 @@ get_mesh (const struct GNUNET_PeerIdentity *target)
525 return mh; 525 return mh;
526 } 526 }
527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
528 "Creating mesh channel to %s\n", 528 "Creating cadet channel to %s\n",
529 GNUNET_i2s (target)); 529 GNUNET_i2s (target));
530 mh = GNUNET_new (struct MeshHandle); 530 mh = GNUNET_new (struct CadetHandle);
531 mh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT, 531 mh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT,
532 &reset_mesh_task, 532 &reset_cadet_task,
533 mh); 533 mh);
534 mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); 534 mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
535 mh->target = *target; 535 mh->target = *target;
536 GNUNET_assert (GNUNET_OK == 536 GNUNET_assert (GNUNET_OK ==
537 GNUNET_CONTAINER_multipeermap_put (mesh_map, 537 GNUNET_CONTAINER_multipeermap_put (cadet_map,
538 &mh->target, 538 &mh->target,
539 mh, 539 mh,
540 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 540 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
541 mh->channel = GNUNET_MESH_channel_create (mesh_handle, 541 mh->channel = GNUNET_CADET_channel_create (cadet_handle,
542 mh, 542 mh,
543 &mh->target, 543 &mh->target,
544 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, 544 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
545 GNUNET_MESH_OPTION_RELIABLE); 545 GNUNET_CADET_OPTION_RELIABLE);
546 GNUNET_assert (mh == 546 GNUNET_assert (mh ==
547 GNUNET_CONTAINER_multipeermap_get (mesh_map, 547 GNUNET_CONTAINER_multipeermap_get (cadet_map,
548 target)); 548 target));
549 return mh; 549 return mh;
550} 550}
@@ -560,21 +560,21 @@ get_mesh (const struct GNUNET_PeerIdentity *target)
560 * @param proc_cls closure for @a proc 560 * @param proc_cls closure for @a proc
561 * @return handle to cancel the operation 561 * @return handle to cancel the operation
562 */ 562 */
563struct GSF_MeshRequest * 563struct GSF_CadetRequest *
564GSF_mesh_query (const struct GNUNET_PeerIdentity *target, 564GSF_cadet_query (const struct GNUNET_PeerIdentity *target,
565 const struct GNUNET_HashCode *query, 565 const struct GNUNET_HashCode *query,
566 enum GNUNET_BLOCK_Type type, 566 enum GNUNET_BLOCK_Type type,
567 GSF_MeshReplyProcessor proc, void *proc_cls) 567 GSF_CadetReplyProcessor proc, void *proc_cls)
568{ 568{
569 struct MeshHandle *mh; 569 struct CadetHandle *mh;
570 struct GSF_MeshRequest *sr; 570 struct GSF_CadetRequest *sr;
571 571
572 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 572 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
573 "Preparing to send query for %s via mesh to %s\n", 573 "Preparing to send query for %s via cadet to %s\n",
574 GNUNET_h2s (query), 574 GNUNET_h2s (query),
575 GNUNET_i2s (target)); 575 GNUNET_i2s (target));
576 mh = get_mesh (target); 576 mh = get_cadet (target);
577 sr = GNUNET_new (struct GSF_MeshRequest); 577 sr = GNUNET_new (struct GSF_CadetRequest);
578 sr->mh = mh; 578 sr->mh = mh;
579 sr->proc = proc; 579 sr->proc = proc;
580 sr->proc_cls = proc_cls; 580 sr->proc_cls = proc_cls;
@@ -595,10 +595,10 @@ GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
595 * @param sr request to cancel 595 * @param sr request to cancel
596 */ 596 */
597void 597void
598GSF_mesh_query_cancel (struct GSF_MeshRequest *sr) 598GSF_cadet_query_cancel (struct GSF_CadetRequest *sr)
599{ 599{
600 struct MeshHandle *mh = sr->mh; 600 struct CadetHandle *mh = sr->mh;
601 GSF_MeshReplyProcessor p; 601 GSF_CadetReplyProcessor p;
602 602
603 p = sr->proc; 603 p = sr->proc;
604 sr->proc = NULL; 604 sr->proc = NULL;
@@ -610,7 +610,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
610 0, NULL); 610 0, NULL);
611 } 611 }
612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
613 "Cancelled query for %s via mesh to %s\n", 613 "Cancelled query for %s via cadet to %s\n",
614 GNUNET_h2s (&sr->query), 614 GNUNET_h2s (&sr->query),
615 GNUNET_i2s (&sr->mh->target)); 615 GNUNET_i2s (&sr->mh->target));
616 if (GNUNET_YES == sr->was_transmitted) 616 if (GNUNET_YES == sr->was_transmitted)
@@ -626,7 +626,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
626 if ( (0 == GNUNET_CONTAINER_multihashmap_size (mh->waiting_map)) && 626 if ( (0 == GNUNET_CONTAINER_multihashmap_size (mh->waiting_map)) &&
627 (NULL == mh->pending_head) ) 627 (NULL == mh->pending_head) )
628 mh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 628 mh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
629 &mesh_timeout, 629 &cadet_timeout,
630 mh); 630 mh);
631} 631}
632 632
@@ -636,9 +636,9 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
636 * call the 'proc' continuation and release associated 636 * call the 'proc' continuation and release associated
637 * resources. 637 * resources.
638 * 638 *
639 * @param cls the `struct MeshHandle` 639 * @param cls the `struct CadetHandle`
640 * @param key the key of the entry in the map (the query) 640 * @param key the key of the entry in the map (the query)
641 * @param value the `struct GSF_MeshRequest` to clean up 641 * @param value the `struct GSF_CadetRequest` to clean up
642 * @return #GNUNET_YES (continue to iterate) 642 * @return #GNUNET_YES (continue to iterate)
643 */ 643 */
644static int 644static int
@@ -646,48 +646,48 @@ free_waiting_entry (void *cls,
646 const struct GNUNET_HashCode *key, 646 const struct GNUNET_HashCode *key,
647 void *value) 647 void *value)
648{ 648{
649 struct GSF_MeshRequest *sr = value; 649 struct GSF_CadetRequest *sr = value;
650 650
651 GSF_mesh_query_cancel (sr); 651 GSF_cadet_query_cancel (sr);
652 return GNUNET_YES; 652 return GNUNET_YES;
653} 653}
654 654
655 655
656/** 656/**
657 * Function called by mesh when a client disconnects. 657 * Function called by cadet when a client disconnects.
658 * Cleans up our `struct MeshClient` of that channel. 658 * Cleans up our `struct CadetClient` of that channel.
659 * 659 *
660 * @param cls NULL 660 * @param cls NULL
661 * @param channel channel of the disconnecting client 661 * @param channel channel of the disconnecting client
662 * @param channel_ctx our `struct MeshClient` 662 * @param channel_ctx our `struct CadetClient`
663 */ 663 */
664static void 664static void
665cleaner_cb (void *cls, 665cleaner_cb (void *cls,
666 const struct GNUNET_MESH_Channel *channel, 666 const struct GNUNET_CADET_Channel *channel,
667 void *channel_ctx) 667 void *channel_ctx)
668{ 668{
669 struct MeshHandle *mh = channel_ctx; 669 struct CadetHandle *mh = channel_ctx;
670 struct GSF_MeshRequest *sr; 670 struct GSF_CadetRequest *sr;
671 671
672 if (NULL == mh->channel) 672 if (NULL == mh->channel)
673 return; /* being destroyed elsewhere */ 673 return; /* being destroyed elsewhere */
674 GNUNET_assert (channel == mh->channel); 674 GNUNET_assert (channel == mh->channel);
675 mh->channel = NULL; 675 mh->channel = NULL;
676 while (NULL != (sr = mh->pending_head)) 676 while (NULL != (sr = mh->pending_head))
677 GSF_mesh_query_cancel (sr); 677 GSF_cadet_query_cancel (sr);
678 /* first remove `mh` from the `mesh_map`, so that if the 678 /* first remove `mh` from the `cadet_map`, so that if the
679 callback from `free_waiting_entry()` happens to re-issue 679 callback from `free_waiting_entry()` happens to re-issue
680 the request, we don't immediately have it back in the 680 the request, we don't immediately have it back in the
681 `waiting_map`. */ 681 `waiting_map`. */
682 GNUNET_assert (GNUNET_OK == 682 GNUNET_assert (GNUNET_OK ==
683 GNUNET_CONTAINER_multipeermap_remove (mesh_map, 683 GNUNET_CONTAINER_multipeermap_remove (cadet_map,
684 &mh->target, 684 &mh->target,
685 mh)); 685 mh));
686 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, 686 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
687 &free_waiting_entry, 687 &free_waiting_entry,
688 mh); 688 mh);
689 if (NULL != mh->wh) 689 if (NULL != mh->wh)
690 GNUNET_MESH_notify_transmit_ready_cancel (mh->wh); 690 GNUNET_CADET_notify_transmit_ready_cancel (mh->wh);
691 if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task) 691 if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task)
692 GNUNET_SCHEDULER_cancel (mh->timeout_task); 692 GNUNET_SCHEDULER_cancel (mh->timeout_task);
693 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task) 693 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
@@ -703,15 +703,15 @@ cleaner_cb (void *cls,
703 * Initialize subsystem for non-anonymous file-sharing. 703 * Initialize subsystem for non-anonymous file-sharing.
704 */ 704 */
705void 705void
706GSF_mesh_start_client () 706GSF_cadet_start_client ()
707{ 707{
708 static const struct GNUNET_MESH_MessageHandler handlers[] = { 708 static const struct GNUNET_CADET_MessageHandler handlers[] = {
709 { &reply_cb, GNUNET_MESSAGE_TYPE_FS_MESH_REPLY, 0 }, 709 { &reply_cb, GNUNET_MESSAGE_TYPE_FS_CADET_REPLY, 0 },
710 { NULL, 0, 0 } 710 { NULL, 0, 0 }
711 }; 711 };
712 712
713 mesh_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); 713 cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
714 mesh_handle = GNUNET_MESH_connect (GSF_cfg, 714 cadet_handle = GNUNET_CADET_connect (GSF_cfg,
715 NULL, 715 NULL,
716 NULL, 716 NULL,
717 &cleaner_cb, 717 &cleaner_cb,
@@ -721,25 +721,25 @@ GSF_mesh_start_client ()
721 721
722 722
723/** 723/**
724 * Function called on each active meshs to shut them down. 724 * Function called on each active cadets to shut them down.
725 * 725 *
726 * @param cls NULL 726 * @param cls NULL
727 * @param key target peer, unused 727 * @param key target peer, unused
728 * @param value the `struct MeshHandle` to destroy 728 * @param value the `struct CadetHandle` to destroy
729 * @return #GNUNET_YES (continue to iterate) 729 * @return #GNUNET_YES (continue to iterate)
730 */ 730 */
731static int 731static int
732release_meshs (void *cls, 732release_cadets (void *cls,
733 const struct GNUNET_PeerIdentity *key, 733 const struct GNUNET_PeerIdentity *key,
734 void *value) 734 void *value)
735{ 735{
736 struct MeshHandle *mh = value; 736 struct CadetHandle *mh = value;
737 737
738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
739 "Timeout on mesh channel to %s\n", 739 "Timeout on cadet channel to %s\n",
740 GNUNET_i2s (&mh->target)); 740 GNUNET_i2s (&mh->target));
741 if (NULL != mh->channel) 741 if (NULL != mh->channel)
742 GNUNET_MESH_channel_destroy (mh->channel); 742 GNUNET_CADET_channel_destroy (mh->channel);
743 return GNUNET_YES; 743 return GNUNET_YES;
744} 744}
745 745
@@ -748,19 +748,19 @@ release_meshs (void *cls,
748 * Shutdown subsystem for non-anonymous file-sharing. 748 * Shutdown subsystem for non-anonymous file-sharing.
749 */ 749 */
750void 750void
751GSF_mesh_stop_client () 751GSF_cadet_stop_client ()
752{ 752{
753 GNUNET_CONTAINER_multipeermap_iterate (mesh_map, 753 GNUNET_CONTAINER_multipeermap_iterate (cadet_map,
754 &release_meshs, 754 &release_cadets,
755 NULL); 755 NULL);
756 GNUNET_CONTAINER_multipeermap_destroy (mesh_map); 756 GNUNET_CONTAINER_multipeermap_destroy (cadet_map);
757 mesh_map = NULL; 757 cadet_map = NULL;
758 if (NULL != mesh_handle) 758 if (NULL != cadet_handle)
759 { 759 {
760 GNUNET_MESH_disconnect (mesh_handle); 760 GNUNET_CADET_disconnect (cadet_handle);
761 mesh_handle = NULL; 761 cadet_handle = NULL;
762 } 762 }
763} 763}
764 764
765 765
766/* end of gnunet-service-fs_mesh_client.c */ 766/* end of gnunet-service-fs_cadet_client.c */
diff --git a/src/fs/gnunet-service-fs_mesh_server.c b/src/fs/gnunet-service-fs_mesh_server.c
index e157c40e6..77add757d 100644
--- a/src/fs/gnunet-service-fs_mesh_server.c
+++ b/src/fs/gnunet-service-fs_mesh_server.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_mesh_server.c 22 * @file fs/gnunet-service-fs_cadet_server.c
23 * @brief non-anonymous file-transfer 23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
@@ -30,12 +30,12 @@
30#include "platform.h" 30#include "platform.h"
31#include "gnunet_constants.h" 31#include "gnunet_constants.h"
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_mesh_service.h" 33#include "gnunet_cadet_service.h"
34#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
35#include "gnunet_applications.h" 35#include "gnunet_applications.h"
36#include "gnunet-service-fs.h" 36#include "gnunet-service-fs.h"
37#include "gnunet-service-fs_indexing.h" 37#include "gnunet-service-fs_indexing.h"
38#include "gnunet-service-fs_mesh.h" 38#include "gnunet-service-fs_cadet.h"
39 39
40/** 40/**
41 * After how long do we termiante idle connections? 41 * After how long do we termiante idle connections?
@@ -44,7 +44,7 @@
44 44
45 45
46/** 46/**
47 * A message in the queue to be written to the mesh. 47 * A message in the queue to be written to the cadet.
48 */ 48 */
49struct WriteQueueItem 49struct WriteQueueItem
50{ 50{
@@ -66,29 +66,29 @@ struct WriteQueueItem
66 66
67 67
68/** 68/**
69 * Information we keep around for each active meshing client. 69 * Information we keep around for each active cadeting client.
70 */ 70 */
71struct MeshClient 71struct CadetClient
72{ 72{
73 /** 73 /**
74 * DLL 74 * DLL
75 */ 75 */
76 struct MeshClient *next; 76 struct CadetClient *next;
77 77
78 /** 78 /**
79 * DLL 79 * DLL
80 */ 80 */
81 struct MeshClient *prev; 81 struct CadetClient *prev;
82 82
83 /** 83 /**
84 * Channel for communication. 84 * Channel for communication.
85 */ 85 */
86 struct GNUNET_MESH_Channel *channel; 86 struct GNUNET_CADET_Channel *channel;
87 87
88 /** 88 /**
89 * Handle for active write operation, or NULL. 89 * Handle for active write operation, or NULL.
90 */ 90 */
91 struct GNUNET_MESH_TransmitHandle *wh; 91 struct GNUNET_CADET_TransmitHandle *wh;
92 92
93 /** 93 /**
94 * Head of write queue. 94 * Head of write queue.
@@ -126,65 +126,65 @@ struct MeshClient
126/** 126/**
127 * Listen channel for incoming requests. 127 * Listen channel for incoming requests.
128 */ 128 */
129static struct GNUNET_MESH_Handle *listen_channel; 129static struct GNUNET_CADET_Handle *listen_channel;
130 130
131/** 131/**
132 * Head of DLL of mesh clients. 132 * Head of DLL of cadet clients.
133 */ 133 */
134static struct MeshClient *sc_head; 134static struct CadetClient *sc_head;
135 135
136/** 136/**
137 * Tail of DLL of mesh clients. 137 * Tail of DLL of cadet clients.
138 */ 138 */
139static struct MeshClient *sc_tail; 139static struct CadetClient *sc_tail;
140 140
141/** 141/**
142 * Number of active mesh clients in the 'sc_*'-DLL. 142 * Number of active cadet clients in the 'sc_*'-DLL.
143 */ 143 */
144static unsigned int sc_count; 144static unsigned int sc_count;
145 145
146/** 146/**
147 * Maximum allowed number of mesh clients. 147 * Maximum allowed number of cadet clients.
148 */ 148 */
149static unsigned long long sc_count_max; 149static unsigned long long sc_count_max;
150 150
151 151
152 152
153/** 153/**
154 * Task run to asynchronously terminate the mesh due to timeout. 154 * Task run to asynchronously terminate the cadet due to timeout.
155 * 155 *
156 * @param cls the 'struct MeshClient' 156 * @param cls the 'struct CadetClient'
157 * @param tc scheduler context 157 * @param tc scheduler context
158 */ 158 */
159static void 159static void
160timeout_mesh_task (void *cls, 160timeout_cadet_task (void *cls,
161 const struct GNUNET_SCHEDULER_TaskContext *tc) 161 const struct GNUNET_SCHEDULER_TaskContext *tc)
162{ 162{
163 struct MeshClient *sc = cls; 163 struct CadetClient *sc = cls;
164 struct GNUNET_MESH_Channel *tun; 164 struct GNUNET_CADET_Channel *tun;
165 165
166 sc->timeout_task = GNUNET_SCHEDULER_NO_TASK; 166 sc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
167 tun = sc->channel; 167 tun = sc->channel;
168 sc->channel = NULL; 168 sc->channel = NULL;
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
170 "Timeout for inactive mesh client %p\n", 170 "Timeout for inactive cadet client %p\n",
171 sc); 171 sc);
172 GNUNET_MESH_channel_destroy (tun); 172 GNUNET_CADET_channel_destroy (tun);
173} 173}
174 174
175 175
176/** 176/**
177 * Reset the timeout for the mesh client (due to activity). 177 * Reset the timeout for the cadet client (due to activity).
178 * 178 *
179 * @param sc client handle to reset timeout for 179 * @param sc client handle to reset timeout for
180 */ 180 */
181static void 181static void
182refresh_timeout_task (struct MeshClient *sc) 182refresh_timeout_task (struct CadetClient *sc)
183{ 183{
184 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) 184 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
185 GNUNET_SCHEDULER_cancel (sc->timeout_task); 185 GNUNET_SCHEDULER_cancel (sc->timeout_task);
186 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, 186 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT,
187 &timeout_mesh_task, 187 &timeout_cadet_task,
188 sc); 188 sc);
189} 189}
190 190
@@ -195,13 +195,13 @@ refresh_timeout_task (struct MeshClient *sc)
195 * @param sc client to continue reading requests from 195 * @param sc client to continue reading requests from
196 */ 196 */
197static void 197static void
198continue_reading (struct MeshClient *sc) 198continue_reading (struct CadetClient *sc)
199{ 199{
200 refresh_timeout_task (sc); 200 refresh_timeout_task (sc);
201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
202 "Finished processing mesh request from client %p, ready to receive the next one\n", 202 "Finished processing cadet request from client %p, ready to receive the next one\n",
203 sc); 203 sc);
204 GNUNET_MESH_receive_done (sc->channel); 204 GNUNET_CADET_receive_done (sc->channel);
205} 205}
206 206
207 207
@@ -211,13 +211,13 @@ continue_reading (struct MeshClient *sc)
211 * @param sc where to process the write queue 211 * @param sc where to process the write queue
212 */ 212 */
213static void 213static void
214continue_writing (struct MeshClient *sc); 214continue_writing (struct CadetClient *sc);
215 215
216 216
217/** 217/**
218 * Send a reply now, mesh is ready. 218 * Send a reply now, cadet is ready.
219 * 219 *
220 * @param cls closure with the `struct MeshClient` which sent the query 220 * @param cls closure with the `struct CadetClient` which sent the query
221 * @param size number of bytes available in @a buf 221 * @param size number of bytes available in @a buf
222 * @param buf where to write the message 222 * @param buf where to write the message
223 * @return number of bytes written to @a buf 223 * @return number of bytes written to @a buf
@@ -227,8 +227,8 @@ write_continuation (void *cls,
227 size_t size, 227 size_t size,
228 void *buf) 228 void *buf)
229{ 229{
230 struct MeshClient *sc = cls; 230 struct CadetClient *sc = cls;
231 struct GNUNET_MESH_Channel *tun; 231 struct GNUNET_CADET_Channel *tun;
232 struct WriteQueueItem *wqi; 232 struct WriteQueueItem *wqi;
233 size_t ret; 233 size_t ret;
234 234
@@ -243,21 +243,21 @@ write_continuation (void *cls,
243 (size < wqi->msize) ) 243 (size < wqi->msize) )
244 { 244 {
245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
246 "Transmission of reply failed, terminating mesh\n"); 246 "Transmission of reply failed, terminating cadet\n");
247 tun = sc->channel; 247 tun = sc->channel;
248 sc->channel = NULL; 248 sc->channel = NULL;
249 GNUNET_MESH_channel_destroy (tun); 249 GNUNET_CADET_channel_destroy (tun);
250 return 0; 250 return 0;
251 } 251 }
252 GNUNET_CONTAINER_DLL_remove (sc->wqi_head, 252 GNUNET_CONTAINER_DLL_remove (sc->wqi_head,
253 sc->wqi_tail, 253 sc->wqi_tail,
254 wqi); 254 wqi);
255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
256 "Transmitted %u byte reply via mesh to %p\n", 256 "Transmitted %u byte reply via cadet to %p\n",
257 (unsigned int) size, 257 (unsigned int) size,
258 sc); 258 sc);
259 GNUNET_STATISTICS_update (GSF_stats, 259 GNUNET_STATISTICS_update (GSF_stats,
260 gettext_noop ("# Blocks transferred via mesh"), 1, 260 gettext_noop ("# Blocks transferred via cadet"), 1,
261 GNUNET_NO); 261 GNUNET_NO);
262 memcpy (buf, &wqi[1], ret = wqi->msize); 262 memcpy (buf, &wqi[1], ret = wqi->msize);
263 GNUNET_free (wqi); 263 GNUNET_free (wqi);
@@ -272,10 +272,10 @@ write_continuation (void *cls,
272 * @param sc where to process the write queue 272 * @param sc where to process the write queue
273 */ 273 */
274static void 274static void
275continue_writing (struct MeshClient *sc) 275continue_writing (struct CadetClient *sc)
276{ 276{
277 struct WriteQueueItem *wqi; 277 struct WriteQueueItem *wqi;
278 struct GNUNET_MESH_Channel *tun; 278 struct GNUNET_CADET_Channel *tun;
279 279
280 if (NULL != sc->wh) 280 if (NULL != sc->wh)
281 { 281 {
@@ -290,7 +290,7 @@ continue_writing (struct MeshClient *sc)
290 continue_reading (sc); 290 continue_reading (sc);
291 return; 291 return;
292 } 292 }
293 sc->wh = GNUNET_MESH_notify_transmit_ready (sc->channel, GNUNET_NO, 293 sc->wh = GNUNET_CADET_notify_transmit_ready (sc->channel, GNUNET_NO,
294 GNUNET_TIME_UNIT_FOREVER_REL, 294 GNUNET_TIME_UNIT_FOREVER_REL,
295 wqi->msize, 295 wqi->msize,
296 &write_continuation, 296 &write_continuation,
@@ -298,10 +298,10 @@ continue_writing (struct MeshClient *sc)
298 if (NULL == sc->wh) 298 if (NULL == sc->wh)
299 { 299 {
300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
301 "Write failed; terminating mesh\n"); 301 "Write failed; terminating cadet\n");
302 tun = sc->channel; 302 tun = sc->channel;
303 sc->channel = NULL; 303 sc->channel = NULL;
304 GNUNET_MESH_channel_destroy (tun); 304 GNUNET_CADET_channel_destroy (tun);
305 return; 305 return;
306 } 306 }
307} 307}
@@ -310,7 +310,7 @@ continue_writing (struct MeshClient *sc)
310/** 310/**
311 * Process a datum that was stored in the datastore. 311 * Process a datum that was stored in the datastore.
312 * 312 *
313 * @param cls closure with the `struct MeshClient` which sent the query 313 * @param cls closure with the `struct CadetClient` which sent the query
314 * @param key key for the content 314 * @param key key for the content
315 * @param size number of bytes in @a data 315 * @param size number of bytes in @a data
316 * @param data content stored 316 * @param data content stored
@@ -331,10 +331,10 @@ handle_datastore_reply (void *cls,
331 struct GNUNET_TIME_Absolute expiration, 331 struct GNUNET_TIME_Absolute expiration,
332 uint64_t uid) 332 uint64_t uid)
333{ 333{
334 struct MeshClient *sc = cls; 334 struct CadetClient *sc = cls;
335 size_t msize = size + sizeof (struct MeshReplyMessage); 335 size_t msize = size + sizeof (struct CadetReplyMessage);
336 struct WriteQueueItem *wqi; 336 struct WriteQueueItem *wqi;
337 struct MeshReplyMessage *srm; 337 struct CadetReplyMessage *srm;
338 338
339 sc->qe = NULL; 339 sc->qe = NULL;
340 if (NULL == data) 340 if (NULL == data)
@@ -349,7 +349,7 @@ handle_datastore_reply (void *cls,
349 "Have no answer for query `%s'\n", 349 "Have no answer for query `%s'\n",
350 GNUNET_h2s (key)); 350 GNUNET_h2s (key));
351 GNUNET_STATISTICS_update (GSF_stats, 351 GNUNET_STATISTICS_update (GSF_stats,
352 gettext_noop ("# queries received via mesh not answered"), 1, 352 gettext_noop ("# queries received via cadet not answered"), 1,
353 GNUNET_NO); 353 GNUNET_NO);
354 continue_writing (sc); 354 continue_writing (sc);
355 return; 355 return;
@@ -381,16 +381,16 @@ handle_datastore_reply (void *cls,
381 } 381 }
382 GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type); 382 GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type);
383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
384 "Starting transmission of %u byte reply of type %d for query `%s' via mesh to %p\n", 384 "Starting transmission of %u byte reply of type %d for query `%s' via cadet to %p\n",
385 (unsigned int) size, 385 (unsigned int) size,
386 (unsigned int) type, 386 (unsigned int) type,
387 GNUNET_h2s (key), 387 GNUNET_h2s (key),
388 sc); 388 sc);
389 wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize); 389 wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize);
390 wqi->msize = msize; 390 wqi->msize = msize;
391 srm = (struct MeshReplyMessage *) &wqi[1]; 391 srm = (struct CadetReplyMessage *) &wqi[1];
392 srm->header.size = htons ((uint16_t) msize); 392 srm->header.size = htons ((uint16_t) msize);
393 srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_MESH_REPLY); 393 srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_REPLY);
394 srm->type = htonl (type); 394 srm->type = htonl (type);
395 srm->expiration = GNUNET_TIME_absolute_hton (expiration); 395 srm->expiration = GNUNET_TIME_absolute_hton (expiration);
396 memcpy (&srm[1], data, size); 396 memcpy (&srm[1], data, size);
@@ -408,7 +408,7 @@ handle_datastore_reply (void *cls,
408 * 408 *
409 * Do not call #GNUNET_SERVER_mst_destroy in callback 409 * Do not call #GNUNET_SERVER_mst_destroy in callback
410 * 410 *
411 * @param cls closure with the 'struct MeshClient' 411 * @param cls closure with the 'struct CadetClient'
412 * @param channel channel handle 412 * @param channel channel handle
413 * @param channel_ctx channel context 413 * @param channel_ctx channel context
414 * @param message the actual message 414 * @param message the actual message
@@ -416,20 +416,20 @@ handle_datastore_reply (void *cls,
416 */ 416 */
417static int 417static int
418request_cb (void *cls, 418request_cb (void *cls,
419 struct GNUNET_MESH_Channel *channel, 419 struct GNUNET_CADET_Channel *channel,
420 void **channel_ctx, 420 void **channel_ctx,
421 const struct GNUNET_MessageHeader *message) 421 const struct GNUNET_MessageHeader *message)
422{ 422{
423 struct MeshClient *sc = *channel_ctx; 423 struct CadetClient *sc = *channel_ctx;
424 const struct MeshQueryMessage *sqm; 424 const struct CadetQueryMessage *sqm;
425 425
426 sqm = (const struct MeshQueryMessage *) message; 426 sqm = (const struct CadetQueryMessage *) message;
427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
428 "Received query for `%s' via mesh from client %p\n", 428 "Received query for `%s' via cadet from client %p\n",
429 GNUNET_h2s (&sqm->query), 429 GNUNET_h2s (&sqm->query),
430 sc); 430 sc);
431 GNUNET_STATISTICS_update (GSF_stats, 431 GNUNET_STATISTICS_update (GSF_stats,
432 gettext_noop ("# queries received via mesh"), 1, 432 gettext_noop ("# queries received via cadet"), 1,
433 GNUNET_NO); 433 GNUNET_NO);
434 refresh_timeout_task (sc); 434 refresh_timeout_task (sc);
435 sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh, 435 sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh,
@@ -451,37 +451,37 @@ request_cb (void *cls,
451 451
452 452
453/** 453/**
454 * Functions of this type are called upon new mesh connection from other peers. 454 * Functions of this type are called upon new cadet connection from other peers.
455 * 455 *
456 * @param cls the closure from GNUNET_MESH_connect 456 * @param cls the closure from GNUNET_CADET_connect
457 * @param channel the channel representing the mesh 457 * @param channel the channel representing the cadet
458 * @param initiator the identity of the peer who wants to establish a mesh 458 * @param initiator the identity of the peer who wants to establish a cadet
459 * with us; NULL on binding error 459 * with us; NULL on binding error
460 * @param port mesh port used for the incoming connection 460 * @param port cadet port used for the incoming connection
461 * @param options channel option flags 461 * @param options channel option flags
462 * @return initial channel context (our 'struct MeshClient') 462 * @return initial channel context (our 'struct CadetClient')
463 */ 463 */
464static void * 464static void *
465accept_cb (void *cls, 465accept_cb (void *cls,
466 struct GNUNET_MESH_Channel *channel, 466 struct GNUNET_CADET_Channel *channel,
467 const struct GNUNET_PeerIdentity *initiator, 467 const struct GNUNET_PeerIdentity *initiator,
468 uint32_t port, enum GNUNET_MESH_ChannelOption options) 468 uint32_t port, enum GNUNET_CADET_ChannelOption options)
469{ 469{
470 struct MeshClient *sc; 470 struct CadetClient *sc;
471 471
472 GNUNET_assert (NULL != channel); 472 GNUNET_assert (NULL != channel);
473 if (sc_count >= sc_count_max) 473 if (sc_count >= sc_count_max)
474 { 474 {
475 GNUNET_STATISTICS_update (GSF_stats, 475 GNUNET_STATISTICS_update (GSF_stats,
476 gettext_noop ("# mesh client connections rejected"), 1, 476 gettext_noop ("# cadet client connections rejected"), 1,
477 GNUNET_NO); 477 GNUNET_NO);
478 GNUNET_MESH_channel_destroy (channel); 478 GNUNET_CADET_channel_destroy (channel);
479 return NULL; 479 return NULL;
480 } 480 }
481 GNUNET_STATISTICS_update (GSF_stats, 481 GNUNET_STATISTICS_update (GSF_stats,
482 gettext_noop ("# mesh connections active"), 1, 482 gettext_noop ("# cadet connections active"), 1,
483 GNUNET_NO); 483 GNUNET_NO);
484 sc = GNUNET_new (struct MeshClient); 484 sc = GNUNET_new (struct CadetClient);
485 sc->channel = channel; 485 sc->channel = channel;
486 GNUNET_CONTAINER_DLL_insert (sc_head, 486 GNUNET_CONTAINER_DLL_insert (sc_head,
487 sc_tail, 487 sc_tail,
@@ -489,7 +489,7 @@ accept_cb (void *cls,
489 sc_count++; 489 sc_count++;
490 refresh_timeout_task (sc); 490 refresh_timeout_task (sc);
491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
492 "Accepting inbound mesh connection from `%s' as client %p\n", 492 "Accepting inbound cadet connection from `%s' as client %p\n",
493 GNUNET_i2s (initiator), 493 GNUNET_i2s (initiator),
494 sc); 494 sc);
495 return sc; 495 return sc;
@@ -497,36 +497,36 @@ accept_cb (void *cls,
497 497
498 498
499/** 499/**
500 * Function called by mesh when a client disconnects. 500 * Function called by cadet when a client disconnects.
501 * Cleans up our 'struct MeshClient' of that channel. 501 * Cleans up our 'struct CadetClient' of that channel.
502 * 502 *
503 * @param cls NULL 503 * @param cls NULL
504 * @param channel channel of the disconnecting client 504 * @param channel channel of the disconnecting client
505 * @param channel_ctx our 'struct MeshClient' 505 * @param channel_ctx our 'struct CadetClient'
506 */ 506 */
507static void 507static void
508cleaner_cb (void *cls, 508cleaner_cb (void *cls,
509 const struct GNUNET_MESH_Channel *channel, 509 const struct GNUNET_CADET_Channel *channel,
510 void *channel_ctx) 510 void *channel_ctx)
511{ 511{
512 struct MeshClient *sc = channel_ctx; 512 struct CadetClient *sc = channel_ctx;
513 struct WriteQueueItem *wqi; 513 struct WriteQueueItem *wqi;
514 514
515 if (NULL == sc) 515 if (NULL == sc)
516 return; 516 return;
517 sc->channel = NULL; 517 sc->channel = NULL;
518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
519 "Terminating mesh connection with client %p\n", 519 "Terminating cadet connection with client %p\n",
520 sc); 520 sc);
521 GNUNET_STATISTICS_update (GSF_stats, 521 GNUNET_STATISTICS_update (GSF_stats,
522 gettext_noop ("# mesh connections active"), -1, 522 gettext_noop ("# cadet connections active"), -1,
523 GNUNET_NO); 523 GNUNET_NO);
524 if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) 524 if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task)
525 GNUNET_SCHEDULER_cancel (sc->terminate_task); 525 GNUNET_SCHEDULER_cancel (sc->terminate_task);
526 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) 526 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
527 GNUNET_SCHEDULER_cancel (sc->timeout_task); 527 GNUNET_SCHEDULER_cancel (sc->timeout_task);
528 if (NULL != sc->wh) 528 if (NULL != sc->wh)
529 GNUNET_MESH_notify_transmit_ready_cancel (sc->wh); 529 GNUNET_CADET_notify_transmit_ready_cancel (sc->wh);
530 if (NULL != sc->qe) 530 if (NULL != sc->qe)
531 GNUNET_DATASTORE_cancel (sc->qe); 531 GNUNET_DATASTORE_cancel (sc->qe);
532 while (NULL != (wqi = sc->wqi_head)) 532 while (NULL != (wqi = sc->wqi_head))
@@ -548,10 +548,10 @@ cleaner_cb (void *cls,
548 * Initialize subsystem for non-anonymous file-sharing. 548 * Initialize subsystem for non-anonymous file-sharing.
549 */ 549 */
550void 550void
551GSF_mesh_start_server () 551GSF_cadet_start_server ()
552{ 552{
553 static const struct GNUNET_MESH_MessageHandler handlers[] = { 553 static const struct GNUNET_CADET_MessageHandler handlers[] = {
554 { &request_cb, GNUNET_MESSAGE_TYPE_FS_MESH_QUERY, sizeof (struct MeshQueryMessage)}, 554 { &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct CadetQueryMessage)},
555 { NULL, 0, 0 } 555 { NULL, 0, 0 }
556 }; 556 };
557 static const uint32_t ports[] = { 557 static const uint32_t ports[] = {
@@ -562,13 +562,13 @@ GSF_mesh_start_server ()
562 if (GNUNET_YES != 562 if (GNUNET_YES !=
563 GNUNET_CONFIGURATION_get_value_number (GSF_cfg, 563 GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
564 "fs", 564 "fs",
565 "MAX_MESH_CLIENTS", 565 "MAX_CADET_CLIENTS",
566 &sc_count_max)) 566 &sc_count_max))
567 return; 567 return;
568 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 568 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
569 "Initializing mesh FS server with a limit of %llu connections\n", 569 "Initializing cadet FS server with a limit of %llu connections\n",
570 sc_count_max); 570 sc_count_max);
571 listen_channel = GNUNET_MESH_connect (GSF_cfg, 571 listen_channel = GNUNET_CADET_connect (GSF_cfg,
572 NULL, 572 NULL,
573 &accept_cb, 573 &accept_cb,
574 &cleaner_cb, 574 &cleaner_cb,
@@ -581,15 +581,15 @@ GSF_mesh_start_server ()
581 * Shutdown subsystem for non-anonymous file-sharing. 581 * Shutdown subsystem for non-anonymous file-sharing.
582 */ 582 */
583void 583void
584GSF_mesh_stop_server () 584GSF_cadet_stop_server ()
585{ 585{
586 if (NULL != listen_channel) 586 if (NULL != listen_channel)
587 { 587 {
588 GNUNET_MESH_disconnect (listen_channel); 588 GNUNET_CADET_disconnect (listen_channel);
589 listen_channel = NULL; 589 listen_channel = NULL;
590 } 590 }
591 GNUNET_assert (NULL == sc_head); 591 GNUNET_assert (NULL == sc_head);
592 GNUNET_assert (0 == sc_count); 592 GNUNET_assert (0 == sc_count);
593} 593}
594 594
595/* end of gnunet-service-fs_mesh.c */ 595/* end of gnunet-service-fs_cadet.c */
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 0af19d537..67c935acd 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -31,7 +31,7 @@
31#include "gnunet-service-fs_indexing.h" 31#include "gnunet-service-fs_indexing.h"
32#include "gnunet-service-fs_pe.h" 32#include "gnunet-service-fs_pe.h"
33#include "gnunet-service-fs_pr.h" 33#include "gnunet-service-fs_pr.h"
34#include "gnunet-service-fs_mesh.h" 34#include "gnunet-service-fs_cadet.h"
35 35
36 36
37/** 37/**
@@ -65,10 +65,10 @@
65#define INSANE_STATISTICS GNUNET_NO 65#define INSANE_STATISTICS GNUNET_NO
66 66
67/** 67/**
68 * If obtaining a block via mesh fails, how often do we retry it before 68 * If obtaining a block via cadet fails, how often do we retry it before
69 * giving up for good (and sticking to non-anonymous transfer)? 69 * giving up for good (and sticking to non-anonymous transfer)?
70 */ 70 */
71#define MESH_RETRY_MAX 3 71#define CADET_RETRY_MAX 3
72 72
73 73
74/** 74/**
@@ -117,9 +117,9 @@ struct GSF_PendingRequest
117 struct GNUNET_DHT_GetHandle *gh; 117 struct GNUNET_DHT_GetHandle *gh;
118 118
119 /** 119 /**
120 * Mesh request handle for this request (or NULL for none). 120 * Cadet request handle for this request (or NULL for none).
121 */ 121 */
122 struct GSF_MeshRequest *mesh_request; 122 struct GSF_CadetRequest *cadet_request;
123 123
124 /** 124 /**
125 * Function to call upon completion of the local get 125 * Function to call upon completion of the local get
@@ -174,10 +174,10 @@ struct GSF_PendingRequest
174 uint64_t first_uid; 174 uint64_t first_uid;
175 175
176 /** 176 /**
177 * How often have we retried this request via 'mesh'? 177 * How often have we retried this request via 'cadet'?
178 * (used to bound overall retries). 178 * (used to bound overall retries).
179 */ 179 */
180 unsigned int mesh_retry_count; 180 unsigned int cadet_retry_count;
181 181
182 /** 182 /**
183 * Number of valid entries in the 'replies_seen' array. 183 * Number of valid entries in the 'replies_seen' array.
@@ -595,11 +595,11 @@ clean_request (void *cls, const struct GNUNET_HashCode *key, void *value)
595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
596 "Cleaning up pending request for `%s'.\n", 596 "Cleaning up pending request for `%s'.\n",
597 GNUNET_h2s (key)); 597 GNUNET_h2s (key));
598 if (NULL != pr->mesh_request) 598 if (NULL != pr->cadet_request)
599 { 599 {
600 pr->mesh_retry_count = MESH_RETRY_MAX; 600 pr->cadet_retry_count = CADET_RETRY_MAX;
601 GSF_mesh_query_cancel (pr->mesh_request); 601 GSF_cadet_query_cancel (pr->cadet_request);
602 pr->mesh_request = NULL; 602 pr->cadet_request = NULL;
603 } 603 }
604 if (NULL != (cont = pr->llc_cont)) 604 if (NULL != (cont = pr->llc_cont))
605 { 605 {
@@ -668,11 +668,11 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup)
668 * but do NOT remove from our data-structures, we still need it there 668 * but do NOT remove from our data-structures, we still need it there
669 * to prevent the request from looping */ 669 * to prevent the request from looping */
670 pr->rh = NULL; 670 pr->rh = NULL;
671 if (NULL != pr->mesh_request) 671 if (NULL != pr->cadet_request)
672 { 672 {
673 pr->mesh_retry_count = MESH_RETRY_MAX; 673 pr->cadet_retry_count = CADET_RETRY_MAX;
674 GSF_mesh_query_cancel (pr->mesh_request); 674 GSF_cadet_query_cancel (pr->cadet_request);
675 pr->mesh_request = NULL; 675 pr->cadet_request = NULL;
676 } 676 }
677 if (NULL != (cont = pr->llc_cont)) 677 if (NULL != (cont = pr->llc_cont))
678 { 678 {
@@ -1139,7 +1139,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1139 1139
1140 1140
1141/** 1141/**
1142 * Function called with a reply from the mesh. 1142 * Function called with a reply from the cadet.
1143 * 1143 *
1144 * @param cls the pending request struct 1144 * @param cls the pending request struct
1145 * @param type type of the block, ANY on error 1145 * @param type type of the block, ANY on error
@@ -1148,7 +1148,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1148 * @param data reply block data, NULL on error 1148 * @param data reply block data, NULL on error
1149 */ 1149 */
1150static void 1150static void
1151mesh_reply_proc (void *cls, 1151cadet_reply_proc (void *cls,
1152 enum GNUNET_BLOCK_Type type, 1152 enum GNUNET_BLOCK_Type type,
1153 struct GNUNET_TIME_Absolute expiration, 1153 struct GNUNET_TIME_Absolute expiration,
1154 size_t data_size, 1154 size_t data_size,
@@ -1158,22 +1158,22 @@ mesh_reply_proc (void *cls,
1158 struct ProcessReplyClosure prq; 1158 struct ProcessReplyClosure prq;
1159 struct GNUNET_HashCode query; 1159 struct GNUNET_HashCode query;
1160 1160
1161 pr->mesh_request = NULL; 1161 pr->cadet_request = NULL;
1162 if (GNUNET_BLOCK_TYPE_ANY == type) 1162 if (GNUNET_BLOCK_TYPE_ANY == type)
1163 { 1163 {
1164 GNUNET_break (NULL == data); 1164 GNUNET_break (NULL == data);
1165 GNUNET_break (0 == data_size); 1165 GNUNET_break (0 == data_size);
1166 pr->mesh_retry_count++; 1166 pr->cadet_retry_count++;
1167 if (pr->mesh_retry_count >= MESH_RETRY_MAX) 1167 if (pr->cadet_retry_count >= CADET_RETRY_MAX)
1168 return; /* give up on mesh */ 1168 return; /* give up on cadet */
1169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1170 "Error retrieiving block via mesh\n"); 1170 "Error retrieiving block via cadet\n");
1171 /* retry -- without delay, as this is non-anonymous 1171 /* retry -- without delay, as this is non-anonymous
1172 and mesh/mesh connect will take some time anyway */ 1172 and cadet/cadet connect will take some time anyway */
1173 pr->mesh_request = GSF_mesh_query (pr->public_data.target, 1173 pr->cadet_request = GSF_cadet_query (pr->public_data.target,
1174 &pr->public_data.query, 1174 &pr->public_data.query,
1175 pr->public_data.type, 1175 pr->public_data.type,
1176 &mesh_reply_proc, 1176 &cadet_reply_proc,
1177 pr); 1177 pr);
1178 return; 1178 return;
1179 } 1179 }
@@ -1189,7 +1189,7 @@ mesh_reply_proc (void *cls,
1189 return; 1189 return;
1190 } 1190 }
1191 GNUNET_STATISTICS_update (GSF_stats, 1191 GNUNET_STATISTICS_update (GSF_stats,
1192 gettext_noop ("# Replies received from MESH"), 1, 1192 gettext_noop ("# Replies received from CADET"), 1,
1193 GNUNET_NO); 1193 GNUNET_NO);
1194 memset (&prq, 0, sizeof (prq)); 1194 memset (&prq, 0, sizeof (prq));
1195 prq.data = data; 1195 prq.data = data;
@@ -1204,27 +1204,27 @@ mesh_reply_proc (void *cls,
1204 1204
1205 1205
1206/** 1206/**
1207 * Consider downloading via mesh (if possible) 1207 * Consider downloading via cadet (if possible)
1208 * 1208 *
1209 * @param pr the pending request to process 1209 * @param pr the pending request to process
1210 */ 1210 */
1211void 1211void
1212GSF_mesh_lookup_ (struct GSF_PendingRequest *pr) 1212GSF_cadet_lookup_ (struct GSF_PendingRequest *pr)
1213{ 1213{
1214 if (0 != pr->public_data.anonymity_level) 1214 if (0 != pr->public_data.anonymity_level)
1215 return; 1215 return;
1216 if (0 == pr->public_data.target) 1216 if (0 == pr->public_data.target)
1217 { 1217 {
1218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1219 "Cannot do mesh-based download, target peer not known\n"); 1219 "Cannot do cadet-based download, target peer not known\n");
1220 return; 1220 return;
1221 } 1221 }
1222 if (NULL != pr->mesh_request) 1222 if (NULL != pr->cadet_request)
1223 return; 1223 return;
1224 pr->mesh_request = GSF_mesh_query (pr->public_data.target, 1224 pr->cadet_request = GSF_cadet_query (pr->public_data.target,
1225 &pr->public_data.query, 1225 &pr->public_data.query,
1226 pr->public_data.type, 1226 pr->public_data.type,
1227 &mesh_reply_proc, 1227 &cadet_reply_proc,
1228 pr); 1228 pr);
1229} 1229}
1230 1230
@@ -1553,7 +1553,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr,
1553 GSF_LocalLookupContinuation cont, void *cont_cls) 1553 GSF_LocalLookupContinuation cont, void *cont_cls)
1554{ 1554{
1555 GNUNET_assert (NULL == pr->gh); 1555 GNUNET_assert (NULL == pr->gh);
1556 GNUNET_assert (NULL == pr->mesh_request); 1556 GNUNET_assert (NULL == pr->cadet_request);
1557 GNUNET_assert (NULL == pr->llc_cont); 1557 GNUNET_assert (NULL == pr->llc_cont);
1558 pr->llc_cont = cont; 1558 pr->llc_cont = cont;
1559 pr->llc_cont_cls = cont_cls; 1559 pr->llc_cont_cls = cont_cls;
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index 022e13eb4..309565d7e 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -351,12 +351,12 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr);
351 351
352 352
353/** 353/**
354 * Consider downloading via mesh (if possible) 354 * Consider downloading via cadet (if possible)
355 * 355 *
356 * @param pr the pending request to process 356 * @param pr the pending request to process
357 */ 357 */
358void 358void
359GSF_mesh_lookup_ (struct GSF_PendingRequest *pr); 359GSF_cadet_lookup_ (struct GSF_PendingRequest *pr);
360 360
361 361
362/** 362/**
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index 51f05192e..8dee24912 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -331,10 +331,10 @@ main (int argc, char *argv[])
331 binary_name = "test-fs-download-indexed"; 331 binary_name = "test-fs-download-indexed";
332 config_name = "test_fs_download_indexed.conf"; 332 config_name = "test_fs_download_indexed.conf";
333 } 333 }
334 if (NULL != strstr (argv[0], "mesh")) 334 if (NULL != strstr (argv[0], "cadet"))
335 { 335 {
336 binary_name = "test-fs-download-mesh"; 336 binary_name = "test-fs-download-cadet";
337 config_name = "test_fs_download_mesh.conf"; 337 config_name = "test_fs_download_cadet.conf";
338 } 338 }
339 if (0 != GNUNET_TESTING_peer_run (binary_name, 339 if (0 != GNUNET_TESTING_peer_run (binary_name,
340 config_name, 340 config_name,
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 034bb7b0e..75f85a76f 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -122,7 +122,7 @@ do_publish (void *cls,
122{ 122{
123 unsigned int i; 123 unsigned int i;
124 124
125 if (NULL != strstr (progname, "mesh")) 125 if (NULL != strstr (progname, "cadet"))
126 anonymity_level = 0; 126 anonymity_level = 0;
127 else 127 else
128 anonymity_level = 1; 128 anonymity_level = 1;
@@ -144,8 +144,8 @@ main (int argc, char *argv[])
144 const char *config; 144 const char *config;
145 145
146 progname = argv[0]; 146 progname = argv[0];
147 if (NULL != strstr (progname, "mesh")) 147 if (NULL != strstr (progname, "cadet"))
148 config = "test_gnunet_service_fs_p2p_mesh.conf"; 148 config = "test_gnunet_service_fs_p2p_cadet.conf";
149 else 149 else
150 config = "fs_test_lib_data.conf"; 150 config = "fs_test_lib_data.conf";
151 (void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-p2p", 151 (void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-p2p",