diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh_channel.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 476 |
1 files changed, 238 insertions, 238 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index d3bbcdbc0..91338d5c0 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -24,52 +24,52 @@ | |||
24 | 24 | ||
25 | #include "gnunet_statistics_service.h" | 25 | #include "gnunet_statistics_service.h" |
26 | 26 | ||
27 | #include "mesh.h" | 27 | #include "cadet.h" |
28 | #include "mesh_protocol.h" | 28 | #include "cadet_protocol.h" |
29 | 29 | ||
30 | #include "gnunet-service-mesh_channel.h" | 30 | #include "gnunet-service-cadet_channel.h" |
31 | #include "gnunet-service-mesh_local.h" | 31 | #include "gnunet-service-cadet_local.h" |
32 | #include "gnunet-service-mesh_tunnel.h" | 32 | #include "gnunet-service-cadet_tunnel.h" |
33 | #include "gnunet-service-mesh_peer.h" | 33 | #include "gnunet-service-cadet_peer.h" |
34 | 34 | ||
35 | #define LOG(level, ...) GNUNET_log_from(level,"mesh-chn",__VA_ARGS__) | 35 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-chn",__VA_ARGS__) |
36 | 36 | ||
37 | #define MESH_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\ | 37 | #define CADET_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\ |
38 | GNUNET_TIME_UNIT_MILLISECONDS, 250) | 38 | GNUNET_TIME_UNIT_MILLISECONDS, 250) |
39 | #define MESH_RETRANSMIT_MARGIN 4 | 39 | #define CADET_RETRANSMIT_MARGIN 4 |
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * All the states a connection can be in. | 43 | * All the states a connection can be in. |
44 | */ | 44 | */ |
45 | enum MeshChannelState | 45 | enum CadetChannelState |
46 | { | 46 | { |
47 | /** | 47 | /** |
48 | * Uninitialized status, should never appear in operation. | 48 | * Uninitialized status, should never appear in operation. |
49 | */ | 49 | */ |
50 | MESH_CHANNEL_NEW, | 50 | CADET_CHANNEL_NEW, |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Connection create message sent, waiting for ACK. | 53 | * Connection create message sent, waiting for ACK. |
54 | */ | 54 | */ |
55 | MESH_CHANNEL_SENT, | 55 | CADET_CHANNEL_SENT, |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Connection confirmed, ready to carry traffic. | 58 | * Connection confirmed, ready to carry traffic. |
59 | */ | 59 | */ |
60 | MESH_CHANNEL_READY, | 60 | CADET_CHANNEL_READY, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Info holder for channel messages in queues. | 65 | * Info holder for channel messages in queues. |
66 | */ | 66 | */ |
67 | struct MeshChannelQueue | 67 | struct CadetChannelQueue |
68 | { | 68 | { |
69 | /** | 69 | /** |
70 | * Tunnel Queue. | 70 | * Tunnel Queue. |
71 | */ | 71 | */ |
72 | struct MeshTunnel3Queue *tq; | 72 | struct CadetTunnel3Queue *tq; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Message type (DATA/DATA_ACK) | 75 | * Message type (DATA/DATA_ACK) |
@@ -79,25 +79,25 @@ struct MeshChannelQueue | |||
79 | /** | 79 | /** |
80 | * Message copy (for DATAs, to start retransmission timer) | 80 | * Message copy (for DATAs, to start retransmission timer) |
81 | */ | 81 | */ |
82 | struct MeshReliableMessage *copy; | 82 | struct CadetReliableMessage *copy; |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Reliability (for DATA_ACKs, to access rel->ack_q) | 85 | * Reliability (for DATA_ACKs, to access rel->ack_q) |
86 | */ | 86 | */ |
87 | struct MeshChannelReliability *rel; | 87 | struct CadetChannelReliability *rel; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Info needed to retry a message in case it gets lost. | 92 | * Info needed to retry a message in case it gets lost. |
93 | */ | 93 | */ |
94 | struct MeshReliableMessage | 94 | struct CadetReliableMessage |
95 | { | 95 | { |
96 | /** | 96 | /** |
97 | * Double linked list, FIFO style | 97 | * Double linked list, FIFO style |
98 | */ | 98 | */ |
99 | struct MeshReliableMessage *next; | 99 | struct CadetReliableMessage *next; |
100 | struct MeshReliableMessage *prev; | 100 | struct CadetReliableMessage *prev; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Type of message (payload, channel management). | 103 | * Type of message (payload, channel management). |
@@ -107,7 +107,7 @@ struct MeshReliableMessage | |||
107 | /** | 107 | /** |
108 | * Tunnel Reliability queue this message is in. | 108 | * Tunnel Reliability queue this message is in. |
109 | */ | 109 | */ |
110 | struct MeshChannelReliability *rel; | 110 | struct CadetChannelReliability *rel; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * ID of the message (ACK needed to free) | 113 | * ID of the message (ACK needed to free) |
@@ -117,38 +117,38 @@ struct MeshReliableMessage | |||
117 | /** | 117 | /** |
118 | * Tunnel Queue. | 118 | * Tunnel Queue. |
119 | */ | 119 | */ |
120 | struct MeshChannelQueue *chq; | 120 | struct CadetChannelQueue *chq; |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * When was this message issued (to calculate ACK delay) | 123 | * When was this message issued (to calculate ACK delay) |
124 | */ | 124 | */ |
125 | struct GNUNET_TIME_Absolute timestamp; | 125 | struct GNUNET_TIME_Absolute timestamp; |
126 | 126 | ||
127 | /* struct GNUNET_MESH_Data with payload */ | 127 | /* struct GNUNET_CADET_Data with payload */ |
128 | }; | 128 | }; |
129 | 129 | ||
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Info about the traffic state for a client in a channel. | 132 | * Info about the traffic state for a client in a channel. |
133 | */ | 133 | */ |
134 | struct MeshChannelReliability | 134 | struct CadetChannelReliability |
135 | { | 135 | { |
136 | /** | 136 | /** |
137 | * Channel this is about. | 137 | * Channel this is about. |
138 | */ | 138 | */ |
139 | struct MeshChannel *ch; | 139 | struct CadetChannel *ch; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * DLL of messages sent and not yet ACK'd. | 142 | * DLL of messages sent and not yet ACK'd. |
143 | */ | 143 | */ |
144 | struct MeshReliableMessage *head_sent; | 144 | struct CadetReliableMessage *head_sent; |
145 | struct MeshReliableMessage *tail_sent; | 145 | struct CadetReliableMessage *tail_sent; |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * DLL of messages received out of order. | 148 | * DLL of messages received out of order. |
149 | */ | 149 | */ |
150 | struct MeshReliableMessage *head_recv; | 150 | struct CadetReliableMessage *head_recv; |
151 | struct MeshReliableMessage *tail_recv; | 151 | struct CadetReliableMessage *tail_recv; |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Messages received. | 154 | * Messages received. |
@@ -168,7 +168,7 @@ struct MeshChannelReliability | |||
168 | /** | 168 | /** |
169 | * Handle for queued unique data CREATE, DATA_ACK. | 169 | * Handle for queued unique data CREATE, DATA_ACK. |
170 | */ | 170 | */ |
171 | struct MeshChannelQueue *uniq; | 171 | struct CadetChannelQueue *uniq; |
172 | 172 | ||
173 | /** | 173 | /** |
174 | * Can we send data to the client? | 174 | * Can we send data to the client? |
@@ -200,12 +200,12 @@ struct MeshChannelReliability | |||
200 | /** | 200 | /** |
201 | * Struct containing all information regarding a channel to a remote client. | 201 | * Struct containing all information regarding a channel to a remote client. |
202 | */ | 202 | */ |
203 | struct MeshChannel | 203 | struct CadetChannel |
204 | { | 204 | { |
205 | /** | 205 | /** |
206 | * Tunnel this channel is in. | 206 | * Tunnel this channel is in. |
207 | */ | 207 | */ |
208 | struct MeshTunnel3 *t; | 208 | struct CadetTunnel3 *t; |
209 | 209 | ||
210 | /** | 210 | /** |
211 | * Destination port of the channel. | 211 | * Destination port of the channel. |
@@ -213,26 +213,26 @@ struct MeshChannel | |||
213 | uint32_t port; | 213 | uint32_t port; |
214 | 214 | ||
215 | /** | 215 | /** |
216 | * Global channel number ( < GNUNET_MESH_LOCAL_CHANNEL_ID_CLI) | 216 | * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
217 | */ | 217 | */ |
218 | MESH_ChannelNumber gid; | 218 | CADET_ChannelNumber gid; |
219 | 219 | ||
220 | /** | 220 | /** |
221 | * Local tunnel number for root (owner) client. | 221 | * Local tunnel number for root (owner) client. |
222 | * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI or 0 ) | 222 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 ) |
223 | */ | 223 | */ |
224 | MESH_ChannelNumber lid_root; | 224 | CADET_ChannelNumber lid_root; |
225 | 225 | ||
226 | /** | 226 | /** |
227 | * Local tunnel number for local destination clients (incoming number) | 227 | * Local tunnel number for local destination clients (incoming number) |
228 | * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV or 0). | 228 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0). |
229 | */ | 229 | */ |
230 | MESH_ChannelNumber lid_dest; | 230 | CADET_ChannelNumber lid_dest; |
231 | 231 | ||
232 | /** | 232 | /** |
233 | * Channel state. | 233 | * Channel state. |
234 | */ | 234 | */ |
235 | enum MeshChannelState state; | 235 | enum CadetChannelState state; |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Is the tunnel bufferless (minimum latency)? | 238 | * Is the tunnel bufferless (minimum latency)? |
@@ -252,12 +252,12 @@ struct MeshChannel | |||
252 | /** | 252 | /** |
253 | * Client owner of the tunnel, if any | 253 | * Client owner of the tunnel, if any |
254 | */ | 254 | */ |
255 | struct MeshClient *root; | 255 | struct CadetClient *root; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * Client destination of the tunnel, if any. | 258 | * Client destination of the tunnel, if any. |
259 | */ | 259 | */ |
260 | struct MeshClient *dest; | 260 | struct CadetClient *dest; |
261 | 261 | ||
262 | /** | 262 | /** |
263 | * Flag to signal the destruction of the channel. | 263 | * Flag to signal the destruction of the channel. |
@@ -275,13 +275,13 @@ struct MeshChannel | |||
275 | * Reliability data. | 275 | * Reliability data. |
276 | * Only present (non-NULL) at the owner of a tunnel. | 276 | * Only present (non-NULL) at the owner of a tunnel. |
277 | */ | 277 | */ |
278 | struct MeshChannelReliability *root_rel; | 278 | struct CadetChannelReliability *root_rel; |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * Reliability data. | 281 | * Reliability data. |
282 | * Only present (non-NULL) at the destination of a tunnel. | 282 | * Only present (non-NULL) at the destination of a tunnel. |
283 | */ | 283 | */ |
284 | struct MeshChannelReliability *dest_rel; | 284 | struct CadetChannelReliability *dest_rel; |
285 | 285 | ||
286 | }; | 286 | }; |
287 | 287 | ||
@@ -317,7 +317,7 @@ extern GNUNET_PEER_Id myid; | |||
317 | * retransmitted message. | 317 | * retransmitted message. |
318 | */ | 318 | */ |
319 | static int | 319 | static int |
320 | rel_message_free (struct MeshReliableMessage *copy, int update_time); | 320 | rel_message_free (struct CadetReliableMessage *copy, int update_time); |
321 | 321 | ||
322 | /** | 322 | /** |
323 | * send a channel create message. | 323 | * send a channel create message. |
@@ -325,7 +325,7 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time); | |||
325 | * @param ch Channel for which to send. | 325 | * @param ch Channel for which to send. |
326 | */ | 326 | */ |
327 | static void | 327 | static void |
328 | send_create (struct MeshChannel *ch); | 328 | send_create (struct CadetChannel *ch); |
329 | 329 | ||
330 | /** | 330 | /** |
331 | * Confirm we got a channel create, FWD ack. | 331 | * Confirm we got a channel create, FWD ack. |
@@ -335,7 +335,7 @@ send_create (struct MeshChannel *ch); | |||
335 | * @param reaction This ACK is a reaction to a duplicate CREATE, don't save. | 335 | * @param reaction This ACK is a reaction to a duplicate CREATE, don't save. |
336 | */ | 336 | */ |
337 | static void | 337 | static void |
338 | send_ack (struct MeshChannel *ch, int fwd, int reaction); | 338 | send_ack (struct CadetChannel *ch, int fwd, int reaction); |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
@@ -347,7 +347,7 @@ send_ack (struct MeshChannel *ch, int fwd, int reaction); | |||
347 | * @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise. | 347 | * @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise. |
348 | */ | 348 | */ |
349 | static int | 349 | static int |
350 | is_loopback (const struct MeshChannel *ch) | 350 | is_loopback (const struct CadetChannel *ch) |
351 | { | 351 | { |
352 | if (NULL != ch->t) | 352 | if (NULL != ch->t) |
353 | return GMT_is_loopback (ch->t); | 353 | return GMT_is_loopback (ch->t); |
@@ -363,18 +363,18 @@ is_loopback (const struct MeshChannel *ch) | |||
363 | * @param mid Message ID. | 363 | * @param mid Message ID. |
364 | * @param rel Reliability data for retransmission. | 364 | * @param rel Reliability data for retransmission. |
365 | */ | 365 | */ |
366 | static struct MeshReliableMessage * | 366 | static struct CadetReliableMessage * |
367 | copy_message (const struct GNUNET_MESH_Data *msg, uint32_t mid, | 367 | copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid, |
368 | struct MeshChannelReliability *rel) | 368 | struct CadetChannelReliability *rel) |
369 | { | 369 | { |
370 | struct MeshReliableMessage *copy; | 370 | struct CadetReliableMessage *copy; |
371 | uint16_t size; | 371 | uint16_t size; |
372 | 372 | ||
373 | size = ntohs (msg->header.size); | 373 | size = ntohs (msg->header.size); |
374 | copy = GNUNET_malloc (sizeof (*copy) + size); | 374 | copy = GNUNET_malloc (sizeof (*copy) + size); |
375 | copy->mid = mid; | 375 | copy->mid = mid; |
376 | copy->rel = rel; | 376 | copy->rel = rel; |
377 | copy->type = GNUNET_MESSAGE_TYPE_MESH_DATA; | 377 | copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA; |
378 | memcpy (©[1], msg, size); | 378 | memcpy (©[1], msg, size); |
379 | 379 | ||
380 | return copy; | 380 | return copy; |
@@ -385,15 +385,15 @@ copy_message (const struct GNUNET_MESH_Data *msg, uint32_t mid, | |||
385 | * Buffer it until we receive an ACK from the client or the missing | 385 | * Buffer it until we receive an ACK from the client or the missing |
386 | * message from the channel. | 386 | * message from the channel. |
387 | * | 387 | * |
388 | * @param msg Message to buffer (MUST be of type MESH_DATA). | 388 | * @param msg Message to buffer (MUST be of type CADET_DATA). |
389 | * @param rel Reliability data to the corresponding direction. | 389 | * @param rel Reliability data to the corresponding direction. |
390 | */ | 390 | */ |
391 | static void | 391 | static void |
392 | add_buffered_data (const struct GNUNET_MESH_Data *msg, | 392 | add_buffered_data (const struct GNUNET_CADET_Data *msg, |
393 | struct MeshChannelReliability *rel) | 393 | struct CadetChannelReliability *rel) |
394 | { | 394 | { |
395 | struct MeshReliableMessage *copy; | 395 | struct CadetReliableMessage *copy; |
396 | struct MeshReliableMessage *prev; | 396 | struct CadetReliableMessage *prev; |
397 | uint32_t mid; | 397 | uint32_t mid; |
398 | 398 | ||
399 | mid = ntohl (msg->mid); | 399 | mid = ntohl (msg->mid); |
@@ -436,7 +436,7 @@ add_buffered_data (const struct GNUNET_MESH_Data *msg, | |||
436 | * @param c Client which to add to the channel. | 436 | * @param c Client which to add to the channel. |
437 | */ | 437 | */ |
438 | static void | 438 | static void |
439 | add_destination (struct MeshChannel *ch, struct MeshClient *c) | 439 | add_destination (struct CadetChannel *ch, struct CadetClient *c) |
440 | { | 440 | { |
441 | if (NULL != ch->dest) | 441 | if (NULL != ch->dest) |
442 | { | 442 | { |
@@ -451,10 +451,10 @@ add_destination (struct MeshChannel *ch, struct MeshClient *c) | |||
451 | GML_channel_add (c, ch->lid_dest, ch); | 451 | GML_channel_add (c, ch->lid_dest, ch); |
452 | 452 | ||
453 | GNUNET_break (NULL == ch->dest_rel); | 453 | GNUNET_break (NULL == ch->dest_rel); |
454 | ch->dest_rel = GNUNET_new (struct MeshChannelReliability); | 454 | ch->dest_rel = GNUNET_new (struct CadetChannelReliability); |
455 | ch->dest_rel->ch = ch; | 455 | ch->dest_rel->ch = ch; |
456 | ch->dest_rel->expected_delay.rel_value_us = 0; | 456 | ch->dest_rel->expected_delay.rel_value_us = 0; |
457 | ch->dest_rel->retry_timer = MESH_RETRANSMIT_TIME; | 457 | ch->dest_rel->retry_timer = CADET_RETRANSMIT_TIME; |
458 | 458 | ||
459 | ch->dest = c; | 459 | ch->dest = c; |
460 | } | 460 | } |
@@ -467,11 +467,11 @@ add_destination (struct MeshChannel *ch, struct MeshClient *c) | |||
467 | * @param options Bit array in host byte order. | 467 | * @param options Bit array in host byte order. |
468 | */ | 468 | */ |
469 | static void | 469 | static void |
470 | channel_set_options (struct MeshChannel *ch, uint32_t options) | 470 | channel_set_options (struct CadetChannel *ch, uint32_t options) |
471 | { | 471 | { |
472 | ch->nobuffer = (options & GNUNET_MESH_OPTION_NOBUFFER) != 0 ? | 472 | ch->nobuffer = (options & GNUNET_CADET_OPTION_NOBUFFER) != 0 ? |
473 | GNUNET_YES : GNUNET_NO; | 473 | GNUNET_YES : GNUNET_NO; |
474 | ch->reliable = (options & GNUNET_MESH_OPTION_RELIABLE) != 0 ? | 474 | ch->reliable = (options & GNUNET_CADET_OPTION_RELIABLE) != 0 ? |
475 | GNUNET_YES : GNUNET_NO; | 475 | GNUNET_YES : GNUNET_NO; |
476 | } | 476 | } |
477 | 477 | ||
@@ -484,15 +484,15 @@ channel_set_options (struct MeshChannel *ch, uint32_t options) | |||
484 | * @return Bit array in host byte order. | 484 | * @return Bit array in host byte order. |
485 | */ | 485 | */ |
486 | static uint32_t | 486 | static uint32_t |
487 | channel_get_options (struct MeshChannel *ch) | 487 | channel_get_options (struct CadetChannel *ch) |
488 | { | 488 | { |
489 | uint32_t options; | 489 | uint32_t options; |
490 | 490 | ||
491 | options = 0; | 491 | options = 0; |
492 | if (ch->nobuffer) | 492 | if (ch->nobuffer) |
493 | options |= GNUNET_MESH_OPTION_NOBUFFER; | 493 | options |= GNUNET_CADET_OPTION_NOBUFFER; |
494 | if (ch->reliable) | 494 | if (ch->reliable) |
495 | options |= GNUNET_MESH_OPTION_RELIABLE; | 495 | options |= GNUNET_CADET_OPTION_RELIABLE; |
496 | 496 | ||
497 | return options; | 497 | return options; |
498 | } | 498 | } |
@@ -505,11 +505,11 @@ channel_get_options (struct MeshChannel *ch) | |||
505 | * @param local_only Should we avoid sending it to other peers? | 505 | * @param local_only Should we avoid sending it to other peers? |
506 | */ | 506 | */ |
507 | static void | 507 | static void |
508 | send_destroy (struct MeshChannel *ch, int local_only) | 508 | send_destroy (struct CadetChannel *ch, int local_only) |
509 | { | 509 | { |
510 | struct GNUNET_MESH_ChannelManage msg; | 510 | struct GNUNET_CADET_ChannelManage msg; |
511 | 511 | ||
512 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); | 512 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
513 | msg.header.size = htons (sizeof (msg)); | 513 | msg.header.size = htons (sizeof (msg)); |
514 | msg.chid = htonl (ch->gid); | 514 | msg.chid = htonl (ch->gid); |
515 | 515 | ||
@@ -536,7 +536,7 @@ send_destroy (struct MeshChannel *ch, int local_only) | |||
536 | * @param ch Channel that was created. | 536 | * @param ch Channel that was created. |
537 | */ | 537 | */ |
538 | static void | 538 | static void |
539 | send_client_create (struct MeshChannel *ch) | 539 | send_client_create (struct CadetChannel *ch) |
540 | { | 540 | { |
541 | uint32_t opt; | 541 | uint32_t opt; |
542 | 542 | ||
@@ -544,8 +544,8 @@ send_client_create (struct MeshChannel *ch) | |||
544 | return; | 544 | return; |
545 | 545 | ||
546 | opt = 0; | 546 | opt = 0; |
547 | opt |= GNUNET_YES == ch->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0; | 547 | opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0; |
548 | opt |= GNUNET_YES == ch->nobuffer ? GNUNET_MESH_OPTION_NOBUFFER : 0; | 548 | opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0; |
549 | GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt, | 549 | GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt, |
550 | GMT_get_destination (ch->t)); | 550 | GMT_get_destination (ch->t)); |
551 | 551 | ||
@@ -563,8 +563,8 @@ send_client_create (struct MeshChannel *ch) | |||
563 | * @param fwd Is this a fwd (root->dest) message? | 563 | * @param fwd Is this a fwd (root->dest) message? |
564 | */ | 564 | */ |
565 | static void | 565 | static void |
566 | send_client_data (struct MeshChannel *ch, | 566 | send_client_data (struct CadetChannel *ch, |
567 | const struct GNUNET_MESH_Data *msg, | 567 | const struct GNUNET_CADET_Data *msg, |
568 | int fwd) | 568 | int fwd) |
569 | { | 569 | { |
570 | if (fwd) | 570 | if (fwd) |
@@ -593,12 +593,12 @@ send_client_data (struct MeshChannel *ch, | |||
593 | * @param fwd Is this to send FWD data?. | 593 | * @param fwd Is this to send FWD data?. |
594 | */ | 594 | */ |
595 | static void | 595 | static void |
596 | send_client_buffered_data (struct MeshChannel *ch, | 596 | send_client_buffered_data (struct CadetChannel *ch, |
597 | struct MeshClient *c, | 597 | struct CadetClient *c, |
598 | int fwd) | 598 | int fwd) |
599 | { | 599 | { |
600 | struct MeshReliableMessage *copy; | 600 | struct CadetReliableMessage *copy; |
601 | struct MeshChannelReliability *rel; | 601 | struct CadetChannelReliability *rel; |
602 | 602 | ||
603 | LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n"); | 603 | LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n"); |
604 | rel = fwd ? ch->dest_rel : ch->root_rel; | 604 | rel = fwd ? ch->dest_rel : ch->root_rel; |
@@ -614,7 +614,7 @@ send_client_buffered_data (struct MeshChannel *ch, | |||
614 | { | 614 | { |
615 | if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable) | 615 | if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable) |
616 | { | 616 | { |
617 | struct GNUNET_MESH_Data *msg = (struct GNUNET_MESH_Data *) ©[1]; | 617 | struct GNUNET_CADET_Data *msg = (struct GNUNET_CADET_Data *) ©[1]; |
618 | 618 | ||
619 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 619 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
620 | " have %u! now expecting %u\n", | 620 | " have %u! now expecting %u\n", |
@@ -657,10 +657,10 @@ send_client_buffered_data (struct MeshChannel *ch, | |||
657 | * @param fwd Is this a FWD ACK? (FWD ACKs are sent to root) | 657 | * @param fwd Is this a FWD ACK? (FWD ACKs are sent to root) |
658 | */ | 658 | */ |
659 | static void | 659 | static void |
660 | send_client_ack (struct MeshChannel *ch, int fwd) | 660 | send_client_ack (struct CadetChannel *ch, int fwd) |
661 | { | 661 | { |
662 | struct MeshChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel; | 662 | struct CadetChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel; |
663 | struct MeshClient *c = fwd ? ch->root : ch->dest; | 663 | struct CadetClient *c = fwd ? ch->root : ch->dest; |
664 | 664 | ||
665 | if (NULL == c) | 665 | if (NULL == c) |
666 | { | 666 | { |
@@ -694,7 +694,7 @@ send_client_ack (struct MeshChannel *ch, int fwd) | |||
694 | * @param ch Rejected channel. | 694 | * @param ch Rejected channel. |
695 | */ | 695 | */ |
696 | static void | 696 | static void |
697 | send_client_nack (struct MeshChannel *ch) | 697 | send_client_nack (struct CadetChannel *ch) |
698 | { | 698 | { |
699 | if (NULL == ch->root) | 699 | if (NULL == ch->root) |
700 | { | 700 | { |
@@ -708,17 +708,17 @@ send_client_nack (struct MeshChannel *ch) | |||
708 | /** | 708 | /** |
709 | * We haven't received an ACK after a certain time: restransmit the message. | 709 | * We haven't received an ACK after a certain time: restransmit the message. |
710 | * | 710 | * |
711 | * @param cls Closure (MeshChannelReliability with the message to restransmit) | 711 | * @param cls Closure (CadetChannelReliability with the message to restransmit) |
712 | * @param tc TaskContext. | 712 | * @param tc TaskContext. |
713 | */ | 713 | */ |
714 | static void | 714 | static void |
715 | channel_retransmit_message (void *cls, | 715 | channel_retransmit_message (void *cls, |
716 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 716 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
717 | { | 717 | { |
718 | struct MeshChannelReliability *rel = cls; | 718 | struct CadetChannelReliability *rel = cls; |
719 | struct MeshReliableMessage *copy; | 719 | struct CadetReliableMessage *copy; |
720 | struct MeshChannel *ch; | 720 | struct CadetChannel *ch; |
721 | struct GNUNET_MESH_Data *payload; | 721 | struct GNUNET_CADET_Data *payload; |
722 | int fwd; | 722 | int fwd; |
723 | 723 | ||
724 | rel->retry_task = GNUNET_SCHEDULER_NO_TASK; | 724 | rel->retry_task = GNUNET_SCHEDULER_NO_TASK; |
@@ -733,7 +733,7 @@ channel_retransmit_message (void *cls, | |||
733 | return; | 733 | return; |
734 | } | 734 | } |
735 | 735 | ||
736 | payload = (struct GNUNET_MESH_Data *) ©[1]; | 736 | payload = (struct GNUNET_CADET_Data *) ©[1]; |
737 | fwd = (rel == ch->root_rel); | 737 | fwd = (rel == ch->root_rel); |
738 | 738 | ||
739 | /* Message not found in the queue that we are going to use. */ | 739 | /* Message not found in the queue that we are going to use. */ |
@@ -747,13 +747,13 @@ channel_retransmit_message (void *cls, | |||
747 | /** | 747 | /** |
748 | * We haven't received an Channel ACK after a certain time: resend the CREATE. | 748 | * We haven't received an Channel ACK after a certain time: resend the CREATE. |
749 | * | 749 | * |
750 | * @param cls Closure (MeshChannelReliability of the channel to recreate) | 750 | * @param cls Closure (CadetChannelReliability of the channel to recreate) |
751 | * @param tc TaskContext. | 751 | * @param tc TaskContext. |
752 | */ | 752 | */ |
753 | static void | 753 | static void |
754 | channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 754 | channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
755 | { | 755 | { |
756 | struct MeshChannelReliability *rel = cls; | 756 | struct CadetChannelReliability *rel = cls; |
757 | 757 | ||
758 | rel->retry_task = GNUNET_SCHEDULER_NO_TASK; | 758 | rel->retry_task = GNUNET_SCHEDULER_NO_TASK; |
759 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 759 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
@@ -789,20 +789,20 @@ channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
789 | */ | 789 | */ |
790 | static void | 790 | static void |
791 | ch_message_sent (void *cls, | 791 | ch_message_sent (void *cls, |
792 | struct MeshTunnel3 *t, | 792 | struct CadetTunnel3 *t, |
793 | struct MeshTunnel3Queue *q, | 793 | struct CadetTunnel3Queue *q, |
794 | uint16_t type, size_t size) | 794 | uint16_t type, size_t size) |
795 | { | 795 | { |
796 | struct MeshChannelQueue *chq = cls; | 796 | struct CadetChannelQueue *chq = cls; |
797 | struct MeshReliableMessage *copy = chq->copy; | 797 | struct CadetReliableMessage *copy = chq->copy; |
798 | struct MeshChannelReliability *rel; | 798 | struct CadetChannelReliability *rel; |
799 | 799 | ||
800 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n", | 800 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n", |
801 | GM_m2s (chq->type)); | 801 | GM_m2s (chq->type)); |
802 | 802 | ||
803 | switch (chq->type) | 803 | switch (chq->type) |
804 | { | 804 | { |
805 | case GNUNET_MESSAGE_TYPE_MESH_DATA: | 805 | case GNUNET_MESSAGE_TYPE_CADET_DATA: |
806 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid); | 806 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid); |
807 | GNUNET_assert (chq == copy->chq); | 807 | GNUNET_assert (chq == copy->chq); |
808 | copy->timestamp = GNUNET_TIME_absolute_get (); | 808 | copy->timestamp = GNUNET_TIME_absolute_get (); |
@@ -817,12 +817,12 @@ ch_message_sent (void *cls, | |||
817 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay != 0\n"); | 817 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay != 0\n"); |
818 | rel->retry_timer = | 818 | rel->retry_timer = |
819 | GNUNET_TIME_relative_multiply (rel->expected_delay, | 819 | GNUNET_TIME_relative_multiply (rel->expected_delay, |
820 | MESH_RETRANSMIT_MARGIN); | 820 | CADET_RETRANSMIT_MARGIN); |
821 | } | 821 | } |
822 | else | 822 | else |
823 | { | 823 | { |
824 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay reset\n"); | 824 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay reset\n"); |
825 | rel->retry_timer = MESH_RETRANSMIT_TIME; | 825 | rel->retry_timer = CADET_RETRANSMIT_TIME; |
826 | } | 826 | } |
827 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!! using delay %s\n", | 827 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!! using delay %s\n", |
828 | GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, | 828 | GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, |
@@ -839,16 +839,16 @@ ch_message_sent (void *cls, | |||
839 | break; | 839 | break; |
840 | 840 | ||
841 | 841 | ||
842 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | 842 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: |
843 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 843 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: |
844 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: | 844 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: |
845 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type)); | 845 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type)); |
846 | rel = chq->rel; | 846 | rel = chq->rel; |
847 | GNUNET_assert (rel->uniq == chq); | 847 | GNUNET_assert (rel->uniq == chq); |
848 | rel->uniq = NULL; | 848 | rel->uniq = NULL; |
849 | 849 | ||
850 | if (MESH_CHANNEL_READY != rel->ch->state | 850 | if (CADET_CHANNEL_READY != rel->ch->state |
851 | && GNUNET_MESSAGE_TYPE_MESH_DATA_ACK != type | 851 | && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type |
852 | && GNUNET_NO == rel->ch->destroy) | 852 | && GNUNET_NO == rel->ch->destroy) |
853 | { | 853 | { |
854 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task); | 854 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task); |
@@ -875,12 +875,12 @@ ch_message_sent (void *cls, | |||
875 | * @param ch Channel for which to send. | 875 | * @param ch Channel for which to send. |
876 | */ | 876 | */ |
877 | static void | 877 | static void |
878 | send_create (struct MeshChannel *ch) | 878 | send_create (struct CadetChannel *ch) |
879 | { | 879 | { |
880 | struct GNUNET_MESH_ChannelCreate msgcc; | 880 | struct GNUNET_CADET_ChannelCreate msgcc; |
881 | 881 | ||
882 | msgcc.header.size = htons (sizeof (msgcc)); | 882 | msgcc.header.size = htons (sizeof (msgcc)); |
883 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE); | 883 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); |
884 | msgcc.chid = htonl (ch->gid); | 884 | msgcc.chid = htonl (ch->gid); |
885 | msgcc.port = htonl (ch->port); | 885 | msgcc.port = htonl (ch->port); |
886 | msgcc.opt = htonl (channel_get_options (ch)); | 886 | msgcc.opt = htonl (channel_get_options (ch)); |
@@ -897,12 +897,12 @@ send_create (struct MeshChannel *ch) | |||
897 | * @param reaction This ACK is a reaction to a duplicate CREATE, don't save. | 897 | * @param reaction This ACK is a reaction to a duplicate CREATE, don't save. |
898 | */ | 898 | */ |
899 | static void | 899 | static void |
900 | send_ack (struct MeshChannel *ch, int fwd, int reaction) | 900 | send_ack (struct CadetChannel *ch, int fwd, int reaction) |
901 | { | 901 | { |
902 | struct GNUNET_MESH_ChannelManage msg; | 902 | struct GNUNET_CADET_ChannelManage msg; |
903 | 903 | ||
904 | msg.header.size = htons (sizeof (msg)); | 904 | msg.header.size = htons (sizeof (msg)); |
905 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK); | 905 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK); |
906 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", | 906 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", |
907 | GM_f2s (fwd), GMCH_2s (ch)); | 907 | GM_f2s (fwd), GMCH_2s (ch)); |
908 | 908 | ||
@@ -921,7 +921,7 @@ send_ack (struct MeshChannel *ch, int fwd, int reaction) | |||
921 | */ | 921 | */ |
922 | static void | 922 | static void |
923 | fire_and_forget (const struct GNUNET_MessageHeader *msg, | 923 | fire_and_forget (const struct GNUNET_MessageHeader *msg, |
924 | struct MeshChannel *ch, | 924 | struct CadetChannel *ch, |
925 | int force) | 925 | int force) |
926 | { | 926 | { |
927 | GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL, | 927 | GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL, |
@@ -935,12 +935,12 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg, | |||
935 | * @param ch The channel to reject. | 935 | * @param ch The channel to reject. |
936 | */ | 936 | */ |
937 | static void | 937 | static void |
938 | send_nack (struct MeshChannel *ch) | 938 | send_nack (struct CadetChannel *ch) |
939 | { | 939 | { |
940 | struct GNUNET_MESH_ChannelManage msg; | 940 | struct GNUNET_CADET_ChannelManage msg; |
941 | 941 | ||
942 | msg.header.size = htons (sizeof (msg)); | 942 | msg.header.size = htons (sizeof (msg)); |
943 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK); | 943 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK); |
944 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 944 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
945 | " sending channel NACK for channel %s\n", | 945 | " sending channel NACK for channel %s\n", |
946 | GMCH_2s (ch)); | 946 | GMCH_2s (ch)); |
@@ -958,10 +958,10 @@ send_nack (struct MeshChannel *ch) | |||
958 | * @param rel Reliability data for a channel. | 958 | * @param rel Reliability data for a channel. |
959 | */ | 959 | */ |
960 | static void | 960 | static void |
961 | channel_rel_free_all (struct MeshChannelReliability *rel) | 961 | channel_rel_free_all (struct CadetChannelReliability *rel) |
962 | { | 962 | { |
963 | struct MeshReliableMessage *copy; | 963 | struct CadetReliableMessage *copy; |
964 | struct MeshReliableMessage *next; | 964 | struct CadetReliableMessage *next; |
965 | 965 | ||
966 | if (NULL == rel) | 966 | if (NULL == rel) |
967 | return; | 967 | return; |
@@ -1015,11 +1015,11 @@ channel_rel_free_all (struct MeshChannelReliability *rel) | |||
1015 | * @param msg DataACK message with a bitfield of future ACK'd messages. | 1015 | * @param msg DataACK message with a bitfield of future ACK'd messages. |
1016 | */ | 1016 | */ |
1017 | static void | 1017 | static void |
1018 | channel_rel_free_sent (struct MeshChannelReliability *rel, | 1018 | channel_rel_free_sent (struct CadetChannelReliability *rel, |
1019 | const struct GNUNET_MESH_DataACK *msg) | 1019 | const struct GNUNET_CADET_DataACK *msg) |
1020 | { | 1020 | { |
1021 | struct MeshReliableMessage *copy; | 1021 | struct CadetReliableMessage *copy; |
1022 | struct MeshReliableMessage *next; | 1022 | struct CadetReliableMessage *next; |
1023 | uint64_t bitfield; | 1023 | uint64_t bitfield; |
1024 | uint64_t mask; | 1024 | uint64_t mask; |
1025 | uint32_t mid; | 1025 | uint32_t mid; |
@@ -1094,9 +1094,9 @@ channel_rel_free_sent (struct MeshChannelReliability *rel, | |||
1094 | * #GNUNET_NO otherwise. | 1094 | * #GNUNET_NO otherwise. |
1095 | */ | 1095 | */ |
1096 | static int | 1096 | static int |
1097 | rel_message_free (struct MeshReliableMessage *copy, int update_time) | 1097 | rel_message_free (struct CadetReliableMessage *copy, int update_time) |
1098 | { | 1098 | { |
1099 | struct MeshChannelReliability *rel; | 1099 | struct CadetChannelReliability *rel; |
1100 | struct GNUNET_TIME_Relative time; | 1100 | struct GNUNET_TIME_Relative time; |
1101 | 1101 | ||
1102 | rel = copy->rel; | 1102 | rel = copy->rel; |
@@ -1148,10 +1148,10 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time) | |||
1148 | * @param fwd Was the ACK message a FWD ACK? (dest->root, SYNACK) | 1148 | * @param fwd Was the ACK message a FWD ACK? (dest->root, SYNACK) |
1149 | */ | 1149 | */ |
1150 | static void | 1150 | static void |
1151 | channel_confirm (struct MeshChannel *ch, int fwd) | 1151 | channel_confirm (struct CadetChannel *ch, int fwd) |
1152 | { | 1152 | { |
1153 | struct MeshChannelReliability *rel; | 1153 | struct CadetChannelReliability *rel; |
1154 | enum MeshChannelState oldstate; | 1154 | enum CadetChannelState oldstate; |
1155 | 1155 | ||
1156 | rel = fwd ? ch->root_rel : ch->dest_rel; | 1156 | rel = fwd ? ch->root_rel : ch->dest_rel; |
1157 | if (NULL == rel) | 1157 | if (NULL == rel) |
@@ -1162,9 +1162,9 @@ channel_confirm (struct MeshChannel *ch, int fwd) | |||
1162 | LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n", | 1162 | LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n", |
1163 | GM_f2s (fwd), GMCH_2s (ch)); | 1163 | GM_f2s (fwd), GMCH_2s (ch)); |
1164 | oldstate = ch->state; | 1164 | oldstate = ch->state; |
1165 | ch->state = MESH_CHANNEL_READY; | 1165 | ch->state = CADET_CHANNEL_READY; |
1166 | 1166 | ||
1167 | if (MESH_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch)) | 1167 | if (CADET_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch)) |
1168 | { | 1168 | { |
1169 | rel->client_ready = GNUNET_YES; | 1169 | rel->client_ready = GNUNET_YES; |
1170 | rel->expected_delay = rel->retry_timer; | 1170 | rel->expected_delay = rel->retry_timer; |
@@ -1208,13 +1208,13 @@ channel_confirm (struct MeshChannel *ch, int fwd) | |||
1208 | * @param msg Message to copy. | 1208 | * @param msg Message to copy. |
1209 | * @param fwd Is this fwd traffic? | 1209 | * @param fwd Is this fwd traffic? |
1210 | */ | 1210 | */ |
1211 | static struct MeshReliableMessage * | 1211 | static struct CadetReliableMessage * |
1212 | channel_save_copy (struct MeshChannel *ch, | 1212 | channel_save_copy (struct CadetChannel *ch, |
1213 | const struct GNUNET_MessageHeader *msg, | 1213 | const struct GNUNET_MessageHeader *msg, |
1214 | int fwd) | 1214 | int fwd) |
1215 | { | 1215 | { |
1216 | struct MeshChannelReliability *rel; | 1216 | struct CadetChannelReliability *rel; |
1217 | struct MeshReliableMessage *copy; | 1217 | struct CadetReliableMessage *copy; |
1218 | uint32_t mid; | 1218 | uint32_t mid; |
1219 | uint16_t type; | 1219 | uint16_t type; |
1220 | uint16_t size; | 1220 | uint16_t size; |
@@ -1225,7 +1225,7 @@ channel_save_copy (struct MeshChannel *ch, | |||
1225 | size = ntohs (msg->size); | 1225 | size = ntohs (msg->size); |
1226 | 1226 | ||
1227 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type)); | 1227 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type)); |
1228 | copy = GNUNET_malloc (sizeof (struct MeshReliableMessage) + size); | 1228 | copy = GNUNET_malloc (sizeof (struct CadetReliableMessage) + size); |
1229 | LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy); | 1229 | LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy); |
1230 | copy->mid = mid; | 1230 | copy->mid = mid; |
1231 | copy->rel = rel; | 1231 | copy->rel = rel; |
@@ -1247,14 +1247,14 @@ channel_save_copy (struct MeshChannel *ch, | |||
1247 | * | 1247 | * |
1248 | * @return A new initialized channel. NULL on error. | 1248 | * @return A new initialized channel. NULL on error. |
1249 | */ | 1249 | */ |
1250 | static struct MeshChannel * | 1250 | static struct CadetChannel * |
1251 | channel_new (struct MeshTunnel3 *t, | 1251 | channel_new (struct CadetTunnel3 *t, |
1252 | struct MeshClient *owner, | 1252 | struct CadetClient *owner, |
1253 | MESH_ChannelNumber lid_root) | 1253 | CADET_ChannelNumber lid_root) |
1254 | { | 1254 | { |
1255 | struct MeshChannel *ch; | 1255 | struct CadetChannel *ch; |
1256 | 1256 | ||
1257 | ch = GNUNET_new (struct MeshChannel); | 1257 | ch = GNUNET_new (struct CadetChannel); |
1258 | ch->root = owner; | 1258 | ch->root = owner; |
1259 | ch->lid_root = lid_root; | 1259 | ch->lid_root = lid_root; |
1260 | ch->t = t; | 1260 | ch->t = t; |
@@ -1280,7 +1280,7 @@ channel_new (struct MeshTunnel3 *t, | |||
1280 | * @param fwd Is this FWD traffic? | 1280 | * @param fwd Is this FWD traffic? |
1281 | */ | 1281 | */ |
1282 | void | 1282 | void |
1283 | handle_loopback (struct MeshChannel *ch, | 1283 | handle_loopback (struct CadetChannel *ch, |
1284 | const struct GNUNET_MessageHeader *msgh, | 1284 | const struct GNUNET_MessageHeader *msgh, |
1285 | int fwd) | 1285 | int fwd) |
1286 | { | 1286 | { |
@@ -1293,35 +1293,35 @@ handle_loopback (struct MeshChannel *ch, | |||
1293 | 1293 | ||
1294 | switch (type) | 1294 | switch (type) |
1295 | { | 1295 | { |
1296 | case GNUNET_MESSAGE_TYPE_MESH_DATA: | 1296 | case GNUNET_MESSAGE_TYPE_CADET_DATA: |
1297 | /* Don't send hop ACK, wait for client to ACK */ | 1297 | /* Don't send hop ACK, wait for client to ACK */ |
1298 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n", | 1298 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n", |
1299 | ntohl (((struct GNUNET_MESH_Data *) msgh)->mid), ntohs (msgh->size)); | 1299 | ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs (msgh->size)); |
1300 | GMCH_handle_data (ch, (struct GNUNET_MESH_Data *) msgh, fwd); | 1300 | GMCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd); |
1301 | break; | 1301 | break; |
1302 | 1302 | ||
1303 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | 1303 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: |
1304 | GMCH_handle_data_ack (ch, (struct GNUNET_MESH_DataACK *) msgh, fwd); | 1304 | GMCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd); |
1305 | break; | 1305 | break; |
1306 | 1306 | ||
1307 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 1307 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: |
1308 | GMCH_handle_create (ch->t, | 1308 | GMCH_handle_create (ch->t, |
1309 | (struct GNUNET_MESH_ChannelCreate *) msgh); | 1309 | (struct GNUNET_CADET_ChannelCreate *) msgh); |
1310 | break; | 1310 | break; |
1311 | 1311 | ||
1312 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: | 1312 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: |
1313 | GMCH_handle_ack (ch, | 1313 | GMCH_handle_ack (ch, |
1314 | (struct GNUNET_MESH_ChannelManage *) msgh, | 1314 | (struct GNUNET_CADET_ChannelManage *) msgh, |
1315 | fwd); | 1315 | fwd); |
1316 | break; | 1316 | break; |
1317 | 1317 | ||
1318 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: | 1318 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: |
1319 | GMCH_handle_nack (ch); | 1319 | GMCH_handle_nack (ch); |
1320 | break; | 1320 | break; |
1321 | 1321 | ||
1322 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: | 1322 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
1323 | GMCH_handle_destroy (ch, | 1323 | GMCH_handle_destroy (ch, |
1324 | (struct GNUNET_MESH_ChannelManage *) msgh, | 1324 | (struct GNUNET_CADET_ChannelManage *) msgh, |
1325 | fwd); | 1325 | fwd); |
1326 | break; | 1326 | break; |
1327 | 1327 | ||
@@ -1345,10 +1345,10 @@ handle_loopback (struct MeshChannel *ch, | |||
1345 | * @param ch Channel to destroy. | 1345 | * @param ch Channel to destroy. |
1346 | */ | 1346 | */ |
1347 | void | 1347 | void |
1348 | GMCH_destroy (struct MeshChannel *ch) | 1348 | GMCH_destroy (struct CadetChannel *ch) |
1349 | { | 1349 | { |
1350 | struct MeshClient *c; | 1350 | struct CadetClient *c; |
1351 | struct MeshTunnel3 *t; | 1351 | struct CadetTunnel3 *t; |
1352 | 1352 | ||
1353 | if (NULL == ch) | 1353 | if (NULL == ch) |
1354 | return; | 1354 | return; |
@@ -1391,8 +1391,8 @@ GMCH_destroy (struct MeshChannel *ch) | |||
1391 | * | 1391 | * |
1392 | * @return ID used to identify the channel with the remote peer. | 1392 | * @return ID used to identify the channel with the remote peer. |
1393 | */ | 1393 | */ |
1394 | MESH_ChannelNumber | 1394 | CADET_ChannelNumber |
1395 | GMCH_get_id (const struct MeshChannel *ch) | 1395 | GMCH_get_id (const struct CadetChannel *ch) |
1396 | { | 1396 | { |
1397 | return ch->gid; | 1397 | return ch->gid; |
1398 | } | 1398 | } |
@@ -1405,8 +1405,8 @@ GMCH_get_id (const struct MeshChannel *ch) | |||
1405 | * | 1405 | * |
1406 | * @return tunnel of the channel. | 1406 | * @return tunnel of the channel. |
1407 | */ | 1407 | */ |
1408 | struct MeshTunnel3 * | 1408 | struct CadetTunnel3 * |
1409 | GMCH_get_tunnel (const struct MeshChannel *ch) | 1409 | GMCH_get_tunnel (const struct CadetChannel *ch) |
1410 | { | 1410 | { |
1411 | return ch->t; | 1411 | return ch->t; |
1412 | } | 1412 | } |
@@ -1421,9 +1421,9 @@ GMCH_get_tunnel (const struct MeshChannel *ch) | |||
1421 | * @return Free buffer space [0 - 64] | 1421 | * @return Free buffer space [0 - 64] |
1422 | */ | 1422 | */ |
1423 | unsigned int | 1423 | unsigned int |
1424 | GMCH_get_buffer (struct MeshChannel *ch, int fwd) | 1424 | GMCH_get_buffer (struct CadetChannel *ch, int fwd) |
1425 | { | 1425 | { |
1426 | struct MeshChannelReliability *rel; | 1426 | struct CadetChannelReliability *rel; |
1427 | 1427 | ||
1428 | rel = fwd ? ch->dest_rel : ch->root_rel; | 1428 | rel = fwd ? ch->dest_rel : ch->root_rel; |
1429 | 1429 | ||
@@ -1447,9 +1447,9 @@ GMCH_get_buffer (struct MeshChannel *ch, int fwd) | |||
1447 | * @return #GNUNET_YES if client is allowed to send us data. | 1447 | * @return #GNUNET_YES if client is allowed to send us data. |
1448 | */ | 1448 | */ |
1449 | int | 1449 | int |
1450 | GMCH_get_allowed (struct MeshChannel *ch, int fwd) | 1450 | GMCH_get_allowed (struct CadetChannel *ch, int fwd) |
1451 | { | 1451 | { |
1452 | struct MeshChannelReliability *rel; | 1452 | struct CadetChannelReliability *rel; |
1453 | 1453 | ||
1454 | rel = fwd ? ch->root_rel : ch->dest_rel; | 1454 | rel = fwd ? ch->root_rel : ch->dest_rel; |
1455 | 1455 | ||
@@ -1473,9 +1473,9 @@ GMCH_get_allowed (struct MeshChannel *ch, int fwd) | |||
1473 | * @return #GNUNET_YES in case it is. | 1473 | * @return #GNUNET_YES in case it is. |
1474 | */ | 1474 | */ |
1475 | int | 1475 | int |
1476 | GMCH_is_origin (struct MeshChannel *ch, int fwd) | 1476 | GMCH_is_origin (struct CadetChannel *ch, int fwd) |
1477 | { | 1477 | { |
1478 | struct MeshClient *c; | 1478 | struct CadetClient *c; |
1479 | 1479 | ||
1480 | c = fwd ? ch->root : ch->dest; | 1480 | c = fwd ? ch->root : ch->dest; |
1481 | return NULL != c; | 1481 | return NULL != c; |
@@ -1491,9 +1491,9 @@ GMCH_is_origin (struct MeshChannel *ch, int fwd) | |||
1491 | * @return #GNUNET_YES in case it is. | 1491 | * @return #GNUNET_YES in case it is. |
1492 | */ | 1492 | */ |
1493 | int | 1493 | int |
1494 | GMCH_is_terminal (struct MeshChannel *ch, int fwd) | 1494 | GMCH_is_terminal (struct CadetChannel *ch, int fwd) |
1495 | { | 1495 | { |
1496 | struct MeshClient *c; | 1496 | struct CadetClient *c; |
1497 | 1497 | ||
1498 | c = fwd ? ch->dest : ch->root; | 1498 | c = fwd ? ch->dest : ch->root; |
1499 | return NULL != c; | 1499 | return NULL != c; |
@@ -1509,11 +1509,11 @@ GMCH_is_terminal (struct MeshChannel *ch, int fwd) | |||
1509 | * @param fwd Is for FWD traffic? (ACK dest->owner) | 1509 | * @param fwd Is for FWD traffic? (ACK dest->owner) |
1510 | */ | 1510 | */ |
1511 | void | 1511 | void |
1512 | GMCH_send_data_ack (struct MeshChannel *ch, int fwd) | 1512 | GMCH_send_data_ack (struct CadetChannel *ch, int fwd) |
1513 | { | 1513 | { |
1514 | struct GNUNET_MESH_DataACK msg; | 1514 | struct GNUNET_CADET_DataACK msg; |
1515 | struct MeshChannelReliability *rel; | 1515 | struct CadetChannelReliability *rel; |
1516 | struct MeshReliableMessage *copy; | 1516 | struct CadetReliableMessage *copy; |
1517 | unsigned int delta; | 1517 | unsigned int delta; |
1518 | uint64_t mask; | 1518 | uint64_t mask; |
1519 | uint32_t ack; | 1519 | uint32_t ack; |
@@ -1526,13 +1526,13 @@ GMCH_send_data_ack (struct MeshChannel *ch, int fwd) | |||
1526 | ack = rel->mid_recv - 1; | 1526 | ack = rel->mid_recv - 1; |
1527 | LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u\n", ack); | 1527 | LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u\n", ack); |
1528 | 1528 | ||
1529 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK); | 1529 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK); |
1530 | msg.header.size = htons (sizeof (msg)); | 1530 | msg.header.size = htons (sizeof (msg)); |
1531 | msg.chid = htonl (ch->gid); | 1531 | msg.chid = htonl (ch->gid); |
1532 | msg.futures = 0; | 1532 | msg.futures = 0; |
1533 | for (copy = rel->head_recv; NULL != copy; copy = copy->next) | 1533 | for (copy = rel->head_recv; NULL != copy; copy = copy->next) |
1534 | { | 1534 | { |
1535 | if (copy->type != GNUNET_MESSAGE_TYPE_MESH_DATA) | 1535 | if (copy->type != GNUNET_MESSAGE_TYPE_CADET_DATA) |
1536 | { | 1536 | { |
1537 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1537 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1538 | "!! Type %s, expected DATA\n", | 1538 | "!! Type %s, expected DATA\n", |
@@ -1570,14 +1570,14 @@ GMCH_send_data_ack (struct MeshChannel *ch, int fwd) | |||
1570 | * @param fwd Is this about FWD traffic? (Root client). | 1570 | * @param fwd Is this about FWD traffic? (Root client). |
1571 | */ | 1571 | */ |
1572 | void | 1572 | void |
1573 | GMCH_allow_client (struct MeshChannel *ch, int fwd) | 1573 | GMCH_allow_client (struct CadetChannel *ch, int fwd) |
1574 | { | 1574 | { |
1575 | struct MeshChannelReliability *rel; | 1575 | struct CadetChannelReliability *rel; |
1576 | unsigned int buffer; | 1576 | unsigned int buffer; |
1577 | 1577 | ||
1578 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH allow\n"); | 1578 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH allow\n"); |
1579 | 1579 | ||
1580 | if (MESH_CHANNEL_READY != ch->state) | 1580 | if (CADET_CHANNEL_READY != ch->state) |
1581 | { | 1581 | { |
1582 | LOG (GNUNET_ERROR_TYPE_DEBUG, " channel not ready yet!\n"); | 1582 | LOG (GNUNET_ERROR_TYPE_DEBUG, " channel not ready yet!\n"); |
1583 | return; | 1583 | return; |
@@ -1630,7 +1630,7 @@ GMCH_allow_client (struct MeshChannel *ch, int fwd) | |||
1630 | * @param ch Channel. | 1630 | * @param ch Channel. |
1631 | */ | 1631 | */ |
1632 | void | 1632 | void |
1633 | GMCH_debug (struct MeshChannel *ch) | 1633 | GMCH_debug (struct CadetChannel *ch) |
1634 | { | 1634 | { |
1635 | if (NULL == ch) | 1635 | if (NULL == ch) |
1636 | { | 1636 | { |
@@ -1669,10 +1669,10 @@ GMCH_debug (struct MeshChannel *ch) | |||
1669 | * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK) | 1669 | * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK) |
1670 | */ | 1670 | */ |
1671 | void | 1671 | void |
1672 | GMCH_handle_local_ack (struct MeshChannel *ch, int fwd) | 1672 | GMCH_handle_local_ack (struct CadetChannel *ch, int fwd) |
1673 | { | 1673 | { |
1674 | struct MeshChannelReliability *rel; | 1674 | struct CadetChannelReliability *rel; |
1675 | struct MeshClient *c; | 1675 | struct CadetClient *c; |
1676 | 1676 | ||
1677 | rel = fwd ? ch->dest_rel : ch->root_rel; | 1677 | rel = fwd ? ch->dest_rel : ch->root_rel; |
1678 | c = fwd ? ch->dest : ch->root; | 1678 | c = fwd ? ch->dest : ch->root; |
@@ -1717,15 +1717,15 @@ GMCH_handle_local_ack (struct MeshChannel *ch, int fwd) | |||
1717 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. | 1717 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. |
1718 | */ | 1718 | */ |
1719 | int | 1719 | int |
1720 | GMCH_handle_local_data (struct MeshChannel *ch, | 1720 | GMCH_handle_local_data (struct CadetChannel *ch, |
1721 | struct MeshClient *c, | 1721 | struct CadetClient *c, |
1722 | struct GNUNET_MessageHeader *message, | 1722 | struct GNUNET_MessageHeader *message, |
1723 | int fwd) | 1723 | int fwd) |
1724 | { | 1724 | { |
1725 | struct MeshChannelReliability *rel; | 1725 | struct CadetChannelReliability *rel; |
1726 | struct GNUNET_MESH_Data *payload; | 1726 | struct GNUNET_CADET_Data *payload; |
1727 | size_t size = ntohs (message->size); | 1727 | size_t size = ntohs (message->size); |
1728 | uint16_t p2p_size = sizeof(struct GNUNET_MESH_Data) + size; | 1728 | uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size; |
1729 | unsigned char cbuf[p2p_size]; | 1729 | unsigned char cbuf[p2p_size]; |
1730 | 1730 | ||
1731 | /* Is the client in the channel? */ | 1731 | /* Is the client in the channel? */ |
@@ -1750,12 +1750,12 @@ GMCH_handle_local_data (struct MeshChannel *ch, | |||
1750 | rel->client_allowed = GNUNET_NO; | 1750 | rel->client_allowed = GNUNET_NO; |
1751 | 1751 | ||
1752 | /* Ok, everything is correct, send the message. */ | 1752 | /* Ok, everything is correct, send the message. */ |
1753 | payload = (struct GNUNET_MESH_Data *) cbuf; | 1753 | payload = (struct GNUNET_CADET_Data *) cbuf; |
1754 | payload->mid = htonl (rel->mid_send); | 1754 | payload->mid = htonl (rel->mid_send); |
1755 | rel->mid_send++; | 1755 | rel->mid_send++; |
1756 | memcpy (&payload[1], message, size); | 1756 | memcpy (&payload[1], message, size); |
1757 | payload->header.size = htons (p2p_size); | 1757 | payload->header.size = htons (p2p_size); |
1758 | payload->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA); | 1758 | payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA); |
1759 | payload->chid = htonl (ch->gid); | 1759 | payload->chid = htonl (ch->gid); |
1760 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); | 1760 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); |
1761 | GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); | 1761 | GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); |
@@ -1787,8 +1787,8 @@ GMCH_handle_local_data (struct MeshChannel *ch, | |||
1787 | * @param is_root Is the request coming from root? | 1787 | * @param is_root Is the request coming from root? |
1788 | */ | 1788 | */ |
1789 | void | 1789 | void |
1790 | GMCH_handle_local_destroy (struct MeshChannel *ch, | 1790 | GMCH_handle_local_destroy (struct CadetChannel *ch, |
1791 | struct MeshClient *c, | 1791 | struct CadetClient *c, |
1792 | int is_root) | 1792 | int is_root) |
1793 | { | 1793 | { |
1794 | ch->destroy = GNUNET_YES; | 1794 | ch->destroy = GNUNET_YES; |
@@ -1823,13 +1823,13 @@ GMCH_handle_local_destroy (struct MeshChannel *ch, | |||
1823 | * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. | 1823 | * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. |
1824 | */ | 1824 | */ |
1825 | int | 1825 | int |
1826 | GMCH_handle_local_create (struct MeshClient *c, | 1826 | GMCH_handle_local_create (struct CadetClient *c, |
1827 | struct GNUNET_MESH_ChannelMessage *msg) | 1827 | struct GNUNET_CADET_ChannelMessage *msg) |
1828 | { | 1828 | { |
1829 | struct MeshChannel *ch; | 1829 | struct CadetChannel *ch; |
1830 | struct MeshTunnel3 *t; | 1830 | struct CadetTunnel3 *t; |
1831 | struct MeshPeer *peer; | 1831 | struct CadetPeer *peer; |
1832 | MESH_ChannelNumber chid; | 1832 | CADET_ChannelNumber chid; |
1833 | 1833 | ||
1834 | LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", | 1834 | LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", |
1835 | GNUNET_i2s (&msg->peer), ntohl (msg->port)); | 1835 | GNUNET_i2s (&msg->peer), ntohl (msg->port)); |
@@ -1848,7 +1848,7 @@ GMCH_handle_local_create (struct MeshClient *c, | |||
1848 | 1848 | ||
1849 | if (GMP_get_short_id (peer) == myid) | 1849 | if (GMP_get_short_id (peer) == myid) |
1850 | { | 1850 | { |
1851 | GMT_change_cstate (t, MESH_TUNNEL3_READY); | 1851 | GMT_change_cstate (t, CADET_TUNNEL3_READY); |
1852 | } | 1852 | } |
1853 | else | 1853 | else |
1854 | { | 1854 | { |
@@ -1867,9 +1867,9 @@ GMCH_handle_local_create (struct MeshClient *c, | |||
1867 | channel_set_options (ch, ntohl (msg->opt)); | 1867 | channel_set_options (ch, ntohl (msg->opt)); |
1868 | 1868 | ||
1869 | /* In unreliable channels, we'll use the DLL to buffer BCK data */ | 1869 | /* In unreliable channels, we'll use the DLL to buffer BCK data */ |
1870 | ch->root_rel = GNUNET_new (struct MeshChannelReliability); | 1870 | ch->root_rel = GNUNET_new (struct CadetChannelReliability); |
1871 | ch->root_rel->ch = ch; | 1871 | ch->root_rel->ch = ch; |
1872 | ch->root_rel->retry_timer = MESH_RETRANSMIT_TIME; | 1872 | ch->root_rel->retry_timer = CADET_RETRANSMIT_TIME; |
1873 | ch->root_rel->expected_delay.rel_value_us = 0; | 1873 | ch->root_rel->expected_delay.rel_value_us = 0; |
1874 | 1874 | ||
1875 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch)); | 1875 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch)); |
@@ -1881,7 +1881,7 @@ GMCH_handle_local_create (struct MeshClient *c, | |||
1881 | 1881 | ||
1882 | 1882 | ||
1883 | /** | 1883 | /** |
1884 | * Handler for mesh network payload traffic. | 1884 | * Handler for cadet network payload traffic. |
1885 | * | 1885 | * |
1886 | * @param ch Channel for the message. | 1886 | * @param ch Channel for the message. |
1887 | * @param msg Unencryted data message. | 1887 | * @param msg Unencryted data message. |
@@ -1891,12 +1891,12 @@ GMCH_handle_local_create (struct MeshClient *c, | |||
1891 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | 1891 | * #GNUNET_SYSERR if message on a one-ended channel (remote) |
1892 | */ | 1892 | */ |
1893 | void | 1893 | void |
1894 | GMCH_handle_data (struct MeshChannel *ch, | 1894 | GMCH_handle_data (struct CadetChannel *ch, |
1895 | const struct GNUNET_MESH_Data *msg, | 1895 | const struct GNUNET_CADET_Data *msg, |
1896 | int fwd) | 1896 | int fwd) |
1897 | { | 1897 | { |
1898 | struct MeshChannelReliability *rel; | 1898 | struct CadetChannelReliability *rel; |
1899 | struct MeshClient *c; | 1899 | struct CadetClient *c; |
1900 | uint32_t mid; | 1900 | uint32_t mid; |
1901 | 1901 | ||
1902 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | 1902 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ |
@@ -1921,7 +1921,7 @@ GMCH_handle_data (struct MeshChannel *ch, | |||
1921 | return; | 1921 | return; |
1922 | } | 1922 | } |
1923 | 1923 | ||
1924 | if (MESH_CHANNEL_READY != ch->state) | 1924 | if (CADET_CHANNEL_READY != ch->state) |
1925 | { | 1925 | { |
1926 | if (GNUNET_NO == fwd) | 1926 | if (GNUNET_NO == fwd) |
1927 | { | 1927 | { |
@@ -1986,7 +1986,7 @@ GMCH_handle_data (struct MeshChannel *ch, | |||
1986 | 1986 | ||
1987 | 1987 | ||
1988 | /** | 1988 | /** |
1989 | * Handler for mesh network traffic end-to-end ACKs. | 1989 | * Handler for cadet network traffic end-to-end ACKs. |
1990 | * | 1990 | * |
1991 | * @param ch Channel on which we got this message. | 1991 | * @param ch Channel on which we got this message. |
1992 | * @param msg Data message. | 1992 | * @param msg Data message. |
@@ -1996,13 +1996,13 @@ GMCH_handle_data (struct MeshChannel *ch, | |||
1996 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | 1996 | * #GNUNET_SYSERR if message on a one-ended channel (remote) |
1997 | */ | 1997 | */ |
1998 | void | 1998 | void |
1999 | GMCH_handle_data_ack (struct MeshChannel *ch, | 1999 | GMCH_handle_data_ack (struct CadetChannel *ch, |
2000 | const struct GNUNET_MESH_DataACK *msg, | 2000 | const struct GNUNET_CADET_DataACK *msg, |
2001 | int fwd) | 2001 | int fwd) |
2002 | { | 2002 | { |
2003 | struct MeshChannelReliability *rel; | 2003 | struct CadetChannelReliability *rel; |
2004 | struct MeshReliableMessage *copy; | 2004 | struct CadetReliableMessage *copy; |
2005 | struct MeshReliableMessage *next; | 2005 | struct CadetReliableMessage *next; |
2006 | uint32_t ack; | 2006 | uint32_t ack; |
2007 | int work; | 2007 | int work; |
2008 | 2008 | ||
@@ -2068,7 +2068,7 @@ GMCH_handle_data_ack (struct MeshChannel *ch, | |||
2068 | struct GNUNET_TIME_Relative delay; | 2068 | struct GNUNET_TIME_Relative delay; |
2069 | 2069 | ||
2070 | delay = GNUNET_TIME_relative_multiply (rel->retry_timer, | 2070 | delay = GNUNET_TIME_relative_multiply (rel->retry_timer, |
2071 | MESH_RETRANSMIT_MARGIN); | 2071 | CADET_RETRANSMIT_MARGIN); |
2072 | new_target = GNUNET_TIME_absolute_add (rel->head_sent->timestamp, | 2072 | new_target = GNUNET_TIME_absolute_add (rel->head_sent->timestamp, |
2073 | delay); | 2073 | delay); |
2074 | delay = GNUNET_TIME_absolute_get_remaining (new_target); | 2074 | delay = GNUNET_TIME_absolute_get_remaining (new_target); |
@@ -2095,13 +2095,13 @@ GMCH_handle_data_ack (struct MeshChannel *ch, | |||
2095 | * @param t Tunnel this channel will be in. | 2095 | * @param t Tunnel this channel will be in. |
2096 | * @param msg Channel crate message. | 2096 | * @param msg Channel crate message. |
2097 | */ | 2097 | */ |
2098 | struct MeshChannel * | 2098 | struct CadetChannel * |
2099 | GMCH_handle_create (struct MeshTunnel3 *t, | 2099 | GMCH_handle_create (struct CadetTunnel3 *t, |
2100 | const struct GNUNET_MESH_ChannelCreate *msg) | 2100 | const struct GNUNET_CADET_ChannelCreate *msg) |
2101 | { | 2101 | { |
2102 | MESH_ChannelNumber chid; | 2102 | CADET_ChannelNumber chid; |
2103 | struct MeshChannel *ch; | 2103 | struct CadetChannel *ch; |
2104 | struct MeshClient *c; | 2104 | struct CadetClient *c; |
2105 | int new_channel; | 2105 | int new_channel; |
2106 | int reaction; | 2106 | int reaction; |
2107 | 2107 | ||
@@ -2155,7 +2155,7 @@ GMCH_handle_create (struct MeshTunnel3 *t, | |||
2155 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n"); | 2155 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n"); |
2156 | 2156 | ||
2157 | send_client_create (ch); | 2157 | send_client_create (ch); |
2158 | ch->state = MESH_CHANNEL_SENT; | 2158 | ch->state = CADET_CHANNEL_SENT; |
2159 | } | 2159 | } |
2160 | else | 2160 | else |
2161 | { | 2161 | { |
@@ -2183,7 +2183,7 @@ GMCH_handle_create (struct MeshTunnel3 *t, | |||
2183 | * @param ch Channel. | 2183 | * @param ch Channel. |
2184 | */ | 2184 | */ |
2185 | void | 2185 | void |
2186 | GMCH_handle_nack (struct MeshChannel *ch) | 2186 | GMCH_handle_nack (struct CadetChannel *ch) |
2187 | { | 2187 | { |
2188 | send_client_nack (ch); | 2188 | send_client_nack (ch); |
2189 | GMCH_destroy (ch); | 2189 | GMCH_destroy (ch); |
@@ -2201,8 +2201,8 @@ GMCH_handle_nack (struct MeshChannel *ch) | |||
2201 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | 2201 | * #GNUNET_SYSERR if message on a one-ended channel (remote) |
2202 | */ | 2202 | */ |
2203 | void | 2203 | void |
2204 | GMCH_handle_ack (struct MeshChannel *ch, | 2204 | GMCH_handle_ack (struct CadetChannel *ch, |
2205 | const struct GNUNET_MESH_ChannelManage *msg, | 2205 | const struct GNUNET_CADET_ChannelManage *msg, |
2206 | int fwd) | 2206 | int fwd) |
2207 | { | 2207 | { |
2208 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | 2208 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ |
@@ -2232,11 +2232,11 @@ GMCH_handle_ack (struct MeshChannel *ch, | |||
2232 | * #GNUNET_SYSERR if message on a one-ended channel (remote) | 2232 | * #GNUNET_SYSERR if message on a one-ended channel (remote) |
2233 | */ | 2233 | */ |
2234 | void | 2234 | void |
2235 | GMCH_handle_destroy (struct MeshChannel *ch, | 2235 | GMCH_handle_destroy (struct CadetChannel *ch, |
2236 | const struct GNUNET_MESH_ChannelManage *msg, | 2236 | const struct GNUNET_CADET_ChannelManage *msg, |
2237 | int fwd) | 2237 | int fwd) |
2238 | { | 2238 | { |
2239 | struct MeshChannelReliability *rel; | 2239 | struct CadetChannelReliability *rel; |
2240 | 2240 | ||
2241 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | 2241 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ |
2242 | if (GNUNET_SYSERR == fwd) | 2242 | if (GNUNET_SYSERR == fwd) |
@@ -2288,10 +2288,10 @@ GMCH_handle_destroy (struct MeshChannel *ch, | |||
2288 | */ | 2288 | */ |
2289 | void | 2289 | void |
2290 | GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | 2290 | GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, |
2291 | struct MeshChannel *ch, int fwd, | 2291 | struct CadetChannel *ch, int fwd, |
2292 | void *existing_copy) | 2292 | void *existing_copy) |
2293 | { | 2293 | { |
2294 | struct MeshChannelQueue *chq; | 2294 | struct CadetChannelQueue *chq; |
2295 | uint16_t type; | 2295 | uint16_t type; |
2296 | 2296 | ||
2297 | type = ntohs (message->type); | 2297 | type = ntohs (message->type); |
@@ -2306,21 +2306,21 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2306 | 2306 | ||
2307 | switch (type) | 2307 | switch (type) |
2308 | { | 2308 | { |
2309 | struct GNUNET_MESH_Data *payload; | 2309 | struct GNUNET_CADET_Data *payload; |
2310 | case GNUNET_MESSAGE_TYPE_MESH_DATA: | 2310 | case GNUNET_MESSAGE_TYPE_CADET_DATA: |
2311 | 2311 | ||
2312 | payload = (struct GNUNET_MESH_Data *) message; | 2312 | payload = (struct GNUNET_CADET_Data *) message; |
2313 | LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n", | 2313 | LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n", |
2314 | GM_m2s (type), ntohl (payload->mid)); | 2314 | GM_m2s (type), ntohl (payload->mid)); |
2315 | if (GNUNET_YES == ch->reliable) | 2315 | if (GNUNET_YES == ch->reliable) |
2316 | { | 2316 | { |
2317 | chq = GNUNET_new (struct MeshChannelQueue); | 2317 | chq = GNUNET_new (struct CadetChannelQueue); |
2318 | chq->type = type; | 2318 | chq->type = type; |
2319 | if (NULL == existing_copy) | 2319 | if (NULL == existing_copy) |
2320 | chq->copy = channel_save_copy (ch, message, fwd); | 2320 | chq->copy = channel_save_copy (ch, message, fwd); |
2321 | else | 2321 | else |
2322 | { | 2322 | { |
2323 | chq->copy = (struct MeshReliableMessage *) existing_copy; | 2323 | chq->copy = (struct CadetReliableMessage *) existing_copy; |
2324 | if (NULL != chq->copy->chq) | 2324 | if (NULL != chq->copy->chq) |
2325 | { | 2325 | { |
2326 | /* Last retransmission was queued but not yet sent! | 2326 | /* Last retransmission was queued but not yet sent! |
@@ -2357,7 +2357,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2357 | break; | 2357 | break; |
2358 | 2358 | ||
2359 | 2359 | ||
2360 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: | 2360 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: |
2361 | if (GNUNET_YES == fwd || NULL != existing_copy) | 2361 | if (GNUNET_YES == fwd || NULL != existing_copy) |
2362 | { | 2362 | { |
2363 | /* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/ | 2363 | /* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/ |
@@ -2365,9 +2365,9 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2365 | return; | 2365 | return; |
2366 | } | 2366 | } |
2367 | /* fall-trough */ | 2367 | /* fall-trough */ |
2368 | case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: | 2368 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: |
2369 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 2369 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: |
2370 | chq = GNUNET_new (struct MeshChannelQueue); | 2370 | chq = GNUNET_new (struct CadetChannelQueue); |
2371 | chq->type = type; | 2371 | chq->type = type; |
2372 | chq->rel = fwd ? ch->root_rel : ch->dest_rel; | 2372 | chq->rel = fwd ? ch->root_rel : ch->dest_rel; |
2373 | if (NULL != chq->rel->uniq) | 2373 | if (NULL != chq->rel->uniq) |
@@ -2396,8 +2396,8 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2396 | break; | 2396 | break; |
2397 | 2397 | ||
2398 | 2398 | ||
2399 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: | 2399 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
2400 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: | 2400 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: |
2401 | fire_and_forget (message, ch, GNUNET_YES); | 2401 | fire_and_forget (message, ch, GNUNET_YES); |
2402 | break; | 2402 | break; |
2403 | 2403 | ||
@@ -2418,7 +2418,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2418 | * @return Static string with the channel IDs. | 2418 | * @return Static string with the channel IDs. |
2419 | */ | 2419 | */ |
2420 | const char * | 2420 | const char * |
2421 | GMCH_2s (const struct MeshChannel *ch) | 2421 | GMCH_2s (const struct CadetChannel *ch) |
2422 | { | 2422 | { |
2423 | static char buf[64]; | 2423 | static char buf[64]; |
2424 | 2424 | ||