[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33183 - in gnunet/src: conversation dns exit fs include me
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33183 - in gnunet/src: conversation dns exit fs include mesh pt regex set topology vpn |
Date: |
Wed, 7 May 2014 14:06:50 +0200 |
Author: bartpolot
Date: 2014-05-07 14:06:50 +0200 (Wed, 07 May 2014)
New Revision: 33183
Modified:
gnunet/src/conversation/conversation.h
gnunet/src/conversation/conversation_api_call.c
gnunet/src/conversation/gnunet-service-conversation.c
gnunet/src/dns/dnsstub.c
gnunet/src/exit/exit.h
gnunet/src/exit/gnunet-daemon-exit.c
gnunet/src/fs/fs_api.c
gnunet/src/fs/gnunet-service-fs.c
gnunet/src/fs/gnunet-service-fs_mesh.h
gnunet/src/fs/gnunet-service-fs_mesh_client.c
gnunet/src/fs/gnunet-service-fs_mesh_server.c
gnunet/src/fs/gnunet-service-fs_pr.c
gnunet/src/fs/gnunet-service-fs_pr.h
gnunet/src/fs/test_fs_download.c
gnunet/src/fs/test_gnunet_service_fs_p2p.c
gnunet/src/include/gnunet_applications.h
gnunet/src/include/gnunet_block_lib.h
gnunet/src/include/gnunet_core_service.h
gnunet/src/include/gnunet_mesh_service.h
gnunet/src/include/gnunet_protocols.h
gnunet/src/include/gnunet_signatures.h
gnunet/src/mesh/gnunet-mesh-profiler.c
gnunet/src/mesh/gnunet-mesh.c
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_channel.h
gnunet/src/mesh/gnunet-service-mesh_connection.c
gnunet/src/mesh/gnunet-service-mesh_connection.h
gnunet/src/mesh/gnunet-service-mesh_dht.c
gnunet/src/mesh/gnunet-service-mesh_dht.h
gnunet/src/mesh/gnunet-service-mesh_hello.c
gnunet/src/mesh/gnunet-service-mesh_hello.h
gnunet/src/mesh/gnunet-service-mesh_local.c
gnunet/src/mesh/gnunet-service-mesh_local.h
gnunet/src/mesh/gnunet-service-mesh_peer.c
gnunet/src/mesh/gnunet-service-mesh_peer.h
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.h
gnunet/src/mesh/mesh.h
gnunet/src/mesh/mesh_api.c
gnunet/src/mesh/mesh_common.c
gnunet/src/mesh/mesh_path.c
gnunet/src/mesh/mesh_path.h
gnunet/src/mesh/mesh_protocol.h
gnunet/src/mesh/mesh_test_lib.c
gnunet/src/mesh/mesh_test_lib.h
gnunet/src/mesh/mesh_tunnel_tree.c
gnunet/src/mesh/mesh_tunnel_tree.h
gnunet/src/mesh/test_mesh.c
gnunet/src/mesh/test_mesh_local.c
gnunet/src/mesh/test_mesh_single.c
gnunet/src/pt/gnunet-daemon-pt.c
gnunet/src/regex/gnunet-daemon-regexprofiler.c
gnunet/src/regex/gnunet-regex-simulation-profiler.c
gnunet/src/regex/regex_internal_dht.c
gnunet/src/regex/regex_test_lib.c
gnunet/src/set/gnunet-service-set.c
gnunet/src/set/gnunet-service-set.h
gnunet/src/set/gnunet-service-set_intersection.c
gnunet/src/set/gnunet-service-set_union.c
gnunet/src/topology/gnunet-daemon-topology.c
gnunet/src/vpn/gnunet-service-vpn.c
Log:
Rename mesh->cadet
Modified: gnunet/src/conversation/conversation.h
===================================================================
--- gnunet/src/conversation/conversation.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/conversation/conversation.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -235,12 +235,12 @@
/**
- * Mesh message for phone is ringing.
+ * Cadet message for phone is ringing.
*/
-struct MeshPhoneRingMessage
+struct CadetPhoneRingMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
*/
struct GNUNET_MessageHeader header;
@@ -288,12 +288,12 @@
/**
- * Mesh message for hanging up.
+ * Cadet message for hanging up.
*/
-struct MeshPhoneHangupMessage
+struct CadetPhoneHangupMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
*/
struct GNUNET_MessageHeader header;
@@ -301,12 +301,12 @@
/**
- * Mesh message for picking up.
+ * Cadet message for picking up.
*/
-struct MeshPhonePickupMessage
+struct CadetPhonePickupMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
*/
struct GNUNET_MessageHeader header;
@@ -314,12 +314,12 @@
/**
- * Mesh message for phone suspended.
+ * Cadet message for phone suspended.
*/
-struct MeshPhoneSuspendMessage
+struct CadetPhoneSuspendMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
*/
struct GNUNET_MessageHeader header;
@@ -327,12 +327,12 @@
/**
- * Mesh message for phone resumed.
+ * Cadet message for phone resumed.
*/
-struct MeshPhoneResumeMessage
+struct CadetPhoneResumeMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
*/
struct GNUNET_MessageHeader header;
@@ -340,12 +340,12 @@
/**
- * Mesh message to transmit the audio.
+ * Cadet message to transmit the audio.
*/
-struct MeshAudioMessage
+struct CadetAudioMessage
{
/**
- * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO
+ * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
*/
struct GNUNET_MessageHeader header;
Modified: gnunet/src/conversation/conversation_api_call.c
===================================================================
--- gnunet/src/conversation/conversation_api_call.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/conversation/conversation_api_call.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -384,7 +384,7 @@
break;
case CS_SUSPENDED_CALLEE:
case CS_SUSPENDED_BOTH:
- /* can (rarely) also happen: other peer suspended, but mesh might
+ /* can (rarely) also happen: other peer suspended, but cadet might
have had delayed data on the unreliable channel */
break;
case CS_ACTIVE:
Modified: gnunet/src/conversation/gnunet-service-conversation.c
===================================================================
--- gnunet/src/conversation/gnunet-service-conversation.c 2014-05-07
10:42:58 UTC (rev 33182)
+++ gnunet/src/conversation/gnunet-service-conversation.c 2014-05-07
12:06:50 UTC (rev 33183)
@@ -30,7 +30,7 @@
#include "gnunet_applications.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_conversation_service.h"
#include "conversation.h"
@@ -44,8 +44,8 @@
/**
- * A line connects a local client with a mesh channel (or, if it is an
- * open line, is waiting for a mesh channel).
+ * A line connects a local client with a cadet channel (or, if it is an
+ * open line, is waiting for a cadet channel).
*/
struct Line;
@@ -88,7 +88,7 @@
/**
- * A `struct Channel` represents a mesh channel, which is a P2P
+ * A `struct Channel` represents a cadet channel, which is a P2P
* connection to another conversation service. Multiple channels can
* be attached the the same `struct Line`, which represents a local
* client. We keep them in a linked list.
@@ -114,17 +114,17 @@
/**
* Handle for the reliable channel (contol data)
*/
- struct GNUNET_MESH_Channel *channel_reliable;
+ struct GNUNET_CADET_Channel *channel_reliable;
/**
* Handle for unreliable channel (audio data)
*/
- struct GNUNET_MESH_Channel *channel_unreliable;
+ struct GNUNET_CADET_Channel *channel_unreliable;
/**
* Transmit handle for pending audio messages
*/
- struct GNUNET_MESH_TransmitHandle *unreliable_mth;
+ struct GNUNET_CADET_TransmitHandle *unreliable_mth;
/**
* Message queue for control messages
@@ -175,7 +175,7 @@
/**
- * A `struct Line` connects a local client with mesh channels.
+ * A `struct Line` connects a local client with cadet channels.
*/
struct Line
{
@@ -228,9 +228,9 @@
static struct GNUNET_SERVER_NotificationContext *nc;
/**
- * Handle for mesh
+ * Handle for cadet
*/
-static struct GNUNET_MESH_Handle *mesh;
+static struct GNUNET_CADET_Handle *cadet;
/**
* Identity of this peer.
@@ -304,7 +304,7 @@
{
const struct ClientPhonePickupMessage *msg;
struct GNUNET_MQ_Envelope *e;
- struct MeshPhonePickupMessage *mppm;
+ struct CadetPhonePickupMessage *mppm;
struct Line *line;
struct Channel *ch;
@@ -350,9 +350,9 @@
}
GNUNET_break (CS_CALLEE_CONNECTED == ch->status);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending PICK_UP message to mesh\n");
+ "Sending PICK_UP message to cadet\n");
e = GNUNET_MQ_msg (mppm,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP);
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP);
GNUNET_MQ_send (ch->reliable_mq, e);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -364,13 +364,13 @@
* @param ch channel to destroy.
*/
static void
-destroy_line_mesh_channels (struct Channel *ch)
+destroy_line_cadet_channels (struct Channel *ch)
{
struct Line *line = ch->line;
- struct GNUNET_MESH_Channel *t;
+ struct GNUNET_CADET_Channel *t;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Destroying mesh channels\n");
+ "Destroying cadet channels\n");
if (NULL != ch->reliable_mq)
{
GNUNET_MQ_destroy (ch->reliable_mq);
@@ -378,18 +378,18 @@
}
if (NULL != ch->unreliable_mth)
{
- GNUNET_MESH_notify_transmit_ready_cancel (ch->unreliable_mth);
+ GNUNET_CADET_notify_transmit_ready_cancel (ch->unreliable_mth);
ch->unreliable_mth = NULL;
}
if (NULL != (t = ch->channel_unreliable))
{
ch->channel_unreliable = NULL;
- GNUNET_MESH_channel_destroy (t);
+ GNUNET_CADET_channel_destroy (t);
}
if (NULL != (t = ch->channel_reliable))
{
ch->channel_reliable = NULL;
- GNUNET_MESH_channel_destroy (t);
+ GNUNET_CADET_channel_destroy (t);
}
GNUNET_CONTAINER_DLL_remove (line->channel_head,
line->channel_tail,
@@ -419,7 +419,7 @@
GNUNET_break (0);
break;
case CS_CALLEE_SHUTDOWN:
- destroy_line_mesh_channels (ch);
+ destroy_line_cadet_channels (ch);
break;
case CS_CALLER_CALLING:
GNUNET_break (0);
@@ -428,7 +428,7 @@
GNUNET_break (0);
break;
case CS_CALLER_SHUTDOWN:
- destroy_line_mesh_channels (ch);
+ destroy_line_cadet_channels (ch);
break;
}
}
@@ -448,7 +448,7 @@
{
const struct ClientPhoneHangupMessage *msg;
struct GNUNET_MQ_Envelope *e;
- struct MeshPhoneHangupMessage *mhum;
+ struct CadetPhoneHangupMessage *mhum;
struct Line *line;
struct Channel *ch;
@@ -497,9 +497,9 @@
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending HANG_UP message via mesh\n");
+ "Sending HANG_UP message via cadet\n");
e = GNUNET_MQ_msg (mhum,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP);
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP);
GNUNET_MQ_notify_sent (e,
&mq_done_finish_caller_shutdown,
ch);
@@ -522,7 +522,7 @@
{
const struct ClientPhoneSuspendMessage *msg;
struct GNUNET_MQ_Envelope *e;
- struct MeshPhoneSuspendMessage *mhum;
+ struct CadetPhoneSuspendMessage *mhum;
struct Line *line;
struct Channel *ch;
@@ -578,9 +578,9 @@
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending SUSPEND message via mesh\n");
+ "Sending SUSPEND message via cadet\n");
e = GNUNET_MQ_msg (mhum,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND);
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND);
GNUNET_MQ_send (ch->reliable_mq, e);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -600,7 +600,7 @@
{
const struct ClientPhoneResumeMessage *msg;
struct GNUNET_MQ_Envelope *e;
- struct MeshPhoneResumeMessage *mhum;
+ struct CadetPhoneResumeMessage *mhum;
struct Line *line;
struct Channel *ch;
@@ -656,9 +656,9 @@
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending RESUME message via mesh\n");
+ "Sending RESUME message via cadet\n");
e = GNUNET_MQ_msg (mhum,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME);
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME);
GNUNET_MQ_send (ch->reliable_mq, e);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -680,7 +680,7 @@
struct Line *line;
struct Channel *ch;
struct GNUNET_MQ_Envelope *e;
- struct MeshPhoneRingMessage *ring;
+ struct CadetPhoneRingMessage *ring;
msg = (const struct ClientCallMessage *) message;
line = GNUNET_SERVER_client_get_user_context (client, struct Line);
@@ -706,13 +706,13 @@
ch->target = msg->target;
ch->remote_line = ntohl (msg->line);
ch->status = CS_CALLER_CALLING;
- ch->channel_reliable = GNUNET_MESH_channel_create (mesh,
+ ch->channel_reliable = GNUNET_CADET_channel_create (cadet,
ch,
&msg->target,
GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
-
GNUNET_MESH_OPTION_RELIABLE);
- ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable);
- e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING);
+
GNUNET_CADET_OPTION_RELIABLE);
+ ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable);
+ e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
ring->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING);
ring->purpose.size = htonl (sizeof (struct GNUNET_PeerIdentity) * 2 +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
@@ -729,14 +729,14 @@
&ring->purpose,
&ring->signature);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending RING message via mesh\n");
+ "Sending RING message via cadet\n");
GNUNET_MQ_send (ch->reliable_mq, e);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
/**
- * Transmit audio data via unreliable mesh channel.
+ * Transmit audio data via unreliable cadet channel.
*
* @param cls the `struct Channel` we are transmitting for
* @param size number of bytes available in @a buf
@@ -749,26 +749,26 @@
void *buf)
{
struct Channel *ch = cls;
- struct MeshAudioMessage *mam = buf;
+ struct CadetAudioMessage *mam = buf;
ch->unreliable_mth = NULL;
if ( (NULL == buf) ||
- (size < sizeof (struct MeshAudioMessage) + ch->audio_size) )
+ (size < sizeof (struct CadetAudioMessage) + ch->audio_size) )
{
/* eh, other error handling? */
return 0;
}
- mam->header.size = htons (sizeof (struct MeshAudioMessage) + ch->audio_size);
- mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO);
+ mam->header.size = htons (sizeof (struct CadetAudioMessage) +
ch->audio_size);
+ mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO);
mam->remote_line = htonl (ch->remote_line);
mam->source_line = htonl (ch->line->local_line);
memcpy (&mam[1], ch->audio_data, ch->audio_size);
GNUNET_free (ch->audio_data);
ch->audio_data = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending %u bytes of audio data from line %u to remote line %u
via mesh\n",
+ "Sending %u bytes of audio data from line %u to remote line %u
via cadet\n",
ch->audio_size, ch->line->local_line, ch->remote_line);
- return sizeof (struct MeshAudioMessage) + ch->audio_size;
+ return sizeof (struct CadetAudioMessage) + ch->audio_size;
}
@@ -825,7 +825,7 @@
case CS_CALLEE_SHUTDOWN:
case CS_CALLER_SHUTDOWN:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
- "Mesh audio channel in shutdown; audio data dropped\n");
+ "Cadet audio channel in shutdown; audio data dropped\n");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -838,7 +838,7 @@
if (NULL == ch->channel_unreliable)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
- _("Mesh audio channel not ready; audio data dropped\n"));
+ _("Cadet audio channel not ready; audio data dropped\n"));
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -848,7 +848,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Bandwidth insufficient; dropping previous audio data segment
with %u bytes\n",
(unsigned int) ch->audio_size);
- GNUNET_MESH_notify_transmit_ready_cancel (ch->unreliable_mth);
+ GNUNET_CADET_notify_transmit_ready_cancel (ch->unreliable_mth);
ch->unreliable_mth = NULL;
GNUNET_free (ch->audio_data);
ch->audio_data = NULL;
@@ -858,10 +858,10 @@
memcpy (ch->audio_data,
&msg[1],
size);
- ch->unreliable_mth = GNUNET_MESH_notify_transmit_ready
(ch->channel_unreliable,
+ ch->unreliable_mth = GNUNET_CADET_notify_transmit_ready
(ch->channel_unreliable,
GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
- sizeof (struct
MeshAudioMessage)
+ sizeof (struct
CadetAudioMessage)
+ ch->audio_size,
&transmit_line_audio,
ch);
@@ -873,19 +873,19 @@
* We are done signalling shutdown to the other peer.
* Destroy the channel.
*
- * @param cls the `struct GNUNET_MESH_channel` to destroy
+ * @param cls the `struct GNUNET_CADET_channel` to destroy
*/
static void
mq_done_destroy_channel (void *cls)
{
- struct GNUNET_MESH_Channel *channel = cls;
+ struct GNUNET_CADET_Channel *channel = cls;
- GNUNET_MESH_channel_destroy (channel);
+ GNUNET_CADET_channel_destroy (channel);
}
/**
- * Function to handle a ring message incoming over mesh
+ * Function to handle a ring message incoming over cadet
*
* @param cls closure, NULL
* @param channel the channel over which the message arrived
@@ -895,20 +895,20 @@
* @return #GNUNET_OK
*/
static int
-handle_mesh_ring_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+handle_cadet_ring_message (void *cls,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
- const struct MeshPhoneRingMessage *msg;
+ const struct CadetPhoneRingMessage *msg;
struct Line *line;
struct Channel *ch;
struct GNUNET_MQ_Envelope *e;
- struct MeshPhoneHangupMessage *hang_up;
+ struct CadetPhoneHangupMessage *hang_up;
struct ClientPhoneRingMessage cring;
struct GNUNET_MQ_Handle *reliable_mq;
- msg = (const struct MeshPhoneRingMessage *) message;
+ msg = (const struct CadetPhoneRingMessage *) message;
if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
sizeof (struct
GNUNET_CRYPTO_EccSignaturePurpose) +
@@ -922,7 +922,7 @@
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- GNUNET_MESH_receive_done (channel); /* needed? */
+ GNUNET_CADET_receive_done (channel); /* needed? */
for (line = lines_head; NULL != line; line = line->next)
if (line->local_line == ntohl (msg->remote_line))
break;
@@ -932,11 +932,11 @@
_("No available phone for incoming call on line %u, sending
HANG_UP signal\n"),
ntohl (msg->remote_line));
e = GNUNET_MQ_msg (hang_up,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP);
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP);
GNUNET_MQ_notify_sent (e,
&mq_done_destroy_channel,
channel);
- reliable_mq = GNUNET_MESH_mq_create (channel);
+ reliable_mq = GNUNET_CADET_mq_create (channel);
GNUNET_MQ_send (reliable_mq, e);
/* FIXME: do we need to clean up reliable_mq somehow/somewhere? */
return GNUNET_OK;
@@ -949,7 +949,7 @@
ch->status = CS_CALLEE_RINGING;
ch->remote_line = ntohl (msg->source_line);
ch->channel_reliable = channel;
- ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable);
+ ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable);
ch->cid = line->cid_gen++;
ch->target = msg->source;
*channel_ctx = ch;
@@ -969,7 +969,7 @@
/**
- * Function to handle a hangup message incoming over mesh
+ * Function to handle a hangup message incoming over cadet
*
* @param cls closure, NULL
* @param channel the channel over which the message arrived
@@ -979,8 +979,8 @@
* @return #GNUNET_OK
*/
static int
-handle_mesh_hangup_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+handle_cadet_hangup_message (void *cls,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1001,8 +1001,8 @@
hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
hup.cid = ch->cid;
status = ch->status;
- GNUNET_MESH_receive_done (channel);
- destroy_line_mesh_channels (ch);
+ GNUNET_CADET_receive_done (channel);
+ destroy_line_cadet_channels (ch);
switch (status)
{
case CS_CALLEE_RINGING:
@@ -1027,7 +1027,7 @@
/**
- * Function to handle a pickup message incoming over mesh
+ * Function to handle a pickup message incoming over cadet
*
* @param cls closure, NULL
* @param channel the channel over which the message arrived
@@ -1037,8 +1037,8 @@
* @return #GNUNET_OK
*/
static int
-handle_mesh_pickup_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+handle_cadet_pickup_message (void *cls,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1053,17 +1053,17 @@
return GNUNET_SYSERR;
}
line = ch->line;
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
switch (ch->status)
{
case CS_CALLEE_RINGING:
case CS_CALLEE_CONNECTED:
GNUNET_break_op (0);
- destroy_line_mesh_channels (ch);
+ destroy_line_cadet_channels (ch);
return GNUNET_SYSERR;
case CS_CALLEE_SHUTDOWN:
GNUNET_break_op (0);
- destroy_line_mesh_channels (ch);
+ destroy_line_cadet_channels (ch);
break;
case CS_CALLER_CALLING:
ch->status = CS_CALLER_CONNECTED;
@@ -1085,11 +1085,11 @@
line->client,
&pick.header,
GNUNET_NO);
- ch->channel_unreliable = GNUNET_MESH_channel_create (mesh,
+ ch->channel_unreliable = GNUNET_CADET_channel_create (cadet,
ch,
&ch->target,
GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
-
GNUNET_MESH_OPTION_DEFAULT);
+
GNUNET_CADET_OPTION_DEFAULT);
if (NULL == ch->channel_unreliable)
{
GNUNET_break (0);
@@ -1099,7 +1099,7 @@
/**
- * Function to handle a suspend message incoming over mesh
+ * Function to handle a suspend message incoming over cadet
*
* @param cls closure, NULL
* @param channel the channel over which the message arrived
@@ -1109,8 +1109,8 @@
* @return #GNUNET_OK
*/
static int
-handle_mesh_suspend_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+handle_cadet_suspend_message (void *cls,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1128,7 +1128,7 @@
suspend.header.size = htons (sizeof (suspend));
suspend.header.type = htons
(GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND);
suspend.cid = ch->cid;
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Suspending channel CID: %u(%u:%u)\n",
ch->cid, ch->remote_line, line->local_line);
@@ -1160,7 +1160,7 @@
/**
- * Function to handle a resume message incoming over mesh
+ * Function to handle a resume message incoming over cadet
*
* @param cls closure, NULL
* @param channel the channel over which the message arrived
@@ -1170,8 +1170,8 @@
* @return #GNUNET_OK
*/
static int
-handle_mesh_resume_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+handle_cadet_resume_message (void *cls,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1189,7 +1189,7 @@
resume.header.size = htons (sizeof (resume));
resume.header.type = htons
(GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME);
resume.cid = ch->cid;
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
if (GNUNET_YES != ch->suspended_remote)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1224,7 +1224,7 @@
/**
- * Function to handle an audio message incoming over mesh
+ * Function to handle an audio message incoming over cadet
*
* @param cls closure, NULL
* @param channel the channel over which the message arrived
@@ -1234,25 +1234,25 @@
* @return #GNUNET_OK
*/
static int
-handle_mesh_audio_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+handle_cadet_audio_message (void *cls,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
- const struct MeshAudioMessage *msg;
+ const struct CadetAudioMessage *msg;
struct Channel *ch = *channel_ctx;
struct Line *line;
struct GNUNET_PeerIdentity sender;
- size_t msize = ntohs (message->size) - sizeof (struct MeshAudioMessage);
+ size_t msize = ntohs (message->size) - sizeof (struct CadetAudioMessage);
char buf[msize + sizeof (struct ClientAudioMessage)];
struct ClientAudioMessage *cam;
- const union GNUNET_MESH_ChannelInfo *info;
+ const union GNUNET_CADET_ChannelInfo *info;
- msg = (const struct MeshAudioMessage *) message;
+ msg = (const struct CadetAudioMessage *) message;
if (NULL == ch)
{
- info = GNUNET_MESH_channel_get_info (channel,
- GNUNET_MESH_OPTION_PEER);
+ info = GNUNET_CADET_channel_get_info (channel,
+ GNUNET_CADET_OPTION_PEER);
if (NULL == info)
{
GNUNET_break (0);
@@ -1293,13 +1293,13 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received %u bytes of AUDIO data on suspended channel CID
%u:(%u:%u); dropping\n",
msize, ch->cid, ch->remote_line, line->local_line);
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
return GNUNET_OK;
}
ch->channel_unreliable = channel;
*channel_ctx = ch;
}
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Forwarding %u bytes of AUDIO data to client CID %u:(%u:%u)\n",
msize, ch->cid, ch->remote_line, ch->line->local_line);
@@ -1330,9 +1330,9 @@
*/
static void *
inbound_channel (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Received incoming channel on port %u\n"),
@@ -1345,7 +1345,7 @@
* Function called whenever an inbound channel is destroyed. Should clean up
* any associated state.
*
- * @param cls closure (set from #GNUNET_MESH_connect)
+ * @param cls closure (set from #GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored;
@@ -1353,7 +1353,7 @@
*/
static void
inbound_end (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
struct Channel *ch = channel_ctx;
@@ -1363,7 +1363,7 @@
if (NULL == ch)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Mesh channel destroyed, but channel is unknown to us\n");
+ "Cadet channel destroyed, but channel is unknown to us\n");
return;
}
line = ch->line;
@@ -1371,7 +1371,7 @@
{
if (NULL != ch->unreliable_mth)
{
- GNUNET_MESH_notify_transmit_ready_cancel (ch->unreliable_mth);
+ GNUNET_CADET_notify_transmit_ready_cancel (ch->unreliable_mth);
ch->unreliable_mth = NULL;
}
ch->channel_unreliable = NULL;
@@ -1387,7 +1387,7 @@
ch->channel_reliable = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Mesh channel destroyed by mesh in state %d\n",
+ "Cadet channel destroyed by cadet in state %d\n",
ch->status);
hup.header.size = htons (sizeof (hup));
hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
@@ -1413,7 +1413,7 @@
case CS_CALLER_SHUTDOWN:
break;
}
- destroy_line_mesh_channels (ch);
+ destroy_line_cadet_channels (ch);
}
@@ -1441,7 +1441,7 @@
lines_tail,
line);
while (NULL != line->channel_head)
- destroy_line_mesh_channels (line->channel_head);
+ destroy_line_cadet_channels (line->channel_head);
GNUNET_free (line);
}
@@ -1462,17 +1462,17 @@
while (NULL != (line = lines_head))
{
while (NULL != (ch = line->channel_head))
- destroy_line_mesh_channels (ch);
+ destroy_line_cadet_channels (ch);
GNUNET_CONTAINER_DLL_remove (lines_head,
lines_tail,
line);
GNUNET_SERVER_client_set_user_context (line->client, (void *) NULL);
GNUNET_free (line);
}
- if (NULL != mesh)
+ if (NULL != cadet)
{
- GNUNET_MESH_disconnect (mesh);
- mesh = NULL;
+ GNUNET_CADET_disconnect (cadet);
+ cadet = NULL;
}
if (NULL != nc)
{
@@ -1518,23 +1518,23 @@
0},
{NULL, NULL, 0, 0}
};
- static struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
- {&handle_mesh_ring_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING,
- sizeof (struct MeshPhoneRingMessage)},
- {&handle_mesh_hangup_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP,
- sizeof (struct MeshPhoneHangupMessage)},
- {&handle_mesh_pickup_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP,
- sizeof (struct MeshPhonePickupMessage)},
- {&handle_mesh_suspend_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND,
- sizeof (struct MeshPhoneSuspendMessage)},
- {&handle_mesh_resume_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME,
- sizeof (struct MeshPhoneResumeMessage)},
- {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO,
+ static struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
+ {&handle_cadet_ring_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING,
+ sizeof (struct CadetPhoneRingMessage)},
+ {&handle_cadet_hangup_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP,
+ sizeof (struct CadetPhoneHangupMessage)},
+ {&handle_cadet_pickup_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP,
+ sizeof (struct CadetPhonePickupMessage)},
+ {&handle_cadet_suspend_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND,
+ sizeof (struct CadetPhoneSuspendMessage)},
+ {&handle_cadet_resume_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME,
+ sizeof (struct CadetPhoneResumeMessage)},
+ {&handle_cadet_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO,
0},
{NULL, 0, 0}
};
@@ -1548,14 +1548,14 @@
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_get_peer_identity (cfg,
&my_identity));
- mesh = GNUNET_MESH_connect (cfg,
+ cadet = GNUNET_CADET_connect (cfg,
NULL,
&inbound_channel,
&inbound_end,
- mesh_handlers,
+ cadet_handlers,
ports);
- if (NULL == mesh)
+ if (NULL == cadet)
{
GNUNET_break (0);
GNUNET_SCHEDULER_shutdown ();
Modified: gnunet/src/dns/dnsstub.c
===================================================================
--- gnunet/src/dns/dnsstub.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/dns/dnsstub.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -100,7 +100,7 @@
/**
* IP address to use for the DNS server if we are a DNS exit service
- * (for VPN via mesh); otherwise NULL.
+ * (for VPN via cadet); otherwise NULL.
*/
char *dns_exit;
};
Modified: gnunet/src/exit/exit.h
===================================================================
--- gnunet/src/exit/exit.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/exit/exit.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -20,7 +20,7 @@
/**
* @file exit/exit.h
- * @brief format for mesh messages exchanged between VPN service and exit
daemon
+ * @brief format for cadet messages exchanged between VPN service and exit
daemon
* @author Christian Grothoff
*/
#ifndef EXIT_H
@@ -31,7 +31,7 @@
GNUNET_NETWORK_STRUCT_BEGIN
/**
- * Message send via mesh to an exit daemon to initiate forwarding of
+ * Message send via cadet to an exit daemon to initiate forwarding of
* TCP data to a local service.
*/
struct GNUNET_EXIT_TcpServiceStartMessage
@@ -62,7 +62,7 @@
/**
- * Message send via mesh to an exit daemon to initiate forwarding of
+ * Message send via cadet to an exit daemon to initiate forwarding of
* TCP data to the Internet.
*/
struct GNUNET_EXIT_TcpInternetStartMessage
@@ -91,7 +91,7 @@
/**
- * Message send via mesh between VPN and entry and an exit daemon to
+ * Message send via cadet between VPN and entry and an exit daemon to
* transmit TCP data between the VPN entry and an exit session. This
* format is used for both Internet-exits and service-exits and
* in both directions (VPN to exit and exit to VPN).
@@ -119,7 +119,7 @@
/**
- * Message send via mesh to an exit daemon to send
+ * Message send via cadet to an exit daemon to send
* UDP data to a local service.
*/
struct GNUNET_EXIT_UdpServiceMessage
@@ -149,7 +149,7 @@
/**
- * Message send via mesh to an exit daemon to forward
+ * Message send via cadet to an exit daemon to forward
* UDP data to the Internet.
*/
struct GNUNET_EXIT_UdpInternetMessage
@@ -209,7 +209,7 @@
/**
- * Message send via mesh to an exit daemon to send
+ * Message send via cadet to an exit daemon to send
* ICMP data to a local service.
*/
struct GNUNET_EXIT_IcmpServiceMessage
@@ -245,7 +245,7 @@
/**
- * Message send via mesh to an exit daemon to forward
+ * Message send via cadet to an exit daemon to forward
* ICMP data to the Internet.
*/
struct GNUNET_EXIT_IcmpInternetMessage
@@ -280,7 +280,7 @@
/**
- * Message send via mesh to the vpn service to send
+ * Message send via cadet to the vpn service to send
* ICMP data to the VPN's TUN interface.
*/
struct GNUNET_EXIT_IcmpToVPNMessage
Modified: gnunet/src/exit/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/exit/gnunet-daemon-exit.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/exit/gnunet-daemon-exit.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -20,7 +20,7 @@
/**
* @file exit/gnunet-daemon-exit.c
- * @brief tool to allow IP traffic exit from the GNUnet mesh to the Internet
+ * @brief tool to allow IP traffic exit from the GNUnet cadet to the Internet
* @author Philipp Toelke
* @author Christian Grothoff
*
@@ -39,7 +39,7 @@
#include "gnunet_protocols.h"
#include "gnunet_applications.h"
#include "gnunet_dht_service.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_dnsparser_lib.h"
#include "gnunet_dnsstub_lib.h"
#include "gnunet_statistics_service.h"
@@ -52,13 +52,13 @@
/**
- * Maximum path compression length for mesh regex announcing for IPv4 address
+ * Maximum path compression length for cadet regex announcing for IPv4 address
* based regex.
*/
#define REGEX_MAX_PATH_LEN_IPV4 4
/**
- * Maximum path compression length for mesh regex announcing for IPv6 address
+ * Maximum path compression length for cadet regex announcing for IPv6 address
* based regex.
*/
#define REGEX_MAX_PATH_LEN_IPV6 8
@@ -219,9 +219,9 @@
struct ChannelState
{
/**
- * Mesh channel that is used for this connection.
+ * Cadet channel that is used for this connection.
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
/**
* Who is the other end of this channel.
@@ -232,7 +232,7 @@
/**
* Active channel transmission request (or NULL).
*/
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *th;
/**
* #GNUNET_NO if this is a channel for TCP/UDP,
@@ -369,9 +369,9 @@
static struct GNUNET_STATISTICS_Handle *stats;
/**
- * The handle to mesh
+ * The handle to cadet
*/
-static struct GNUNET_MESH_Handle *mesh_handle;
+static struct GNUNET_CADET_Handle *cadet_handle;
/**
* This hashmaps contains the mapping from peer, service-descriptor,
@@ -462,7 +462,7 @@
/**
- * We got a reply from DNS for a request of a MESH channel. Send it
+ * We got a reply from DNS for a request of a CADET channel. Send it
* via the channel (after changing the request ID back).
*
* @param cls the 'struct ChannelState'
@@ -471,7 +471,7 @@
* @return number of bytes written to buf
*/
static size_t
-transmit_reply_to_mesh (void *cls,
+transmit_reply_to_cadet (void *cls,
size_t size,
void *buf)
{
@@ -528,31 +528,31 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processing DNS result from stub resolver\n");
GNUNET_assert (NULL == cls);
- /* Handle case that this is a reply to a request from a MESH DNS channel */
+ /* Handle case that this is a reply to a request from a CADET DNS channel */
ts = channels[dns->id];
if ( (NULL == ts) ||
(ts->specifics.dns.rs != rs) )
return;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Got a response from the stub resolver for DNS request received via
MESH!\n");
+ "Got a response from the stub resolver for DNS request received via
CADET!\n");
channels[dns->id] = NULL;
GNUNET_free_non_null (ts->specifics.dns.reply);
ts->specifics.dns.reply = GNUNET_malloc (r);
ts->specifics.dns.reply_length = r;
memcpy (ts->specifics.dns.reply, dns, r);
if (NULL != ts->th)
- GNUNET_MESH_notify_transmit_ready_cancel (ts->th);
- ts->th = GNUNET_MESH_notify_transmit_ready (ts->channel,
+ GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
+ ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
sizeof (struct
GNUNET_MessageHeader) + r,
- &transmit_reply_to_mesh,
+ &transmit_reply_to_cadet,
ts);
}
/**
- * Process a request via mesh to perform a DNS query.
+ * Process a request via cadet to perform a DNS query.
*
* @param cls closure, NULL
* @param channel connection to the other end
@@ -563,7 +563,7 @@
* #GNUNET_SYSERR to close it (signal serious error)
*/
static int
-receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel
*channel,
+receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel
*channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -807,7 +807,7 @@
/**
- * MESH is ready to receive a message for the channel. Transmit it.
+ * CADET is ready to receive a message for the channel. Transmit it.
*
* @param cls the 'struct ChannelState'.
* @param size number of bytes available in buf
@@ -818,7 +818,7 @@
send_to_peer_notify_callback (void *cls, size_t size, void *buf)
{
struct ChannelState *s = cls;
- struct GNUNET_MESH_Channel *channel = s->channel;
+ struct GNUNET_CADET_Channel *channel = s->channel;
struct ChannelMessageQueue *tnq;
s->th = NULL;
@@ -827,7 +827,7 @@
return 0;
if (0 == size)
{
- s->th = GNUNET_MESH_notify_transmit_ready (channel,
+ s->th = GNUNET_CADET_notify_transmit_ready (channel,
GNUNET_NO /* corking */,
GNUNET_TIME_UNIT_FOREVER_REL,
tnq->len,
@@ -843,36 +843,36 @@
tnq);
GNUNET_free (tnq);
if (NULL != (tnq = s->specifics.tcp_udp.head))
- s->th = GNUNET_MESH_notify_transmit_ready (channel,
+ s->th = GNUNET_CADET_notify_transmit_ready (channel,
GNUNET_NO /* corking */,
GNUNET_TIME_UNIT_FOREVER_REL,
tnq->len,
&send_to_peer_notify_callback,
s);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes transmitted via mesh
channels"),
+ gettext_noop ("# Bytes transmitted via cadet
channels"),
size, GNUNET_NO);
return size;
}
/**
- * Send the given packet via the mesh channel.
+ * Send the given packet via the cadet channel.
*
* @param s channel destination
* @param tnq message to queue
*/
static void
-send_packet_to_mesh_channel (struct ChannelState *s,
+send_packet_to_cadet_channel (struct ChannelState *s,
struct ChannelMessageQueue *tnq)
{
- struct GNUNET_MESH_Channel *mesh_channel;
+ struct GNUNET_CADET_Channel *cadet_channel;
- mesh_channel = s->channel;
+ cadet_channel = s->channel;
GNUNET_assert (NULL != s);
GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head,
s->specifics.tcp_udp.tail, tnq);
if (NULL == s->th)
- s->th = GNUNET_MESH_notify_transmit_ready (mesh_channel,
+ s->th = GNUNET_CADET_notify_transmit_ready (cadet_channel,
GNUNET_NO /* cork */,
GNUNET_TIME_UNIT_FOREVER_REL,
tnq->len,
@@ -1065,7 +1065,7 @@
memcpy (&i2v->icmp_header,
icmp,
pktlen);
- send_packet_to_mesh_channel (state, tnq);
+ send_packet_to_cadet_channel (state, tnq);
}
@@ -1142,7 +1142,7 @@
memcpy (&urm[1],
&udp[1],
pktlen - sizeof (struct GNUNET_TUN_UdpHeader));
- send_packet_to_mesh_channel (state, tnq);
+ send_packet_to_cadet_channel (state, tnq);
}
@@ -1230,7 +1230,7 @@
memcpy (&tdm->tcp_header,
buf,
pktlen);
- send_packet_to_mesh_channel (state, tnq);
+ send_packet_to_cadet_channel (state, tnq);
}
@@ -1486,7 +1486,7 @@
* We are starting a fresh connection (TCP or UDP) and need
* to pick a source port and IP address (within the correct
* range and address family) to associate replies with the
- * connection / correct mesh channel. This function generates
+ * connection / correct cadet channel. This function generates
* a "fresh" source IP and source port number for a connection
* After picking a good source address, this function sets up
* the state in the 'connections_map' and 'connections_heap'
@@ -1549,7 +1549,7 @@
s = GNUNET_CONTAINER_heap_remove_root (connections_heap);
GNUNET_assert (state != s);
s->specifics.tcp_udp.heap_node = NULL;
- GNUNET_MESH_channel_destroy (s->channel);
+ GNUNET_CADET_channel_destroy (s->channel);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_remove (connections_map,
&s->specifics.tcp_udp.state_key,
@@ -1833,7 +1833,7 @@
/**
- * Process a request via mesh to send a request to a TCP service
+ * Process a request via cadet to send a request to a TCP service
* offered by this system.
*
* @param cls closure, NULL
@@ -1845,7 +1845,7 @@
*/
static int
receive_tcp_service (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1869,10 +1869,10 @@
state->is_dns = GNUNET_NO;
}
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# TCP service creation requests
received via mesh"),
+ gettext_noop ("# TCP service creation requests
received via cadet"),
1, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
/* check that we got at least a valid header */
if (pkt_len < sizeof (struct GNUNET_EXIT_TcpServiceStartMessage))
@@ -1937,7 +1937,7 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
-receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel
*channel,
+receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel
*channel,
void **channel_ctx GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message)
{
@@ -1965,10 +1965,10 @@
state->is_dns = GNUNET_NO;
}
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# TCP IP-exit creation requests
received via mesh"),
+ gettext_noop ("# TCP IP-exit creation requests
received via cadet"),
1, GNUNET_NO);
if (pkt_len < sizeof (struct GNUNET_EXIT_TcpInternetStartMessage))
{
@@ -2061,7 +2061,7 @@
* #GNUNET_SYSERR to close it (signal serious error)
*/
static int
-receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel,
+receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel
*channel,
void **channel_ctx GNUNET_UNUSED,
const struct GNUNET_MessageHeader *message)
{
@@ -2070,10 +2070,10 @@
uint16_t pkt_len = ntohs (message->size);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# TCP data requests received via
mesh"),
+ gettext_noop ("# TCP data requests received via
cadet"),
1, GNUNET_NO);
if (pkt_len < sizeof (struct GNUNET_EXIT_TcpDataMessage))
{
@@ -2294,7 +2294,7 @@
*/
static int
receive_icmp_remote (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -2318,10 +2318,10 @@
state->is_dns = GNUNET_NO;
}
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# ICMP IP-exit requests received via
mesh"),
+ gettext_noop ("# ICMP IP-exit requests received via
cadet"),
1, GNUNET_NO);
if (pkt_len < sizeof (struct GNUNET_EXIT_IcmpInternetMessage))
{
@@ -2533,7 +2533,7 @@
/**
- * Process a request via mesh to send ICMP data to a service
+ * Process a request via cadet to send ICMP data to a service
* offered by this system.
*
* @param cls closure, NULL
@@ -2545,7 +2545,7 @@
*/
static int
receive_icmp_service (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -2567,10 +2567,10 @@
state->is_dns = GNUNET_NO;
}
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# ICMP service requests received via
mesh"),
+ gettext_noop ("# ICMP service requests received via
cadet"),
1, GNUNET_NO);
/* check that we got at least a valid header */
if (pkt_len < sizeof (struct GNUNET_EXIT_IcmpServiceMessage))
@@ -2833,7 +2833,7 @@
*/
static int
receive_udp_remote (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -2856,10 +2856,10 @@
state->is_dns = GNUNET_NO;
}
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# UDP IP-exit requests received via
mesh"),
+ gettext_noop ("# UDP IP-exit requests received via
cadet"),
1, GNUNET_NO);
if (pkt_len < sizeof (struct GNUNET_EXIT_UdpInternetMessage))
{
@@ -2932,7 +2932,7 @@
/**
- * Process a request via mesh to send a request to a UDP service
+ * Process a request via cadet to send a request to a UDP service
* offered by this system.
*
* @param cls closure, NULL
@@ -2944,7 +2944,7 @@
*/
static int
receive_udp_service (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -2963,10 +2963,10 @@
state->is_dns = GNUNET_NO;
}
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes received from MESH"),
+ gettext_noop ("# Bytes received from CADET"),
pkt_len, GNUNET_NO);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# UDP service requests received via
mesh"),
+ gettext_noop ("# UDP service requests received via
cadet"),
1, GNUNET_NO);
/* check that we got at least a valid header */
if (pkt_len < sizeof (struct GNUNET_EXIT_UdpServiceMessage))
@@ -3008,7 +3008,7 @@
/**
- * Callback from GNUNET_MESH for new channels.
+ * Callback from GNUNET_CADET for new channels.
*
* @param cls closure
* @param channel new handle to the channel
@@ -3019,16 +3019,16 @@
*/
static void *
new_channel (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
struct ChannelState *s = GNUNET_new (struct ChannelState);
s->is_dns = GNUNET_SYSERR;
s->peer = *initiator;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Inbound MESH channels created"),
+ gettext_noop ("# Inbound CADET channels created"),
1, GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received inbound channel from `%s'\n",
@@ -3039,17 +3039,17 @@
/**
- * Function called by mesh whenever an inbound channel is destroyed.
+ * Function called by cadet whenever an inbound channel is destroyed.
* Should clean up any associated state.
*
- * @param cls closure (set from #GNUNET_MESH_connect)
+ * @param cls closure (set from #GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
clean_channel (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
struct ChannelState *s = channel_ctx;
@@ -3089,7 +3089,7 @@
}
if (NULL != s->th)
{
- GNUNET_MESH_notify_transmit_ready_cancel (s->th);
+ GNUNET_CADET_notify_transmit_ready_cancel (s->th);
s->th = NULL;
}
GNUNET_free (s);
@@ -3140,10 +3140,10 @@
GNUNET_REGEX_announce_cancel (regex6);
regex6 = NULL;
}
- if (NULL != mesh_handle)
+ if (NULL != cadet_handle)
{
- GNUNET_MESH_disconnect (mesh_handle);
- mesh_handle = NULL;
+ GNUNET_CADET_disconnect (cadet_handle);
+ cadet_handle = NULL;
}
if (NULL != connections_map)
{
@@ -3465,7 +3465,7 @@
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg_)
{
- static struct GNUNET_MESH_MessageHandler handlers[] = {
+ static struct GNUNET_CADET_MessageHandler handlers[] = {
{&receive_icmp_service, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE, 0},
{&receive_icmp_remote, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET, 0},
{&receive_udp_service, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE, 0},
@@ -3718,18 +3718,18 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
- mesh_handle
- = GNUNET_MESH_connect (cfg, NULL,
+ cadet_handle
+ = GNUNET_CADET_connect (cfg, NULL,
&new_channel,
&clean_channel, handlers,
apptypes);
- if (NULL == mesh_handle)
+ if (NULL == cadet_handle)
{
GNUNET_SCHEDULER_shutdown ();
return;
}
- /* Mesh handle acquired, now announce regular expressions matching our exit
*/
+ /* Cadet handle acquired, now announce regular expressions matching our exit
*/
if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) )
{
policy = NULL;
Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/fs/fs_api.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -1762,7 +1762,7 @@
/**
* Read a download request tree.
*
- * @param rh mesh to read from
+ * @param rh cadet to read from
* @return value the download request read from disk, NULL on error
*/
static struct DownloadRequest *
Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/fs/gnunet-service-fs.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -43,7 +43,7 @@
#include "gnunet-service-fs_pr.h"
#include "gnunet-service-fs_push.h"
#include "gnunet-service-fs_put.h"
-#include "gnunet-service-fs_mesh.h"
+#include "gnunet-service-fs_cadet.h"
#include "fs.h"
/**
@@ -412,10 +412,10 @@
{
case GNUNET_BLOCK_TYPE_FS_DBLOCK:
case GNUNET_BLOCK_TYPE_FS_IBLOCK:
- /* the above block types MAY be available via 'mesh' */
+ /* the above block types MAY be available via 'cadet' */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Considering mesh-based download for block\n");
- GSF_mesh_lookup_ (pr);
+ "Considering cadet-based download for block\n");
+ GSF_cadet_lookup_ (pr);
break;
case GNUNET_BLOCK_TYPE_FS_UBLOCK:
/* the above block types are in the DHT */
@@ -475,8 +475,8 @@
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GSF_mesh_stop_client ();
- GSF_mesh_stop_server ();
+ GSF_cadet_stop_client ();
+ GSF_cadet_stop_server ();
if (NULL != GSF_core)
{
GNUNET_CORE_disconnect (GSF_core);
@@ -646,8 +646,8 @@
GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters,
NULL);
datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE);
- GSF_mesh_start_server ();
- GSF_mesh_start_client ();
+ GSF_cadet_start_server ();
+ GSF_cadet_start_client ();
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
NULL);
return GNUNET_OK;
Modified: gnunet/src/fs/gnunet-service-fs_mesh.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/fs/gnunet-service-fs_mesh.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,21 +19,21 @@
*/
/**
- * @file fs/gnunet-service-fs_mesh.h
+ * @file fs/gnunet-service-fs_cadet.h
* @brief non-anonymous file-transfer
* @author Christian Grothoff
*/
-#ifndef GNUNET_SERVICE_FS_MESH_H
-#define GNUNET_SERVICE_FS_MESH_H
+#ifndef GNUNET_SERVICE_FS_CADET_H
+#define GNUNET_SERVICE_FS_CADET_H
/**
- * Handle for a request that is going out via mesh API.
+ * Handle for a request that is going out via cadet API.
*/
-struct GSF_MeshRequest;
+struct GSF_CadetRequest;
/**
- * Function called with a reply from the mesh.
+ * Function called with a reply from the cadet.
*
* @param cls closure
* @param type type of the block, ANY on error
@@ -41,7 +41,7 @@
* @param data_size number of bytes in 'data', 0 on error
* @param data reply block data, NULL on error
*/
-typedef void (*GSF_MeshReplyProcessor)(void *cls,
+typedef void (*GSF_CadetReplyProcessor)(void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute expiration,
size_t data_size,
@@ -58,11 +58,11 @@
* @param proc_cls closure for 'proc'
* @return handle to cancel the operation
*/
-struct GSF_MeshRequest *
-GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
+struct GSF_CadetRequest *
+GSF_cadet_query (const struct GNUNET_PeerIdentity *target,
const struct GNUNET_HashCode *query,
enum GNUNET_BLOCK_Type type,
- GSF_MeshReplyProcessor proc, void *proc_cls);
+ GSF_CadetReplyProcessor proc, void *proc_cls);
/**
@@ -72,34 +72,34 @@
* @param sr request to cancel
*/
void
-GSF_mesh_query_cancel (struct GSF_MeshRequest *sr);
+GSF_cadet_query_cancel (struct GSF_CadetRequest *sr);
/**
* Initialize subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_start_server (void);
+GSF_cadet_start_server (void);
/**
* Shutdown subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_stop_server (void);
+GSF_cadet_stop_server (void);
/**
* Initialize subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_start_client (void);
+GSF_cadet_start_client (void);
/**
* Shutdown subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_stop_client (void);
+GSF_cadet_stop_client (void);
GNUNET_NETWORK_STRUCT_BEGIN
@@ -107,11 +107,11 @@
/**
* Query from one peer, asking the other for CHK-data.
*/
-struct MeshQueryMessage
+struct CadetQueryMessage
{
/**
- * Type is GNUNET_MESSAGE_TYPE_FS_MESH_QUERY.
+ * Type is GNUNET_MESSAGE_TYPE_FS_CADET_QUERY.
*/
struct GNUNET_MessageHeader header;
@@ -129,13 +129,13 @@
/**
- * Reply to a MeshQueryMessage.
+ * Reply to a CadetQueryMessage.
*/
-struct MeshReplyMessage
+struct CadetReplyMessage
{
/**
- * Type is GNUNET_MESSAGE_TYPE_FS_MESH_REPLY.
+ * Type is GNUNET_MESSAGE_TYPE_FS_CADET_REPLY.
*/
struct GNUNET_MessageHeader header;
Modified: gnunet/src/fs/gnunet-service-fs_mesh_client.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_client.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/fs/gnunet-service-fs_mesh_client.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -19,7 +19,7 @@
*/
/**
- * @file fs/gnunet-service-fs_mesh_client.c
+ * @file fs/gnunet-service-fs_cadet_client.c
* @brief non-anonymous file-transfer
* @author Christian Grothoff
*
@@ -30,12 +30,12 @@
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_util_lib.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_protocols.h"
#include "gnunet_applications.h"
#include "gnunet-service-fs.h"
#include "gnunet-service-fs_indexing.h"
-#include "gnunet-service-fs_mesh.h"
+#include "gnunet-service-fs_cadet.h"
/**
@@ -45,36 +45,36 @@
/**
- * Handle for a mesh to another peer.
+ * Handle for a cadet to another peer.
*/
-struct MeshHandle;
+struct CadetHandle;
/**
- * Handle for a request that is going out via mesh API.
+ * Handle for a request that is going out via cadet API.
*/
-struct GSF_MeshRequest
+struct GSF_CadetRequest
{
/**
* DLL.
*/
- struct GSF_MeshRequest *next;
+ struct GSF_CadetRequest *next;
/**
* DLL.
*/
- struct GSF_MeshRequest *prev;
+ struct GSF_CadetRequest *prev;
/**
- * Which mesh is this request associated with?
+ * Which cadet is this request associated with?
*/
- struct MeshHandle *mh;
+ struct CadetHandle *mh;
/**
* Function to call with the result.
*/
- GSF_MeshReplyProcessor proc;
+ GSF_CadetReplyProcessor proc;
/**
* Closure for 'proc'
@@ -100,22 +100,22 @@
/**
- * Handle for a mesh to another peer.
+ * Handle for a cadet to another peer.
*/
-struct MeshHandle
+struct CadetHandle
{
/**
- * Head of DLL of pending requests on this mesh.
+ * Head of DLL of pending requests on this cadet.
*/
- struct GSF_MeshRequest *pending_head;
+ struct GSF_CadetRequest *pending_head;
/**
- * Tail of DLL of pending requests on this mesh.
+ * Tail of DLL of pending requests on this cadet.
*/
- struct GSF_MeshRequest *pending_tail;
+ struct GSF_CadetRequest *pending_tail;
/**
- * Map from query to `struct GSF_MeshRequest`s waiting for
+ * Map from query to `struct GSF_CadetRequest`s waiting for
* a reply.
*/
struct GNUNET_CONTAINER_MultiHashMap *waiting_map;
@@ -123,29 +123,29 @@
/**
* Channel to the other peer.
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
/**
* Handle for active write operation, or NULL.
*/
- struct GNUNET_MESH_TransmitHandle *wh;
+ struct GNUNET_CADET_TransmitHandle *wh;
/**
- * Which peer does this mesh go to?
+ * Which peer does this cadet go to?
*/
struct GNUNET_PeerIdentity target;
/**
- * Task to kill inactive meshs (we keep them around for
+ * Task to kill inactive cadets (we keep them around for
* a few seconds to give the application a chance to give
* us another query).
*/
GNUNET_SCHEDULER_TaskIdentifier timeout_task;
/**
- * Task to reset meshs that had errors (asynchronously,
+ * Task to reset cadets that had errors (asynchronously,
* as we may not be able to do it immediately during a
- * callback from the mesh API).
+ * callback from the cadet API).
*/
GNUNET_SCHEDULER_TaskIdentifier reset_task;
@@ -153,36 +153,36 @@
/**
- * Mesh channel for creating outbound channels.
+ * Cadet channel for creating outbound channels.
*/
-static struct GNUNET_MESH_Handle *mesh_handle;
+static struct GNUNET_CADET_Handle *cadet_handle;
/**
- * Map from peer identities to 'struct MeshHandles' with mesh
+ * Map from peer identities to 'struct CadetHandles' with cadet
* channels to those peers.
*/
-static struct GNUNET_CONTAINER_MultiPeerMap *mesh_map;
+static struct GNUNET_CONTAINER_MultiPeerMap *cadet_map;
/* ********************* client-side code ************************* */
/**
- * Transmit pending requests via the mesh.
+ * Transmit pending requests via the cadet.
*
- * @param mh mesh to process
+ * @param mh cadet to process
*/
static void
-transmit_pending (struct MeshHandle *mh);
+transmit_pending (struct CadetHandle *mh);
/**
* Iterator called on each entry in a waiting map to
* move it back to the pending list.
*
- * @param cls the `struct MeshHandle`
+ * @param cls the `struct CadetHandle`
* @param key the key of the entry in the map (the query)
- * @param value the `struct GSF_MeshRequest` to move to pending
+ * @param value the `struct GSF_CadetRequest` to move to pending
* @return #GNUNET_YES (continue to iterate)
*/
static int
@@ -190,8 +190,8 @@
const struct GNUNET_HashCode *key,
void *value)
{
- struct MeshHandle *mh = cls;
- struct GSF_MeshRequest *sr = value;
+ struct CadetHandle *mh = cls;
+ struct GSF_CadetRequest *sr = value;
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map,
@@ -206,94 +206,94 @@
/**
- * We had a serious error, tear down and re-create mesh from scratch.
+ * We had a serious error, tear down and re-create cadet from scratch.
*
- * @param mh mesh to reset
+ * @param mh cadet to reset
*/
static void
-reset_mesh (struct MeshHandle *mh)
+reset_cadet (struct CadetHandle *mh)
{
- struct GNUNET_MESH_Channel *channel = mh->channel;
+ struct GNUNET_CADET_Channel *channel = mh->channel;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Resetting mesh channel to %s\n",
+ "Resetting cadet channel to %s\n",
GNUNET_i2s (&mh->target));
mh->channel = NULL;
if (NULL != channel)
- GNUNET_MESH_channel_destroy (channel);
+ GNUNET_CADET_channel_destroy (channel);
GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
&move_to_pending,
mh);
- mh->channel = GNUNET_MESH_channel_create (mesh_handle,
+ mh->channel = GNUNET_CADET_channel_create (cadet_handle,
mh,
&mh->target,
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
- GNUNET_MESH_OPTION_RELIABLE);
+ GNUNET_CADET_OPTION_RELIABLE);
transmit_pending (mh);
}
/**
- * Task called when it is time to destroy an inactive mesh channel.
+ * Task called when it is time to destroy an inactive cadet channel.
*
- * @param cls the `struct MeshHandle` to tear down
+ * @param cls the `struct CadetHandle` to tear down
* @param tc scheduler context, unused
*/
static void
-mesh_timeout (void *cls,
+cadet_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshHandle *mh = cls;
- struct GNUNET_MESH_Channel *tun;
+ struct CadetHandle *mh = cls;
+ struct GNUNET_CADET_Channel *tun;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout on mesh channel to %s\n",
+ "Timeout on cadet channel to %s\n",
GNUNET_i2s (&mh->target));
mh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
tun = mh->channel;
mh->channel = NULL;
- GNUNET_MESH_channel_destroy (tun);
+ GNUNET_CADET_channel_destroy (tun);
}
/**
- * Task called when it is time to reset an mesh.
+ * Task called when it is time to reset an cadet.
*
- * @param cls the `struct MeshHandle` to tear down
+ * @param cls the `struct CadetHandle` to tear down
* @param tc scheduler context, unused
*/
static void
-reset_mesh_task (void *cls,
+reset_cadet_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshHandle *mh = cls;
+ struct CadetHandle *mh = cls;
mh->reset_task = GNUNET_SCHEDULER_NO_TASK;
- reset_mesh (mh);
+ reset_cadet (mh);
}
/**
- * We had a serious error, tear down and re-create mesh from scratch,
+ * We had a serious error, tear down and re-create cadet from scratch,
* but do so asynchronously.
*
- * @param mh mesh to reset
+ * @param mh cadet to reset
*/
static void
-reset_mesh_async (struct MeshHandle *mh)
+reset_cadet_async (struct CadetHandle *mh)
{
if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
GNUNET_SCHEDULER_cancel (mh->reset_task);
- mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_mesh_task,
+ mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_cadet_task,
mh);
}
/**
* Functions of this signature are called whenever we are ready to transmit
- * query via a mesh.
+ * query via a cadet.
*
- * @param cls the struct MeshHandle for which we did the write call
+ * @param cls the struct CadetHandle for which we did the write call
* @param size the number of bytes that can be written to @a buf
* @param buf where to write the message
* @return number of bytes written to @a buf
@@ -303,23 +303,23 @@
size_t size,
void *buf)
{
- struct MeshHandle *mh = cls;
- struct MeshQueryMessage sqm;
- struct GSF_MeshRequest *sr;
+ struct CadetHandle *mh = cls;
+ struct CadetQueryMessage sqm;
+ struct GSF_CadetRequest *sr;
mh->wh = NULL;
if (NULL == buf)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Mesh channel to %s failed during transmission attempt,
rebuilding\n",
+ "Cadet channel to %s failed during transmission attempt,
rebuilding\n",
GNUNET_i2s (&mh->target));
- reset_mesh_async (mh);
+ reset_cadet_async (mh);
return 0;
}
sr = mh->pending_head;
if (NULL == sr)
return 0;
- GNUNET_assert (size >= sizeof (struct MeshQueryMessage));
+ GNUNET_assert (size >= sizeof (struct CadetQueryMessage));
GNUNET_CONTAINER_DLL_remove (mh->pending_head,
mh->pending_tail,
sr);
@@ -330,16 +330,16 @@
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
sr->was_transmitted = GNUNET_YES;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending query for %s via mesh to %s\n",
+ "Sending query for %s via cadet to %s\n",
GNUNET_h2s (&sr->query),
GNUNET_i2s (&mh->target));
sqm.header.size = htons (sizeof (sqm));
- sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_MESH_QUERY);
+ sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_QUERY);
sqm.type = htonl (sr->type);
sqm.query = sr->query;
memcpy (buf, &sqm, sizeof (sqm));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Successfully transmitted %u bytes via mesh to %s\n",
+ "Successfully transmitted %u bytes via cadet to %s\n",
(unsigned int) size,
GNUNET_i2s (&mh->target));
transmit_pending (mh);
@@ -348,20 +348,20 @@
/**
- * Transmit pending requests via the mesh.
+ * Transmit pending requests via the cadet.
*
- * @param mh mesh to process
+ * @param mh cadet to process
*/
static void
-transmit_pending (struct MeshHandle *mh)
+transmit_pending (struct CadetHandle *mh)
{
if (NULL == mh->channel)
return;
if (NULL != mh->wh)
return;
- mh->wh = GNUNET_MESH_notify_transmit_ready (mh->channel, GNUNET_YES /* allow
cork */,
+ mh->wh = GNUNET_CADET_notify_transmit_ready (mh->channel, GNUNET_YES /*
allow cork */,
GNUNET_TIME_UNIT_FOREVER_REL,
- sizeof (struct MeshQueryMessage),
+ sizeof (struct CadetQueryMessage),
&transmit_sqm, mh);
}
@@ -405,7 +405,7 @@
*
* @param cls the `struct HandleReplyClosure`
* @param key the key of the entry in the map (the query)
- * @param value the `struct GSF_MeshRequest` to handle result for
+ * @param value the `struct GSF_CadetRequest` to handle result for
* @return #GNUNET_YES (continue to iterate)
*/
static int
@@ -414,7 +414,7 @@
void *value)
{
struct HandleReplyClosure *hrc = cls;
- struct GSF_MeshRequest *sr = value;
+ struct GSF_CadetRequest *sr = value;
sr->proc (sr->proc_cls,
hrc->type,
@@ -422,7 +422,7 @@
hrc->data_size,
hrc->data);
sr->proc = NULL;
- GSF_mesh_query_cancel (sr);
+ GSF_cadet_query_cancel (sr);
hrc->found = GNUNET_YES;
return GNUNET_YES;
}
@@ -432,7 +432,7 @@
* Functions with this signature are called whenever a complete reply
* is received.
*
- * @param cls closure with the `struct MeshHandle`
+ * @param cls closure with the `struct CadetHandle`
* @param channel channel handle
* @param channel_ctx channel context
* @param message the actual message
@@ -440,26 +440,26 @@
*/
static int
reply_cb (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
- struct MeshHandle *mh = *channel_ctx;
- const struct MeshReplyMessage *srm;
+ struct CadetHandle *mh = *channel_ctx;
+ const struct CadetReplyMessage *srm;
struct HandleReplyClosure hrc;
uint16_t msize;
enum GNUNET_BLOCK_Type type;
struct GNUNET_HashCode query;
msize = ntohs (message->size);
- if (sizeof (struct MeshReplyMessage) > msize)
+ if (sizeof (struct CadetReplyMessage) > msize)
{
GNUNET_break_op (0);
- reset_mesh_async (mh);
+ reset_cadet_async (mh);
return GNUNET_SYSERR;
}
- srm = (const struct MeshReplyMessage *) message;
- msize -= sizeof (struct MeshReplyMessage);
+ srm = (const struct CadetReplyMessage *) message;
+ msize -= sizeof (struct CadetReplyMessage);
type = (enum GNUNET_BLOCK_Type) ntohl (srm->type);
if (GNUNET_YES !=
GNUNET_BLOCK_get_key (GSF_block_ctx,
@@ -468,20 +468,20 @@
{
GNUNET_break_op (0);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Received bogus reply of type %u with %u bytes via mesh from
peer %s\n",
+ "Received bogus reply of type %u with %u bytes via cadet from
peer %s\n",
type,
msize,
GNUNET_i2s (&mh->target));
- reset_mesh_async (mh);
+ reset_cadet_async (mh);
return GNUNET_SYSERR;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received reply `%s' via mesh from peer %s\n",
+ "Received reply `%s' via cadet from peer %s\n",
GNUNET_h2s (&query),
GNUNET_i2s (&mh->target));
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# replies received via mesh"), 1,
+ gettext_noop ("# replies received via cadet"), 1,
GNUNET_NO);
hrc.data = &srm[1];
hrc.data_size = msize;
@@ -495,7 +495,7 @@
if (GNUNET_NO == hrc.found)
{
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# replies received via mesh
dropped"), 1,
+ gettext_noop ("# replies received via cadet
dropped"), 1,
GNUNET_NO);
return GNUNET_OK;
}
@@ -504,16 +504,16 @@
/**
- * Get (or create) a mesh to talk to the given peer.
+ * Get (or create) a cadet to talk to the given peer.
*
* @param target peer we want to communicate with
*/
-static struct MeshHandle *
-get_mesh (const struct GNUNET_PeerIdentity *target)
+static struct CadetHandle *
+get_cadet (const struct GNUNET_PeerIdentity *target)
{
- struct MeshHandle *mh;
+ struct CadetHandle *mh;
- mh = GNUNET_CONTAINER_multipeermap_get (mesh_map,
+ mh = GNUNET_CONTAINER_multipeermap_get (cadet_map,
target);
if (NULL != mh)
{
@@ -525,26 +525,26 @@
return mh;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Creating mesh channel to %s\n",
+ "Creating cadet channel to %s\n",
GNUNET_i2s (target));
- mh = GNUNET_new (struct MeshHandle);
+ mh = GNUNET_new (struct CadetHandle);
mh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT,
- &reset_mesh_task,
+ &reset_cadet_task,
mh);
mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
mh->target = *target;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_put (mesh_map,
+ GNUNET_CONTAINER_multipeermap_put (cadet_map,
&mh->target,
mh,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
- mh->channel = GNUNET_MESH_channel_create (mesh_handle,
+ mh->channel = GNUNET_CADET_channel_create (cadet_handle,
mh,
&mh->target,
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
- GNUNET_MESH_OPTION_RELIABLE);
+ GNUNET_CADET_OPTION_RELIABLE);
GNUNET_assert (mh ==
- GNUNET_CONTAINER_multipeermap_get (mesh_map,
+ GNUNET_CONTAINER_multipeermap_get (cadet_map,
target));
return mh;
}
@@ -560,21 +560,21 @@
* @param proc_cls closure for @a proc
* @return handle to cancel the operation
*/
-struct GSF_MeshRequest *
-GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
+struct GSF_CadetRequest *
+GSF_cadet_query (const struct GNUNET_PeerIdentity *target,
const struct GNUNET_HashCode *query,
enum GNUNET_BLOCK_Type type,
- GSF_MeshReplyProcessor proc, void *proc_cls)
+ GSF_CadetReplyProcessor proc, void *proc_cls)
{
- struct MeshHandle *mh;
- struct GSF_MeshRequest *sr;
+ struct CadetHandle *mh;
+ struct GSF_CadetRequest *sr;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Preparing to send query for %s via mesh to %s\n",
+ "Preparing to send query for %s via cadet to %s\n",
GNUNET_h2s (query),
GNUNET_i2s (target));
- mh = get_mesh (target);
- sr = GNUNET_new (struct GSF_MeshRequest);
+ mh = get_cadet (target);
+ sr = GNUNET_new (struct GSF_CadetRequest);
sr->mh = mh;
sr->proc = proc;
sr->proc_cls = proc_cls;
@@ -595,10 +595,10 @@
* @param sr request to cancel
*/
void
-GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
+GSF_cadet_query_cancel (struct GSF_CadetRequest *sr)
{
- struct MeshHandle *mh = sr->mh;
- GSF_MeshReplyProcessor p;
+ struct CadetHandle *mh = sr->mh;
+ GSF_CadetReplyProcessor p;
p = sr->proc;
sr->proc = NULL;
@@ -610,7 +610,7 @@
0, NULL);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Cancelled query for %s via mesh to %s\n",
+ "Cancelled query for %s via cadet to %s\n",
GNUNET_h2s (&sr->query),
GNUNET_i2s (&sr->mh->target));
if (GNUNET_YES == sr->was_transmitted)
@@ -626,7 +626,7 @@
if ( (0 == GNUNET_CONTAINER_multihashmap_size (mh->waiting_map)) &&
(NULL == mh->pending_head) )
mh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
- &mesh_timeout,
+ &cadet_timeout,
mh);
}
@@ -636,9 +636,9 @@
* call the 'proc' continuation and release associated
* resources.
*
- * @param cls the `struct MeshHandle`
+ * @param cls the `struct CadetHandle`
* @param key the key of the entry in the map (the query)
- * @param value the `struct GSF_MeshRequest` to clean up
+ * @param value the `struct GSF_CadetRequest` to clean up
* @return #GNUNET_YES (continue to iterate)
*/
static int
@@ -646,48 +646,48 @@
const struct GNUNET_HashCode *key,
void *value)
{
- struct GSF_MeshRequest *sr = value;
+ struct GSF_CadetRequest *sr = value;
- GSF_mesh_query_cancel (sr);
+ GSF_cadet_query_cancel (sr);
return GNUNET_YES;
}
/**
- * Function called by mesh when a client disconnects.
- * Cleans up our `struct MeshClient` of that channel.
+ * Function called by cadet when a client disconnects.
+ * Cleans up our `struct CadetClient` of that channel.
*
* @param cls NULL
* @param channel channel of the disconnecting client
- * @param channel_ctx our `struct MeshClient`
+ * @param channel_ctx our `struct CadetClient`
*/
static void
cleaner_cb (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
- struct MeshHandle *mh = channel_ctx;
- struct GSF_MeshRequest *sr;
+ struct CadetHandle *mh = channel_ctx;
+ struct GSF_CadetRequest *sr;
if (NULL == mh->channel)
return; /* being destroyed elsewhere */
GNUNET_assert (channel == mh->channel);
mh->channel = NULL;
while (NULL != (sr = mh->pending_head))
- GSF_mesh_query_cancel (sr);
- /* first remove `mh` from the `mesh_map`, so that if the
+ GSF_cadet_query_cancel (sr);
+ /* first remove `mh` from the `cadet_map`, so that if the
callback from `free_waiting_entry()` happens to re-issue
the request, we don't immediately have it back in the
`waiting_map`. */
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_remove (mesh_map,
+ GNUNET_CONTAINER_multipeermap_remove (cadet_map,
&mh->target,
mh));
GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
&free_waiting_entry,
mh);
if (NULL != mh->wh)
- GNUNET_MESH_notify_transmit_ready_cancel (mh->wh);
+ GNUNET_CADET_notify_transmit_ready_cancel (mh->wh);
if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task)
GNUNET_SCHEDULER_cancel (mh->timeout_task);
if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
@@ -703,15 +703,15 @@
* Initialize subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_start_client ()
+GSF_cadet_start_client ()
{
- static const struct GNUNET_MESH_MessageHandler handlers[] = {
- { &reply_cb, GNUNET_MESSAGE_TYPE_FS_MESH_REPLY, 0 },
+ static const struct GNUNET_CADET_MessageHandler handlers[] = {
+ { &reply_cb, GNUNET_MESSAGE_TYPE_FS_CADET_REPLY, 0 },
{ NULL, 0, 0 }
};
- mesh_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
- mesh_handle = GNUNET_MESH_connect (GSF_cfg,
+ cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
+ cadet_handle = GNUNET_CADET_connect (GSF_cfg,
NULL,
NULL,
&cleaner_cb,
@@ -721,25 +721,25 @@
/**
- * Function called on each active meshs to shut them down.
+ * Function called on each active cadets to shut them down.
*
* @param cls NULL
* @param key target peer, unused
- * @param value the `struct MeshHandle` to destroy
+ * @param value the `struct CadetHandle` to destroy
* @return #GNUNET_YES (continue to iterate)
*/
static int
-release_meshs (void *cls,
+release_cadets (void *cls,
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct MeshHandle *mh = value;
+ struct CadetHandle *mh = value;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout on mesh channel to %s\n",
+ "Timeout on cadet channel to %s\n",
GNUNET_i2s (&mh->target));
if (NULL != mh->channel)
- GNUNET_MESH_channel_destroy (mh->channel);
+ GNUNET_CADET_channel_destroy (mh->channel);
return GNUNET_YES;
}
@@ -748,19 +748,19 @@
* Shutdown subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_stop_client ()
+GSF_cadet_stop_client ()
{
- GNUNET_CONTAINER_multipeermap_iterate (mesh_map,
- &release_meshs,
+ GNUNET_CONTAINER_multipeermap_iterate (cadet_map,
+ &release_cadets,
NULL);
- GNUNET_CONTAINER_multipeermap_destroy (mesh_map);
- mesh_map = NULL;
- if (NULL != mesh_handle)
+ GNUNET_CONTAINER_multipeermap_destroy (cadet_map);
+ cadet_map = NULL;
+ if (NULL != cadet_handle)
{
- GNUNET_MESH_disconnect (mesh_handle);
- mesh_handle = NULL;
+ GNUNET_CADET_disconnect (cadet_handle);
+ cadet_handle = NULL;
}
}
-/* end of gnunet-service-fs_mesh_client.c */
+/* end of gnunet-service-fs_cadet_client.c */
Modified: gnunet/src/fs/gnunet-service-fs_mesh_server.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_server.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/fs/gnunet-service-fs_mesh_server.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -19,7 +19,7 @@
*/
/**
- * @file fs/gnunet-service-fs_mesh_server.c
+ * @file fs/gnunet-service-fs_cadet_server.c
* @brief non-anonymous file-transfer
* @author Christian Grothoff
*
@@ -30,12 +30,12 @@
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_util_lib.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_protocols.h"
#include "gnunet_applications.h"
#include "gnunet-service-fs.h"
#include "gnunet-service-fs_indexing.h"
-#include "gnunet-service-fs_mesh.h"
+#include "gnunet-service-fs_cadet.h"
/**
* After how long do we termiante idle connections?
@@ -44,7 +44,7 @@
/**
- * A message in the queue to be written to the mesh.
+ * A message in the queue to be written to the cadet.
*/
struct WriteQueueItem
{
@@ -66,29 +66,29 @@
/**
- * Information we keep around for each active meshing client.
+ * Information we keep around for each active cadeting client.
*/
-struct MeshClient
+struct CadetClient
{
/**
* DLL
*/
- struct MeshClient *next;
+ struct CadetClient *next;
/**
* DLL
*/
- struct MeshClient *prev;
+ struct CadetClient *prev;
/**
* Channel for communication.
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
/**
* Handle for active write operation, or NULL.
*/
- struct GNUNET_MESH_TransmitHandle *wh;
+ struct GNUNET_CADET_TransmitHandle *wh;
/**
* Head of write queue.
@@ -126,65 +126,65 @@
/**
* Listen channel for incoming requests.
*/
-static struct GNUNET_MESH_Handle *listen_channel;
+static struct GNUNET_CADET_Handle *listen_channel;
/**
- * Head of DLL of mesh clients.
+ * Head of DLL of cadet clients.
*/
-static struct MeshClient *sc_head;
+static struct CadetClient *sc_head;
/**
- * Tail of DLL of mesh clients.
+ * Tail of DLL of cadet clients.
*/
-static struct MeshClient *sc_tail;
+static struct CadetClient *sc_tail;
/**
- * Number of active mesh clients in the 'sc_*'-DLL.
+ * Number of active cadet clients in the 'sc_*'-DLL.
*/
static unsigned int sc_count;
/**
- * Maximum allowed number of mesh clients.
+ * Maximum allowed number of cadet clients.
*/
static unsigned long long sc_count_max;
/**
- * Task run to asynchronously terminate the mesh due to timeout.
+ * Task run to asynchronously terminate the cadet due to timeout.
*
- * @param cls the 'struct MeshClient'
+ * @param cls the 'struct CadetClient'
* @param tc scheduler context
*/
static void
-timeout_mesh_task (void *cls,
+timeout_cadet_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshClient *sc = cls;
- struct GNUNET_MESH_Channel *tun;
+ struct CadetClient *sc = cls;
+ struct GNUNET_CADET_Channel *tun;
sc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
tun = sc->channel;
sc->channel = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout for inactive mesh client %p\n",
+ "Timeout for inactive cadet client %p\n",
sc);
- GNUNET_MESH_channel_destroy (tun);
+ GNUNET_CADET_channel_destroy (tun);
}
/**
- * Reset the timeout for the mesh client (due to activity).
+ * Reset the timeout for the cadet client (due to activity).
*
* @param sc client handle to reset timeout for
*/
static void
-refresh_timeout_task (struct MeshClient *sc)
+refresh_timeout_task (struct CadetClient *sc)
{
if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
GNUNET_SCHEDULER_cancel (sc->timeout_task);
sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT,
- &timeout_mesh_task,
+ &timeout_cadet_task,
sc);
}
@@ -195,13 +195,13 @@
* @param sc client to continue reading requests from
*/
static void
-continue_reading (struct MeshClient *sc)
+continue_reading (struct CadetClient *sc)
{
refresh_timeout_task (sc);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Finished processing mesh request from client %p, ready to
receive the next one\n",
+ "Finished processing cadet request from client %p, ready to
receive the next one\n",
sc);
- GNUNET_MESH_receive_done (sc->channel);
+ GNUNET_CADET_receive_done (sc->channel);
}
@@ -211,13 +211,13 @@
* @param sc where to process the write queue
*/
static void
-continue_writing (struct MeshClient *sc);
+continue_writing (struct CadetClient *sc);
/**
- * Send a reply now, mesh is ready.
+ * Send a reply now, cadet is ready.
*
- * @param cls closure with the `struct MeshClient` which sent the query
+ * @param cls closure with the `struct CadetClient` which sent the query
* @param size number of bytes available in @a buf
* @param buf where to write the message
* @return number of bytes written to @a buf
@@ -227,8 +227,8 @@
size_t size,
void *buf)
{
- struct MeshClient *sc = cls;
- struct GNUNET_MESH_Channel *tun;
+ struct CadetClient *sc = cls;
+ struct GNUNET_CADET_Channel *tun;
struct WriteQueueItem *wqi;
size_t ret;
@@ -243,21 +243,21 @@
(size < wqi->msize) )
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmission of reply failed, terminating mesh\n");
+ "Transmission of reply failed, terminating cadet\n");
tun = sc->channel;
sc->channel = NULL;
- GNUNET_MESH_channel_destroy (tun);
+ GNUNET_CADET_channel_destroy (tun);
return 0;
}
GNUNET_CONTAINER_DLL_remove (sc->wqi_head,
sc->wqi_tail,
wqi);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitted %u byte reply via mesh to %p\n",
+ "Transmitted %u byte reply via cadet to %p\n",
(unsigned int) size,
sc);
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# Blocks transferred via mesh"), 1,
+ gettext_noop ("# Blocks transferred via cadet"), 1,
GNUNET_NO);
memcpy (buf, &wqi[1], ret = wqi->msize);
GNUNET_free (wqi);
@@ -272,10 +272,10 @@
* @param sc where to process the write queue
*/
static void
-continue_writing (struct MeshClient *sc)
+continue_writing (struct CadetClient *sc)
{
struct WriteQueueItem *wqi;
- struct GNUNET_MESH_Channel *tun;
+ struct GNUNET_CADET_Channel *tun;
if (NULL != sc->wh)
{
@@ -290,7 +290,7 @@
continue_reading (sc);
return;
}
- sc->wh = GNUNET_MESH_notify_transmit_ready (sc->channel, GNUNET_NO,
+ sc->wh = GNUNET_CADET_notify_transmit_ready (sc->channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
wqi->msize,
&write_continuation,
@@ -298,10 +298,10 @@
if (NULL == sc->wh)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Write failed; terminating mesh\n");
+ "Write failed; terminating cadet\n");
tun = sc->channel;
sc->channel = NULL;
- GNUNET_MESH_channel_destroy (tun);
+ GNUNET_CADET_channel_destroy (tun);
return;
}
}
@@ -310,7 +310,7 @@
/**
* Process a datum that was stored in the datastore.
*
- * @param cls closure with the `struct MeshClient` which sent the query
+ * @param cls closure with the `struct CadetClient` which sent the query
* @param key key for the content
* @param size number of bytes in @a data
* @param data content stored
@@ -331,10 +331,10 @@
struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
- struct MeshClient *sc = cls;
- size_t msize = size + sizeof (struct MeshReplyMessage);
+ struct CadetClient *sc = cls;
+ size_t msize = size + sizeof (struct CadetReplyMessage);
struct WriteQueueItem *wqi;
- struct MeshReplyMessage *srm;
+ struct CadetReplyMessage *srm;
sc->qe = NULL;
if (NULL == data)
@@ -349,7 +349,7 @@
"Have no answer for query `%s'\n",
GNUNET_h2s (key));
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# queries received via mesh not
answered"), 1,
+ gettext_noop ("# queries received via cadet not
answered"), 1,
GNUNET_NO);
continue_writing (sc);
return;
@@ -381,16 +381,16 @@
}
GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting transmission of %u byte reply of type %d for query `%s'
via mesh to %p\n",
+ "Starting transmission of %u byte reply of type %d for query `%s'
via cadet to %p\n",
(unsigned int) size,
(unsigned int) type,
GNUNET_h2s (key),
sc);
wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize);
wqi->msize = msize;
- srm = (struct MeshReplyMessage *) &wqi[1];
+ srm = (struct CadetReplyMessage *) &wqi[1];
srm->header.size = htons ((uint16_t) msize);
- srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_MESH_REPLY);
+ srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_REPLY);
srm->type = htonl (type);
srm->expiration = GNUNET_TIME_absolute_hton (expiration);
memcpy (&srm[1], data, size);
@@ -408,7 +408,7 @@
*
* Do not call #GNUNET_SERVER_mst_destroy in callback
*
- * @param cls closure with the 'struct MeshClient'
+ * @param cls closure with the 'struct CadetClient'
* @param channel channel handle
* @param channel_ctx channel context
* @param message the actual message
@@ -416,20 +416,20 @@
*/
static int
request_cb (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
- struct MeshClient *sc = *channel_ctx;
- const struct MeshQueryMessage *sqm;
+ struct CadetClient *sc = *channel_ctx;
+ const struct CadetQueryMessage *sqm;
- sqm = (const struct MeshQueryMessage *) message;
+ sqm = (const struct CadetQueryMessage *) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received query for `%s' via mesh from client %p\n",
+ "Received query for `%s' via cadet from client %p\n",
GNUNET_h2s (&sqm->query),
sc);
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# queries received via mesh"), 1,
+ gettext_noop ("# queries received via cadet"), 1,
GNUNET_NO);
refresh_timeout_task (sc);
sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh,
@@ -451,37 +451,37 @@
/**
- * Functions of this type are called upon new mesh connection from other peers.
+ * Functions of this type are called upon new cadet connection from other
peers.
*
- * @param cls the closure from GNUNET_MESH_connect
- * @param channel the channel representing the mesh
- * @param initiator the identity of the peer who wants to establish a mesh
+ * @param cls the closure from GNUNET_CADET_connect
+ * @param channel the channel representing the cadet
+ * @param initiator the identity of the peer who wants to establish a cadet
* with us; NULL on binding error
- * @param port mesh port used for the incoming connection
+ * @param port cadet port used for the incoming connection
* @param options channel option flags
- * @return initial channel context (our 'struct MeshClient')
+ * @return initial channel context (our 'struct CadetClient')
*/
static void *
accept_cb (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
- struct MeshClient *sc;
+ struct CadetClient *sc;
GNUNET_assert (NULL != channel);
if (sc_count >= sc_count_max)
{
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# mesh client connections
rejected"), 1,
+ gettext_noop ("# cadet client connections
rejected"), 1,
GNUNET_NO);
- GNUNET_MESH_channel_destroy (channel);
+ GNUNET_CADET_channel_destroy (channel);
return NULL;
}
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# mesh connections active"), 1,
+ gettext_noop ("# cadet connections active"), 1,
GNUNET_NO);
- sc = GNUNET_new (struct MeshClient);
+ sc = GNUNET_new (struct CadetClient);
sc->channel = channel;
GNUNET_CONTAINER_DLL_insert (sc_head,
sc_tail,
@@ -489,7 +489,7 @@
sc_count++;
refresh_timeout_task (sc);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Accepting inbound mesh connection from `%s' as client %p\n",
+ "Accepting inbound cadet connection from `%s' as client %p\n",
GNUNET_i2s (initiator),
sc);
return sc;
@@ -497,36 +497,36 @@
/**
- * Function called by mesh when a client disconnects.
- * Cleans up our 'struct MeshClient' of that channel.
+ * Function called by cadet when a client disconnects.
+ * Cleans up our 'struct CadetClient' of that channel.
*
* @param cls NULL
* @param channel channel of the disconnecting client
- * @param channel_ctx our 'struct MeshClient'
+ * @param channel_ctx our 'struct CadetClient'
*/
static void
cleaner_cb (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
- struct MeshClient *sc = channel_ctx;
+ struct CadetClient *sc = channel_ctx;
struct WriteQueueItem *wqi;
if (NULL == sc)
return;
sc->channel = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Terminating mesh connection with client %p\n",
+ "Terminating cadet connection with client %p\n",
sc);
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# mesh connections active"), -1,
+ gettext_noop ("# cadet connections active"), -1,
GNUNET_NO);
if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task)
GNUNET_SCHEDULER_cancel (sc->terminate_task);
if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
GNUNET_SCHEDULER_cancel (sc->timeout_task);
if (NULL != sc->wh)
- GNUNET_MESH_notify_transmit_ready_cancel (sc->wh);
+ GNUNET_CADET_notify_transmit_ready_cancel (sc->wh);
if (NULL != sc->qe)
GNUNET_DATASTORE_cancel (sc->qe);
while (NULL != (wqi = sc->wqi_head))
@@ -548,10 +548,10 @@
* Initialize subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_start_server ()
+GSF_cadet_start_server ()
{
- static const struct GNUNET_MESH_MessageHandler handlers[] = {
- { &request_cb, GNUNET_MESSAGE_TYPE_FS_MESH_QUERY, sizeof (struct
MeshQueryMessage)},
+ static const struct GNUNET_CADET_MessageHandler handlers[] = {
+ { &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct
CadetQueryMessage)},
{ NULL, 0, 0 }
};
static const uint32_t ports[] = {
@@ -562,13 +562,13 @@
if (GNUNET_YES !=
GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
"fs",
- "MAX_MESH_CLIENTS",
+ "MAX_CADET_CLIENTS",
&sc_count_max))
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Initializing mesh FS server with a limit of %llu connections\n",
+ "Initializing cadet FS server with a limit of %llu connections\n",
sc_count_max);
- listen_channel = GNUNET_MESH_connect (GSF_cfg,
+ listen_channel = GNUNET_CADET_connect (GSF_cfg,
NULL,
&accept_cb,
&cleaner_cb,
@@ -581,15 +581,15 @@
* Shutdown subsystem for non-anonymous file-sharing.
*/
void
-GSF_mesh_stop_server ()
+GSF_cadet_stop_server ()
{
if (NULL != listen_channel)
{
- GNUNET_MESH_disconnect (listen_channel);
+ GNUNET_CADET_disconnect (listen_channel);
listen_channel = NULL;
}
GNUNET_assert (NULL == sc_head);
GNUNET_assert (0 == sc_count);
}
-/* end of gnunet-service-fs_mesh.c */
+/* end of gnunet-service-fs_cadet.c */
Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/fs/gnunet-service-fs_pr.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -31,7 +31,7 @@
#include "gnunet-service-fs_indexing.h"
#include "gnunet-service-fs_pe.h"
#include "gnunet-service-fs_pr.h"
-#include "gnunet-service-fs_mesh.h"
+#include "gnunet-service-fs_cadet.h"
/**
@@ -65,10 +65,10 @@
#define INSANE_STATISTICS GNUNET_NO
/**
- * If obtaining a block via mesh fails, how often do we retry it before
+ * If obtaining a block via cadet fails, how often do we retry it before
* giving up for good (and sticking to non-anonymous transfer)?
*/
-#define MESH_RETRY_MAX 3
+#define CADET_RETRY_MAX 3
/**
@@ -117,9 +117,9 @@
struct GNUNET_DHT_GetHandle *gh;
/**
- * Mesh request handle for this request (or NULL for none).
+ * Cadet request handle for this request (or NULL for none).
*/
- struct GSF_MeshRequest *mesh_request;
+ struct GSF_CadetRequest *cadet_request;
/**
* Function to call upon completion of the local get
@@ -174,10 +174,10 @@
uint64_t first_uid;
/**
- * How often have we retried this request via 'mesh'?
+ * How often have we retried this request via 'cadet'?
* (used to bound overall retries).
*/
- unsigned int mesh_retry_count;
+ unsigned int cadet_retry_count;
/**
* Number of valid entries in the 'replies_seen' array.
@@ -595,11 +595,11 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Cleaning up pending request for `%s'.\n",
GNUNET_h2s (key));
- if (NULL != pr->mesh_request)
+ if (NULL != pr->cadet_request)
{
- pr->mesh_retry_count = MESH_RETRY_MAX;
- GSF_mesh_query_cancel (pr->mesh_request);
- pr->mesh_request = NULL;
+ pr->cadet_retry_count = CADET_RETRY_MAX;
+ GSF_cadet_query_cancel (pr->cadet_request);
+ pr->cadet_request = NULL;
}
if (NULL != (cont = pr->llc_cont))
{
@@ -668,11 +668,11 @@
* but do NOT remove from our data-structures, we still need it there
* to prevent the request from looping */
pr->rh = NULL;
- if (NULL != pr->mesh_request)
+ if (NULL != pr->cadet_request)
{
- pr->mesh_retry_count = MESH_RETRY_MAX;
- GSF_mesh_query_cancel (pr->mesh_request);
- pr->mesh_request = NULL;
+ pr->cadet_retry_count = CADET_RETRY_MAX;
+ GSF_cadet_query_cancel (pr->cadet_request);
+ pr->cadet_request = NULL;
}
if (NULL != (cont = pr->llc_cont))
{
@@ -1139,7 +1139,7 @@
/**
- * Function called with a reply from the mesh.
+ * Function called with a reply from the cadet.
*
* @param cls the pending request struct
* @param type type of the block, ANY on error
@@ -1148,7 +1148,7 @@
* @param data reply block data, NULL on error
*/
static void
-mesh_reply_proc (void *cls,
+cadet_reply_proc (void *cls,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute expiration,
size_t data_size,
@@ -1158,22 +1158,22 @@
struct ProcessReplyClosure prq;
struct GNUNET_HashCode query;
- pr->mesh_request = NULL;
+ pr->cadet_request = NULL;
if (GNUNET_BLOCK_TYPE_ANY == type)
{
GNUNET_break (NULL == data);
GNUNET_break (0 == data_size);
- pr->mesh_retry_count++;
- if (pr->mesh_retry_count >= MESH_RETRY_MAX)
- return; /* give up on mesh */
+ pr->cadet_retry_count++;
+ if (pr->cadet_retry_count >= CADET_RETRY_MAX)
+ return; /* give up on cadet */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Error retrieiving block via mesh\n");
+ "Error retrieiving block via cadet\n");
/* retry -- without delay, as this is non-anonymous
- and mesh/mesh connect will take some time anyway */
- pr->mesh_request = GSF_mesh_query (pr->public_data.target,
+ and cadet/cadet connect will take some time anyway */
+ pr->cadet_request = GSF_cadet_query (pr->public_data.target,
&pr->public_data.query,
pr->public_data.type,
- &mesh_reply_proc,
+ &cadet_reply_proc,
pr);
return;
}
@@ -1189,7 +1189,7 @@
return;
}
GNUNET_STATISTICS_update (GSF_stats,
- gettext_noop ("# Replies received from MESH"), 1,
+ gettext_noop ("# Replies received from CADET"), 1,
GNUNET_NO);
memset (&prq, 0, sizeof (prq));
prq.data = data;
@@ -1204,27 +1204,27 @@
/**
- * Consider downloading via mesh (if possible)
+ * Consider downloading via cadet (if possible)
*
* @param pr the pending request to process
*/
void
-GSF_mesh_lookup_ (struct GSF_PendingRequest *pr)
+GSF_cadet_lookup_ (struct GSF_PendingRequest *pr)
{
if (0 != pr->public_data.anonymity_level)
return;
if (0 == pr->public_data.target)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Cannot do mesh-based download, target peer not known\n");
+ "Cannot do cadet-based download, target peer not known\n");
return;
}
- if (NULL != pr->mesh_request)
+ if (NULL != pr->cadet_request)
return;
- pr->mesh_request = GSF_mesh_query (pr->public_data.target,
+ pr->cadet_request = GSF_cadet_query (pr->public_data.target,
&pr->public_data.query,
pr->public_data.type,
- &mesh_reply_proc,
+ &cadet_reply_proc,
pr);
}
@@ -1553,7 +1553,7 @@
GSF_LocalLookupContinuation cont, void *cont_cls)
{
GNUNET_assert (NULL == pr->gh);
- GNUNET_assert (NULL == pr->mesh_request);
+ GNUNET_assert (NULL == pr->cadet_request);
GNUNET_assert (NULL == pr->llc_cont);
pr->llc_cont = cont;
pr->llc_cont_cls = cont_cls;
Modified: gnunet/src/fs/gnunet-service-fs_pr.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/fs/gnunet-service-fs_pr.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -351,12 +351,12 @@
/**
- * Consider downloading via mesh (if possible)
+ * Consider downloading via cadet (if possible)
*
* @param pr the pending request to process
*/
void
-GSF_mesh_lookup_ (struct GSF_PendingRequest *pr);
+GSF_cadet_lookup_ (struct GSF_PendingRequest *pr);
/**
Modified: gnunet/src/fs/test_fs_download.c
===================================================================
--- gnunet/src/fs/test_fs_download.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/fs/test_fs_download.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -331,10 +331,10 @@
binary_name = "test-fs-download-indexed";
config_name = "test_fs_download_indexed.conf";
}
- if (NULL != strstr (argv[0], "mesh"))
+ if (NULL != strstr (argv[0], "cadet"))
{
- binary_name = "test-fs-download-mesh";
- config_name = "test_fs_download_mesh.conf";
+ binary_name = "test-fs-download-cadet";
+ config_name = "test_fs_download_cadet.conf";
}
if (0 != GNUNET_TESTING_peer_run (binary_name,
config_name,
Modified: gnunet/src/fs/test_gnunet_service_fs_p2p.c
===================================================================
--- gnunet/src/fs/test_gnunet_service_fs_p2p.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/fs/test_gnunet_service_fs_p2p.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -122,7 +122,7 @@
{
unsigned int i;
- if (NULL != strstr (progname, "mesh"))
+ if (NULL != strstr (progname, "cadet"))
anonymity_level = 0;
else
anonymity_level = 1;
@@ -144,8 +144,8 @@
const char *config;
progname = argv[0];
- if (NULL != strstr (progname, "mesh"))
- config = "test_gnunet_service_fs_p2p_mesh.conf";
+ if (NULL != strstr (progname, "cadet"))
+ config = "test_gnunet_service_fs_p2p_cadet.conf";
else
config = "fs_test_lib_data.conf";
(void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-p2p",
Modified: gnunet/src/include/gnunet_applications.h
===================================================================
--- gnunet/src/include/gnunet_applications.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/include/gnunet_applications.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -20,7 +20,7 @@
/**
* @file include/gnunet_applications.h
- * @brief constants for network applications operating on top of the MESH
service
+ * @brief constants for network applications operating on top of the CADET
service
* @author Christian Grothoff
*/
Modified: gnunet/src/include/gnunet_block_lib.h
===================================================================
--- gnunet/src/include/gnunet_block_lib.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/include/gnunet_block_lib.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -80,7 +80,7 @@
/**
* Type of a block that contains a HELLO for a peer (for
- * DHT and MESH find-peer operations).
+ * DHT and CADET find-peer operations).
*/
GNUNET_BLOCK_TYPE_DHT_HELLO = 7,
@@ -107,12 +107,12 @@
GNUNET_BLOCK_TYPE_GNS_NAMERECORD = 11,
/**
- * Block to store a mesh regex state
+ * Block to store a cadet regex state
*/
GNUNET_BLOCK_TYPE_REGEX = 22,
/**
- * Block to store a mesh regex accepting state
+ * Block to store a cadet regex accepting state
*/
GNUNET_BLOCK_TYPE_REGEX_ACCEPT = 23
};
Modified: gnunet/src/include/gnunet_core_service.h
===================================================================
--- gnunet/src/include/gnunet_core_service.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/include/gnunet_core_service.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -58,7 +58,7 @@
GNUNET_CORE_PRIO_BACKGROUND = 0,
/**
- * Normal traffic (i.e. mesh/dv relay, DHT)
+ * Normal traffic (i.e. cadet/dv relay, DHT)
*/
GNUNET_CORE_PRIO_BEST_EFFORT = 1,
@@ -68,7 +68,7 @@
GNUNET_CORE_PRIO_URGENT = 2,
/**
- * Highest priority, control traffic (i.e. NSE, Core/Mesh KX).
+ * Highest priority, control traffic (i.e. NSE, Core/Cadet KX).
*/
GNUNET_CORE_PRIO_CRITICAL_CONTROL = 3
Modified: gnunet/src/include/gnunet_mesh_service.h
===================================================================
--- gnunet/src/include/gnunet_mesh_service.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/include/gnunet_mesh_service.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,13 +19,13 @@
*/
/**
- * @file include/gnunet_mesh_service.h
- * @brief mesh service; establish channels to distant peers
+ * @file include/gnunet_cadet_service.h
+ * @brief cadet service; establish channels to distant peers
* @author Christian Grothoff
*/
-#ifndef GNUNET_MESH_SERVICE_H
-#define GNUNET_MESH_SERVICE_H
+#ifndef GNUNET_CADET_SERVICE_H
+#define GNUNET_CADET_SERVICE_H
#ifdef __cplusplus
extern "C"
@@ -39,66 +39,66 @@
#include "gnunet_transport_service.h"
/**
- * Version number of GNUnet-mesh API.
+ * Version number of GNUnet-cadet API.
*/
-#define GNUNET_MESH_VERSION 0x00000003
+#define GNUNET_CADET_VERSION 0x00000003
/**
* Opaque handle to the service.
*/
-struct GNUNET_MESH_Handle;
+struct GNUNET_CADET_Handle;
/**
* Opaque handle to a channel.
*/
-struct GNUNET_MESH_Channel;
+struct GNUNET_CADET_Channel;
/**
- * Hash to be used in Mesh communication. Only 256 bits needed,
+ * Hash to be used in Cadet communication. Only 256 bits needed,
* instead of the 512 from @c GNUNET_HashCode.
*
*/
-struct GNUNET_MESH_Hash
+struct GNUNET_CADET_Hash
{
unsigned char bits[256 / 8];
};
/**
* Channel options.
- * Second line indicates filed in the MeshChannelInfo union carrying the
answer.
+ * Second line indicates filed in the CadetChannelInfo union carrying the
answer.
*/
-enum GNUNET_MESH_ChannelOption
+enum GNUNET_CADET_ChannelOption
{
/**
* Default options: unreliable, default buffering, not out of order.
*/
- GNUNET_MESH_OPTION_DEFAULT = 0x0,
+ GNUNET_CADET_OPTION_DEFAULT = 0x0,
/**
* Disable buffering on intermediate nodes (for minimum latency).
* Yes/No.
*/
- GNUNET_MESH_OPTION_NOBUFFER = 0x1,
+ GNUNET_CADET_OPTION_NOBUFFER = 0x1,
/**
* Enable channel reliability, lost messages will be retransmitted.
* Yes/No.
*/
- GNUNET_MESH_OPTION_RELIABLE = 0x2,
+ GNUNET_CADET_OPTION_RELIABLE = 0x2,
/**
* Enable out of order delivery of messages.
* Yes/No.
*/
- GNUNET_MESH_OPTION_OOORDER = 0x4,
+ GNUNET_CADET_OPTION_OOORDER = 0x4,
/**
* Who is the peer at the other end of the channel.
- * Only for use in @c GNUNET_MESH_channel_get_info
+ * Only for use in @c GNUNET_CADET_channel_get_info
* struct GNUNET_PeerIdentity *peer
*/
- GNUNET_MESH_OPTION_PEER = 0x8
+ GNUNET_CADET_OPTION_PEER = 0x8
};
@@ -107,19 +107,19 @@
* Functions with this signature are called whenever a message is
* received.
*
- * Each time the function must call #GNUNET_MESH_receive_done on the channel
+ * Each time the function must call #GNUNET_CADET_receive_done on the channel
* in order to receive the next message. This doesn't need to be immediate:
* can be delayed if some processing is done on the message.
*
- * @param cls Closure (set from #GNUNET_MESH_connect).
+ * @param cls Closure (set from #GNUNET_CADET_connect).
* @param channel Connection to the other end.
* @param channel_ctx Place to store local state associated with the channel.
* @param message The actual message.
* @return #GNUNET_OK to keep the channel open,
* #GNUNET_SYSERR to close it (signal serious error).
*/
-typedef int (*GNUNET_MESH_MessageCallback) (void *cls,
- struct GNUNET_MESH_Channel
*channel,
+typedef int (*GNUNET_CADET_MessageCallback) (void *cls,
+ struct GNUNET_CADET_Channel
*channel,
void **channel_ctx,
const struct GNUNET_MessageHeader
*message);
@@ -128,12 +128,12 @@
* Message handler. Each struct specifies how to handle on particular
* type of message received.
*/
-struct GNUNET_MESH_MessageHandler
+struct GNUNET_CADET_MessageHandler
{
/**
* Function to call for messages of "type".
*/
- GNUNET_MESH_MessageCallback callback;
+ GNUNET_CADET_MessageCallback callback;
/**
* Type of the message this handler covers.
@@ -153,29 +153,29 @@
* Method called whenever another peer has added us to a channel
* the other peer initiated.
* Only called (once) upon reception of data with a message type which was
- * subscribed to in #GNUNET_MESH_connect.
+ * subscribed to in #GNUNET_CADET_connect.
*
- * A call to #GNUNET_MESH_channel_destroy causes te channel to be ignored. In
+ * A call to #GNUNET_CADET_channel_destroy causes te channel to be ignored. In
* this case the handler MUST return NULL.
*
* @param cls closure
* @param channel new handle to the channel
* @param initiator peer that started the channel
* @param port Port this channel is for.
- * @param options MeshOption flag field, with all active option bits set to 1.
+ * @param options CadetOption flag field, with all active option bits set to 1.
*
* @return initial channel context for the channel
* (can be NULL -- that's not an error)
*/
-typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls,
+typedef void *(GNUNET_CADET_InboundChannelNotificationHandler) (void *cls,
struct
-
GNUNET_MESH_Channel
+
GNUNET_CADET_Channel
* channel,
const struct
GNUNET_PeerIdentity
* initiator,
uint32_t port,
- enum
GNUNET_MESH_ChannelOption
+ enum
GNUNET_CADET_ChannelOption
options);
@@ -183,21 +183,21 @@
* Function called whenever a channel is destroyed. Should clean up
* any associated state.
*
- * It must NOT call #GNUNET_MESH_channel_destroy on the channel.
+ * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
*
- * @param cls closure (set from #GNUNET_MESH_connect)
+ * @param cls closure (set from #GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
-typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls,
- const struct GNUNET_MESH_Channel
*
+typedef void (GNUNET_CADET_ChannelEndHandler) (void *cls,
+ const struct
GNUNET_CADET_Channel *
channel,
void *channel_ctx);
/**
- * Connect to the mesh service.
+ * Connect to the cadet service.
*
* @param cfg Configuration to use.
* @param cls Closure for the various callbacks that follow (including
@@ -206,59 +206,59 @@
* Can be NULL if no inbound channels are desired.
* See @a ports.
* @param cleaner Function called when a channel is destroyed by the remote
peer.
- * It is NOT called if #GNUNET_MESH_channel_destroy is called on
+ * It is NOT called if #GNUNET_CADET_channel_destroy is called
on
* the channel.
* @param handlers Callbacks for messages we care about, NULL-terminated. Each
- * one must call #GNUNET_MESH_receive_done on the channel to
+ * one must call #GNUNET_CADET_receive_done on the channel to
* receive the next message. Messages of a type that is not
* in the handlers array are ignored if received.
* @param ports NULL or 0-terminated array of port numbers for incoming
channels.
* See @a new_channel.
*
- * @return handle to the mesh service NULL on error
+ * @return handle to the cadet service NULL on error
* (in this case, init is never called)
*/
-struct GNUNET_MESH_Handle *
-GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
- GNUNET_MESH_InboundChannelNotificationHandler new_channel,
- GNUNET_MESH_ChannelEndHandler cleaner,
- const struct GNUNET_MESH_MessageHandler *handlers,
+struct GNUNET_CADET_Handle *
+GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
+ GNUNET_CADET_InboundChannelNotificationHandler
new_channel,
+ GNUNET_CADET_ChannelEndHandler cleaner,
+ const struct GNUNET_CADET_MessageHandler *handlers,
const uint32_t *ports);
/**
- * Disconnect from the mesh service. All channels will be destroyed. All
channel
+ * Disconnect from the cadet service. All channels will be destroyed. All
channel
* disconnect callbacks will be called on any still connected peers, notifying
* about their disconnection. The registered inbound channel cleaner will be
* called should any inbound channels still exist.
*
- * @param handle connection to mesh to disconnect
+ * @param handle connection to cadet to disconnect
*/
void
-GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle);
+GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle);
/**
* Create a new channel towards a remote peer.
*
* If the destination port is not open by any peer or the destination peer
- * does not accept the channel, #GNUNET_MESH_ChannelEndHandler will be called
+ * does not accept the channel, #GNUNET_CADET_ChannelEndHandler will be called
* for this channel.
*
- * @param h mesh handle
+ * @param h cadet handle
* @param channel_ctx client's channel context to associate with the channel
* @param peer peer identity the channel should go to
* @param port Port number.
- * @param options MeshOption flag field, with all desired option bits set to 1.
+ * @param options CadetOption flag field, with all desired option bits set to
1.
*
* @return handle to the channel
*/
-struct GNUNET_MESH_Channel *
-GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h,
+struct GNUNET_CADET_Channel *
+GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h,
void *channel_ctx,
const struct GNUNET_PeerIdentity *peer,
uint32_t port,
- enum GNUNET_MESH_ChannelOption options);
+ enum GNUNET_CADET_ChannelOption options);
/**
@@ -271,13 +271,13 @@
* @param channel Channel handle, becomes invalid after this call.
*/
void
-GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel);
+GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel);
/**
* Struct to retrieve info about a channel.
*/
-union GNUNET_MESH_ChannelInfo
+union GNUNET_CADET_ChannelInfo
{
/**
@@ -296,23 +296,23 @@
* Get information about a channel.
*
* @param channel Channel handle.
- * @param option Query type GNUNET_MESH_OPTION_*
+ * @param option Query type GNUNET_CADET_OPTION_*
* @param ... dependant on option, currently not used
* @return Union with an answer to the query.
*/
-const union GNUNET_MESH_ChannelInfo *
-GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel,
- enum GNUNET_MESH_ChannelOption option, ...);
+const union GNUNET_CADET_ChannelInfo *
+GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
+ enum GNUNET_CADET_ChannelOption option, ...);
/**
* Handle for a transmission request.
*/
-struct GNUNET_MESH_TransmitHandle;
+struct GNUNET_CADET_TransmitHandle;
/**
- * Ask the mesh to call @a notify once it is ready to transmit the
+ * Ask the cadet to call @a notify once it is ready to transmit the
* given number of bytes to the specified channel.
* Only one call can be active at any time, to issue another request,
* wait for the callback or cancel the current request.
@@ -330,8 +330,8 @@
* NULL if we can not even queue the request (insufficient
* memory); if NULL is returned, @a notify will NOT be called.
*/
-struct GNUNET_MESH_TransmitHandle *
-GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Channel *channel,
+struct GNUNET_CADET_TransmitHandle *
+GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel,
int cork,
struct GNUNET_TIME_Relative maxdelay,
size_t notify_size,
@@ -345,7 +345,7 @@
* @param th handle that was returned by "notify_transmit_ready".
*/
void
-GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
+GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle
*th);
@@ -357,23 +357,23 @@
* @param channel Channel that will be allowed to call another handler.
*/
void
-GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel);
+GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel);
/******************************************************************************/
/******************** MONITORING /DEBUG API
*************************/
/******************************************************************************/
-/* The following calls are not useful for normal MESH operation, but for
*/
-/* debug and monitoring of the mesh state. They can be safely ignored.
*/
+/* The following calls are not useful for normal CADET operation, but for
*/
+/* debug and monitoring of the cadet state. They can be safely ignored.
*/
/* The API can change at any point without notice.
*/
/* Please contact the developer if you consider any of this calls useful for
*/
-/* normal mesh applications.
*/
+/* normal cadet applications.
*/
/******************************************************************************/
/**
- * Method called to retrieve information about a specific channel the mesh peer
+ * Method called to retrieve information about a specific channel the cadet
peer
* is aware of, including all transit nodes.
*
* @param cls Closure.
@@ -384,7 +384,7 @@
* @param dest_channel_number Local number for dest, if known.
* @param public_channel_numbe Number for P2P, always known.
*/
-typedef void (*GNUNET_MESH_ChannelCB) (void *cls,
+typedef void (*GNUNET_CADET_ChannelCB) (void *cls,
const struct GNUNET_PeerIdentity *root,
const struct GNUNET_PeerIdentity *dest,
uint32_t port,
@@ -393,7 +393,7 @@
uint32_t public_channel_number);
/**
- * Method called to retrieve information about all peers in MESH, called
+ * Method called to retrieve information about all peers in CADET, called
* once per peer.
*
* After last peer has been reported, an additional call with NULL is done.
@@ -405,7 +405,7 @@
* @param best_path How long is the best path?
* (0 = unknown, 1 = ourselves, 2 = neighbor)
*/
-typedef void (*GNUNET_MESH_PeersCB) (void *cls,
+typedef void (*GNUNET_CADET_PeersCB) (void *cls,
const struct GNUNET_PeerIdentity *peer,
int tunnel, unsigned int n_paths,
unsigned int best_path);
@@ -423,7 +423,7 @@
* Each path starts with the local peer.
* Each path ends with the destination peer (given in @c peer).
*/
-typedef void (*GNUNET_MESH_PeerCB) (void *cls,
+typedef void (*GNUNET_CADET_PeerCB) (void *cls,
const struct GNUNET_PeerIdentity *peer,
int tunnel,
int neighbor,
@@ -432,7 +432,7 @@
/**
- * Method called to retrieve information about all tunnels in MESH, called
+ * Method called to retrieve information about all tunnels in CADET, called
* once per tunnel.
*
* After last tunnel has been reported, an additional call with NULL is done.
@@ -444,7 +444,7 @@
* @param estate Encryption state.
* @param cstate Connectivity state.
*/
-typedef void (*GNUNET_MESH_TunnelsCB) (void *cls,
+typedef void (*GNUNET_CADET_TunnelsCB) (void *cls,
const struct GNUNET_PeerIdentity *peer,
unsigned int channels,
unsigned int connections,
@@ -454,7 +454,7 @@
/**
- * Method called to retrieve information about a specific tunnel the mesh peer
+ * Method called to retrieve information about a specific tunnel the cadet peer
* has established, o`r is trying to establish.
*
* @param cls Closure.
@@ -466,51 +466,51 @@
* @param estate Encryption state.
* @param cstate Connectivity state.
*/
-typedef void (*GNUNET_MESH_TunnelCB) (void *cls,
+typedef void (*GNUNET_CADET_TunnelCB) (void *cls,
const struct GNUNET_PeerIdentity *peer,
unsigned int n_channels,
unsigned int n_connections,
uint32_t *channels,
- struct GNUNET_MESH_Hash *connections,
+ struct GNUNET_CADET_Hash *connections,
unsigned int estate,
unsigned int cstate);
/**
- * Request information about a specific channel of the running mesh peer.
+ * Request information about a specific channel of the running cadet peer.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param peer ID of the other end of the channel.
* @param channel_number Channel number.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
*/
void
-GNUNET_MESH_get_channel (struct GNUNET_MESH_Handle *h,
+GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
struct GNUNET_PeerIdentity *peer,
uint32_t channel_number,
- GNUNET_MESH_ChannelCB callback,
+ GNUNET_CADET_ChannelCB callback,
void *callback_cls);
/**
- * Request information about peers known to the running mesh service.
+ * Request information about peers known to the running cadet service.
* The callback will be called for every peer known to the service.
* Only one info request (of any kind) can be active at once.
*
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
*
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h,
- GNUNET_MESH_PeersCB callback,
+GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
+ GNUNET_CADET_PeersCB callback,
void *callback_cls);
/**
@@ -518,22 +518,22 @@
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
*
- * @return Closure given to GNUNET_MESH_get_peers.
+ * @return Closure given to GNUNET_CADET_get_peers.
*/
void *
-GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h);
+GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h);
/**
- * Request information about a peer known to the running mesh peer.
+ * Request information about a peer known to the running cadet peer.
* The callback will be called for the tunnel once.
* Only one info request (of any kind) can be active at once.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param id Peer whose tunnel to examine.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
@@ -541,48 +541,48 @@
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h,
+GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
const struct GNUNET_PeerIdentity *id,
- GNUNET_MESH_PeerCB callback,
+ GNUNET_CADET_PeerCB callback,
void *callback_cls);
/**
- * Request information about tunnels of the running mesh peer.
+ * Request information about tunnels of the running cadet peer.
* The callback will be called for every tunnel of the service.
* Only one info request (of any kind) can be active at once.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
*
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h,
- GNUNET_MESH_TunnelsCB callback,
+GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h,
+ GNUNET_CADET_TunnelsCB callback,
void *callback_cls);
/**
* Cancel a monitor request. The monitor callback will not be called.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
*
- * @return Closure given to GNUNET_MESH_monitor, if any.
+ * @return Closure given to GNUNET_CADET_monitor, if any.
*/
void *
-GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h);
+GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
/**
- * Request information about a tunnel of the running mesh peer.
+ * Request information about a tunnel of the running cadet peer.
* The callback will be called for the tunnel once.
* Only one info request (of any kind) can be active at once.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param id Peer whose tunnel to examine.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
@@ -590,13 +590,13 @@
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h,
+GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h,
const struct GNUNET_PeerIdentity *id,
- GNUNET_MESH_TunnelCB callback,
+ GNUNET_CADET_TunnelCB callback,
void *callback_cls);
/**
- * Create a message queue for a mesh channel.
+ * Create a message queue for a cadet channel.
* The message queue can only be used to transmit messages,
* not to receive them.
*
@@ -604,7 +604,7 @@
* @return a message queue to messages over the channel
*/
struct GNUNET_MQ_Handle *
-GNUNET_MESH_mq_create (struct GNUNET_MESH_Channel *channel);
+GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel);
#if 0 /* keep Emacsens' auto-indent happy */
@@ -614,6 +614,6 @@
}
#endif
-/* ifndef GNUNET_MESH_SERVICE_H */
+/* ifndef GNUNET_CADET_SERVICE_H */
#endif
-/* end of gnunet_mesh_service.h */
+/* end of gnunet_cadet_service.h */
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/include/gnunet_protocols.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -521,14 +521,14 @@
#define GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP 139
/**
- * P2P request for content (one FS to another via a mesh).
+ * P2P request for content (one FS to another via a cadet).
*/
-#define GNUNET_MESSAGE_TYPE_FS_MESH_QUERY 140
+#define GNUNET_MESSAGE_TYPE_FS_CADET_QUERY 140
/**
- * P2P answer for content (one FS to another via a mesh).
+ * P2P answer for content (one FS to another via a cadet).
*/
-#define GNUNET_MESSAGE_TYPE_FS_MESH_REPLY 141
+#define GNUNET_MESSAGE_TYPE_FS_CADET_REPLY 141
/*******************************************************************************
@@ -811,179 +811,179 @@
/*******************************************************************************
- * MESH message types
+ * CADET message types
******************************************************************************/
/**
- * Type of message used to transport messages throug a MESH-tunnel (LEGACY)
+ * Type of message used to transport messages throug a CADET-tunnel (LEGACY)
*/
-#define GNUNET_MESSAGE_TYPE_MESH 215
+#define GNUNET_MESSAGE_TYPE_CADET 215
/**
* Type of message used to send another peer which messages we want to receive
- * through a mesh-tunnel (LEGACY)
+ * through a cadet-tunnel (LEGACY)
*/
-#define GNUNET_MESSAGE_TYPE_MESH_HELLO 216
+#define GNUNET_MESSAGE_TYPE_CADET_HELLO 216
/**
* Request the creation of a connection
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE 256
+#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE 256
/**
* Send origin an ACK that the connection is complete
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK 257
+#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK 257
/**
* Notify that a connection is no longer valid
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN 258
+#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN 258
/**
* At some point, the route will spontaneously change TODO
*/
-#define GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED 259
+#define GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED 259
/**
* Payload data (usually inside a encrypted tunnel).
*/
-#define GNUNET_MESSAGE_TYPE_MESH_DATA 260
+#define GNUNET_MESSAGE_TYPE_CADET_DATA 260
/**
* Confirm payload data end-to-end.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_DATA_ACK 261
+#define GNUNET_MESSAGE_TYPE_CADET_DATA_ACK 261
/**
* Key exchange encapsulation.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_KX 262
+#define GNUNET_MESSAGE_TYPE_CADET_KX 262
/**
* New ephemeral key.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL 263
+#define GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL 263
/**
* Challenge to test peer's session key.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_KX_PING 264
+#define GNUNET_MESSAGE_TYPE_CADET_KX_PING 264
/**
* Answer to session key challenge.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_KX_PONG 265
+#define GNUNET_MESSAGE_TYPE_CADET_KX_PONG 265
/**
* Request the destuction of a connection
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY 266
+#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY 266
/**
* Hop-by-hop, connection dependent ACK.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_ACK 268
+#define GNUNET_MESSAGE_TYPE_CADET_ACK 268
/**
* Poll for a hop-by-hop ACK.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_POLL 269
+#define GNUNET_MESSAGE_TYPE_CADET_POLL 269
/**
* Announce connection is still alive (direction sensitive).
*/
-#define GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE 270
+#define GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE 270
/**
- * Connect to the mesh service, specifying subscriptions
+ * Connect to the cadet service, specifying subscriptions
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT 272
/**
- * Ask the mesh service to create a new channel.
+ * Ask the cadet service to create a new channel.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE 273
+#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE 273
/**
- * Ask the mesh service to destroy a channel.
+ * Ask the cadet service to destroy a channel.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY 274
+#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY 274
/**
* Confirm the creation of a channel
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK 275
+#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK 275
/**
* Reject the creation of a channel
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK 276
+#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK 276
/**
* Encrypted data. (Payload, channel management, keepalive)
*/
-#define GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED 280
+#define GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED 280
/**
* Payload client <-> service
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 285
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA 285
/**
* Local ACK for data.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK 286
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK 286
/**
* Local information about all channels of service.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS 290
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS 290
/**
* Local information of service about a specific channel.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL 291
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL 291
/**
* Local information about all tunnels of service.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS 292
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS 292
/**
* Local information of service about a specific tunnel.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL 293
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL 293
/**
* Local information about all connections of service.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTIONS 294
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTIONS 294
/**
* Local information of service about a specific connection.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTION 295
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTION 295
/**
* Local information about all peers known to the service.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS 296
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS 296
/**
* Local information of service about a specific peer.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER 297
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER 297
/**
* Traffic (net-cat style) used by the Command Line Interface.
*/
-#define GNUNET_MESSAGE_TYPE_MESH_CLI 298
+#define GNUNET_MESSAGE_TYPE_CADET_CLI 298
/**
* 640kb should be enough for everybody
*/
-#define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 299
+#define GNUNET_MESSAGE_TYPE_CADET_RESERVE_END 299
@@ -2292,34 +2292,34 @@
#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO 739
/**
- * Mesh: call initiation
+ * Cadet: call initiation
*/
-#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING 740
+#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING 740
/**
- * Mesh: hang up / refuse call
+ * Cadet: hang up / refuse call
*/
-#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP 741
+#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP 741
/**
- * Mesh: pick up phone (establish audio channel)
+ * Cadet: pick up phone (establish audio channel)
*/
-#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP 742
+#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP 742
/**
- * Mesh: phone suspended.
+ * Cadet: phone suspended.
*/
-#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND 743
+#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND 743
/**
- * Mesh: phone resumed.
+ * Cadet: phone resumed.
*/
-#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME 744
+#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME 744
/**
- * Mesh: audio data
+ * Cadet: audio data
*/
-#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO 745
+#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO 745
/*******************************************************************************
Modified: gnunet/src/include/gnunet_signatures.h
===================================================================
--- gnunet/src/include/gnunet_signatures.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/include/gnunet_signatures.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -147,9 +147,9 @@
#define GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING 20
/**
- * Key exchange in MESH
+ * Key exchange in CADET
*/
-#define GNUNET_SIGNATURE_PURPOSE_MESH_KX 21
+#define GNUNET_SIGNATURE_PURPOSE_CADET_KX 21
/**
* Signature for the first round of distributed key generation.
Modified: gnunet/src/mesh/gnunet-mesh-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-mesh-profiler.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-mesh-profiler.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -18,14 +18,14 @@
Boston, MA 02111-1307, USA.
*/
/**
- * @file mesh/gnunet-mesh-profiler.c
+ * @file cadet/gnunet-cadet-profiler.c
*
- * @brief Profiler for mesh experiments.
+ * @brief Profiler for cadet experiments.
*/
#include <stdio.h>
#include "platform.h"
-#include "mesh_test_lib.h"
-#include "gnunet_mesh_service.h"
+#include "cadet_test_lib.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
@@ -61,7 +61,7 @@
/**
* Message type for pings.
*/
-struct MeshPingMessage
+struct CadetPingMessage
{
/**
* Header. Type PING/PONG.
@@ -87,7 +87,7 @@
/**
* Peer description.
*/
-struct MeshPeer
+struct CadetPeer
{
/**
* Testbed Operation (to get peer id, etc).
@@ -100,24 +100,24 @@
struct GNUNET_PeerIdentity id;
/**
- * Mesh handle for the root peer
+ * Cadet handle for the root peer
*/
- struct GNUNET_MESH_Handle *mesh;
+ struct GNUNET_CADET_Handle *cadet;
/**
* Channel handle for the root peer
*/
- struct GNUNET_MESH_Channel *ch;
+ struct GNUNET_CADET_Channel *ch;
/**
* Channel handle for the dest peer
*/
- struct GNUNET_MESH_Channel *incoming_ch;
+ struct GNUNET_CADET_Channel *incoming_ch;
/**
* Channel handle for a warmup channel.
*/
- struct GNUNET_MESH_Channel *warmup_ch;
+ struct GNUNET_CADET_Channel *warmup_ch;
/**
* Number of payload packes sent
@@ -137,12 +137,12 @@
/**
* Destinaton to ping.
*/
- struct MeshPeer *dest;
+ struct CadetPeer *dest;
/**
* Incoming channel for pings.
*/
- struct MeshPeer *incoming;
+ struct CadetPeer *incoming;
/**
* Task to do the next ping.
@@ -162,7 +162,7 @@
static struct GNUNET_TIME_Relative round_time;
/**
- * GNUNET_PeerIdentity -> MeshPeer
+ * GNUNET_PeerIdentity -> CadetPeer
*/
static struct GNUNET_CONTAINER_MultiPeerMap *ids;
@@ -179,7 +179,7 @@
/**
* Operation to get peer ids.
*/
-struct MeshPeer *peers;
+struct CadetPeer *peers;
/**
* Peer ids counter.
@@ -204,7 +204,7 @@
/**
* Test context (to shut down).
*/
-static struct GNUNET_MESH_TEST_Context *test_ctx;
+static struct GNUNET_CADET_TEST_Context *test_ctx;
/**
* Task called to shutdown test.
@@ -243,7 +243,7 @@
/**
- * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES.
+ * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
*
* Testcase continues when the root receives confirmation of connected peers,
* on callback funtion ch.
@@ -280,7 +280,7 @@
* @return Index of peer in peers.
*/
static unsigned int
-get_index (struct MeshPeer *peer)
+get_index (struct CadetPeer *peer)
{
return peer - peers;
}
@@ -292,7 +292,7 @@
static void
show_end_data (void)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
unsigned int i;
unsigned int j;
@@ -325,19 +325,19 @@
/**
- * Disconnect from mesh services af all peers, call shutdown.
+ * Disconnect from cadet services af all peers, call shutdown.
*
* @param cls Closure (unused).
* @param tc Task Context.
*/
static void
-disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext
*tc)
+disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext
*tc)
{
long line = (long) cls;
unsigned int i;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "disconnecting mesh service, called from line %ld\n", line);
+ "disconnecting cadet service, called from line %ld\n", line);
disconnect_task = GNUNET_SCHEDULER_NO_TASK;
for (i = 0; i < peers_total; i++)
{
@@ -350,22 +350,22 @@
if (NULL != peers[i].ch)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: channel %p\n", i, peers[i].ch);
- GNUNET_MESH_channel_destroy (peers[i].ch);
+ GNUNET_CADET_channel_destroy (peers[i].ch);
}
if (NULL != peers[i].warmup_ch)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: warmup channel %p\n",
i, peers[i].warmup_ch);
- GNUNET_MESH_channel_destroy (peers[i].warmup_ch);
+ GNUNET_CADET_channel_destroy (peers[i].warmup_ch);
}
if (NULL != peers[i].incoming_ch)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: incoming channel %p\n",
i, peers[i].incoming_ch);
- GNUNET_MESH_channel_destroy (peers[i].incoming_ch);
+ GNUNET_CADET_channel_destroy (peers[i].incoming_ch);
}
}
- GNUNET_MESH_TEST_cleanup (test_ctx);
+ GNUNET_CADET_TEST_cleanup (test_ctx);
if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
{
GNUNET_SCHEDULER_cancel (shutdown_handle);
@@ -385,7 +385,7 @@
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
(void *) line);
}
}
@@ -407,7 +407,7 @@
if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
(void *) __LINE__);
}
@@ -520,17 +520,17 @@
peers[r].up = run;
if (NULL != peers[r].ch)
- GNUNET_MESH_channel_destroy (peers[r].ch);
+ GNUNET_CADET_channel_destroy (peers[r].ch);
peers[r].ch = NULL;
if (NULL != peers[r].dest)
{
if (NULL != peers[r].dest->incoming_ch)
- GNUNET_MESH_channel_destroy (peers[r].dest->incoming_ch);
+ GNUNET_CADET_channel_destroy (peers[r].dest->incoming_ch);
peers[r].dest->incoming_ch = NULL;
}
op = GNUNET_TESTBED_peer_manage_service (&peers[r], testbed_handles[r],
- "mesh", NULL, NULL, run);
+ "cadet", NULL, NULL, run);
GNUNET_break (NULL != op);
peers_running += run ? 1 : -1;
GNUNET_assert (peers_running > 0);
@@ -587,15 +587,15 @@
static size_t
tmt_rdy_pong (void *cls, size_t size, void *buf)
{
- struct MeshPingMessage *ping = cls;
- struct MeshPingMessage *pong;
+ struct CadetPingMessage *ping = cls;
+ struct CadetPingMessage *pong;
if (0 == size || NULL == buf)
{
GNUNET_free (ping);
return 0;
}
- pong = (struct MeshPingMessage *) buf;
+ pong = (struct CadetPingMessage *) buf;
memcpy (pong, ping, sizeof (*ping));
pong->header.type = htons (PONG);
@@ -613,7 +613,7 @@
static void
ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshPeer *peer = (struct MeshPeer *) cls;
+ struct CadetPeer *peer = (struct CadetPeer *) cls;
peer->ping_task = GNUNET_SCHEDULER_NO_TASK;
@@ -624,9 +624,9 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u -> %u (%u)\n",
get_index (peer), get_index (peer->dest), peer->data_sent);
- GNUNET_MESH_notify_transmit_ready (peer->ch, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (peer->ch, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
- sizeof (struct MeshPingMessage),
+ sizeof (struct CadetPingMessage),
&tmt_rdy_ping, peer);
}
@@ -637,15 +637,15 @@
* @param tc Task context.
*/
static void
-pong (struct GNUNET_MESH_Channel *channel, const struct MeshPingMessage *ping)
+pong (struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage
*ping)
{
- struct MeshPingMessage *copy;
+ struct CadetPingMessage *copy;
- copy = GNUNET_new (struct MeshPingMessage);
+ copy = GNUNET_new (struct CadetPingMessage);
memcpy (copy, ping, sizeof (*ping));
- GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
- sizeof (struct MeshPingMessage),
+ sizeof (struct CadetPingMessage),
&tmt_rdy_pong, copy);
}
@@ -660,11 +660,11 @@
static size_t
tmt_rdy_ping (void *cls, size_t size, void *buf)
{
- struct MeshPeer *peer = (struct MeshPeer *) cls;
- struct MeshPingMessage *msg = buf;
+ struct CadetPeer *peer = (struct CadetPeer *) cls;
+ struct CadetPingMessage *msg = buf;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy called, filling buffer\n");
- if (size < sizeof (struct MeshPingMessage) || NULL == buf)
+ if (size < sizeof (struct CadetPingMessage) || NULL == buf)
{
GNUNET_break (GNUNET_YES == test_finished);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -683,14 +683,14 @@
peer->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (PING_PERIOD),
&ping, peer);
- return sizeof (struct MeshPingMessage);
+ return sizeof (struct CadetPingMessage);
}
/**
* Function is called whenever a PING message is received.
*
- * @param cls closure (peer #, set from GNUNET_MESH_connect)
+ * @param cls closure (peer #, set from GNUNET_CADET_connect)
* @param channel connection to the other end
* @param channel_ctx place to store local state associated with the channel
* @param message the actual message
@@ -698,16 +698,16 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
int
-ping_handler (void *cls, struct GNUNET_MESH_Channel *channel,
+ping_handler (void *cls, struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
long n = (long) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u got PING\n", n);
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
if (GNUNET_NO == test_finished)
- pong (channel, (struct MeshPingMessage *) message);
+ pong (channel, (struct CadetPingMessage *) message);
return GNUNET_OK;
}
@@ -716,7 +716,7 @@
/**
* Function is called whenever a PONG message is received.
*
- * @param cls closure (peer #, set from GNUNET_MESH_connect)
+ * @param cls closure (peer #, set from GNUNET_CADET_connect)
* @param channel connection to the other end
* @param channel_ctx place to store local state associated with the channel
* @param message the actual message
@@ -724,22 +724,22 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
int
-pong_handler (void *cls, struct GNUNET_MESH_Channel *channel,
+pong_handler (void *cls, struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
long n = (long) cls;
- struct MeshPeer *peer;
- struct MeshPingMessage *msg;
+ struct CadetPeer *peer;
+ struct CadetPingMessage *msg;
struct GNUNET_TIME_Absolute send_time;
struct GNUNET_TIME_Relative latency;
unsigned int r /* Ping round */;
float delta;
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
peer = &peers[n];
- msg = (struct MeshPingMessage *) message;
+ msg = (struct CadetPingMessage *) message;
send_time = GNUNET_TIME_absolute_ntoh (msg->timestamp);
latency = GNUNET_TIME_absolute_get_duration (send_time);
@@ -761,9 +761,9 @@
/**
* Handlers, for diverse services
*/
-static struct GNUNET_MESH_MessageHandler handlers[] = {
- {&ping_handler, PING, sizeof (struct MeshPingMessage)},
- {&pong_handler, PONG, sizeof (struct MeshPingMessage)},
+static struct GNUNET_CADET_MessageHandler handlers[] = {
+ {&ping_handler, PING, sizeof (struct CadetPingMessage)},
+ {&pong_handler, PONG, sizeof (struct CadetPingMessage)},
{NULL, 0, 0}
};
@@ -781,12 +781,12 @@
* (can be NULL -- that's not an error).
*/
static void *
-incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel,
+incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
long n = (long) cls;
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
peer = GNUNET_CONTAINER_multipeermap_get (ids, initiator);
GNUNET_assert (NULL != peer);
@@ -818,17 +818,17 @@
* Function called whenever an inbound channel is destroyed. Should clean up
* any associated state.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
-channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
+channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
long n = (long) cls;
- struct MeshPeer *peer = &peers[n];
+ struct CadetPeer *peer = &peers[n];
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Channel %p disconnected at peer %ld\n", channel, n);
@@ -844,8 +844,8 @@
*
* @return Random peer not yet connected to.
*/
-static struct MeshPeer *
-select_random_peer (struct MeshPeer *peer)
+static struct CadetPeer *
+select_random_peer (struct CadetPeer *peer)
{
unsigned int r;
@@ -859,7 +859,7 @@
}
/**
- * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES.
+ * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
*
* Testcase continues when the root receives confirmation of connected peers,
* on callback funtion ch.
@@ -870,7 +870,7 @@
static void
start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- enum GNUNET_MESH_ChannelOption flags;
+ enum GNUNET_CADET_ChannelOption flags;
unsigned long i;
test_task = GNUNET_SCHEDULER_NO_TASK;
@@ -879,17 +879,17 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n");
- flags = GNUNET_MESH_OPTION_DEFAULT;
+ flags = GNUNET_CADET_OPTION_DEFAULT;
for (i = 0; i < peers_pinging; i++)
{
peers[i].dest = select_random_peer (&peers[i]);
- peers[i].ch = GNUNET_MESH_channel_create (peers[i].mesh, NULL,
+ peers[i].ch = GNUNET_CADET_channel_create (peers[i].cadet, NULL,
&peers[i].dest->id,
1, flags);
if (NULL == peers[i].ch)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i);
- GNUNET_MESH_TEST_cleanup (test_ctx);
+ GNUNET_CADET_TEST_cleanup (test_ctx);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u => %u %p\n",
@@ -903,7 +903,7 @@
disconnect_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time,
number_rounds
+ 1),
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL);
}
@@ -915,7 +915,7 @@
static void
warmup (void)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
unsigned int i;
for (i = 0; i < peers_total; i++)
@@ -924,12 +924,12 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u => %u\n",
i, get_index (peer));
peers[i].warmup_ch =
- GNUNET_MESH_channel_create (peers[i].mesh, NULL, &peer->id,
- 1, GNUNET_MESH_OPTION_DEFAULT);
+ GNUNET_CADET_channel_create (peers[i].cadet, NULL, &peer->id,
+ 1, GNUNET_CADET_OPTION_DEFAULT);
if (NULL == peers[i].warmup_ch)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i);
- GNUNET_MESH_TEST_cleanup (test_ctx);
+ GNUNET_CADET_TEST_cleanup (test_ctx);
return;
}
}
@@ -991,17 +991,17 @@
* test main: start test when all peers are connected
*
* @param cls Closure.
- * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end.
+ * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
* @param num_peers Number of peers that are running.
* @param testbed_peers Array of peers.
- * @param meshes Handle to each of the MESHs of the peers.
+ * @param cadetes Handle to each of the CADETs of the peers.
*/
static void
tmain (void *cls,
- struct GNUNET_MESH_TEST_Context *ctx,
+ struct GNUNET_CADET_TEST_Context *ctx,
unsigned int num_peers,
struct GNUNET_TESTBED_Peer **testbed_peers,
- struct GNUNET_MESH_Handle **meshes)
+ struct GNUNET_CADET_Handle **cadetes)
{
unsigned long i;
@@ -1011,7 +1011,7 @@
peers_running = num_peers;
testbed_handles = testbed_peers;
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
@@ -1019,7 +1019,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requesting id %ld\n", i);
peers[i].up = GNUNET_YES;
- peers[i].mesh = meshes[i];
+ peers[i].cadet = cadetes[i];
peers[i].op =
GNUNET_TESTBED_peer_get_information (testbed_handles[i],
GNUNET_TESTBED_PIT_IDENTITY,
@@ -1060,7 +1060,7 @@
fprintf (stderr, "%s peers is not valid (> 2)\n", argv[1]);
return 1;
}
- peers = GNUNET_malloc (sizeof (struct MeshPeer) * peers_total);
+ peers = GNUNET_malloc (sizeof (struct CadetPeer) * peers_total);
peers_pinging = atoll (argv[3]);
@@ -1079,7 +1079,7 @@
test_finished = GNUNET_NO;
ports[0] = 1;
ports[1] = 0;
- GNUNET_MESH_TEST_run ("mesh-profiler", config_file, peers_total,
+ GNUNET_CADET_TEST_run ("cadet-profiler", config_file, peers_total,
&tmain, NULL, /* tmain cls */
&incoming_channel, &channel_cleaner,
handlers, ports);
@@ -1088,5 +1088,5 @@
return 0;
}
-/* end of gnunet-mesh-profiler.c */
+/* end of gnunet-cadet-profiler.c */
Modified: gnunet/src/mesh/gnunet-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-mesh.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/gnunet-mesh.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,14 +19,14 @@
*/
/**
- * @file mesh/gnunet-mesh.c
- * @brief Print information about mesh tunnels and peers.
+ * @file cadet/gnunet-cadet.c
+ * @brief Print information about cadet tunnels and peers.
* @author Bartlomiej Polot
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_mesh_service.h"
-#include "mesh.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
/**
@@ -101,14 +101,14 @@
/**
- * Mesh handle.
+ * Cadet handle.
*/
-static struct GNUNET_MESH_Handle *mh;
+static struct GNUNET_CADET_Handle *mh;
/**
* Channel handle.
*/
-static struct GNUNET_MESH_Channel *ch;
+static struct GNUNET_CADET_Channel *ch;
/**
* Shutdown task handle.
@@ -136,12 +136,12 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
if (NULL != ch)
{
- GNUNET_MESH_channel_destroy (ch);
+ GNUNET_CADET_channel_destroy (ch);
ch = NULL;
}
if (NULL != mh)
{
- GNUNET_MESH_disconnect (mh);
+ GNUNET_CADET_disconnect (mh);
mh = NULL;
}
}
@@ -178,7 +178,7 @@
msg = buf;
msg->size = htons (total_size);
- msg->type = htons (GNUNET_MESSAGE_TYPE_MESH_CLI);
+ msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_CLI);
memcpy (&msg[1], cls, data_size);
if (GNUNET_NO == echo)
{
@@ -218,7 +218,7 @@
GNUNET_SCHEDULER_shutdown();
return;
}
- GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
data_size
+ sizeof (struct GNUNET_MessageHeader),
@@ -248,16 +248,16 @@
* Function called whenever a channel is destroyed. Should clean up
* any associated state.
*
- * It must NOT call #GNUNET_MESH_channel_destroy on the channel.
+ * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
*
- * @param cls closure (set from #GNUNET_MESH_connect)
+ * @param cls closure (set from #GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
channel_ended (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Channel ended!\n");
@@ -271,25 +271,25 @@
* Method called whenever another peer has added us to a channel
* the other peer initiated.
* Only called (once) upon reception of data with a message type which was
- * subscribed to in #GNUNET_MESH_connect.
+ * subscribed to in #GNUNET_CADET_connect.
*
- * A call to #GNUNET_MESH_channel_destroy causes te channel to be ignored. In
+ * A call to #GNUNET_CADET_channel_destroy causes te channel to be ignored. In
* this case the handler MUST return NULL.
*
* @param cls closure
* @param channel new handle to the channel
* @param initiator peer that started the channel
* @param port Port this channel is for.
- * @param options MeshOption flag field, with all active option bits set to 1.
+ * @param options CadetOption flag field, with all active option bits set to 1.
*
* @return initial channel context for the channel
* (can be NULL -- that's not an error)
*/
static void *
channel_incoming (void *cls,
- struct GNUNET_MESH_Channel * channel,
+ struct GNUNET_CADET_Channel * channel,
const struct GNUNET_PeerIdentity * initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Incoming channel %p on port %u\n",
@@ -326,7 +326,7 @@
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch)
return;
- GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
sizeof (struct GNUNET_MessageHeader),
&data_ready, NULL);
@@ -335,7 +335,7 @@
/**
- * Call MESH's monitor API, get info of one connection.
+ * Call CADET's monitor API, get info of one connection.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -344,7 +344,7 @@
create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_PeerIdentity pid;
- enum GNUNET_MESH_ChannelOption opt;
+ enum GNUNET_CADET_ChannelOption opt;
GNUNET_assert (NULL == ch);
@@ -360,8 +360,8 @@
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to `%s'\n", target_id);
- opt = GNUNET_MESH_OPTION_DEFAULT | GNUNET_MESH_OPTION_RELIABLE;
- ch = GNUNET_MESH_channel_create (mh, NULL, &pid, target_port, opt);
+ opt = GNUNET_CADET_OPTION_DEFAULT | GNUNET_CADET_OPTION_RELIABLE;
+ ch = GNUNET_CADET_channel_create (mh, NULL, &pid, target_port, opt);
if (GNUNET_NO == echo)
listen_stdio ();
else
@@ -372,11 +372,11 @@
/**
* Function called whenever a message is received.
*
- * Each time the function must call #GNUNET_MESH_receive_done on the channel
+ * Each time the function must call #GNUNET_CADET_receive_done on the channel
* in order to receive the next message. This doesn't need to be immediate:
* can be delayed if some processing is done on the message.
*
- * @param cls Closure (set from #GNUNET_MESH_connect).
+ * @param cls Closure (set from #GNUNET_CADET_connect).
* @param channel Connection to the other end.
* @param channel_ctx Place to store local state associated with the channel.
* @param message The actual message.
@@ -385,7 +385,7 @@
*/
static int
data_callback (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -400,7 +400,7 @@
if (0 != listen_port)
{
/* Just listening to echo incoming messages*/
- GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
sizeof (struct GNUNET_MessageHeader),
&data_ready, NULL);
@@ -440,7 +440,7 @@
/**
- * Method called to retrieve information about all peers in MESH, called
+ * Method called to retrieve information about all peers in CADET, called
* once per peer.
*
* After last peer has been reported, an additional call with NULL is done.
@@ -493,7 +493,7 @@
/**
- * Method called to retrieve information about all tunnels in MESH.
+ * Method called to retrieve information about all tunnels in CADET.
*
* @param cls Closure.
* @param peer Destination peer.
@@ -524,7 +524,7 @@
/**
- * Method called to retrieve information about a specific tunnel the mesh peer
+ * Method called to retrieve information about a specific tunnel the cadet peer
* has established, o`r is trying to establish.
*
* @param cls Closure.
@@ -542,7 +542,7 @@
unsigned int n_channels,
unsigned int n_connections,
uint32_t *channels,
- struct GNUNET_MESH_Hash *connections,
+ struct GNUNET_CADET_Hash *connections,
unsigned int estate,
unsigned int cstate)
{
@@ -570,7 +570,7 @@
/**
- * Call MESH's meta API, get all peers known to a peer.
+ * Call CADET's meta API, get all peers known to a peer.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -583,12 +583,12 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
return;
}
- GNUNET_MESH_get_peers (mh, &peers_callback, NULL);
+ GNUNET_CADET_get_peers (mh, &peers_callback, NULL);
}
/**
- * Call MESH's monitor API, get info of one peer.
+ * Call CADET's monitor API, get info of one peer.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -609,11 +609,11 @@
GNUNET_SCHEDULER_shutdown();
return;
}
- GNUNET_MESH_get_peer (mh, &pid, peer_callback, NULL);
+ GNUNET_CADET_get_peer (mh, &pid, peer_callback, NULL);
}
/**
- * Call MESH's meta API, get all tunnels known to a peer.
+ * Call CADET's meta API, get all tunnels known to a peer.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -626,12 +626,12 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
return;
}
- GNUNET_MESH_get_tunnels (mh, &tunnels_callback, NULL);
+ GNUNET_CADET_get_tunnels (mh, &tunnels_callback, NULL);
}
/**
- * Call MESH's monitor API, get info of one tunnel.
+ * Call CADET's monitor API, get info of one tunnel.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -652,12 +652,12 @@
GNUNET_SCHEDULER_shutdown();
return;
}
- GNUNET_MESH_get_tunnel (mh, &pid, tunnel_callback, NULL);
+ GNUNET_CADET_get_tunnel (mh, &pid, tunnel_callback, NULL);
}
/**
- * Call MESH's monitor API, get info of one channel.
+ * Call CADET's monitor API, get info of one channel.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -670,7 +670,7 @@
/**
- * Call MESH's monitor API, get info of one connection.
+ * Call CADET's monitor API, get info of one connection.
*
* @param cls Closure (unused).
* @param tc TaskContext
@@ -694,10 +694,10 @@
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- GNUNET_MESH_InboundChannelNotificationHandler *newch = NULL;
- GNUNET_MESH_ChannelEndHandler *endch = NULL;
- static const struct GNUNET_MESH_MessageHandler handlers[] = {
- {&data_callback, GNUNET_MESSAGE_TYPE_MESH_CLI, 0},
+ GNUNET_CADET_InboundChannelNotificationHandler *newch = NULL;
+ GNUNET_CADET_ChannelEndHandler *endch = NULL;
+ static const struct GNUNET_CADET_MessageHandler handlers[] = {
+ {&data_callback, GNUNET_MESSAGE_TYPE_CADET_CLI, 0},
{NULL, 0, 0} /* FIXME add option to monitor msg types */
};
static uint32_t *ports = NULL;
@@ -770,8 +770,8 @@
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to mesh\n");
- mh = GNUNET_MESH_connect (cfg,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to cadet\n");
+ mh = GNUNET_CADET_connect (cfg,
NULL, /* cls */
newch, /* new channel */
endch, /* cleaner */
@@ -798,7 +798,7 @@
main (int argc, char *const *argv)
{
int res;
- const char helpstr[] = "Create channels and retreive info about meshs
status.";
+ const char helpstr[] = "Create channels and retreive info about cadets
status.";
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
// {'a', "channel", "TUNNEL_ID:CHANNEL_ID",
// gettext_noop ("provide information about a particular channel"),
@@ -836,7 +836,7 @@
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- res = GNUNET_PROGRAM_run (argc, argv, "gnunet-mesh (OPTIONS | TARGET PORT)",
+ res = GNUNET_PROGRAM_run (argc, argv, "gnunet-cadet (OPTIONS | TARGET PORT)",
gettext_noop (helpstr),
options, &run, NULL);
@@ -848,4 +848,4 @@
return 1;
}
-/* end of gnunet-mesh.c */
+/* end of gnunet-cadet.c */
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,8 +19,8 @@
*/
/**
- * @file mesh/gnunet-service-mesh.c
- * @brief GNUnet MESH service with encryption
+ * @file cadet/gnunet-service-cadet.c
+ * @brief GNUnet CADET service with encryption
* @author Bartlomiej Polot
*
* FIXME in progress:
@@ -33,7 +33,7 @@
* TODO END
*
* Dictionary:
- * - peer: other mesh instance. If there is direct connection it's a neighbor.
+ * - peer: other cadet instance. If there is direct connection it's a neighbor.
* - tunnel: encrypted connection to a peer, neighbor or not.
* - channel: connection between two clients, on the same or different peers.
* have properties like reliability.
@@ -43,16 +43,16 @@
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "mesh.h"
+#include "cadet.h"
#include "gnunet_statistics_service.h"
-#include "gnunet-service-mesh_local.h"
-#include "gnunet-service-mesh_channel.h"
-#include "gnunet-service-mesh_connection.h"
-#include "gnunet-service-mesh_tunnel.h"
-#include "gnunet-service-mesh_dht.h"
-#include "gnunet-service-mesh_peer.h"
-#include "gnunet-service-mesh_hello.h"
+#include "gnunet-service-cadet_local.h"
+#include "gnunet-service-cadet_channel.h"
+#include "gnunet-service-cadet_connection.h"
+#include "gnunet-service-cadet_tunnel.h"
+#include "gnunet-service-cadet_dht.h"
+#include "gnunet-service-cadet_peer.h"
+#include "gnunet-service-cadet_hello.h"
/******************************************************************************/
@@ -121,7 +121,7 @@
/**
- * Process mesh requests.
+ * Process cadet requests.
*
* @param cls closure
* @param server the initialized server
@@ -133,7 +133,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n");
- stats = GNUNET_STATISTICS_create ("mesh", c);
+ stats = GNUNET_STATISTICS_create ("cadet", c);
/* Scheduled the task to clean up when shutdown is called */
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
@@ -144,7 +144,7 @@
GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key);
myid = GNUNET_PEER_intern (&my_full_id);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "STARTING SERVICE (MESH) for peer [%s]\n",
+ "STARTING SERVICE (CADET) for peer [%s]\n",
GNUNET_i2s (&my_full_id));
GML_init (server); /* Local clients */
@@ -154,12 +154,12 @@
GMD_init (c); /* DHT */
GMT_init (c, my_private_key); /* Tunnels */
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh service running\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cadet service running\n");
}
/**
- * The main function for the mesh service.
+ * The main function for the cadet service.
*
* @param argc number of arguments from the command line
* @param argv command line arguments
@@ -172,7 +172,7 @@
int r;
shutting_down = GNUNET_NO;
- r = GNUNET_SERVICE_run (argc, argv, "mesh", GNUNET_SERVICE_OPTION_NONE, &run,
+ r = GNUNET_SERVICE_run (argc, argv, "cadet", GNUNET_SERVICE_OPTION_NONE,
&run,
NULL);
GNUNET_free (my_private_key);
ret = (GNUNET_OK == r) ? 0 : 1;
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -24,52 +24,52 @@
#include "gnunet_statistics_service.h"
-#include "mesh.h"
-#include "mesh_protocol.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
-#include "gnunet-service-mesh_channel.h"
-#include "gnunet-service-mesh_local.h"
-#include "gnunet-service-mesh_tunnel.h"
-#include "gnunet-service-mesh_peer.h"
+#include "gnunet-service-cadet_channel.h"
+#include "gnunet-service-cadet_local.h"
+#include "gnunet-service-cadet_tunnel.h"
+#include "gnunet-service-cadet_peer.h"
-#define LOG(level, ...) GNUNET_log_from(level,"mesh-chn",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from(level,"cadet-chn",__VA_ARGS__)
-#define MESH_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\
+#define CADET_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\
GNUNET_TIME_UNIT_MILLISECONDS, 250)
-#define MESH_RETRANSMIT_MARGIN 4
+#define CADET_RETRANSMIT_MARGIN 4
/**
* All the states a connection can be in.
*/
-enum MeshChannelState
+enum CadetChannelState
{
/**
* Uninitialized status, should never appear in operation.
*/
- MESH_CHANNEL_NEW,
+ CADET_CHANNEL_NEW,
/**
* Connection create message sent, waiting for ACK.
*/
- MESH_CHANNEL_SENT,
+ CADET_CHANNEL_SENT,
/**
* Connection confirmed, ready to carry traffic.
*/
- MESH_CHANNEL_READY,
+ CADET_CHANNEL_READY,
};
/**
* Info holder for channel messages in queues.
*/
-struct MeshChannelQueue
+struct CadetChannelQueue
{
/**
* Tunnel Queue.
*/
- struct MeshTunnel3Queue *tq;
+ struct CadetTunnel3Queue *tq;
/**
* Message type (DATA/DATA_ACK)
@@ -79,25 +79,25 @@
/**
* Message copy (for DATAs, to start retransmission timer)
*/
- struct MeshReliableMessage *copy;
+ struct CadetReliableMessage *copy;
/**
* Reliability (for DATA_ACKs, to access rel->ack_q)
*/
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
};
/**
* Info needed to retry a message in case it gets lost.
*/
-struct MeshReliableMessage
+struct CadetReliableMessage
{
/**
* Double linked list, FIFO style
*/
- struct MeshReliableMessage *next;
- struct MeshReliableMessage *prev;
+ struct CadetReliableMessage *next;
+ struct CadetReliableMessage *prev;
/**
* Type of message (payload, channel management).
@@ -107,7 +107,7 @@
/**
* Tunnel Reliability queue this message is in.
*/
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
/**
* ID of the message (ACK needed to free)
@@ -117,38 +117,38 @@
/**
* Tunnel Queue.
*/
- struct MeshChannelQueue *chq;
+ struct CadetChannelQueue *chq;
/**
* When was this message issued (to calculate ACK delay)
*/
struct GNUNET_TIME_Absolute timestamp;
- /* struct GNUNET_MESH_Data with payload */
+ /* struct GNUNET_CADET_Data with payload */
};
/**
* Info about the traffic state for a client in a channel.
*/
-struct MeshChannelReliability
+struct CadetChannelReliability
{
/**
* Channel this is about.
*/
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
/**
* DLL of messages sent and not yet ACK'd.
*/
- struct MeshReliableMessage *head_sent;
- struct MeshReliableMessage *tail_sent;
+ struct CadetReliableMessage *head_sent;
+ struct CadetReliableMessage *tail_sent;
/**
* DLL of messages received out of order.
*/
- struct MeshReliableMessage *head_recv;
- struct MeshReliableMessage *tail_recv;
+ struct CadetReliableMessage *head_recv;
+ struct CadetReliableMessage *tail_recv;
/**
* Messages received.
@@ -168,7 +168,7 @@
/**
* Handle for queued unique data CREATE, DATA_ACK.
*/
- struct MeshChannelQueue *uniq;
+ struct CadetChannelQueue *uniq;
/**
* Can we send data to the client?
@@ -200,12 +200,12 @@
/**
* Struct containing all information regarding a channel to a remote client.
*/
-struct MeshChannel
+struct CadetChannel
{
/**
* Tunnel this channel is in.
*/
- struct MeshTunnel3 *t;
+ struct CadetTunnel3 *t;
/**
* Destination port of the channel.
@@ -213,26 +213,26 @@
uint32_t port;
/**
- * Global channel number ( < GNUNET_MESH_LOCAL_CHANNEL_ID_CLI)
+ * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
*/
- MESH_ChannelNumber gid;
+ CADET_ChannelNumber gid;
/**
* Local tunnel number for root (owner) client.
- * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI or 0 )
+ * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 )
*/
- MESH_ChannelNumber lid_root;
+ CADET_ChannelNumber lid_root;
/**
* Local tunnel number for local destination clients (incoming number)
- * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV or 0).
+ * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0).
*/
- MESH_ChannelNumber lid_dest;
+ CADET_ChannelNumber lid_dest;
/**
* Channel state.
*/
- enum MeshChannelState state;
+ enum CadetChannelState state;
/**
* Is the tunnel bufferless (minimum latency)?
@@ -252,12 +252,12 @@
/**
* Client owner of the tunnel, if any
*/
- struct MeshClient *root;
+ struct CadetClient *root;
/**
* Client destination of the tunnel, if any.
*/
- struct MeshClient *dest;
+ struct CadetClient *dest;
/**
* Flag to signal the destruction of the channel.
@@ -275,13 +275,13 @@
* Reliability data.
* Only present (non-NULL) at the owner of a tunnel.
*/
- struct MeshChannelReliability *root_rel;
+ struct CadetChannelReliability *root_rel;
/**
* Reliability data.
* Only present (non-NULL) at the destination of a tunnel.
*/
- struct MeshChannelReliability *dest_rel;
+ struct CadetChannelReliability *dest_rel;
};
@@ -317,7 +317,7 @@
* retransmitted message.
*/
static int
-rel_message_free (struct MeshReliableMessage *copy, int update_time);
+rel_message_free (struct CadetReliableMessage *copy, int update_time);
/**
* send a channel create message.
@@ -325,7 +325,7 @@
* @param ch Channel for which to send.
*/
static void
-send_create (struct MeshChannel *ch);
+send_create (struct CadetChannel *ch);
/**
* Confirm we got a channel create, FWD ack.
@@ -335,7 +335,7 @@
* @param reaction This ACK is a reaction to a duplicate CREATE, don't save.
*/
static void
-send_ack (struct MeshChannel *ch, int fwd, int reaction);
+send_ack (struct CadetChannel *ch, int fwd, int reaction);
@@ -347,7 +347,7 @@
* @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise.
*/
static int
-is_loopback (const struct MeshChannel *ch)
+is_loopback (const struct CadetChannel *ch)
{
if (NULL != ch->t)
return GMT_is_loopback (ch->t);
@@ -363,18 +363,18 @@
* @param mid Message ID.
* @param rel Reliability data for retransmission.
*/
-static struct MeshReliableMessage *
-copy_message (const struct GNUNET_MESH_Data *msg, uint32_t mid,
- struct MeshChannelReliability *rel)
+static struct CadetReliableMessage *
+copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid,
+ struct CadetChannelReliability *rel)
{
- struct MeshReliableMessage *copy;
+ struct CadetReliableMessage *copy;
uint16_t size;
size = ntohs (msg->header.size);
copy = GNUNET_malloc (sizeof (*copy) + size);
copy->mid = mid;
copy->rel = rel;
- copy->type = GNUNET_MESSAGE_TYPE_MESH_DATA;
+ copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA;
memcpy (©[1], msg, size);
return copy;
@@ -385,15 +385,15 @@
* Buffer it until we receive an ACK from the client or the missing
* message from the channel.
*
- * @param msg Message to buffer (MUST be of type MESH_DATA).
+ * @param msg Message to buffer (MUST be of type CADET_DATA).
* @param rel Reliability data to the corresponding direction.
*/
static void
-add_buffered_data (const struct GNUNET_MESH_Data *msg,
- struct MeshChannelReliability *rel)
+add_buffered_data (const struct GNUNET_CADET_Data *msg,
+ struct CadetChannelReliability *rel)
{
- struct MeshReliableMessage *copy;
- struct MeshReliableMessage *prev;
+ struct CadetReliableMessage *copy;
+ struct CadetReliableMessage *prev;
uint32_t mid;
mid = ntohl (msg->mid);
@@ -436,7 +436,7 @@
* @param c Client which to add to the channel.
*/
static void
-add_destination (struct MeshChannel *ch, struct MeshClient *c)
+add_destination (struct CadetChannel *ch, struct CadetClient *c)
{
if (NULL != ch->dest)
{
@@ -451,10 +451,10 @@
GML_channel_add (c, ch->lid_dest, ch);
GNUNET_break (NULL == ch->dest_rel);
- ch->dest_rel = GNUNET_new (struct MeshChannelReliability);
+ ch->dest_rel = GNUNET_new (struct CadetChannelReliability);
ch->dest_rel->ch = ch;
ch->dest_rel->expected_delay.rel_value_us = 0;
- ch->dest_rel->retry_timer = MESH_RETRANSMIT_TIME;
+ ch->dest_rel->retry_timer = CADET_RETRANSMIT_TIME;
ch->dest = c;
}
@@ -467,11 +467,11 @@
* @param options Bit array in host byte order.
*/
static void
-channel_set_options (struct MeshChannel *ch, uint32_t options)
+channel_set_options (struct CadetChannel *ch, uint32_t options)
{
- ch->nobuffer = (options & GNUNET_MESH_OPTION_NOBUFFER) != 0 ?
+ ch->nobuffer = (options & GNUNET_CADET_OPTION_NOBUFFER) != 0 ?
GNUNET_YES : GNUNET_NO;
- ch->reliable = (options & GNUNET_MESH_OPTION_RELIABLE) != 0 ?
+ ch->reliable = (options & GNUNET_CADET_OPTION_RELIABLE) != 0 ?
GNUNET_YES : GNUNET_NO;
}
@@ -484,15 +484,15 @@
* @return Bit array in host byte order.
*/
static uint32_t
-channel_get_options (struct MeshChannel *ch)
+channel_get_options (struct CadetChannel *ch)
{
uint32_t options;
options = 0;
if (ch->nobuffer)
- options |= GNUNET_MESH_OPTION_NOBUFFER;
+ options |= GNUNET_CADET_OPTION_NOBUFFER;
if (ch->reliable)
- options |= GNUNET_MESH_OPTION_RELIABLE;
+ options |= GNUNET_CADET_OPTION_RELIABLE;
return options;
}
@@ -505,11 +505,11 @@
* @param local_only Should we avoid sending it to other peers?
*/
static void
-send_destroy (struct MeshChannel *ch, int local_only)
+send_destroy (struct CadetChannel *ch, int local_only)
{
- struct GNUNET_MESH_ChannelManage msg;
+ struct GNUNET_CADET_ChannelManage msg;
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
msg.header.size = htons (sizeof (msg));
msg.chid = htonl (ch->gid);
@@ -536,7 +536,7 @@
* @param ch Channel that was created.
*/
static void
-send_client_create (struct MeshChannel *ch)
+send_client_create (struct CadetChannel *ch)
{
uint32_t opt;
@@ -544,8 +544,8 @@
return;
opt = 0;
- opt |= GNUNET_YES == ch->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0;
- opt |= GNUNET_YES == ch->nobuffer ? GNUNET_MESH_OPTION_NOBUFFER : 0;
+ opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0;
+ opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0;
GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt,
GMT_get_destination (ch->t));
@@ -563,8 +563,8 @@
* @param fwd Is this a fwd (root->dest) message?
*/
static void
-send_client_data (struct MeshChannel *ch,
- const struct GNUNET_MESH_Data *msg,
+send_client_data (struct CadetChannel *ch,
+ const struct GNUNET_CADET_Data *msg,
int fwd)
{
if (fwd)
@@ -593,12 +593,12 @@
* @param fwd Is this to send FWD data?.
*/
static void
-send_client_buffered_data (struct MeshChannel *ch,
- struct MeshClient *c,
+send_client_buffered_data (struct CadetChannel *ch,
+ struct CadetClient *c,
int fwd)
{
- struct MeshReliableMessage *copy;
- struct MeshChannelReliability *rel;
+ struct CadetReliableMessage *copy;
+ struct CadetChannelReliability *rel;
LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n");
rel = fwd ? ch->dest_rel : ch->root_rel;
@@ -614,7 +614,7 @@
{
if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable)
{
- struct GNUNET_MESH_Data *msg = (struct GNUNET_MESH_Data *) ©[1];
+ struct GNUNET_CADET_Data *msg = (struct GNUNET_CADET_Data *) ©[1];
LOG (GNUNET_ERROR_TYPE_DEBUG,
" have %u! now expecting %u\n",
@@ -657,10 +657,10 @@
* @param fwd Is this a FWD ACK? (FWD ACKs are sent to root)
*/
static void
-send_client_ack (struct MeshChannel *ch, int fwd)
+send_client_ack (struct CadetChannel *ch, int fwd)
{
- struct MeshChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel;
- struct MeshClient *c = fwd ? ch->root : ch->dest;
+ struct CadetChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel;
+ struct CadetClient *c = fwd ? ch->root : ch->dest;
if (NULL == c)
{
@@ -694,7 +694,7 @@
* @param ch Rejected channel.
*/
static void
-send_client_nack (struct MeshChannel *ch)
+send_client_nack (struct CadetChannel *ch)
{
if (NULL == ch->root)
{
@@ -708,17 +708,17 @@
/**
* We haven't received an ACK after a certain time: restransmit the message.
*
- * @param cls Closure (MeshChannelReliability with the message to restransmit)
+ * @param cls Closure (CadetChannelReliability with the message to restransmit)
* @param tc TaskContext.
*/
static void
channel_retransmit_message (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshChannelReliability *rel = cls;
- struct MeshReliableMessage *copy;
- struct MeshChannel *ch;
- struct GNUNET_MESH_Data *payload;
+ struct CadetChannelReliability *rel = cls;
+ struct CadetReliableMessage *copy;
+ struct CadetChannel *ch;
+ struct GNUNET_CADET_Data *payload;
int fwd;
rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
@@ -733,7 +733,7 @@
return;
}
- payload = (struct GNUNET_MESH_Data *) ©[1];
+ payload = (struct GNUNET_CADET_Data *) ©[1];
fwd = (rel == ch->root_rel);
/* Message not found in the queue that we are going to use. */
@@ -747,13 +747,13 @@
/**
* We haven't received an Channel ACK after a certain time: resend the CREATE.
*
- * @param cls Closure (MeshChannelReliability of the channel to recreate)
+ * @param cls Closure (CadetChannelReliability of the channel to recreate)
* @param tc TaskContext.
*/
static void
channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshChannelReliability *rel = cls;
+ struct CadetChannelReliability *rel = cls;
rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -789,20 +789,20 @@
*/
static void
ch_message_sent (void *cls,
- struct MeshTunnel3 *t,
- struct MeshTunnel3Queue *q,
+ struct CadetTunnel3 *t,
+ struct CadetTunnel3Queue *q,
uint16_t type, size_t size)
{
- struct MeshChannelQueue *chq = cls;
- struct MeshReliableMessage *copy = chq->copy;
- struct MeshChannelReliability *rel;
+ struct CadetChannelQueue *chq = cls;
+ struct CadetReliableMessage *copy = chq->copy;
+ struct CadetChannelReliability *rel;
LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n",
GM_m2s (chq->type));
switch (chq->type)
{
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid);
GNUNET_assert (chq == copy->chq);
copy->timestamp = GNUNET_TIME_absolute_get ();
@@ -817,12 +817,12 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay != 0\n");
rel->retry_timer =
GNUNET_TIME_relative_multiply (rel->expected_delay,
- MESH_RETRANSMIT_MARGIN);
+ CADET_RETRANSMIT_MARGIN);
}
else
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay reset\n");
- rel->retry_timer = MESH_RETRANSMIT_TIME;
+ rel->retry_timer = CADET_RETRANSMIT_TIME;
}
LOG (GNUNET_ERROR_TYPE_DEBUG, "!! using delay %s\n",
GNUNET_STRINGS_relative_time_to_string (rel->retry_timer,
@@ -839,16 +839,16 @@
break;
- case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type));
rel = chq->rel;
GNUNET_assert (rel->uniq == chq);
rel->uniq = NULL;
- if (MESH_CHANNEL_READY != rel->ch->state
- && GNUNET_MESSAGE_TYPE_MESH_DATA_ACK != type
+ if (CADET_CHANNEL_READY != rel->ch->state
+ && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type
&& GNUNET_NO == rel->ch->destroy)
{
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task);
@@ -875,12 +875,12 @@
* @param ch Channel for which to send.
*/
static void
-send_create (struct MeshChannel *ch)
+send_create (struct CadetChannel *ch)
{
- struct GNUNET_MESH_ChannelCreate msgcc;
+ struct GNUNET_CADET_ChannelCreate msgcc;
msgcc.header.size = htons (sizeof (msgcc));
- msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE);
+ msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE);
msgcc.chid = htonl (ch->gid);
msgcc.port = htonl (ch->port);
msgcc.opt = htonl (channel_get_options (ch));
@@ -897,12 +897,12 @@
* @param reaction This ACK is a reaction to a duplicate CREATE, don't save.
*/
static void
-send_ack (struct MeshChannel *ch, int fwd, int reaction)
+send_ack (struct CadetChannel *ch, int fwd, int reaction)
{
- struct GNUNET_MESH_ChannelManage msg;
+ struct GNUNET_CADET_ChannelManage msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK);
LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n",
GM_f2s (fwd), GMCH_2s (ch));
@@ -921,7 +921,7 @@
*/
static void
fire_and_forget (const struct GNUNET_MessageHeader *msg,
- struct MeshChannel *ch,
+ struct CadetChannel *ch,
int force)
{
GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL,
@@ -935,12 +935,12 @@
* @param ch The channel to reject.
*/
static void
-send_nack (struct MeshChannel *ch)
+send_nack (struct CadetChannel *ch)
{
- struct GNUNET_MESH_ChannelManage msg;
+ struct GNUNET_CADET_ChannelManage msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK);
LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending channel NACK for channel %s\n",
GMCH_2s (ch));
@@ -958,10 +958,10 @@
* @param rel Reliability data for a channel.
*/
static void
-channel_rel_free_all (struct MeshChannelReliability *rel)
+channel_rel_free_all (struct CadetChannelReliability *rel)
{
- struct MeshReliableMessage *copy;
- struct MeshReliableMessage *next;
+ struct CadetReliableMessage *copy;
+ struct CadetReliableMessage *next;
if (NULL == rel)
return;
@@ -1015,11 +1015,11 @@
* @param msg DataACK message with a bitfield of future ACK'd messages.
*/
static void
-channel_rel_free_sent (struct MeshChannelReliability *rel,
- const struct GNUNET_MESH_DataACK *msg)
+channel_rel_free_sent (struct CadetChannelReliability *rel,
+ const struct GNUNET_CADET_DataACK *msg)
{
- struct MeshReliableMessage *copy;
- struct MeshReliableMessage *next;
+ struct CadetReliableMessage *copy;
+ struct CadetReliableMessage *next;
uint64_t bitfield;
uint64_t mask;
uint32_t mid;
@@ -1094,9 +1094,9 @@
* #GNUNET_NO otherwise.
*/
static int
-rel_message_free (struct MeshReliableMessage *copy, int update_time)
+rel_message_free (struct CadetReliableMessage *copy, int update_time)
{
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
struct GNUNET_TIME_Relative time;
rel = copy->rel;
@@ -1148,10 +1148,10 @@
* @param fwd Was the ACK message a FWD ACK? (dest->root, SYNACK)
*/
static void
-channel_confirm (struct MeshChannel *ch, int fwd)
+channel_confirm (struct CadetChannel *ch, int fwd)
{
- struct MeshChannelReliability *rel;
- enum MeshChannelState oldstate;
+ struct CadetChannelReliability *rel;
+ enum CadetChannelState oldstate;
rel = fwd ? ch->root_rel : ch->dest_rel;
if (NULL == rel)
@@ -1162,9 +1162,9 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n",
GM_f2s (fwd), GMCH_2s (ch));
oldstate = ch->state;
- ch->state = MESH_CHANNEL_READY;
+ ch->state = CADET_CHANNEL_READY;
- if (MESH_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch))
+ if (CADET_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch))
{
rel->client_ready = GNUNET_YES;
rel->expected_delay = rel->retry_timer;
@@ -1208,13 +1208,13 @@
* @param msg Message to copy.
* @param fwd Is this fwd traffic?
*/
-static struct MeshReliableMessage *
-channel_save_copy (struct MeshChannel *ch,
+static struct CadetReliableMessage *
+channel_save_copy (struct CadetChannel *ch,
const struct GNUNET_MessageHeader *msg,
int fwd)
{
- struct MeshChannelReliability *rel;
- struct MeshReliableMessage *copy;
+ struct CadetChannelReliability *rel;
+ struct CadetReliableMessage *copy;
uint32_t mid;
uint16_t type;
uint16_t size;
@@ -1225,7 +1225,7 @@
size = ntohs (msg->size);
LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type));
- copy = GNUNET_malloc (sizeof (struct MeshReliableMessage) + size);
+ copy = GNUNET_malloc (sizeof (struct CadetReliableMessage) + size);
LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy);
copy->mid = mid;
copy->rel = rel;
@@ -1247,14 +1247,14 @@
*
* @return A new initialized channel. NULL on error.
*/
-static struct MeshChannel *
-channel_new (struct MeshTunnel3 *t,
- struct MeshClient *owner,
- MESH_ChannelNumber lid_root)
+static struct CadetChannel *
+channel_new (struct CadetTunnel3 *t,
+ struct CadetClient *owner,
+ CADET_ChannelNumber lid_root)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
- ch = GNUNET_new (struct MeshChannel);
+ ch = GNUNET_new (struct CadetChannel);
ch->root = owner;
ch->lid_root = lid_root;
ch->t = t;
@@ -1280,7 +1280,7 @@
* @param fwd Is this FWD traffic?
*/
void
-handle_loopback (struct MeshChannel *ch,
+handle_loopback (struct CadetChannel *ch,
const struct GNUNET_MessageHeader *msgh,
int fwd)
{
@@ -1293,35 +1293,35 @@
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
/* Don't send hop ACK, wait for client to ACK */
LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n",
- ntohl (((struct GNUNET_MESH_Data *) msgh)->mid), ntohs
(msgh->size));
- GMCH_handle_data (ch, (struct GNUNET_MESH_Data *) msgh, fwd);
+ ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs
(msgh->size));
+ GMCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
- GMCH_handle_data_ack (ch, (struct GNUNET_MESH_DataACK *) msgh, fwd);
+ case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
+ GMCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
GMCH_handle_create (ch->t,
- (struct GNUNET_MESH_ChannelCreate *) msgh);
+ (struct GNUNET_CADET_ChannelCreate *) msgh);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
GMCH_handle_ack (ch,
- (struct GNUNET_MESH_ChannelManage *) msgh,
+ (struct GNUNET_CADET_ChannelManage *) msgh,
fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
GMCH_handle_nack (ch);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
GMCH_handle_destroy (ch,
- (struct GNUNET_MESH_ChannelManage *) msgh,
+ (struct GNUNET_CADET_ChannelManage *) msgh,
fwd);
break;
@@ -1345,10 +1345,10 @@
* @param ch Channel to destroy.
*/
void
-GMCH_destroy (struct MeshChannel *ch)
+GMCH_destroy (struct CadetChannel *ch)
{
- struct MeshClient *c;
- struct MeshTunnel3 *t;
+ struct CadetClient *c;
+ struct CadetTunnel3 *t;
if (NULL == ch)
return;
@@ -1391,8 +1391,8 @@
*
* @return ID used to identify the channel with the remote peer.
*/
-MESH_ChannelNumber
-GMCH_get_id (const struct MeshChannel *ch)
+CADET_ChannelNumber
+GMCH_get_id (const struct CadetChannel *ch)
{
return ch->gid;
}
@@ -1405,8 +1405,8 @@
*
* @return tunnel of the channel.
*/
-struct MeshTunnel3 *
-GMCH_get_tunnel (const struct MeshChannel *ch)
+struct CadetTunnel3 *
+GMCH_get_tunnel (const struct CadetChannel *ch)
{
return ch->t;
}
@@ -1421,9 +1421,9 @@
* @return Free buffer space [0 - 64]
*/
unsigned int
-GMCH_get_buffer (struct MeshChannel *ch, int fwd)
+GMCH_get_buffer (struct CadetChannel *ch, int fwd)
{
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
rel = fwd ? ch->dest_rel : ch->root_rel;
@@ -1447,9 +1447,9 @@
* @return #GNUNET_YES if client is allowed to send us data.
*/
int
-GMCH_get_allowed (struct MeshChannel *ch, int fwd)
+GMCH_get_allowed (struct CadetChannel *ch, int fwd)
{
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
rel = fwd ? ch->root_rel : ch->dest_rel;
@@ -1473,9 +1473,9 @@
* @return #GNUNET_YES in case it is.
*/
int
-GMCH_is_origin (struct MeshChannel *ch, int fwd)
+GMCH_is_origin (struct CadetChannel *ch, int fwd)
{
- struct MeshClient *c;
+ struct CadetClient *c;
c = fwd ? ch->root : ch->dest;
return NULL != c;
@@ -1491,9 +1491,9 @@
* @return #GNUNET_YES in case it is.
*/
int
-GMCH_is_terminal (struct MeshChannel *ch, int fwd)
+GMCH_is_terminal (struct CadetChannel *ch, int fwd)
{
- struct MeshClient *c;
+ struct CadetClient *c;
c = fwd ? ch->dest : ch->root;
return NULL != c;
@@ -1509,11 +1509,11 @@
* @param fwd Is for FWD traffic? (ACK dest->owner)
*/
void
-GMCH_send_data_ack (struct MeshChannel *ch, int fwd)
+GMCH_send_data_ack (struct CadetChannel *ch, int fwd)
{
- struct GNUNET_MESH_DataACK msg;
- struct MeshChannelReliability *rel;
- struct MeshReliableMessage *copy;
+ struct GNUNET_CADET_DataACK msg;
+ struct CadetChannelReliability *rel;
+ struct CadetReliableMessage *copy;
unsigned int delta;
uint64_t mask;
uint32_t ack;
@@ -1526,13 +1526,13 @@
ack = rel->mid_recv - 1;
LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u\n", ack);
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK);
msg.header.size = htons (sizeof (msg));
msg.chid = htonl (ch->gid);
msg.futures = 0;
for (copy = rel->head_recv; NULL != copy; copy = copy->next)
{
- if (copy->type != GNUNET_MESSAGE_TYPE_MESH_DATA)
+ if (copy->type != GNUNET_MESSAGE_TYPE_CADET_DATA)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"!! Type %s, expected DATA\n",
@@ -1570,14 +1570,14 @@
* @param fwd Is this about FWD traffic? (Root client).
*/
void
-GMCH_allow_client (struct MeshChannel *ch, int fwd)
+GMCH_allow_client (struct CadetChannel *ch, int fwd)
{
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
unsigned int buffer;
LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH allow\n");
- if (MESH_CHANNEL_READY != ch->state)
+ if (CADET_CHANNEL_READY != ch->state)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " channel not ready yet!\n");
return;
@@ -1630,7 +1630,7 @@
* @param ch Channel.
*/
void
-GMCH_debug (struct MeshChannel *ch)
+GMCH_debug (struct CadetChannel *ch)
{
if (NULL == ch)
{
@@ -1669,10 +1669,10 @@
* @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK)
*/
void
-GMCH_handle_local_ack (struct MeshChannel *ch, int fwd)
+GMCH_handle_local_ack (struct CadetChannel *ch, int fwd)
{
- struct MeshChannelReliability *rel;
- struct MeshClient *c;
+ struct CadetChannelReliability *rel;
+ struct CadetClient *c;
rel = fwd ? ch->dest_rel : ch->root_rel;
c = fwd ? ch->dest : ch->root;
@@ -1717,15 +1717,15 @@
* @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en
error.
*/
int
-GMCH_handle_local_data (struct MeshChannel *ch,
- struct MeshClient *c,
+GMCH_handle_local_data (struct CadetChannel *ch,
+ struct CadetClient *c,
struct GNUNET_MessageHeader *message,
int fwd)
{
- struct MeshChannelReliability *rel;
- struct GNUNET_MESH_Data *payload;
+ struct CadetChannelReliability *rel;
+ struct GNUNET_CADET_Data *payload;
size_t size = ntohs (message->size);
- uint16_t p2p_size = sizeof(struct GNUNET_MESH_Data) + size;
+ uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size;
unsigned char cbuf[p2p_size];
/* Is the client in the channel? */
@@ -1750,12 +1750,12 @@
rel->client_allowed = GNUNET_NO;
/* Ok, everything is correct, send the message. */
- payload = (struct GNUNET_MESH_Data *) cbuf;
+ payload = (struct GNUNET_CADET_Data *) cbuf;
payload->mid = htonl (rel->mid_send);
rel->mid_send++;
memcpy (&payload[1], message, size);
payload->header.size = htons (p2p_size);
- payload->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA);
+ payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA);
payload->chid = htonl (ch->gid);
LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL);
@@ -1787,8 +1787,8 @@
* @param is_root Is the request coming from root?
*/
void
-GMCH_handle_local_destroy (struct MeshChannel *ch,
- struct MeshClient *c,
+GMCH_handle_local_destroy (struct CadetChannel *ch,
+ struct CadetClient *c,
int is_root)
{
ch->destroy = GNUNET_YES;
@@ -1823,13 +1823,13 @@
* @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
*/
int
-GMCH_handle_local_create (struct MeshClient *c,
- struct GNUNET_MESH_ChannelMessage *msg)
+GMCH_handle_local_create (struct CadetClient *c,
+ struct GNUNET_CADET_ChannelMessage *msg)
{
- struct MeshChannel *ch;
- struct MeshTunnel3 *t;
- struct MeshPeer *peer;
- MESH_ChannelNumber chid;
+ struct CadetChannel *ch;
+ struct CadetTunnel3 *t;
+ struct CadetPeer *peer;
+ CADET_ChannelNumber chid;
LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n",
GNUNET_i2s (&msg->peer), ntohl (msg->port));
@@ -1848,7 +1848,7 @@
if (GMP_get_short_id (peer) == myid)
{
- GMT_change_cstate (t, MESH_TUNNEL3_READY);
+ GMT_change_cstate (t, CADET_TUNNEL3_READY);
}
else
{
@@ -1867,9 +1867,9 @@
channel_set_options (ch, ntohl (msg->opt));
/* In unreliable channels, we'll use the DLL to buffer BCK data */
- ch->root_rel = GNUNET_new (struct MeshChannelReliability);
+ ch->root_rel = GNUNET_new (struct CadetChannelReliability);
ch->root_rel->ch = ch;
- ch->root_rel->retry_timer = MESH_RETRANSMIT_TIME;
+ ch->root_rel->retry_timer = CADET_RETRANSMIT_TIME;
ch->root_rel->expected_delay.rel_value_us = 0;
LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch));
@@ -1881,7 +1881,7 @@
/**
- * Handler for mesh network payload traffic.
+ * Handler for cadet network payload traffic.
*
* @param ch Channel for the message.
* @param msg Unencryted data message.
@@ -1891,12 +1891,12 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_data (struct MeshChannel *ch,
- const struct GNUNET_MESH_Data *msg,
+GMCH_handle_data (struct CadetChannel *ch,
+ const struct GNUNET_CADET_Data *msg,
int fwd)
{
- struct MeshChannelReliability *rel;
- struct MeshClient *c;
+ struct CadetChannelReliability *rel;
+ struct CadetClient *c;
uint32_t mid;
/* If this is a remote (non-loopback) channel, find 'fwd'. */
@@ -1921,7 +1921,7 @@
return;
}
- if (MESH_CHANNEL_READY != ch->state)
+ if (CADET_CHANNEL_READY != ch->state)
{
if (GNUNET_NO == fwd)
{
@@ -1986,7 +1986,7 @@
/**
- * Handler for mesh network traffic end-to-end ACKs.
+ * Handler for cadet network traffic end-to-end ACKs.
*
* @param ch Channel on which we got this message.
* @param msg Data message.
@@ -1996,13 +1996,13 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_data_ack (struct MeshChannel *ch,
- const struct GNUNET_MESH_DataACK *msg,
+GMCH_handle_data_ack (struct CadetChannel *ch,
+ const struct GNUNET_CADET_DataACK *msg,
int fwd)
{
- struct MeshChannelReliability *rel;
- struct MeshReliableMessage *copy;
- struct MeshReliableMessage *next;
+ struct CadetChannelReliability *rel;
+ struct CadetReliableMessage *copy;
+ struct CadetReliableMessage *next;
uint32_t ack;
int work;
@@ -2068,7 +2068,7 @@
struct GNUNET_TIME_Relative delay;
delay = GNUNET_TIME_relative_multiply (rel->retry_timer,
- MESH_RETRANSMIT_MARGIN);
+ CADET_RETRANSMIT_MARGIN);
new_target = GNUNET_TIME_absolute_add (rel->head_sent->timestamp,
delay);
delay = GNUNET_TIME_absolute_get_remaining (new_target);
@@ -2095,13 +2095,13 @@
* @param t Tunnel this channel will be in.
* @param msg Channel crate message.
*/
-struct MeshChannel *
-GMCH_handle_create (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_ChannelCreate *msg)
+struct CadetChannel *
+GMCH_handle_create (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_ChannelCreate *msg)
{
- MESH_ChannelNumber chid;
- struct MeshChannel *ch;
- struct MeshClient *c;
+ CADET_ChannelNumber chid;
+ struct CadetChannel *ch;
+ struct CadetClient *c;
int new_channel;
int reaction;
@@ -2155,7 +2155,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n");
send_client_create (ch);
- ch->state = MESH_CHANNEL_SENT;
+ ch->state = CADET_CHANNEL_SENT;
}
else
{
@@ -2183,7 +2183,7 @@
* @param ch Channel.
*/
void
-GMCH_handle_nack (struct MeshChannel *ch)
+GMCH_handle_nack (struct CadetChannel *ch)
{
send_client_nack (ch);
GMCH_destroy (ch);
@@ -2201,8 +2201,8 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_ack (struct MeshChannel *ch,
- const struct GNUNET_MESH_ChannelManage *msg,
+GMCH_handle_ack (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelManage *msg,
int fwd)
{
/* If this is a remote (non-loopback) channel, find 'fwd'. */
@@ -2232,11 +2232,11 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_destroy (struct MeshChannel *ch,
- const struct GNUNET_MESH_ChannelManage *msg,
+GMCH_handle_destroy (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelManage *msg,
int fwd)
{
- struct MeshChannelReliability *rel;
+ struct CadetChannelReliability *rel;
/* If this is a remote (non-loopback) channel, find 'fwd'. */
if (GNUNET_SYSERR == fwd)
@@ -2288,10 +2288,10 @@
*/
void
GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
- struct MeshChannel *ch, int fwd,
+ struct CadetChannel *ch, int fwd,
void *existing_copy)
{
- struct MeshChannelQueue *chq;
+ struct CadetChannelQueue *chq;
uint16_t type;
type = ntohs (message->type);
@@ -2306,21 +2306,21 @@
switch (type)
{
- struct GNUNET_MESH_Data *payload;
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
+ struct GNUNET_CADET_Data *payload;
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
- payload = (struct GNUNET_MESH_Data *) message;
+ payload = (struct GNUNET_CADET_Data *) message;
LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n",
GM_m2s (type), ntohl (payload->mid));
if (GNUNET_YES == ch->reliable)
{
- chq = GNUNET_new (struct MeshChannelQueue);
+ chq = GNUNET_new (struct CadetChannelQueue);
chq->type = type;
if (NULL == existing_copy)
chq->copy = channel_save_copy (ch, message, fwd);
else
{
- chq->copy = (struct MeshReliableMessage *) existing_copy;
+ chq->copy = (struct CadetReliableMessage *) existing_copy;
if (NULL != chq->copy->chq)
{
/* Last retransmission was queued but not yet sent!
@@ -2357,7 +2357,7 @@
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
if (GNUNET_YES == fwd || NULL != existing_copy)
{
/* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/
@@ -2365,9 +2365,9 @@
return;
}
/* fall-trough */
- case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- chq = GNUNET_new (struct MeshChannelQueue);
+ case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ chq = GNUNET_new (struct CadetChannelQueue);
chq->type = type;
chq->rel = fwd ? ch->root_rel : ch->dest_rel;
if (NULL != chq->rel->uniq)
@@ -2396,8 +2396,8 @@
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
fire_and_forget (message, ch, GNUNET_YES);
break;
@@ -2418,7 +2418,7 @@
* @return Static string with the channel IDs.
*/
const char *
-GMCH_2s (const struct MeshChannel *ch)
+GMCH_2s (const struct CadetChannel *ch)
{
static char buf[64];
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.h 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.h 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_channel.h
- * @brief mesh service; dealing with end-to-end channels
+ * @file cadet/gnunet-service-cadet_channel.h
+ * @brief cadet service; dealing with end-to-end channels
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GMCH (Gnunet Mesh CHannel)
+ * All functions in this file should use the prefix GMCH (Gnunet Cadet CHannel)
*/
-#ifndef GNUNET_SERVICE_MESH_CHANNEL_H
-#define GNUNET_SERVICE_MESH_CHANNEL_H
+#ifndef GNUNET_SERVICE_CADET_CHANNEL_H
+#define GNUNET_SERVICE_CADET_CHANNEL_H
#ifdef __cplusplus
extern "C"
@@ -40,17 +40,17 @@
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "mesh_protocol.h"
-#include "mesh.h"
+#include "cadet_protocol.h"
+#include "cadet.h"
/**
* Struct containing all information regarding a channel to a remote client.
*/
-struct MeshChannel;
+struct CadetChannel;
-#include "gnunet-service-mesh_tunnel.h"
-#include "gnunet-service-mesh_local.h"
+#include "gnunet-service-cadet_tunnel.h"
+#include "gnunet-service-cadet_local.h"
/**
@@ -59,7 +59,7 @@
* @param ch Channel to destroy.
*/
void
-GMCH_destroy (struct MeshChannel *ch);
+GMCH_destroy (struct CadetChannel *ch);
/**
@@ -69,8 +69,8 @@
*
* @return ID used to identify the channel with the remote peer.
*/
-MESH_ChannelNumber
-GMCH_get_id (const struct MeshChannel *ch);
+CADET_ChannelNumber
+GMCH_get_id (const struct CadetChannel *ch);
/**
* Get the channel tunnel.
@@ -79,8 +79,8 @@
*
* @return tunnel of the channel.
*/
-struct MeshTunnel3 *
-GMCH_get_tunnel (const struct MeshChannel *ch);
+struct CadetTunnel3 *
+GMCH_get_tunnel (const struct CadetChannel *ch);
/**
* Get free buffer space towards the client on a specific channel.
@@ -91,7 +91,7 @@
* @return Free buffer space [0 - 64]
*/
unsigned int
-GMCH_get_buffer (struct MeshChannel *ch, int fwd);
+GMCH_get_buffer (struct CadetChannel *ch, int fwd);
/**
@@ -103,7 +103,7 @@
* @return #GNUNET_YES if client is allowed to send us data.
*/
int
-GMCH_get_allowed (struct MeshChannel *ch, int fwd);
+GMCH_get_allowed (struct CadetChannel *ch, int fwd);
/**
@@ -115,7 +115,7 @@
* @return #GNUNET_YES in case it is.
*/
int
-GMCH_is_origin (struct MeshChannel *ch, int fwd);
+GMCH_is_origin (struct CadetChannel *ch, int fwd);
/**
* Is the destination client for this channel on this peer?
@@ -126,7 +126,7 @@
* @return #GNUNET_YES in case it is.
*/
int
-GMCH_is_terminal (struct MeshChannel *ch, int fwd);
+GMCH_is_terminal (struct CadetChannel *ch, int fwd);
/**
* Send an end-to-end ACK message for the most recent in-sequence payload.
@@ -137,7 +137,7 @@
* @param fwd Is for FWD traffic? (ACK dest->owner)
*/
void
-GMCH_send_data_ack (struct MeshChannel *ch, int fwd);
+GMCH_send_data_ack (struct CadetChannel *ch, int fwd);
/**
* Notify the destination client that a new incoming channel was created.
@@ -145,7 +145,7 @@
* @param ch Channel that was created.
*/
void
-GMCH_send_create (struct MeshChannel *ch);
+GMCH_send_create (struct CadetChannel *ch);
/**
* Allow a client to send us more data, in case it was choked.
@@ -154,7 +154,7 @@
* @param fwd Is this about FWD traffic? (Root client).
*/
void
-GMCH_allow_client (struct MeshChannel *ch, int fwd);
+GMCH_allow_client (struct CadetChannel *ch, int fwd);
/**
* Log channel info.
@@ -162,7 +162,7 @@
* @param ch Channel.
*/
void
-GMCH_debug (struct MeshChannel *ch);
+GMCH_debug (struct CadetChannel *ch);
/**
* Handle an ACK given by a client.
@@ -173,7 +173,7 @@
* @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK)
*/
void
-GMCH_handle_local_ack (struct MeshChannel *ch, int fwd);
+GMCH_handle_local_ack (struct CadetChannel *ch, int fwd);
/**
* Handle data given by a client.
@@ -190,8 +190,8 @@
* @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en
error.
*/
int
-GMCH_handle_local_data (struct MeshChannel *ch,
- struct MeshClient *c,
+GMCH_handle_local_data (struct CadetChannel *ch,
+ struct CadetClient *c,
struct GNUNET_MessageHeader *message,
int fwd);
@@ -205,8 +205,8 @@
* @param is_root Is the request coming from root?
*/
void
-GMCH_handle_local_destroy (struct MeshChannel *ch,
- struct MeshClient *c,
+GMCH_handle_local_destroy (struct CadetChannel *ch,
+ struct CadetClient *c,
int is_root);
/**
@@ -220,11 +220,11 @@
* @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
*/
int
-GMCH_handle_local_create (struct MeshClient *c,
- struct GNUNET_MESH_ChannelMessage *msg);
+GMCH_handle_local_create (struct CadetClient *c,
+ struct GNUNET_CADET_ChannelMessage *msg);
/**
- * Handler for mesh network payload traffic.
+ * Handler for cadet network payload traffic.
*
* @param ch Channel for the message.
* @param msg Unencryted data message.
@@ -234,12 +234,12 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_data (struct MeshChannel *ch,
- const struct GNUNET_MESH_Data *msg,
+GMCH_handle_data (struct CadetChannel *ch,
+ const struct GNUNET_CADET_Data *msg,
int fwd);
/**
- * Handler for mesh network traffic end-to-end ACKs.
+ * Handler for cadet network traffic end-to-end ACKs.
*
* @param ch Channel on which we got this message.
* @param msg Data message.
@@ -249,8 +249,8 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_data_ack (struct MeshChannel *ch,
- const struct GNUNET_MESH_DataACK *msg,
+GMCH_handle_data_ack (struct CadetChannel *ch,
+ const struct GNUNET_CADET_DataACK *msg,
int fwd);
/**
@@ -261,9 +261,9 @@
* @param t Tunnel this channel will be in.
* @param msg Channel crate message.
*/
-struct MeshChannel *
-GMCH_handle_create (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_ChannelCreate *msg);
+struct CadetChannel *
+GMCH_handle_create (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_ChannelCreate *msg);
/**
* Handler for channel NACK messages.
@@ -273,7 +273,7 @@
* @param ch Channel.
*/
void
-GMCH_handle_nack (struct MeshChannel *ch);
+GMCH_handle_nack (struct CadetChannel *ch);
/**
* Handler for channel ack messages.
@@ -286,8 +286,8 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_ack (struct MeshChannel *ch,
- const struct GNUNET_MESH_ChannelManage *msg,
+GMCH_handle_ack (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelManage *msg,
int fwd);
/**
@@ -301,8 +301,8 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
void
-GMCH_handle_destroy (struct MeshChannel *ch,
- const struct GNUNET_MESH_ChannelManage *msg,
+GMCH_handle_destroy (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelManage *msg,
int fwd);
/**
@@ -323,7 +323,7 @@
*/
void
GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
- struct MeshChannel *ch, int fwd,
+ struct CadetChannel *ch, int fwd,
void *existing_copy);
/**
@@ -334,7 +334,7 @@
* @return Static string with the channel IDs.
*/
const char *
-GMCH_2s (const struct MeshChannel *ch);
+GMCH_2s (const struct CadetChannel *ch);
#if 0 /* keep Emacsens' auto-indent happy */
@@ -344,6 +344,6 @@
}
#endif
-/* ifndef GNUNET_SERVICE_MESH_CHANNEL_H */
+/* ifndef GNUNET_SERVICE_CADET_CHANNEL_H */
#endif
-/* end of gnunet-service-mesh_channel.h */
+/* end of gnunet-service-cadet_channel.h */
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -19,8 +19,8 @@
*/
/**
- * @file mesh/gnunet-service-mesh_connection.c
- * @brief GNUnet MESH service connection handling
+ * @file cadet/gnunet-service-cadet_connection.c
+ * @brief GNUnet CADET service connection handling
* @author Bartlomiej Polot
*/
@@ -29,17 +29,17 @@
#include "gnunet_statistics_service.h"
-#include "mesh_path.h"
-#include "mesh_protocol.h"
-#include "mesh.h"
-#include "gnunet-service-mesh_connection.h"
-#include "gnunet-service-mesh_peer.h"
-#include "gnunet-service-mesh_tunnel.h"
+#include "cadet_path.h"
+#include "cadet_protocol.h"
+#include "cadet.h"
+#include "gnunet-service-cadet_connection.h"
+#include "gnunet-service-cadet_peer.h"
+#include "gnunet-service-cadet_tunnel.h"
-#define LOG(level, ...) GNUNET_log_from (level,"mesh-con",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from (level,"cadet-con",__VA_ARGS__)
-#define MESH_MAX_POLL_TIME GNUNET_TIME_relative_multiply (\
+#define CADET_MAX_POLL_TIME GNUNET_TIME_relative_multiply (\
GNUNET_TIME_UNIT_MINUTES,\
10)
#define AVG_MSGS 32
@@ -53,12 +53,12 @@
* Struct to encapsulate all the Flow Control information to a peer to which
* we are directly connected (on a core level).
*/
-struct MeshFlowControl
+struct CadetFlowControl
{
/**
* Connection this controls.
*/
- struct MeshConnection *c;
+ struct CadetConnection *c;
/**
* How many messages are in the queue on this connection.
@@ -103,18 +103,18 @@
/**
* Queued poll message, to cancel if not necessary anymore (got ACK).
*/
- struct MeshConnectionQueue *poll_msg;
+ struct CadetConnectionQueue *poll_msg;
/**
* Queued poll message, to cancel if not necessary anymore (got ACK).
*/
- struct MeshConnectionQueue *ack_msg;
+ struct CadetConnectionQueue *ack_msg;
};
/**
* Keep a record of the last messages sent on this connection.
*/
-struct MeshConnectionPerformance
+struct CadetConnectionPerformance
{
/**
* Circular buffer for storing measurements.
@@ -141,43 +141,43 @@
/**
* Struct containing all information regarding a connection to a peer.
*/
-struct MeshConnection
+struct CadetConnection
{
/**
* Tunnel this connection is part of.
*/
- struct MeshTunnel3 *t;
+ struct CadetTunnel3 *t;
/**
* Flow control information for traffic fwd.
*/
- struct MeshFlowControl fwd_fc;
+ struct CadetFlowControl fwd_fc;
/**
* Flow control information for traffic bck.
*/
- struct MeshFlowControl bck_fc;
+ struct CadetFlowControl bck_fc;
/**
* Measure connection performance on the endpoint.
*/
- struct MeshConnectionPerformance *perf;
+ struct CadetConnectionPerformance *perf;
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash id;
+ struct GNUNET_CADET_Hash id;
/**
* State of the connection.
*/
- enum MeshConnectionState state;
+ enum CadetConnectionState state;
/**
* Path being used for the tunnel. At the origin of the connection
* it's a pointer to the destination's path pool, otherwise just a copy.
*/
- struct MeshPeerPath *path;
+ struct CadetPeerPath *path;
/**
* Position of the local peer in the path.
@@ -200,7 +200,7 @@
* Queue handle for maintainance traffic. One handle for FWD and BCK since
* one peer never needs to maintain both directions (no loopback
connections).
*/
- struct MeshPeerQueue *maintenance_q;
+ struct CadetPeerQueue *maintenance_q;
/**
* Counter to do exponential backoff when creating a connection (max 64).
@@ -221,12 +221,12 @@
/**
* Handle for messages queued but not yet sent.
*/
-struct MeshConnectionQueue
+struct CadetConnectionQueue
{
/**
* Peer queue handle, to cancel if necessary.
*/
- struct MeshPeerQueue *q;
+ struct CadetPeerQueue *q;
/**
* Was this a forced message? (Do not account for it)
@@ -264,7 +264,7 @@
extern struct GNUNET_PeerIdentity my_full_id;
/**
- * Connections known, indexed by cid (MeshConnection).
+ * Connections known, indexed by cid (CadetConnection).
*/
static struct GNUNET_CONTAINER_MultiHashMap *connections;
@@ -297,7 +297,7 @@
#if 0 // avoid compiler warning for unused static function
static void
-fc_debug (struct MeshFlowControl *fc)
+fc_debug (struct CadetFlowControl *fc)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n",
fc->last_pid_recv, fc->last_ack_sent);
@@ -308,7 +308,7 @@
}
static void
-connection_debug (struct MeshConnection *c)
+connection_debug (struct CadetConnection *c)
{
if (NULL == c)
{
@@ -335,7 +335,7 @@
* @param fwd Direction for the next keepalive.
*/
static void
-schedule_next_keepalive (struct MeshConnection *c, int fwd);
+schedule_next_keepalive (struct CadetConnection *c, int fwd);
/**
@@ -351,7 +351,7 @@
* @param fwd Is this forward?
*/
static void
-connection_reset_timeout (struct MeshConnection *c, int fwd);
+connection_reset_timeout (struct CadetConnection *c, int fwd);
/**
@@ -362,22 +362,22 @@
* @return String representation.
*/
static const char *
-GMC_state2s (enum MeshConnectionState s)
+GMC_state2s (enum CadetConnectionState s)
{
switch (s)
{
- case MESH_CONNECTION_NEW:
- return "MESH_CONNECTION_NEW";
- case MESH_CONNECTION_SENT:
- return "MESH_CONNECTION_SENT";
- case MESH_CONNECTION_ACK:
- return "MESH_CONNECTION_ACK";
- case MESH_CONNECTION_READY:
- return "MESH_CONNECTION_READY";
- case MESH_CONNECTION_DESTROYED:
- return "MESH_CONNECTION_DESTROYED";
+ case CADET_CONNECTION_NEW:
+ return "CADET_CONNECTION_NEW";
+ case CADET_CONNECTION_SENT:
+ return "CADET_CONNECTION_SENT";
+ case CADET_CONNECTION_ACK:
+ return "CADET_CONNECTION_ACK";
+ case CADET_CONNECTION_READY:
+ return "CADET_CONNECTION_READY";
+ case CADET_CONNECTION_DESTROYED:
+ return "CADET_CONNECTION_DESTROYED";
default:
- return "MESH_CONNECTION_STATE_ERROR";
+ return "CADET_CONNECTION_STATE_ERROR";
}
}
@@ -388,7 +388,7 @@
* @param fc Flow Control structure to initialize.
*/
static void
-fc_init (struct MeshFlowControl *fc)
+fc_init (struct CadetFlowControl *fc)
{
fc->last_pid_sent = (uint32_t) -1; /* Next (expected) = 0 */
fc->last_pid_recv = (uint32_t) -1;
@@ -406,27 +406,27 @@
*
* @param cid Connection ID.
*/
-static struct MeshConnection *
-connection_get (const struct GNUNET_MESH_Hash *cid)
+static struct CadetConnection *
+connection_get (const struct GNUNET_CADET_Hash *cid)
{
return GNUNET_CONTAINER_multihashmap_get (connections, GM_h2hc (cid));
}
static void
-connection_change_state (struct MeshConnection* c,
- enum MeshConnectionState state)
+connection_change_state (struct CadetConnection* c,
+ enum CadetConnectionState state)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Connection %s state %s -> %s\n",
GMC_2s (c), GMC_state2s (c->state), GMC_state2s (state));
- if (MESH_CONNECTION_DESTROYED == c->state)
+ if (CADET_CONNECTION_DESTROYED == c->state)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n");
return;
}
c->state = state;
- if (MESH_CONNECTION_READY == state)
+ if (CADET_CONNECTION_READY == state)
c->create_retry = 1;
}
@@ -443,11 +443,11 @@
*/
static void
ack_sent (void *cls,
- struct MeshConnection *c,
- struct MeshConnectionQueue *q,
+ struct CadetConnection *c,
+ struct CadetConnectionQueue *q,
uint16_t type, int fwd, size_t size)
{
- struct MeshFlowControl *fc = cls;
+ struct CadetFlowControl *fc = cls;
fc->ack_msg = NULL;
}
@@ -467,11 +467,11 @@
* @param force Don't optimize out.
*/
static void
-send_ack (struct MeshConnection *c, unsigned int buffer, int fwd, int force)
+send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force)
{
- struct MeshFlowControl *next_fc;
- struct MeshFlowControl *prev_fc;
- struct GNUNET_MESH_ACK msg;
+ struct CadetFlowControl *next_fc;
+ struct CadetFlowControl *prev_fc;
+ struct GNUNET_CADET_ACK msg;
uint32_t ack;
int delta;
@@ -534,12 +534,12 @@
/* Build ACK message and send on connection */
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ACK);
msg.ack = htonl (ack);
msg.cid = c->id;
prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header,
- GNUNET_MESSAGE_TYPE_MESH_ACK,
+ GNUNET_MESSAGE_TYPE_CADET_ACK,
ack, c, !fwd, GNUNET_YES,
&ack_sent, prev_fc);
}
@@ -561,13 +561,13 @@
*/
static void
conn_message_sent (void *cls,
- struct MeshConnection *c, int sent,
+ struct CadetConnection *c, int sent,
uint16_t type, uint32_t pid, int fwd, size_t size,
struct GNUNET_TIME_Relative wait)
{
- struct MeshConnectionPerformance *p;
- struct MeshFlowControl *fc;
- struct MeshConnectionQueue *q = cls;
+ struct CadetConnectionPerformance *p;
+ struct CadetFlowControl *fc;
+ struct CadetConnectionQueue *q = cls;
double usecsperbyte;
int forced;
@@ -586,7 +586,7 @@
}
GNUNET_free (q);
}
- else if (type == GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED)
+ else if (type == GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED)
{
/* If NULL == q and ENCRYPTED == type, message must have been ch_mngmnt */
forced = GNUNET_YES;
@@ -597,8 +597,8 @@
}
if (NULL == c)
{
- GNUNET_break (type == GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN ||
- type == GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY);
+ GNUNET_break (type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN ||
+ type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);
LOG (GNUNET_ERROR_TYPE_ERROR, "Message %s sent on NULL connection!\n",
GM_m2s (type));
return;
@@ -614,15 +614,15 @@
/* Send ACK if needed, after accounting for sent ID in fc->queue_n */
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
c->maintenance_q = NULL;
/* Don't trigger a keepalive for sent ACKs, only SYN and SYNACKs */
- if (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE == type || !fwd)
+ if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE == type || !fwd)
schedule_next_keepalive (c, fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
if (GNUNET_YES == sent)
{
GNUNET_assert (NULL != q);
@@ -647,16 +647,16 @@
}
break;
- case GNUNET_MESSAGE_TYPE_MESH_KX:
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
if (GNUNET_YES == sent)
connection_reset_timeout (c, fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
fc->poll_msg = NULL;
break;
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
fc->ack_msg = NULL;
break;
@@ -697,8 +697,8 @@
*
* @return Previous peer in the connection.
*/
-static struct MeshPeer *
-get_prev_hop (const struct MeshConnection *c)
+static struct CadetPeer *
+get_prev_hop (const struct CadetConnection *c)
{
GNUNET_PEER_Id id;
@@ -723,8 +723,8 @@
*
* @return Next peer in the connection.
*/
-static struct MeshPeer *
-get_next_hop (const struct MeshConnection *c)
+static struct CadetPeer *
+get_next_hop (const struct CadetConnection *c)
{
GNUNET_PEER_Id id;
@@ -750,8 +750,8 @@
*
* @return Next peer in the connection.
*/
-static struct MeshPeer *
-get_hop (struct MeshConnection *c, int fwd)
+static struct CadetPeer *
+get_hop (struct CadetConnection *c, int fwd)
{
if (fwd)
return get_next_hop (c);
@@ -771,7 +771,7 @@
* #GNUNET_SYSERR for errors.
*/
static int
-is_fwd (const struct MeshConnection *c,
+is_fwd (const struct CadetConnection *c,
const struct GNUNET_PeerIdentity *sender)
{
GNUNET_PEER_Id id;
@@ -797,23 +797,23 @@
* (First (~SYNACK) goes BCK, second (~ACK) goes FWD)
*/
static void
-send_connection_ack (struct MeshConnection *connection, int fwd)
+send_connection_ack (struct CadetConnection *connection, int fwd)
{
- struct MeshTunnel3 *t;
+ struct CadetTunnel3 *t;
t = connection->t;
LOG (GNUNET_ERROR_TYPE_INFO, "===> {%14s ACK} on connection %s\n",
GM_f2s (!fwd), GMC_2s (connection));
GMP_queue_add (get_hop (connection, fwd), NULL,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 0,
- sizeof (struct GNUNET_MESH_ConnectionACK),
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0,
+ sizeof (struct GNUNET_CADET_ConnectionACK),
connection, fwd, &conn_message_sent, NULL);
connection->pending_messages++;
- if (MESH_TUNNEL3_NEW == GMT_get_cstate (t))
- GMT_change_cstate (t, MESH_TUNNEL3_WAITING);
- if (MESH_CONNECTION_READY != connection->state)
- connection_change_state (connection, MESH_CONNECTION_SENT);
+ if (CADET_TUNNEL3_NEW == GMT_get_cstate (t))
+ GMT_change_cstate (t, CADET_TUNNEL3_WAITING);
+ if (CADET_CONNECTION_READY != connection->state)
+ connection_change_state (connection, CADET_CONNECTION_SENT);
}
@@ -826,20 +826,20 @@
* @param fwd Direction towards which to send it.
*/
static void
-send_broken (struct MeshConnection *c,
+send_broken (struct CadetConnection *c,
const struct GNUNET_PeerIdentity *id1,
const struct GNUNET_PeerIdentity *id2,
int fwd)
{
- struct GNUNET_MESH_ConnectionBroken msg;
+ struct GNUNET_CADET_ConnectionBroken msg;
- msg.header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN);
+ msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN);
msg.cid = c->id;
msg.peer1 = *id1;
msg.peer2 = *id2;
GMC_send_prebuilt_message (&msg.header,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0,
c, fwd, GNUNET_YES, NULL, NULL);
}
@@ -854,20 +854,20 @@
* @param peer Peer to notify (neighbor who sent the connection).
*/
static void
-send_broken_unknown (const struct GNUNET_MESH_Hash *connection_id,
+send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id,
const struct GNUNET_PeerIdentity *id1,
const struct GNUNET_PeerIdentity *id2,
const struct GNUNET_PeerIdentity *peer_id)
{
- struct GNUNET_MESH_ConnectionBroken *msg;
- struct MeshPeer *neighbor;
+ struct GNUNET_CADET_ConnectionBroken *msg;
+ struct CadetPeer *neighbor;
LOG (GNUNET_ERROR_TYPE_INFO, "===> BROKEN on unknown connection %s\n",
GNUNET_h2s (GM_h2hc (connection_id)));
- msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken);
- msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken));
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN);
+ msg = GNUNET_new (struct GNUNET_CADET_ConnectionBroken);
+ msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken));
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN);
msg->cid = *connection_id;
msg->peer1 = *id1;
if (NULL != id2)
@@ -876,9 +876,9 @@
memset (&msg->peer2, 0, sizeof (msg->peer2));
neighbor = GMP_get (peer_id);
GMP_queue_add (neighbor, msg,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 2,
- sizeof (struct GNUNET_MESH_ConnectionBroken),
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 2,
+ sizeof (struct GNUNET_CADET_ConnectionBroken),
NULL, GNUNET_SYSERR, /* connection, fwd */
NULL, NULL); /* continuation */
}
@@ -891,10 +891,10 @@
* @param fwd Is this a FWD keepalive? (owner -> dest).
*/
static void
-send_connection_keepalive (struct MeshConnection *c, int fwd)
+send_connection_keepalive (struct CadetConnection *c, int fwd)
{
struct GNUNET_MessageHeader msg;
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
LOG (GNUNET_ERROR_TYPE_INFO,
"keepalive %s for connection %s\n",
@@ -910,7 +910,7 @@
GNUNET_assert (NULL != c->t);
msg.size = htons (sizeof (msg));
- msg.type = htons (GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE);
+ msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE);
GNUNET_assert (NULL ==
GMT_send_prebuilt_message (&msg, c->t, c,
@@ -925,7 +925,7 @@
* @param fwd If #GNUNET_YES, send CREATE, otherwise send ACK.
*/
static void
-connection_recreate (struct MeshConnection *c, int fwd)
+connection_recreate (struct CadetConnection *c, int fwd)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n");
if (fwd)
@@ -944,25 +944,25 @@
* @param fwd Is FWD?
*/
static void
-connection_maintain (struct MeshConnection *c, int fwd)
+connection_maintain (struct CadetConnection *c, int fwd)
{
if (GNUNET_NO != c->destroy)
return;
- if (MESH_TUNNEL3_SEARCHING == GMT_get_cstate (c->t))
+ if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (c->t))
{
/* TODO DHT GET with RO_BART */
return;
}
switch (c->state)
{
- case MESH_CONNECTION_NEW:
+ case CADET_CONNECTION_NEW:
GNUNET_break (0);
/* fall-through */
- case MESH_CONNECTION_SENT:
+ case CADET_CONNECTION_SENT:
connection_recreate (c, fwd);
break;
- case MESH_CONNECTION_READY:
+ case CADET_CONNECTION_READY:
send_connection_keepalive (c, fwd);
break;
default:
@@ -981,7 +981,7 @@
* Non-zero value for true, not necessarily GNUNET_YES.
*/
static void
-connection_keepalive (struct MeshConnection *c, int fwd, int shutdown)
+connection_keepalive (struct CadetConnection *c, int fwd, int shutdown)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "%s keepalive for %s\n",
GM_f2s (fwd), GMC_2s (c));
@@ -1010,7 +1010,7 @@
connection_fwd_keepalive (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- connection_keepalive ((struct MeshConnection *) cls,
+ connection_keepalive ((struct CadetConnection *) cls,
GNUNET_YES,
tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
}
@@ -1026,7 +1026,7 @@
connection_bck_keepalive (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- connection_keepalive ((struct MeshConnection *) cls,
+ connection_keepalive ((struct CadetConnection *) cls,
GNUNET_NO,
tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
}
@@ -1042,7 +1042,7 @@
* @param fwd Direction for the next keepalive.
*/
static void
-schedule_next_keepalive (struct MeshConnection *c, int fwd)
+schedule_next_keepalive (struct CadetConnection *c, int fwd)
{
struct GNUNET_TIME_Relative delay;
GNUNET_SCHEDULER_TaskIdentifier *task_id;
@@ -1052,7 +1052,7 @@
return;
/* Calculate delay to use, depending on the state of the connection */
- if (MESH_CONNECTION_READY == c->state)
+ if (CADET_CONNECTION_READY == c->state)
{
delay = refresh_connection_time;
}
@@ -1104,9 +1104,9 @@
* @param fwd Is this about fwd traffic?
*/
static void
-connection_unlock_queue (struct MeshConnection *c, int fwd)
+connection_unlock_queue (struct CadetConnection *c, int fwd)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"connection_unlock_queue %s on %s\n",
@@ -1133,10 +1133,10 @@
* @param fwd Cancel fwd traffic?
*/
static void
-connection_cancel_queues (struct MeshConnection *c, int fwd)
+connection_cancel_queues (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
- struct MeshPeer *peer;
+ struct CadetFlowControl *fc;
+ struct CadetPeer *peer;
LOG (GNUNET_ERROR_TYPE_DEBUG,
" *** Cancel %s queues for connection %s\n",
@@ -1182,11 +1182,11 @@
*/
static void
poll_sent (void *cls,
- struct MeshConnection *c,
- struct MeshConnectionQueue *q,
+ struct CadetConnection *c,
+ struct CadetConnectionQueue *q,
uint16_t type, int fwd, size_t size)
{
- struct MeshFlowControl *fc = cls;
+ struct CadetFlowControl *fc = cls;
if (2 == c->destroy)
{
@@ -1213,9 +1213,9 @@
static void
connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshFlowControl *fc = cls;
- struct GNUNET_MESH_Poll msg;
- struct MeshConnection *c;
+ struct CadetFlowControl *fc = cls;
+ struct GNUNET_CADET_Poll msg;
+ struct CadetConnection *c;
fc->poll_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -1227,13 +1227,13 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling connection %s %s\n",
GMC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK");
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_POLL);
msg.header.size = htons (sizeof (msg));
msg.pid = htonl (fc->last_pid_sent);
LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n",
fc->last_pid_sent);
fc->poll_msg =
GMC_send_prebuilt_message (&msg.header,
- GNUNET_MESSAGE_TYPE_MESH_POLL,
+ GNUNET_MESSAGE_TYPE_CADET_POLL,
fc->last_pid_sent,
c, fc == &c->fwd_fc, GNUNET_YES,
&poll_sent, fc);
@@ -1251,7 +1251,7 @@
connection_fwd_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshConnection *c = cls;
+ struct CadetConnection *c = cls;
c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -1280,7 +1280,7 @@
connection_bck_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshConnection *c = cls;
+ struct CadetConnection *c = cls;
c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -1314,7 +1314,7 @@
* TODO use heap to improve efficiency of scheduler.
*/
static void
-connection_reset_timeout (struct MeshConnection *c, int fwd)
+connection_reset_timeout (struct CadetConnection *c, int fwd)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GM_f2s (fwd));
@@ -1348,10 +1348,10 @@
* #GNUNET_SYSERR if the was an error and @c c is malformed.
*/
static int
-register_neighbors (struct MeshConnection *c)
+register_neighbors (struct CadetConnection *c)
{
- struct MeshPeer *next_peer;
- struct MeshPeer *prev_peer;
+ struct CadetPeer *next_peer;
+ struct CadetPeer *prev_peer;
next_peer = get_next_hop (c);
prev_peer = get_prev_hop (c);
@@ -1395,15 +1395,15 @@
* @param c Connection.
*/
static void
-unregister_neighbors (struct MeshConnection *c)
+unregister_neighbors (struct CadetConnection *c)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
peer = get_next_hop (c);
if (GNUNET_OK != GMP_remove_connection (peer, c))
{
- GNUNET_assert (MESH_CONNECTION_NEW == c->state
- || MESH_CONNECTION_DESTROYED == c->state);
+ GNUNET_assert (CADET_CONNECTION_NEW == c->state
+ || CADET_CONNECTION_DESTROYED == c->state);
LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
if (NULL != c->t) GMT_debug (c->t);
}
@@ -1411,8 +1411,8 @@
peer = get_prev_hop (c);
if (GNUNET_OK != GMP_remove_connection (peer, c))
{
- GNUNET_assert (MESH_CONNECTION_NEW == c->state
- || MESH_CONNECTION_DESTROYED == c->state);
+ GNUNET_assert (CADET_CONNECTION_NEW == c->state
+ || CADET_CONNECTION_DESTROYED == c->state);
LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
if (NULL != c->t) GMT_debug (c->t);
}
@@ -1429,7 +1429,7 @@
* @param peer Peer.
*/
static void
-add_to_peer (struct MeshConnection *c, struct MeshPeer *peer)
+add_to_peer (struct CadetConnection *c, struct CadetPeer *peer)
{
GMP_add_tunnel (peer);
c->t = GMP_get_tunnel (peer);
@@ -1446,12 +1446,12 @@
*
* @return Fixed and shortened path.
*/
-static struct MeshPeerPath *
+static struct CadetPeerPath *
build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers,
unsigned int size,
unsigned int *own_pos)
{
- struct MeshPeerPath *path;
+ struct CadetPeerPath *path;
GNUNET_PEER_Id shortid;
unsigned int i;
unsigned int j;
@@ -1508,7 +1508,7 @@
static void
log_message (const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MESH_Hash *hash)
+ const struct GNUNET_CADET_Hash *hash)
{
LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n",
GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)),
@@ -1533,26 +1533,26 @@
GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_ConnectionCreate *msg;
+ struct GNUNET_CADET_ConnectionCreate *msg;
struct GNUNET_PeerIdentity *id;
- struct GNUNET_MESH_Hash *cid;
- struct MeshPeerPath *path;
- struct MeshPeer *dest_peer;
- struct MeshPeer *orig_peer;
- struct MeshConnection *c;
+ struct GNUNET_CADET_Hash *cid;
+ struct CadetPeerPath *path;
+ struct CadetPeer *dest_peer;
+ struct CadetPeer *orig_peer;
+ struct CadetConnection *c;
unsigned int own_pos;
uint16_t size;
/* Check size */
size = ntohs (message->size);
- if (size < sizeof (struct GNUNET_MESH_ConnectionCreate))
+ if (size < sizeof (struct GNUNET_CADET_ConnectionCreate))
{
GNUNET_break_op (0);
return GNUNET_OK;
}
/* Calculate hops */
- size -= sizeof (struct GNUNET_MESH_ConnectionCreate);
+ size -= sizeof (struct GNUNET_CADET_ConnectionCreate);
if (size % sizeof (struct GNUNET_PeerIdentity))
{
GNUNET_break_op (0);
@@ -1567,7 +1567,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " path has %u hops.\n", size);
/* Get parameters */
- msg = (struct GNUNET_MESH_ConnectionCreate *) message;
+ msg = (struct GNUNET_CADET_ConnectionCreate *) message;
cid = &msg->cid;
log_message (message, peer, cid);
id = (struct GNUNET_PeerIdentity *) &msg[1];
@@ -1611,8 +1611,8 @@
{
path = path_duplicate (c->path);
}
- if (MESH_CONNECTION_NEW == c->state)
- connection_change_state (c, MESH_CONNECTION_SENT);
+ if (CADET_CONNECTION_NEW == c->state)
+ connection_change_state (c, CADET_CONNECTION_SENT);
/* Remember peers */
dest_peer = GMP_get (&id[size - 1]);
@@ -1625,12 +1625,12 @@
GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES);
add_to_peer (c, orig_peer);
- if (MESH_TUNNEL3_NEW == GMT_get_cstate (c->t))
- GMT_change_cstate (c->t, MESH_TUNNEL3_WAITING);
+ if (CADET_TUNNEL3_NEW == GMT_get_cstate (c->t))
+ GMT_change_cstate (c->t, CADET_TUNNEL3_WAITING);
send_connection_ack (c, GNUNET_NO);
- if (MESH_CONNECTION_SENT == c->state)
- connection_change_state (c, MESH_CONNECTION_ACK);
+ if (CADET_CONNECTION_SENT == c->state)
+ connection_change_state (c, CADET_CONNECTION_ACK);
}
else
{
@@ -1639,7 +1639,7 @@
GMP_add_path (dest_peer, path_duplicate (path), GNUNET_NO);
GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO);
GMC_send_prebuilt_message (message,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0,
c, GNUNET_YES, GNUNET_YES,
NULL, NULL);
}
@@ -1662,14 +1662,14 @@
GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_ConnectionACK *msg;
- struct MeshConnection *c;
- struct MeshPeerPath *p;
- struct MeshPeer *pi;
- enum MeshConnectionState oldstate;
+ struct GNUNET_CADET_ConnectionACK *msg;
+ struct CadetConnection *c;
+ struct CadetPeerPath *p;
+ struct CadetPeer *pi;
+ enum CadetConnectionState oldstate;
int fwd;
- msg = (struct GNUNET_MESH_ConnectionACK *) message;
+ msg = (struct GNUNET_CADET_ConnectionACK *) message;
log_message (message, peer, &msg->cid);
c = connection_get (&msg->cid);
if (NULL == c)
@@ -1694,14 +1694,14 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n");
fwd = GNUNET_NO;
- if (MESH_CONNECTION_SENT == oldstate)
- connection_change_state (c, MESH_CONNECTION_ACK);
+ if (CADET_CONNECTION_SENT == oldstate)
+ connection_change_state (c, CADET_CONNECTION_ACK);
}
else if (get_prev_hop (c) == pi)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK\n");
fwd = GNUNET_YES;
- connection_change_state (c, MESH_CONNECTION_READY);
+ connection_change_state (c, CADET_CONNECTION_READY);
}
else
{
@@ -1733,16 +1733,16 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n");
/* If just created, cancel the short timeout and start a long one */
- if (MESH_CONNECTION_SENT == oldstate)
+ if (CADET_CONNECTION_SENT == oldstate)
connection_reset_timeout (c, GNUNET_YES);
/* Change connection state */
- connection_change_state (c, MESH_CONNECTION_READY);
+ connection_change_state (c, CADET_CONNECTION_READY);
send_connection_ack (c, GNUNET_YES);
/* Change tunnel state, trigger KX */
- if (MESH_TUNNEL3_WAITING == GMT_get_cstate (c->t))
- GMT_change_cstate (c->t, MESH_TUNNEL3_READY);
+ if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t))
+ GMT_change_cstate (c->t, CADET_TUNNEL3_READY);
return GNUNET_OK;
}
@@ -1758,19 +1758,19 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n");
/* If just created, cancel the short timeout and start a long one */
- if (MESH_CONNECTION_ACK == oldstate)
+ if (CADET_CONNECTION_ACK == oldstate)
connection_reset_timeout (c, GNUNET_NO);
/* Change tunnel state */
- if (MESH_TUNNEL3_WAITING == GMT_get_cstate (c->t))
- GMT_change_cstate (c->t, MESH_TUNNEL3_READY);
+ if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t))
+ GMT_change_cstate (c->t, CADET_TUNNEL3_READY);
return GNUNET_OK;
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
GMC_send_prebuilt_message (message,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0,
c, fwd, GNUNET_YES, NULL, NULL);
return GNUNET_OK;
}
@@ -1791,11 +1791,11 @@
const struct GNUNET_PeerIdentity* id,
const struct GNUNET_MessageHeader* message)
{
- struct GNUNET_MESH_ConnectionBroken *msg;
- struct MeshConnection *c;
+ struct GNUNET_CADET_ConnectionBroken *msg;
+ struct CadetConnection *c;
int fwd;
- msg = (struct GNUNET_MESH_ConnectionBroken *) message;
+ msg = (struct GNUNET_CADET_ConnectionBroken *) message;
log_message (message, id, &msg->cid);
LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
GNUNET_i2s (&msg->peer1));
@@ -1812,14 +1812,14 @@
if (GMC_is_terminal (c, fwd))
{
struct GNUNET_MessageHeader *out_msg;
- struct MeshPeer *neighbor;
- struct MeshPeer *endpoint;
+ struct CadetPeer *neighbor;
+ struct CadetPeer *endpoint;
neighbor = get_hop (c, !fwd);
endpoint = GMP_get_short (c->path->peers[c->path->length - 1]);
path_invalidate (c->path);
GMP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
- c->state = MESH_CONNECTION_DESTROYED;
+ c->state = CADET_CONNECTION_DESTROYED;
while (NULL != (out_msg = GMP_connection_pop (neighbor, c)))
{
GNUNET_assert (NULL ==
@@ -1832,7 +1832,7 @@
else
{
GMC_send_prebuilt_message (message,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0,
c, fwd, GNUNET_YES, NULL, NULL);
c->destroy = GNUNET_YES;
connection_cancel_queues (c, !fwd);
@@ -1857,11 +1857,11 @@
GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_ConnectionDestroy *msg;
- struct MeshConnection *c;
+ struct GNUNET_CADET_ConnectionDestroy *msg;
+ struct CadetConnection *c;
int fwd;
- msg = (struct GNUNET_MESH_ConnectionDestroy *) message;
+ msg = (struct GNUNET_CADET_ConnectionDestroy *) message;
log_message (message, peer, &msg->cid);
c = connection_get (&msg->cid);
if (NULL == c)
@@ -1883,7 +1883,7 @@
}
if (GNUNET_NO == GMC_is_terminal (c, fwd))
GMC_send_prebuilt_message (message,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
c, fwd, GNUNET_YES, NULL, NULL);
else if (0 == c->pending_messages)
{
@@ -1892,7 +1892,7 @@
return GNUNET_OK;
}
c->destroy = GNUNET_YES;
- c->state = MESH_CONNECTION_DESTROYED;
+ c->state = CADET_CONNECTION_DESTROYED;
if (NULL != c->t)
{
GMT_remove_connection (c->t, c);
@@ -1903,7 +1903,7 @@
}
/**
- * Generic handler for mesh network encrypted traffic.
+ * Generic handler for cadet network encrypted traffic.
*
* @param peer Peer identity this notification is about.
* @param msg Encrypted message.
@@ -1912,12 +1912,12 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
-handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MESH_Encrypted *msg)
+handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_CADET_Encrypted *msg)
{
- struct MeshConnection *c;
- struct MeshPeer *neighbor;
- struct MeshFlowControl *fc;
+ struct CadetConnection *c;
+ struct CadetPeer *neighbor;
+ struct CadetFlowControl *fc;
GNUNET_PEER_Id peer_id;
uint32_t pid;
uint32_t ttl;
@@ -1929,7 +1929,7 @@
/* Check size */
size = ntohs (msg->header.size);
if (size <
- sizeof (struct GNUNET_MESH_Encrypted) +
+ sizeof (struct GNUNET_CADET_Encrypted) +
sizeof (struct GNUNET_MessageHeader))
{
GNUNET_break_op (0);
@@ -1993,8 +1993,8 @@
pid, fc->last_pid_recv + 1);
return GNUNET_OK;
}
- if (MESH_CONNECTION_SENT == c->state || MESH_CONNECTION_ACK == c->state)
- connection_change_state (c, MESH_CONNECTION_READY);
+ if (CADET_CONNECTION_SENT == c->state || CADET_CONNECTION_ACK == c->state)
+ connection_change_state (c, CADET_CONNECTION_READY);
connection_reset_timeout (c, fwd);
fc->last_pid_recv = pid;
@@ -2029,14 +2029,14 @@
GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
GMC_send_prebuilt_message (&msg->header,
- GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED, 0,
+ GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0,
c, fwd, GNUNET_NO, NULL, NULL);
return GNUNET_OK;
}
/**
- * Generic handler for mesh network encrypted traffic.
+ * Generic handler for cadet network encrypted traffic.
*
* @param peer Peer identity this notification is about.
* @param msg Encrypted message.
@@ -2045,11 +2045,11 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
-handle_mesh_kx (const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MESH_KX *msg)
+handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_CADET_KX *msg)
{
- struct MeshConnection *c;
- struct MeshPeer *neighbor;
+ struct CadetConnection *c;
+ struct CadetPeer *neighbor;
GNUNET_PEER_Id peer_id;
size_t size;
int fwd;
@@ -2059,7 +2059,7 @@
/* Check size */
size = ntohs (msg->header.size);
if (size <
- sizeof (struct GNUNET_MESH_KX) +
+ sizeof (struct GNUNET_CADET_KX) +
sizeof (struct GNUNET_MessageHeader))
{
GNUNET_break_op (0);
@@ -2101,13 +2101,13 @@
}
/* Count as connection confirmation. */
- if (MESH_CONNECTION_SENT == c->state || MESH_CONNECTION_ACK == c->state)
+ if (CADET_CONNECTION_SENT == c->state || CADET_CONNECTION_ACK == c->state)
{
- connection_change_state (c, MESH_CONNECTION_READY);
+ connection_change_state (c, CADET_CONNECTION_READY);
if (NULL != c->t)
{
- if (MESH_TUNNEL3_WAITING == GMT_get_cstate (c->t))
- GMT_change_cstate (c->t, MESH_TUNNEL3_READY);
+ if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t))
+ GMT_change_cstate (c->t, CADET_TUNNEL3_READY);
}
}
connection_reset_timeout (c, fwd);
@@ -2129,7 +2129,7 @@
/* Message not for us: forward to next hop */
LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
- GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_MESH_KX, 0,
+ GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0,
c, fwd, GNUNET_NO, NULL, NULL);
return GNUNET_OK;
@@ -2137,7 +2137,7 @@
/**
- * Core handler for encrypted mesh network traffic (channel mgmt, data).
+ * Core handler for encrypted cadet network traffic (channel mgmt, data).
*
* @param cls Closure (unused).
* @param message Message received.
@@ -2150,8 +2150,8 @@
GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- return handle_mesh_encrypted (peer,
- (struct GNUNET_MESH_Encrypted *)message);
+ return handle_cadet_encrypted (peer,
+ (struct GNUNET_CADET_Encrypted *)message);
}
@@ -2169,13 +2169,13 @@
GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- return handle_mesh_kx (peer,
- (struct GNUNET_MESH_KX *) message);
+ return handle_cadet_kx (peer,
+ (struct GNUNET_CADET_KX *) message);
}
/**
- * Core handler for mesh network traffic point-to-point acks.
+ * Core handler for cadet network traffic point-to-point acks.
*
* @param cls closure
* @param message message
@@ -2188,14 +2188,14 @@
GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_ACK *msg;
- struct MeshConnection *c;
- struct MeshFlowControl *fc;
+ struct GNUNET_CADET_ACK *msg;
+ struct CadetConnection *c;
+ struct CadetFlowControl *fc;
GNUNET_PEER_Id id;
uint32_t ack;
int fwd;
- msg = (struct GNUNET_MESH_ACK *) message;
+ msg = (struct GNUNET_CADET_ACK *) message;
log_message (message, peer, &msg->cid);
c = connection_get (&msg->cid);
if (NULL == c)
@@ -2249,7 +2249,7 @@
/**
- * Core handler for mesh network traffic point-to-point ack polls.
+ * Core handler for cadet network traffic point-to-point ack polls.
*
* @param cls closure
* @param message message
@@ -2262,14 +2262,14 @@
GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_Poll *msg;
- struct MeshConnection *c;
- struct MeshFlowControl *fc;
+ struct GNUNET_CADET_Poll *msg;
+ struct CadetConnection *c;
+ struct CadetFlowControl *fc;
GNUNET_PEER_Id id;
uint32_t pid;
int fwd;
- msg = (struct GNUNET_MESH_Poll *) message;
+ msg = (struct GNUNET_CADET_Poll *) message;
log_message (message, peer, &msg->cid);
c = connection_get (&msg->cid);
if (NULL == c)
@@ -2323,7 +2323,7 @@
* @param force Send the ACK even if suboptimal (e.g. requested by POLL).
*/
void
-GMC_send_ack (struct MeshConnection *c, int fwd, int force)
+GMC_send_ack (struct CadetConnection *c, int fwd, int force)
{
unsigned int buffer;
@@ -2383,31 +2383,31 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_MSGS_QUEUE",
+ GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_MSGS_QUEUE",
&max_msgs_queue))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "MESH", "MAX_MSGS_QUEUE", "MISSING");
+ "CADET", "MAX_MSGS_QUEUE", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_CONNECTIONS",
+ GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_CONNECTIONS",
&max_connections))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "MESH", "MAX_CONNECTIONS", "MISSING");
+ "CADET", "MAX_CONNECTIONS", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (c, "MESH",
"REFRESH_CONNECTION_TIME",
+ GNUNET_CONFIGURATION_get_value_time (c, "CADET",
"REFRESH_CONNECTION_TIME",
&refresh_connection_time))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "MESH", "REFRESH_CONNECTION_TIME", "MISSING");
+ "CADET", "REFRESH_CONNECTION_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -2430,7 +2430,7 @@
const struct GNUNET_HashCode *key,
void *value)
{
- struct MeshConnection *c = value;
+ struct CadetConnection *c = value;
GMC_destroy (c);
return GNUNET_YES;
@@ -2449,15 +2449,15 @@
}
-struct MeshConnection *
-GMC_new (const struct GNUNET_MESH_Hash *cid,
- struct MeshTunnel3 *t,
- struct MeshPeerPath *p,
+struct CadetConnection *
+GMC_new (const struct GNUNET_CADET_Hash *cid,
+ struct CadetTunnel3 *t,
+ struct CadetPeerPath *p,
unsigned int own_pos)
{
- struct MeshConnection *c;
+ struct CadetConnection *c;
- c = GNUNET_new (struct MeshConnection);
+ c = GNUNET_new (struct CadetConnection);
c->id = *cid;
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (connections,
@@ -2491,7 +2491,7 @@
void
-GMC_destroy (struct MeshConnection *c)
+GMC_destroy (struct CadetConnection *c)
{
if (NULL == c)
{
@@ -2568,8 +2568,8 @@
*
* @return ID of the connection.
*/
-const struct GNUNET_MESH_Hash *
-GMC_get_id (const struct MeshConnection *c)
+const struct GNUNET_CADET_Hash *
+GMC_get_id (const struct CadetConnection *c)
{
return &c->id;
}
@@ -2583,7 +2583,7 @@
* @return ID of the connection.
*/
const struct GNUNET_HashCode *
-GMC_get_h (const struct MeshConnection *c)
+GMC_get_h (const struct CadetConnection *c)
{
return GM_h2hc (&c->id);
}
@@ -2596,8 +2596,8 @@
*
* @return path used by the connection.
*/
-const struct MeshPeerPath *
-GMC_get_path (const struct MeshConnection *c)
+const struct CadetPeerPath *
+GMC_get_path (const struct CadetConnection *c)
{
if (GNUNET_NO == c->destroy)
return c->path;
@@ -2612,8 +2612,8 @@
*
* @return state of the connection.
*/
-enum MeshConnectionState
-GMC_get_state (const struct MeshConnection *c)
+enum CadetConnectionState
+GMC_get_state (const struct CadetConnection *c)
{
return c->state;
}
@@ -2625,8 +2625,8 @@
*
* @return tunnel of the connection.
*/
-struct MeshTunnel3 *
-GMC_get_tunnel (const struct MeshConnection *c)
+struct CadetTunnel3 *
+GMC_get_tunnel (const struct CadetConnection *c)
{
return c->t;
}
@@ -2641,9 +2641,9 @@
* @return Free buffer space [0 - max_msgs_queue/max_connections]
*/
unsigned int
-GMC_get_buffer (struct MeshConnection *c, int fwd)
+GMC_get_buffer (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
@@ -2659,9 +2659,9 @@
* @return last_ack_sent - last_pid_recv
*/
unsigned int
-GMC_get_allowed (struct MeshConnection *c, int fwd)
+GMC_get_allowed (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
if (GM_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent))
@@ -2680,9 +2680,9 @@
* @return Number of messages queued.
*/
unsigned int
-GMC_get_qn (struct MeshConnection *c, int fwd)
+GMC_get_qn (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
@@ -2699,9 +2699,9 @@
* @return Last PID used + 1.
*/
unsigned int
-GMC_get_pid (struct MeshConnection *c, int fwd)
+GMC_get_pid (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
@@ -2720,7 +2720,7 @@
* @param fwd Is this about FWD traffic? (The ack will go dest->root).
*/
void
-GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd)
+GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " allowing %s %u messages %s\n",
GMC_2s (c), buffer, GM_f2s (fwd));
@@ -2736,8 +2736,8 @@
* @param peer Peer that disconnected.
*/
void
-GMC_notify_broken (struct MeshConnection *c,
- struct MeshPeer *peer)
+GMC_notify_broken (struct CadetConnection *c,
+ struct CadetPeer *peer)
{
int fwd;
@@ -2760,7 +2760,7 @@
* (the one we just scheduled), so no point in checking whether to
* destroy immediately. */
c->destroy = GNUNET_YES;
- c->state = MESH_CONNECTION_DESTROYED;
+ c->state = CADET_CONNECTION_DESTROYED;
/**
* Cancel all queues, if no message is left, connection will be destroyed.
@@ -2780,7 +2780,7 @@
* @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal.
*/
int
-GMC_is_origin (struct MeshConnection *c, int fwd)
+GMC_is_origin (struct CadetConnection *c, int fwd)
{
if (!fwd && c->path->length - 1 == c->own_pos )
return GNUNET_YES;
@@ -2800,7 +2800,7 @@
* @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin.
*/
int
-GMC_is_terminal (struct MeshConnection *c, int fwd)
+GMC_is_terminal (struct CadetConnection *c, int fwd)
{
return GMC_is_origin (c, !fwd);
}
@@ -2815,9 +2815,9 @@
* @return #GNUNET_YES in case it's OK to send.
*/
int
-GMC_is_sendable (struct MeshConnection *c, int fwd)
+GMC_is_sendable (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
LOG (GNUNET_ERROR_TYPE_DEBUG, " checking sendability of %s traffic on %s\n",
GM_f2s (fwd), GMC_2s (c));
@@ -2848,7 +2848,7 @@
* @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise.
*/
int
-GMC_is_direct (struct MeshConnection *c)
+GMC_is_direct (struct CadetConnection *c)
{
return (c->path->length == 2) ? GNUNET_YES : GNUNET_NO;
}
@@ -2870,14 +2870,14 @@
* NULL on error or if @c cont is NULL.
* Invalid on @c cont call.
*/
-struct MeshConnectionQueue *
+struct CadetConnectionQueue *
GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
uint16_t payload_type, uint32_t payload_id,
- struct MeshConnection *c, int fwd, int force,
+ struct CadetConnection *c, int fwd, int force,
GMC_sent cont, void *cont_cls)
{
- struct MeshFlowControl *fc;
- struct MeshConnectionQueue *q;
+ struct CadetFlowControl *fc;
+ struct CadetConnectionQueue *q;
void *data;
size_t size;
uint16_t type;
@@ -2894,16 +2894,16 @@
droppable = GNUNET_NO == force;
switch (type)
{
- struct GNUNET_MESH_Encrypted *emsg;
- struct GNUNET_MESH_KX *kmsg;
- struct GNUNET_MESH_ACK *amsg;
- struct GNUNET_MESH_Poll *pmsg;
- struct GNUNET_MESH_ConnectionDestroy *dmsg;
- struct GNUNET_MESH_ConnectionBroken *bmsg;
+ struct GNUNET_CADET_Encrypted *emsg;
+ struct GNUNET_CADET_KX *kmsg;
+ struct GNUNET_CADET_ACK *amsg;
+ struct GNUNET_CADET_Poll *pmsg;
+ struct GNUNET_CADET_ConnectionDestroy *dmsg;
+ struct GNUNET_CADET_ConnectionBroken *bmsg;
uint32_t ttl;
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
- emsg = (struct GNUNET_MESH_Encrypted *) data;
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
+ emsg = (struct GNUNET_CADET_Encrypted *) data;
ttl = ntohl (emsg->ttl);
if (0 == ttl)
{
@@ -2931,40 +2931,40 @@
}
break;
- case GNUNET_MESSAGE_TYPE_MESH_KX:
- kmsg = (struct GNUNET_MESH_KX *) data;
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
+ kmsg = (struct GNUNET_CADET_KX *) data;
kmsg->cid = c->id;
break;
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
- amsg = (struct GNUNET_MESH_ACK *) data;
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
+ amsg = (struct GNUNET_CADET_ACK *) data;
amsg->cid = c->id;
LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack));
droppable = GNUNET_NO;
break;
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
- pmsg = (struct GNUNET_MESH_Poll *) data;
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
+ pmsg = (struct GNUNET_CADET_Poll *) data;
pmsg->cid = c->id;
LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid));
droppable = GNUNET_NO;
break;
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
- dmsg = (struct GNUNET_MESH_ConnectionDestroy *) data;
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
+ dmsg = (struct GNUNET_CADET_ConnectionDestroy *) data;
dmsg->cid = c->id;
break;
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
- bmsg = (struct GNUNET_MESH_ConnectionBroken *) data;
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
+ bmsg = (struct GNUNET_CADET_ConnectionBroken *) data;
bmsg->cid = c->id;
break;
- case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
+ case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
GNUNET_break (0);
/* falltrough */
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
break;
default:
@@ -2981,7 +2981,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG,
"queue full: %u/%u\n",
fc->queue_n, fc->queue_max);
- if (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED == type)
+ if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type)
{
fc->queue_n--;
}
@@ -2992,7 +2992,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u\n", c, c->pending_messages);
// c->pending_messages++;
- q = GNUNET_new (struct MeshConnectionQueue);
+ q = GNUNET_new (struct CadetConnectionQueue);
q->forced = !droppable;
q->q = GMP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id,
size, c, fwd, &conn_message_sent, q);
@@ -3019,7 +3019,7 @@
* @param q Handle to the queue.
*/
void
-GMC_cancel (struct MeshConnectionQueue *q)
+GMC_cancel (struct CadetConnectionQueue *q)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "! GMC cancel message\n");
@@ -3035,16 +3035,16 @@
* @param connection Connection to create.
*/
void
-GMC_send_create (struct MeshConnection *connection)
+GMC_send_create (struct CadetConnection *connection)
{
- enum MeshTunnel3CState state;
+ enum CadetTunnel3CState state;
size_t size;
- size = sizeof (struct GNUNET_MESH_ConnectionCreate);
+ size = sizeof (struct GNUNET_CADET_ConnectionCreate);
size += connection->path->length * sizeof (struct GNUNET_PeerIdentity);
LOG (GNUNET_ERROR_TYPE_INFO, "===> %s on connection %s (%u bytes)\n",
- GM_m2s (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE),
+ GM_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE),
GMC_2s (connection), size);
LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n",
connection, connection->pending_messages);
@@ -3052,15 +3052,15 @@
connection->maintenance_q =
GMP_queue_add (get_next_hop (connection), NULL,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0,
size, connection, GNUNET_YES, &conn_message_sent, NULL);
state = GMT_get_cstate (connection->t);
- if (MESH_TUNNEL3_SEARCHING == state || MESH_TUNNEL3_NEW == state)
- GMT_change_cstate (connection->t, MESH_TUNNEL3_WAITING);
- if (MESH_CONNECTION_NEW == connection->state)
- connection_change_state (connection, MESH_CONNECTION_SENT);
+ if (CADET_TUNNEL3_SEARCHING == state || CADET_TUNNEL3_NEW == state)
+ GMT_change_cstate (connection->t, CADET_TUNNEL3_WAITING);
+ if (CADET_CONNECTION_NEW == connection->state)
+ connection_change_state (connection, CADET_CONNECTION_SENT);
}
@@ -3074,15 +3074,15 @@
* @param c The connection whose peers to notify.
*/
void
-GMC_send_destroy (struct MeshConnection *c)
+GMC_send_destroy (struct CadetConnection *c)
{
- struct GNUNET_MESH_ConnectionDestroy msg;
+ struct GNUNET_CADET_ConnectionDestroy msg;
if (GNUNET_YES == c->destroy)
return;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY);;
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);;
msg.cid = c->id;
LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending connection destroy for connection %s\n",
@@ -3090,14 +3090,14 @@
if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES))
GMC_send_prebuilt_message (&msg.header,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
c, GNUNET_YES, GNUNET_YES, NULL, NULL);
if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO))
GMC_send_prebuilt_message (&msg.header,
- GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0,
+ GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
c, GNUNET_NO, GNUNET_YES, NULL, NULL);
c->destroy = GNUNET_YES;
- c->state = MESH_CONNECTION_DESTROYED;
+ c->state = CADET_CONNECTION_DESTROYED;
}
@@ -3112,9 +3112,9 @@
* @param fwd Should we poll in the FWD direction?
*/
void
-GMC_start_poll (struct MeshConnection *c, int fwd)
+GMC_start_poll (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n",
@@ -3141,9 +3141,9 @@
* @param fwd Should we stop the poll in the FWD direction?
*/
void
-GMC_stop_poll (struct MeshConnection *c, int fwd)
+GMC_stop_poll (struct CadetConnection *c, int fwd)
{
- struct MeshFlowControl *fc;
+ struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task)
@@ -3159,7 +3159,7 @@
* @param c Connection.
*/
const char *
-GMC_2s (const struct MeshConnection *c)
+GMC_2s (const struct CadetConnection *c)
{
if (NULL == c)
return "NULL";
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_connection.h
- * @brief mesh service; dealing with connections
+ * @file cadet/gnunet-service-cadet_connection.h
+ * @brief cadet service; dealing with connections
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GMC (Gnunet Mesh
Connection)
+ * All functions in this file should use the prefix GMC (Gnunet Cadet
Connection)
*/
-#ifndef GNUNET_SERVICE_MESH_CONNECTION_H
-#define GNUNET_SERVICE_MESH_CONNECTION_H
+#ifndef GNUNET_SERVICE_CADET_CONNECTION_H
+#define GNUNET_SERVICE_CADET_CONNECTION_H
#ifdef __cplusplus
extern "C"
@@ -43,48 +43,48 @@
/**
* All the states a connection can be in.
*/
-enum MeshConnectionState
+enum CadetConnectionState
{
/**
* Uninitialized status, should never appear in operation.
*/
- MESH_CONNECTION_NEW,
+ CADET_CONNECTION_NEW,
/**
* Connection create message sent, waiting for ACK.
*/
- MESH_CONNECTION_SENT,
+ CADET_CONNECTION_SENT,
/**
* Connection ACK sent, waiting for ACK.
*/
- MESH_CONNECTION_ACK,
+ CADET_CONNECTION_ACK,
/**
* Connection confirmed, ready to carry traffic.
*/
- MESH_CONNECTION_READY,
+ CADET_CONNECTION_READY,
/**
* Connection to be destroyed, just waiting to empty queues.
*/
- MESH_CONNECTION_DESTROYED,
+ CADET_CONNECTION_DESTROYED,
};
/**
* Struct containing all information regarding a connection to a peer.
*/
-struct MeshConnection;
+struct CadetConnection;
/**
* Handle for messages queued but not yet sent.
*/
-struct MeshConnectionQueue;
+struct CadetConnectionQueue;
-#include "mesh_path.h"
-#include "gnunet-service-mesh_channel.h"
-#include "gnunet-service-mesh_peer.h"
+#include "cadet_path.h"
+#include "gnunet-service-cadet_channel.h"
+#include "gnunet-service-cadet_peer.h"
@@ -98,8 +98,8 @@
* @param size Size of the message.
*/
typedef void (*GMC_sent) (void *cls,
- struct MeshConnection *c,
- struct MeshConnectionQueue *q,
+ struct CadetConnection *c,
+ struct CadetConnectionQueue *q,
uint16_t type, int fwd, size_t size);
/**
@@ -160,7 +160,7 @@
const struct GNUNET_MessageHeader *message);
/**
- * Core handler for encrypted mesh network traffic (channel mgmt, data).
+ * Core handler for encrypted cadet network traffic (channel mgmt, data).
*
* @param cls Closure (unused).
* @param message Message received.
@@ -188,7 +188,7 @@
const struct GNUNET_MessageHeader *message);
/**
- * Core handler for mesh network traffic point-to-point acks.
+ * Core handler for cadet network traffic point-to-point acks.
*
* @param cls closure
* @param message message
@@ -202,7 +202,7 @@
const struct GNUNET_MessageHeader *message);
/**
- * Core handler for mesh network traffic point-to-point ack polls.
+ * Core handler for cadet network traffic point-to-point ack polls.
*
* @param cls closure
* @param message message
@@ -216,7 +216,7 @@
const struct GNUNET_MessageHeader *message);
/**
- * Core handler for mesh keepalives.
+ * Core handler for cadet keepalives.
*
* @param cls closure
* @param message message
@@ -239,7 +239,7 @@
* @param force Send the ACK even if suboptimal (e.g. requested by POLL).
*/
void
-GMC_send_ack (struct MeshConnection *c, int fwd, int force);
+GMC_send_ack (struct CadetConnection *c, int fwd, int force);
/**
* Initialize the connections subsystem
@@ -265,10 +265,10 @@
*
* @return Newly created connection, NULL in case of error (own id not in
path).
*/
-struct MeshConnection *
-GMC_new (const struct GNUNET_MESH_Hash *cid,
- struct MeshTunnel3 *t,
- struct MeshPeerPath *p,
+struct CadetConnection *
+GMC_new (const struct GNUNET_CADET_Hash *cid,
+ struct CadetTunnel3 *t,
+ struct CadetPeerPath *p,
unsigned int own_pos);
/**
@@ -280,7 +280,7 @@
* @param c Connection to destroy.
*/
void
-GMC_destroy (struct MeshConnection *c);
+GMC_destroy (struct CadetConnection *c);
/**
* Get the connection ID.
@@ -289,8 +289,8 @@
*
* @return ID of the connection.
*/
-const struct GNUNET_MESH_Hash *
-GMC_get_id (const struct MeshConnection *c);
+const struct GNUNET_CADET_Hash *
+GMC_get_id (const struct CadetConnection *c);
/**
@@ -301,7 +301,7 @@
* @return Hash expanded from the ID of the connection.
*/
const struct GNUNET_HashCode *
-GMC_get_h (const struct MeshConnection *c);
+GMC_get_h (const struct CadetConnection *c);
/**
@@ -311,8 +311,8 @@
*
* @return path used by the connection.
*/
-const struct MeshPeerPath *
-GMC_get_path (const struct MeshConnection *c);
+const struct CadetPeerPath *
+GMC_get_path (const struct CadetConnection *c);
/**
* Get the connection state.
@@ -321,8 +321,8 @@
*
* @return state of the connection.
*/
-enum MeshConnectionState
-GMC_get_state (const struct MeshConnection *c);
+enum CadetConnectionState
+GMC_get_state (const struct CadetConnection *c);
/**
* Get the connection tunnel.
@@ -331,8 +331,8 @@
*
* @return tunnel of the connection.
*/
-struct MeshTunnel3 *
-GMC_get_tunnel (const struct MeshConnection *c);
+struct CadetTunnel3 *
+GMC_get_tunnel (const struct CadetConnection *c);
/**
* Get free buffer space in a connection.
@@ -343,7 +343,7 @@
* @return Free buffer space [0 - max_msgs_queue/max_connections]
*/
unsigned int
-GMC_get_buffer (struct MeshConnection *c, int fwd);
+GMC_get_buffer (struct CadetConnection *c, int fwd);
/**
* Get how many messages have we allowed to send to us from a direction.
@@ -354,7 +354,7 @@
* @return last_ack_sent - last_pid_recv
*/
unsigned int
-GMC_get_allowed (struct MeshConnection *c, int fwd);
+GMC_get_allowed (struct CadetConnection *c, int fwd);
/**
* Get messages queued in a connection.
@@ -365,7 +365,7 @@
* @return Number of messages queued.
*/
unsigned int
-GMC_get_qn (struct MeshConnection *c, int fwd);
+GMC_get_qn (struct CadetConnection *c, int fwd);
/**
* Get next PID to use.
@@ -376,7 +376,7 @@
* @return Last PID used + 1.
*/
unsigned int
-GMC_get_pid (struct MeshConnection *c, int fwd);
+GMC_get_pid (struct CadetConnection *c, int fwd);
/**
* Allow the connection to advertise a buffer of the given size.
@@ -389,7 +389,7 @@
* @param fwd Is this about FWD traffic? (The ack will go dest->root).
*/
void
-GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd);
+GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd);
/**
* Send FWD keepalive packets for a connection.
@@ -418,8 +418,8 @@
* @param peer Peer that disconnected.
*/
void
-GMC_notify_broken (struct MeshConnection *c,
- struct MeshPeer *peer);
+GMC_notify_broken (struct CadetConnection *c,
+ struct CadetPeer *peer);
/**
* Is this peer the first one on the connection?
@@ -430,7 +430,7 @@
* @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal.
*/
int
-GMC_is_origin (struct MeshConnection *c, int fwd);
+GMC_is_origin (struct CadetConnection *c, int fwd);
/**
* Is this peer the last one on the connection?
@@ -442,7 +442,7 @@
* @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin.
*/
int
-GMC_is_terminal (struct MeshConnection *c, int fwd);
+GMC_is_terminal (struct CadetConnection *c, int fwd);
/**
* See if we are allowed to send by the next hop in the given direction.
@@ -453,7 +453,7 @@
* @return #GNUNET_YES in case it's OK to send.
*/
int
-GMC_is_sendable (struct MeshConnection *c, int fwd);
+GMC_is_sendable (struct CadetConnection *c, int fwd);
/**
* Check if this connection is a direct one (never trim a direct connection).
@@ -463,7 +463,7 @@
* @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise.
*/
int
-GMC_is_direct (struct MeshConnection *c);
+GMC_is_direct (struct CadetConnection *c);
/**
* Cancel a previously sent message while it's in the queue.
@@ -475,7 +475,7 @@
* @param q Handle to the queue.
*/
void
-GMC_cancel (struct MeshConnectionQueue *q);
+GMC_cancel (struct CadetConnectionQueue *q);
/**
* Sends an already built message on a connection, properly registering
@@ -494,10 +494,10 @@
* NULL on error or if @c cont is NULL.
* Invalid on @c cont call.
*/
-struct MeshConnectionQueue *
+struct CadetConnectionQueue *
GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
uint16_t payload_type, uint32_t payload_id,
- struct MeshConnection *c, int fwd, int force,
+ struct CadetConnection *c, int fwd, int force,
GMC_sent cont, void *cont_cls);
/**
@@ -507,7 +507,7 @@
* @param connection Connection to create.
*/
void
-GMC_send_create (struct MeshConnection *connection);
+GMC_send_create (struct CadetConnection *connection);
/**
* Send a message to all peers in this connection that the connection
@@ -519,7 +519,7 @@
* @param c The connection whose peers to notify.
*/
void
-GMC_send_destroy (struct MeshConnection *c);
+GMC_send_destroy (struct CadetConnection *c);
/**
* @brief Start a polling timer for the connection.
@@ -532,7 +532,7 @@
* @param fwd Should we poll in the FWD direction?
*/
void
-GMC_start_poll (struct MeshConnection *c, int fwd);
+GMC_start_poll (struct CadetConnection *c, int fwd);
/**
@@ -544,7 +544,7 @@
* @param fwd Should we stop the poll in the FWD direction?
*/
void
-GMC_stop_poll (struct MeshConnection *c, int fwd);
+GMC_stop_poll (struct CadetConnection *c, int fwd);
/**
* Get a (static) string for a connection.
@@ -552,7 +552,7 @@
* @param c Connection.
*/
const char *
-GMC_2s (const struct MeshConnection *c);
+GMC_2s (const struct CadetConnection *c);
#if 0 /* keep Emacsens' auto-indent happy */
{
@@ -561,6 +561,6 @@
}
#endif
-/* ifndef GNUNET_SERVICE_MESH_CONNECTION_H */
+/* ifndef GNUNET_SERVICE_CADET_CONNECTION_H */
#endif
-/* end of gnunet-service-mesh_connection.h */
+/* end of gnunet-service-cadet_connection.h */
Modified: gnunet/src/mesh/gnunet-service-mesh_dht.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_dht.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_dht.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -25,12 +25,12 @@
#include "gnunet_dht_service.h"
#include "gnunet_statistics_service.h"
-#include "mesh_path.h"
-#include "gnunet-service-mesh_dht.h"
-#include "gnunet-service-mesh_peer.h"
-#include "gnunet-service-mesh_hello.h"
+#include "cadet_path.h"
+#include "gnunet-service-cadet_dht.h"
+#include "gnunet-service-cadet_peer.h"
+#include "gnunet-service-cadet_hello.h"
-#define LOG(level, ...) GNUNET_log_from (level,"mesh-dht",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from (level,"cadet-dht",__VA_ARGS__)
/******************************************************************************/
@@ -113,13 +113,13 @@
*
* FIXME refactor and use build_path_from_peer_ids
*/
-static struct MeshPeerPath *
+static struct CadetPeerPath *
path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length)
{
- struct MeshPeerPath *p;
+ struct CadetPeerPath *p;
GNUNET_PEER_Id id;
int i;
@@ -172,7 +172,7 @@
p->peers[p->length - 1] = id;
}
}
-#if MESH_DEBUG
+#if CADET_DEBUG
if (get_path_length > 0)
LOG (GNUNET_ERROR_TYPE_DEBUG, " (first of GET: %s)\n",
GNUNET_i2s (&get_path[0]));
@@ -221,8 +221,8 @@
{
struct GMD_search_handle *h = cls;
struct GNUNET_HELLO_Message *hello;
- struct MeshPeerPath *p;
- struct MeshPeer *peer;
+ struct CadetPeerPath *p;
+ struct CadetPeer *peer;
char *s;
p = path_build_from_dht (get_path, get_path_length,
@@ -334,20 +334,20 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "MESH",
"DHT_REPLICATION_LEVEL",
+ GNUNET_CONFIGURATION_get_value_number (c, "CADET",
"DHT_REPLICATION_LEVEL",
&dht_replication_level))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
- "MESH", "DHT_REPLICATION_LEVEL", "USING
DEFAULT");
+ "CADET", "DHT_REPLICATION_LEVEL", "USING
DEFAULT");
dht_replication_level = 3;
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME",
+ GNUNET_CONFIGURATION_get_value_time (c, "CADET", "ID_ANNOUNCE_TIME",
&id_announce_time))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "MESH", "ID_ANNOUNCE_TIME", "MISSING");
+ "CADET", "ID_ANNOUNCE_TIME", "MISSING");
GNUNET_SCHEDULER_shutdown ();
return;
}
Modified: gnunet/src/mesh/gnunet-service-mesh_dht.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_dht.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_dht.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_dht.h
- * @brief mesh service; dealing with DHT requests and results
+ * @file cadet/gnunet-service-cadet_dht.h
+ * @brief cadet service; dealing with DHT requests and results
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GMD (Gnunet Mesh Dht)
+ * All functions in this file should use the prefix GMD (Gnunet Cadet Dht)
*/
-#ifndef GNUNET_SERVICE_MESH_DHT_H
-#define GNUNET_SERVICE_MESH_DHT_H
+#ifndef GNUNET_SERVICE_CADET_DHT_H
+#define GNUNET_SERVICE_CADET_DHT_H
#ifdef __cplusplus
extern "C"
@@ -51,7 +51,7 @@
* After callback will no longer be valid!
*/
typedef void (*GMD_search_callback) (void *cls,
- const struct MeshPeerPath *path);
+ const struct CadetPeerPath *path);
/******************************************************************************/
/******************************** API
***********************************/
@@ -87,6 +87,6 @@
}
#endif
-/* ifndef GNUNET_MESH_SERVICE_LOCAL_H */
+/* ifndef GNUNET_CADET_SERVICE_LOCAL_H */
#endif
-/* end of gnunet-mesh-service_LOCAL.h */
\ No newline at end of file
+/* end of gnunet-cadet-service_LOCAL.h */
\ No newline at end of file
Modified: gnunet/src/mesh/gnunet-service-mesh_hello.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_hello.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_hello.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -24,13 +24,13 @@
#include "gnunet_statistics_service.h"
#include "gnunet_peerinfo_service.h"
-#include "mesh_protocol.h"
-#include "mesh_path.h"
+#include "cadet_protocol.h"
+#include "cadet_path.h"
-#include "gnunet-service-mesh_hello.h"
-#include "gnunet-service-mesh_peer.h"
+#include "gnunet-service-cadet_hello.h"
+#include "gnunet-service-cadet_peer.h"
-#define LOG(level, ...) GNUNET_log_from(level,"mesh-hll",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from(level,"cadet-hll",__VA_ARGS__)
/******************************************************************************/
@@ -98,7 +98,7 @@
const struct GNUNET_HELLO_Message *hello,
const char *err_msg)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
if (NULL == id || NULL == hello)
{
Modified: gnunet/src/mesh/gnunet-service-mesh_hello.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_hello.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_hello.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_hello.h
- * @brief mesh service; dealing with hello messages
+ * @file cadet/gnunet-service-cadet_hello.h
+ * @brief cadet service; dealing with hello messages
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GMH (Gnunet Mesh Hello)
+ * All functions in this file should use the prefix GMH (Gnunet Cadet Hello)
*/
-#ifndef GNUNET_SERVICE_MESH_HELLO_H
-#define GNUNET_SERVICE_MESH_HELLO_H
+#ifndef GNUNET_SERVICE_CADET_HELLO_H
+#define GNUNET_SERVICE_CADET_HELLO_H
#ifdef __cplusplus
extern "C"
@@ -71,6 +71,6 @@
}
#endif
-/* ifndef GNUNET_MESH_SERVICE_HELLO_H */
+/* ifndef GNUNET_CADET_SERVICE_HELLO_H */
#endif
-/* end of gnunet-mesh-service_hello.h */
+/* end of gnunet-cadet-service_hello.h */
Modified: gnunet/src/mesh/gnunet-service-mesh_local.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_local.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -24,17 +24,17 @@
#include "gnunet_statistics_service.h"
-#include "mesh.h"
-#include "mesh_protocol.h" /* GNUNET_MESH_Data is shared */
+#include "cadet.h"
+#include "cadet_protocol.h" /* GNUNET_CADET_Data is shared */
-#include "gnunet-service-mesh_local.h"
-#include "gnunet-service-mesh_channel.h"
+#include "gnunet-service-cadet_local.h"
+#include "gnunet-service-cadet_channel.h"
/* INFO DEBUG */
-#include "gnunet-service-mesh_tunnel.h"
-#include "gnunet-service-mesh_peer.h"
+#include "gnunet-service-cadet_tunnel.h"
+#include "gnunet-service-cadet_peer.h"
-#define LOG(level, ...) GNUNET_log_from(level,"mesh-loc",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from(level,"cadet-loc",__VA_ARGS__)
/******************************************************************************/
/******************************** STRUCTS
**********************************/
@@ -45,17 +45,17 @@
*
* TODO: add a list of 'waiting' ports
*/
-struct MeshClient
+struct CadetClient
{
/**
* Linked list next
*/
- struct MeshClient *next;
+ struct CadetClient *next;
/**
* Linked list prev
*/
- struct MeshClient *prev;
+ struct CadetClient *prev;
/**
* Tunnels that belong to this client, indexed by local id
@@ -70,7 +70,7 @@
/**
* Channel ID for the next incoming channel.
*/
- MESH_ChannelNumber next_chid;
+ CADET_ChannelNumber next_chid;
/**
* Handle to communicate with the client
@@ -112,12 +112,12 @@
/**
* DLL with all the clients, head.
*/
-static struct MeshClient *clients_head;
+static struct CadetClient *clients_head;
/**
* DLL with all the clients, tail.
*/
-static struct MeshClient *clients_tail;
+static struct CadetClient *clients_tail;
/**
* Next ID to assign to a client.
@@ -182,15 +182,15 @@
static void
handle_client_connect (void *cls, struct GNUNET_SERVER_Client *client)
{
- struct MeshClient *c;
+ struct CadetClient *c;
LOG (GNUNET_ERROR_TYPE_DEBUG, "client connected: %p\n", client);
if (NULL == client)
return;
- c = GNUNET_new (struct MeshClient);
+ c = GNUNET_new (struct CadetClient);
c->handle = client;
c->id = next_client_id++; /* overflow not important: just for debug */
- c->next_chid = GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
+ c->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
GNUNET_SERVER_client_keep (client);
GNUNET_SERVER_client_set_user_context (client, c);
GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, c);
@@ -211,14 +211,14 @@
uint32_t key,
void *value)
{
- struct MeshChannel *ch = value;
- struct MeshClient *c = cls;
+ struct CadetChannel *ch = value;
+ struct CadetClient *c = cls;
LOG (GNUNET_ERROR_TYPE_DEBUG,
" Channel %s destroy, due to client %s shutdown.\n",
GMCH_2s (ch), GML_2s (c));
- GMCH_handle_local_destroy (ch, c, key < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV);
+ GMCH_handle_local_destroy (ch, c, key < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV);
return GNUNET_OK;
}
@@ -232,7 +232,7 @@
static void
handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
{
- struct MeshClient *c;
+ struct CadetClient *c;
LOG (GNUNET_ERROR_TYPE_DEBUG, "client disconnected: %p\n", client);
if (client == NULL)
@@ -293,8 +293,8 @@
handle_new_client (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_ClientConnect *cc_msg;
- struct MeshClient *c;
+ struct GNUNET_CADET_ClientConnect *cc_msg;
+ struct CadetClient *c;
unsigned int size;
uint32_t *p;
unsigned int i;
@@ -303,8 +303,8 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "new client connected %p\n", client);
/* Check data sanity */
- size = ntohs (message->size) - sizeof (struct GNUNET_MESH_ClientConnect);
- cc_msg = (struct GNUNET_MESH_ClientConnect *) message;
+ size = ntohs (message->size) - sizeof (struct GNUNET_CADET_ClientConnect);
+ cc_msg = (struct GNUNET_CADET_ClientConnect *) message;
if (0 != (size % sizeof (uint32_t)))
{
GNUNET_break (0);
@@ -314,7 +314,7 @@
size /= sizeof (uint32_t);
/* Initialize new client structure */
- c = GNUNET_SERVER_client_get_user_context (client, struct MeshClient);
+ c = GNUNET_SERVER_client_get_user_context (client, struct CadetClient);
LOG (GNUNET_ERROR_TYPE_DEBUG, " client id %u\n", c->id);
LOG (GNUNET_ERROR_TYPE_DEBUG, " client has %u ports\n", size);
if (size > 0)
@@ -360,7 +360,7 @@
handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct MeshClient *c;
+ struct CadetClient *c;
LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, "new channel requested\n");
@@ -375,7 +375,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
/* Message size sanity check */
- if (sizeof (struct GNUNET_MESH_ChannelMessage) != ntohs (message->size))
+ if (sizeof (struct GNUNET_CADET_ChannelMessage) != ntohs (message->size))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -384,7 +384,7 @@
if (GNUNET_OK !=
GMCH_handle_local_create (c,
- (struct GNUNET_MESH_ChannelMessage *) message))
+ (struct GNUNET_CADET_ChannelMessage *)
message))
{
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
@@ -406,10 +406,10 @@
handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_ChannelMessage *msg;
- struct MeshClient *c;
- struct MeshChannel *ch;
- MESH_ChannelNumber chid;
+ struct GNUNET_CADET_ChannelMessage *msg;
+ struct CadetClient *c;
+ struct CadetChannel *ch;
+ CADET_ChannelNumber chid;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a DESTROY CHANNEL from client!\n");
@@ -423,14 +423,14 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
/* Message sanity check */
- if (sizeof (struct GNUNET_MESH_ChannelMessage) != ntohs (message->size))
+ if (sizeof (struct GNUNET_CADET_ChannelMessage) != ntohs (message->size))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- msg = (struct GNUNET_MESH_ChannelMessage *) message;
+ msg = (struct GNUNET_CADET_ChannelMessage *) message;
/* Retrieve tunnel */
chid = ntohl (msg->channel_id);
@@ -446,7 +446,7 @@
return;
}
- GMCH_handle_local_destroy (ch, c, chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV);
+ GMCH_handle_local_destroy (ch, c, chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
@@ -464,10 +464,10 @@
handle_data (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalData *msg;
- struct MeshClient *c;
- struct MeshChannel *ch;
- MESH_ChannelNumber chid;
+ struct GNUNET_CADET_LocalData *msg;
+ struct CadetClient *c;
+ struct CadetChannel *ch;
+ CADET_ChannelNumber chid;
size_t size;
int fwd;
@@ -482,10 +482,10 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
- msg = (struct GNUNET_MESH_LocalData *) message;
+ msg = (struct GNUNET_CADET_LocalData *) message;
/* Sanity check for message size */
- size = ntohs (message->size) - sizeof (struct GNUNET_MESH_LocalData);
+ size = ntohs (message->size) - sizeof (struct GNUNET_CADET_LocalData);
if (size < sizeof (struct GNUNET_MessageHeader))
{
GNUNET_break (0);
@@ -496,7 +496,7 @@
/* Channel exists? */
chid = ntohl (msg->id);
LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid);
- fwd = chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
+ fwd = chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
ch = GML_channel_get (c, chid);
if (NULL == ch)
{
@@ -533,10 +533,10 @@
handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalAck *msg;
- struct MeshChannel *ch;
- struct MeshClient *c;
- MESH_ChannelNumber chid;
+ struct GNUNET_CADET_LocalAck *msg;
+ struct CadetChannel *ch;
+ struct CadetClient *c;
+ CADET_ChannelNumber chid;
int fwd;
LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
@@ -551,7 +551,7 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
- msg = (struct GNUNET_MESH_LocalAck *) message;
+ msg = (struct GNUNET_CADET_LocalAck *) message;
/* Channel exists? */
chid = ntohl (msg->channel_id);
@@ -571,7 +571,7 @@
/* If client is root, the ACK is going FWD, therefore this is "BCK ACK". */
/* If client is dest, the ACK is going BCK, therefore this is "FWD ACK" */
- fwd = chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
+ fwd = chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
GMCH_handle_local_ack (ch, fwd);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -596,11 +596,11 @@
void *value)
{
struct GNUNET_SERVER_Client *client = cls;
- struct MeshPeer *p = value;
- struct GNUNET_MESH_LocalInfoPeer msg;
+ struct CadetPeer *p = value;
+ struct GNUNET_CADET_LocalInfoPeer msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
msg.destination = *peer;
msg.paths = htons (GMP_count_paths (p));
msg.tunnel = htons (NULL != GMP_get_tunnel (p));
@@ -625,7 +625,7 @@
handle_get_peers (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct MeshClient *c;
+ struct CadetClient *c;
struct GNUNET_MessageHeader reply;
/* Sanity check for client registration */
@@ -642,7 +642,7 @@
GMP_iterate_all (get_all_peers_iterator, client);
reply.size = htons (sizeof (reply));
- reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS);
+ reply.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -666,11 +666,11 @@
void *value)
{
struct GNUNET_SERVER_Client *client = cls;
- struct MeshTunnel3 *t = value;
- struct GNUNET_MESH_LocalInfoTunnel msg;
+ struct CadetTunnel3 *t = value;
+ struct GNUNET_CADET_LocalInfoTunnel msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
msg.destination = *peer;
msg.channels = htonl (GMT_count_channels (t));
msg.connections = htonl (GMT_count_connections (t));
@@ -697,7 +697,7 @@
handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct MeshClient *c;
+ struct CadetClient *c;
struct GNUNET_MessageHeader reply;
/* Sanity check for client registration */
@@ -714,7 +714,7 @@
GMT_iterate_all (get_all_tunnels_iterator, client);
reply.size = htons (sizeof (reply));
- reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
+ reply.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -724,21 +724,21 @@
static void
-iter_connection (void *cls, struct MeshConnection *c)
+iter_connection (void *cls, struct CadetConnection *c)
{
- struct GNUNET_MESH_LocalInfoTunnel *msg = cls;
- struct GNUNET_MESH_Hash *h = (struct GNUNET_MESH_Hash *) &msg[1];
+ struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
+ struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1];
h[msg->connections] = *(GMC_get_id (c));
msg->connections++;
}
static void
-iter_channel (void *cls, struct MeshChannel *ch)
+iter_channel (void *cls, struct CadetChannel *ch)
{
- struct GNUNET_MESH_LocalInfoTunnel *msg = cls;
+ struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1];
- MESH_ChannelNumber *chn = (MESH_ChannelNumber *) &h[msg->connections];
+ CADET_ChannelNumber *chn = (CADET_ChannelNumber *) &h[msg->connections];
chn[msg->channels] = GMCH_get_id (ch);
msg->channels++;
@@ -756,10 +756,10 @@
handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- const struct GNUNET_MESH_LocalInfo *msg;
- struct GNUNET_MESH_LocalInfoTunnel *resp;
- struct MeshClient *c;
- struct MeshTunnel3 *t;
+ const struct GNUNET_CADET_LocalInfo *msg;
+ struct GNUNET_CADET_LocalInfoTunnel *resp;
+ struct CadetClient *c;
+ struct CadetTunnel3 *t;
unsigned int ch_n;
unsigned int c_n;
size_t size;
@@ -772,7 +772,7 @@
return;
}
- msg = (struct GNUNET_MESH_LocalInfo *) message;
+ msg = (struct GNUNET_CADET_LocalInfo *) message;
LOG (GNUNET_ERROR_TYPE_INFO,
"Received tunnel info request from client %u for tunnel %s\n",
c->id, GNUNET_i2s_full(&msg->peer));
@@ -781,11 +781,11 @@
if (NULL == t)
{
/* We don't know the tunnel */
- struct GNUNET_MESH_LocalInfoTunnel warn;
+ struct GNUNET_CADET_LocalInfoTunnel warn;
LOG (GNUNET_ERROR_TYPE_INFO, "Tunnel %s unknown %u\n",
GNUNET_i2s_full(&msg->peer), sizeof (warn));
- warn.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL);
+ warn.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
warn.header.size = htons (sizeof (warn));
warn.destination = msg->peer;
warn.channels = htonl (0);
@@ -804,12 +804,12 @@
ch_n = GMT_count_channels (t);
c_n = GMT_count_connections (t);
- size = sizeof (struct GNUNET_MESH_LocalInfoTunnel);
- size += c_n * sizeof (struct GNUNET_MESH_Hash);
- size += ch_n * sizeof (MESH_ChannelNumber);
+ size = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
+ size += c_n * sizeof (struct GNUNET_CADET_Hash);
+ size += ch_n * sizeof (CADET_ChannelNumber);
resp = GNUNET_malloc (size);
- resp->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL);
+ resp->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
resp->header.size = htons (size);
GMT_iterate_connections (t, &iter_connection, resp);
GMT_iterate_channels (t, &iter_channel, resp);
@@ -834,20 +834,20 @@
* Functions to handle messages from clients
*/
static struct GNUNET_SERVER_MessageHandler client_handlers[] = {
- {&handle_new_client, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0},
- {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE,
- sizeof (struct GNUNET_MESH_ChannelMessage)},
- {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY,
- sizeof (struct GNUNET_MESH_ChannelMessage)},
- {&handle_data, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0},
- {&handle_ack, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK,
- sizeof (struct GNUNET_MESH_LocalAck)},
- {&handle_get_peers, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS,
+ {&handle_new_client, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT, 0},
+ {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE,
+ sizeof (struct GNUNET_CADET_ChannelMessage)},
+ {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY,
+ sizeof (struct GNUNET_CADET_ChannelMessage)},
+ {&handle_data, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, 0},
+ {&handle_ack, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK,
+ sizeof (struct GNUNET_CADET_LocalAck)},
+ {&handle_get_peers, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS,
sizeof (struct GNUNET_MessageHeader)},
- {&handle_get_tunnels, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS,
+ {&handle_get_tunnels, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS,
sizeof (struct GNUNET_MessageHeader)},
- {&handle_show_tunnel, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL,
- sizeof (struct GNUNET_MESH_LocalInfo)},
+ {&handle_show_tunnel, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL,
+ sizeof (struct GNUNET_CADET_LocalInfo)},
{NULL, NULL, 0, 0}
};
@@ -913,21 +913,21 @@
*
* @return non-NULL if channel exists in the clients lists
*/
-struct MeshChannel *
-GML_channel_get (struct MeshClient *c, MESH_ChannelNumber chid)
+struct CadetChannel *
+GML_channel_get (struct CadetClient *c, CADET_ChannelNumber chid)
{
struct GNUNET_CONTAINER_MultiHashMap32 *map;
- if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI))
+ if (0 == (chid & GNUNET_CADET_LOCAL_CHANNEL_ID_CLI))
{
GNUNET_break_op (0);
LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
return NULL;
}
- if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
map = c->incoming_channels;
- else if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI)
+ else if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
map = c->own_channels;
else
{
@@ -954,14 +954,14 @@
* @param ch Channel.
*/
void
-GML_channel_add (struct MeshClient *client,
+GML_channel_add (struct CadetClient *client,
uint32_t chid,
- struct MeshChannel *ch)
+ struct CadetChannel *ch)
{
- if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
GNUNET_CONTAINER_multihashmap32_put (client->incoming_channels, chid, ch,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
- else if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI)
+ else if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
GNUNET_CONTAINER_multihashmap32_put (client->own_channels, chid, ch,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
else
@@ -977,15 +977,15 @@
* @param ch Channel.
*/
void
-GML_channel_remove (struct MeshClient *client,
+GML_channel_remove (struct CadetClient *client,
uint32_t chid,
- struct MeshChannel *ch)
+ struct CadetChannel *ch)
{
- if (GNUNET_MESH_LOCAL_CHANNEL_ID_SERV <= chid)
+ if (GNUNET_CADET_LOCAL_CHANNEL_ID_SERV <= chid)
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap32_remove
(client->incoming_channels,
chid, ch));
- else if (GNUNET_MESH_LOCAL_CHANNEL_ID_CLI <= chid)
+ else if (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI <= chid)
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap32_remove (client->own_channels,
chid, ch));
@@ -1001,18 +1001,18 @@
*
* @return LID of a channel free to use.
*/
-MESH_ChannelNumber
-GML_get_next_chid (struct MeshClient *c)
+CADET_ChannelNumber
+GML_get_next_chid (struct CadetClient *c)
{
- MESH_ChannelNumber chid;
+ CADET_ChannelNumber chid;
while (NULL != GML_channel_get (c, c->next_chid))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", c->next_chid);
- c->next_chid = (c->next_chid + 1) | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
+ c->next_chid = (c->next_chid + 1) | GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
}
chid = c->next_chid;
- c->next_chid = (c->next_chid + 1) | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
+ c->next_chid = (c->next_chid + 1) | GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
return chid;
}
@@ -1025,10 +1025,10 @@
*
* @return non-NULL if client exists in the global DLL
*/
-struct MeshClient *
+struct CadetClient *
GML_client_get (struct GNUNET_SERVER_Client *client)
{
- return GNUNET_SERVER_client_get_user_context (client, struct MeshClient);
+ return GNUNET_SERVER_client_get_user_context (client, struct CadetClient);
}
/**
@@ -1038,7 +1038,7 @@
*
* @return non-NULL if a client has the port.
*/
-struct MeshClient *
+struct CadetClient *
GML_client_get_by_port (uint32_t port)
{
return GNUNET_CONTAINER_multihashmap32_get (ports, port);
@@ -1053,20 +1053,20 @@
* @param id Channel ID.
*/
void
-GML_client_delete_channel (struct MeshClient *c,
- struct MeshChannel *ch,
- MESH_ChannelNumber id)
+GML_client_delete_channel (struct CadetClient *c,
+ struct CadetChannel *ch,
+ CADET_ChannelNumber id)
{
int res;
- if (GNUNET_MESH_LOCAL_CHANNEL_ID_SERV <= id)
+ if (GNUNET_CADET_LOCAL_CHANNEL_ID_SERV <= id)
{
res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels,
id, ch);
if (GNUNET_YES != res)
LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel dest KO\n");
}
- else if (GNUNET_MESH_LOCAL_CHANNEL_ID_CLI <= id)
+ else if (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI <= id)
{
res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels,
id, ch);
@@ -1088,16 +1088,16 @@
* @param id Channel ID to use
*/
void
-GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id)
+GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id)
{
- struct GNUNET_MESH_LocalAck msg;
+ struct GNUNET_CADET_LocalAck msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"send local %s ack on %X towards %p\n",
- id < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV ? "FWD" : "BCK", id, c);
+ id < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV ? "FWD" : "BCK", id, c);
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK);
msg.channel_id = htonl (id);
GNUNET_SERVER_notification_context_unicast (nc,
c->handle,
@@ -1118,14 +1118,14 @@
* @param peer Origin peer.
*/
void
-GML_send_channel_create (struct MeshClient *c,
+GML_send_channel_create (struct CadetClient *c,
uint32_t id, uint32_t port, uint32_t opt,
const struct GNUNET_PeerIdentity *peer)
{
- struct GNUNET_MESH_ChannelMessage msg;
+ struct GNUNET_CADET_ChannelMessage msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE);
msg.channel_id = htonl (id);
msg.port = htonl (port);
msg.opt = htonl (opt);
@@ -1142,16 +1142,16 @@
* @param id Channel ID to use
*/
void
-GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id)
+GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id)
{
- struct GNUNET_MESH_LocalAck msg;
+ struct GNUNET_CADET_LocalAck msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"send local nack on %X towards %p\n",
id, c);
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK);
msg.channel_id = htonl (id);
GNUNET_SERVER_notification_context_unicast (nc,
c->handle,
@@ -1167,9 +1167,9 @@
* @param id ID of the channel that is destroyed.
*/
void
-GML_send_channel_destroy (struct MeshClient *c, uint32_t id)
+GML_send_channel_destroy (struct CadetClient *c, uint32_t id)
{
- struct GNUNET_MESH_ChannelMessage msg;
+ struct GNUNET_CADET_ChannelMessage msg;
if (NULL == c)
{
@@ -1179,7 +1179,7 @@
if (GNUNET_YES == c->shutting_down)
return;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
msg.channel_id = htonl (id);
msg.port = htonl (0);
memset (&msg.peer, 0, sizeof (msg.peer));
@@ -1190,20 +1190,20 @@
/**
- * Modify the mesh message ID from global to local and send to client.
+ * Modify the cadet message ID from global to local and send to client.
*
* @param c Client to send to.
* @param msg Message to modify and send.
* @param id Channel ID to use (c can be both owner and client).
*/
void
-GML_send_data (struct MeshClient *c,
- const struct GNUNET_MESH_Data *msg,
- MESH_ChannelNumber id)
+GML_send_data (struct CadetClient *c,
+ const struct GNUNET_CADET_Data *msg,
+ CADET_ChannelNumber id)
{
- struct GNUNET_MESH_LocalData *copy;
- uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_MESH_Data);
- char cbuf[size + sizeof (struct GNUNET_MESH_LocalData)];
+ struct GNUNET_CADET_LocalData *copy;
+ uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_Data);
+ char cbuf[size + sizeof (struct GNUNET_CADET_LocalData)];
if (size < sizeof (struct GNUNET_MessageHeader))
{
@@ -1215,10 +1215,10 @@
GNUNET_break (0);
return;
}
- copy = (struct GNUNET_MESH_LocalData *) cbuf;
+ copy = (struct GNUNET_CADET_LocalData *) cbuf;
memcpy (©[1], &msg[1], size);
- copy->header.size = htons (sizeof (struct GNUNET_MESH_LocalData) + size);
- copy->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA);
+ copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size);
+ copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
copy->id = htonl (id);
GNUNET_SERVER_notification_context_unicast (nc, c->handle,
©->header, GNUNET_NO);
@@ -1233,7 +1233,7 @@
* @return Static string for the client.
*/
const char *
-GML_2s (const struct MeshClient *c)
+GML_2s (const struct CadetClient *c)
{
static char buf[32];
Modified: gnunet/src/mesh/gnunet-service-mesh_local.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_local.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_local.h
- * @brief mesh service; dealing with local clients
+ * @file cadet/gnunet-service-cadet_local.h
+ * @brief cadet service; dealing with local clients
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GML (Gnunet Mesh Local)
+ * All functions in this file should use the prefix GML (Gnunet Cadet Local)
*/
-#ifndef GNUNET_SERVICE_MESH_LOCAL_H
-#define GNUNET_SERVICE_MESH_LOCAL_H
+#ifndef GNUNET_SERVICE_CADET_LOCAL_H
+#define GNUNET_SERVICE_CADET_LOCAL_H
#ifdef __cplusplus
extern "C"
@@ -43,9 +43,9 @@
/**
* Struct containing information about a client of the service
*/
-struct MeshClient;
+struct CadetClient;
-#include "gnunet-service-mesh_channel.h"
+#include "gnunet-service-cadet_channel.h"
/******************************************************************************/
/******************************** API
***********************************/
@@ -79,8 +79,8 @@
*
* @return non-NULL if channel exists in the clients lists
*/
-struct MeshChannel *
-GML_channel_get (struct MeshClient *c, uint32_t chid);
+struct CadetChannel *
+GML_channel_get (struct CadetClient *c, uint32_t chid);
/**
* Add a channel to a client
@@ -90,9 +90,9 @@
* @param ch Channel.
*/
void
-GML_channel_add (struct MeshClient *client,
+GML_channel_add (struct CadetClient *client,
uint32_t chid,
- struct MeshChannel *ch);
+ struct CadetChannel *ch);
/**
* Remove a channel from a client
@@ -102,9 +102,9 @@
* @param ch Channel.
*/
void
-GML_channel_remove (struct MeshClient *client,
+GML_channel_remove (struct CadetClient *client,
uint32_t chid,
- struct MeshChannel *ch);
+ struct CadetChannel *ch);
/**
* Get the tunnel's next free local channel ID.
@@ -113,8 +113,8 @@
*
* @return LID of a channel free to use.
*/
-MESH_ChannelNumber
-GML_get_next_chid (struct MeshClient *c);
+CADET_ChannelNumber
+GML_get_next_chid (struct CadetClient *c);
/**
* Check if client has registered with the service and has not disconnected
@@ -123,7 +123,7 @@
*
* @return non-NULL if client exists in the global DLL
*/
-struct MeshClient *
+struct CadetClient *
GML_client_get (struct GNUNET_SERVER_Client *client);
/**
@@ -133,7 +133,7 @@
*
* @return non-NULL if a client has the port.
*/
-struct MeshClient *
+struct CadetClient *
GML_client_get_by_port (uint32_t port);
/**
@@ -144,9 +144,9 @@
* @param id Channel ID.
*/
void
-GML_client_delete_channel (struct MeshClient *c,
- struct MeshChannel *ch,
- MESH_ChannelNumber id);
+GML_client_delete_channel (struct CadetClient *c,
+ struct CadetChannel *ch,
+ CADET_ChannelNumber id);
/**
* Build a local ACK message and send it to a local client, if needed.
@@ -157,7 +157,7 @@
* @param id Channel ID to use
*/
void
-GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id);
+GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id);
/**
* Notify the appropriate client that a new incoming channel was created.
@@ -169,7 +169,7 @@
* @param peer Origin peer.
*/
void
-GML_send_channel_create (struct MeshClient *c,
+GML_send_channel_create (struct CadetClient *c,
uint32_t id, uint32_t port, uint32_t opt,
const struct GNUNET_PeerIdentity *peer);
@@ -180,7 +180,7 @@
* @param id Channel ID to use
*/
void
-GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id);
+GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id);
/**
* Notify a client that a channel is no longer valid.
@@ -189,19 +189,19 @@
* @param id ID of the channel that is destroyed.
*/
void
-GML_send_channel_destroy (struct MeshClient *c, uint32_t id);
+GML_send_channel_destroy (struct CadetClient *c, uint32_t id);
/**
- * Modify the mesh message ID from global to local and send to client.
+ * Modify the cadet message ID from global to local and send to client.
*
* @param c Client to send to.
* @param msg Message to modify and send.
* @param id Channel ID to use (c can be both owner and client).
*/
void
-GML_send_data (struct MeshClient *c,
- const struct GNUNET_MESH_Data *msg,
- MESH_ChannelNumber id);
+GML_send_data (struct CadetClient *c,
+ const struct GNUNET_CADET_Data *msg,
+ CADET_ChannelNumber id);
/**
* Get the static string to represent a client.
@@ -211,7 +211,7 @@
* @return Static string for the client.
*/
const char *
-GML_2s (const struct MeshClient *c);
+GML_2s (const struct CadetClient *c);
#if 0 /* keep Emacsens' auto-indent happy */
@@ -221,6 +221,6 @@
}
#endif
-/* ifndef GNUNET_MESH_SERVICE_LOCAL_H */
+/* ifndef GNUNET_CADET_SERVICE_LOCAL_H */
#endif
-/* end of gnunet-mesh-service_LOCAL.h */
+/* end of gnunet-cadet-service_LOCAL.h */
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -26,15 +26,15 @@
#include "gnunet_core_service.h"
#include "gnunet_statistics_service.h"
-#include "mesh_protocol.h"
+#include "cadet_protocol.h"
-#include "gnunet-service-mesh_peer.h"
-#include "gnunet-service-mesh_dht.h"
-#include "gnunet-service-mesh_connection.h"
-#include "gnunet-service-mesh_tunnel.h"
-#include "mesh_path.h"
+#include "gnunet-service-cadet_peer.h"
+#include "gnunet-service-cadet_dht.h"
+#include "gnunet-service-cadet_connection.h"
+#include "gnunet-service-cadet_tunnel.h"
+#include "cadet_path.h"
-#define LOG(level, ...) GNUNET_log_from (level,"mesh-p2p",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from (level,"cadet-p2p",__VA_ARGS__)
/******************************************************************************/
/******************************** STRUCTS
**********************************/
@@ -43,27 +43,27 @@
/**
* Struct containing info about a queued transmission to this peer
*/
-struct MeshPeerQueue
+struct CadetPeerQueue
{
/**
* DLL next
*/
- struct MeshPeerQueue *next;
+ struct CadetPeerQueue *next;
/**
* DLL previous
*/
- struct MeshPeerQueue *prev;
+ struct CadetPeerQueue *prev;
/**
* Peer this transmission is directed to.
*/
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
/**
* Connection this message belongs to.
*/
- struct MeshConnection *c;
+ struct CadetConnection *c;
/**
* Is FWD in c?
@@ -114,7 +114,7 @@
/**
* Struct containing all information regarding a given peer
*/
-struct MeshPeer
+struct CadetPeer
{
/**
* ID of the peer
@@ -129,12 +129,12 @@
/**
* Paths to reach the peer, ordered by ascending hop count
*/
- struct MeshPeerPath *path_head;
+ struct CadetPeerPath *path_head;
/**
* Paths to reach the peer, ordered by ascending hop count
*/
- struct MeshPeerPath *path_tail;
+ struct CadetPeerPath *path_tail;
/**
* Handle to stop the DHT search for paths to this peer
@@ -144,7 +144,7 @@
/**
* Tunnel to this peer, if any.
*/
- struct MeshTunnel3 *tunnel;
+ struct CadetTunnel3 *tunnel;
/**
* Connections that go through this peer, indexed by tid;
@@ -159,12 +159,12 @@
/**
* Transmission queue to core DLL head
*/
- struct MeshPeerQueue *queue_head;
+ struct CadetPeerQueue *queue_head;
/**
* Transmission queue to core DLL tail
*/
- struct MeshPeerQueue *queue_tail;
+ struct CadetPeerQueue *queue_tail;
/**
* How many messages are in the queue to this peer.
@@ -198,7 +198,7 @@
extern GNUNET_PEER_Id myid;
/**
- * Peers known, indexed by PeerIdentity (MeshPeer).
+ * Peers known, indexed by PeerIdentity (CadetPeer).
*/
static struct GNUNET_CONTAINER_MultiPeerMap *peers;
@@ -228,9 +228,9 @@
/******************************************************************************/
static void
-queue_debug (struct MeshPeer *peer)
+queue_debug (struct CadetPeer *peer)
{
- struct MeshPeerQueue *q;
+ struct CadetPeerQueue *q;
LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GMP_2s
(peer));
LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ core tmt rdy: %p\n",
peer->core_transmit);
@@ -265,8 +265,8 @@
const struct GNUNET_HashCode *key,
void *value)
{
- struct MeshPeer *peer = cls;
- struct MeshConnection *c = value;
+ struct CadetPeer *peer = cls;
+ struct CadetConnection *c = value;
LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n",
GMC_2s (c), GMP_2s (peer));
@@ -282,10 +282,10 @@
* @param peer Peer to remove the direct path from.
*
*/
-static struct MeshPeerPath *
-pop_direct_path (struct MeshPeer *peer)
+static struct CadetPeerPath *
+pop_direct_path (struct CadetPeer *peer)
{
- struct MeshPeerPath *iter;
+ struct CadetPeerPath *iter;
for (iter = peer->path_head; NULL != iter; iter = iter->next)
{
@@ -312,8 +312,8 @@
static void
core_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
{
- struct MeshPeer *mp;
- struct MeshPeerPath *path;
+ struct CadetPeer *mp;
+ struct CadetPeerPath *path;
char own_id[16];
strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
@@ -357,8 +357,8 @@
static void
core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
{
- struct MeshPeer *p;
- struct MeshPeerPath *direct_path;
+ struct CadetPeer *p;
+ struct CadetPeerPath *direct_path;
char own_id[16];
strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
@@ -393,19 +393,19 @@
* Functions to handle messages from core
*/
static struct GNUNET_CORE_MessageHandler core_handlers[] = {
- {&GMC_handle_create, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0},
- {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
- sizeof (struct GNUNET_MESH_ConnectionACK)},
- {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN,
- sizeof (struct GNUNET_MESH_ConnectionBroken)},
- {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY,
- sizeof (struct GNUNET_MESH_ConnectionDestroy)},
- {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_MESH_ACK,
- sizeof (struct GNUNET_MESH_ACK)},
- {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_MESH_POLL,
- sizeof (struct GNUNET_MESH_Poll)},
- {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED, 0},
- {&GMC_handle_kx, GNUNET_MESSAGE_TYPE_MESH_KX, 0},
+ {&GMC_handle_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0},
+ {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK,
+ sizeof (struct GNUNET_CADET_ConnectionACK)},
+ {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
+ sizeof (struct GNUNET_CADET_ConnectionBroken)},
+ {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY,
+ sizeof (struct GNUNET_CADET_ConnectionDestroy)},
+ {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_CADET_ACK,
+ sizeof (struct GNUNET_CADET_ACK)},
+ {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_CADET_POLL,
+ sizeof (struct GNUNET_CADET_Poll)},
+ {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0},
+ {&GMC_handle_kx, GNUNET_MESSAGE_TYPE_CADET_KX, 0},
{NULL, 0, 0}
};
@@ -431,7 +431,7 @@
LOG (GNUNET_ERROR_TYPE_ERROR, " my id %s\n", GNUNET_i2s (&my_full_id));
GNUNET_CORE_disconnect (core_handle);
core_handle = GNUNET_CORE_connect (c, /* Main configuration */
- NULL, /* Closure passed to MESH
functions */
+ NULL, /* Closure passed to CADET
functions */
&core_init, /* Call core_init
once connected */
&core_connect, /* Handle connects */
&core_disconnect, /* remove peers on
disconnects */
@@ -451,7 +451,7 @@
/**
* Core callback to write a pre-constructed data packet to core buffer
*
- * @param cls Closure (MeshTransmissionDescriptor with data in "data" member).
+ * @param cls Closure (CadetTransmissionDescriptor with data in "data"
member).
* @param size Number of bytes available in buf.
* @param buf Where the to write the message.
*
@@ -486,11 +486,11 @@
* @return number of bytes written to buf
*/
static size_t
-send_core_connection_create (struct MeshConnection *c, size_t size, void *buf)
+send_core_connection_create (struct CadetConnection *c, size_t size, void *buf)
{
- struct GNUNET_MESH_ConnectionCreate *msg;
+ struct GNUNET_CADET_ConnectionCreate *msg;
struct GNUNET_PeerIdentity *peer_ptr;
- const struct MeshPeerPath *p = GMC_get_path (c);
+ const struct CadetPeerPath *p = GMC_get_path (c);
size_t size_needed;
int i;
@@ -499,7 +499,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION CREATE...\n");
size_needed =
- sizeof (struct GNUNET_MESH_ConnectionCreate) +
+ sizeof (struct GNUNET_CADET_ConnectionCreate) +
p->length * sizeof (struct GNUNET_PeerIdentity);
if (size < size_needed || NULL == buf)
@@ -507,9 +507,9 @@
GNUNET_break (0);
return 0;
}
- msg = (struct GNUNET_MESH_ConnectionCreate *) buf;
+ msg = (struct GNUNET_CADET_ConnectionCreate *) buf;
msg->header.size = htons (size_needed);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE);
msg->cid = *GMC_get_id (c);
peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1];
@@ -535,22 +535,22 @@
* @return number of bytes written to buf
*/
static size_t
-send_core_connection_ack (struct MeshConnection *c, size_t size, void *buf)
+send_core_connection_ack (struct CadetConnection *c, size_t size, void *buf)
{
- struct GNUNET_MESH_ConnectionACK *msg = buf;
+ struct GNUNET_CADET_ConnectionACK *msg = buf;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION ACK...\n");
- if (sizeof (struct GNUNET_MESH_ConnectionACK) > size)
+ if (sizeof (struct GNUNET_CADET_ConnectionACK) > size)
{
GNUNET_break (0);
return 0;
}
- msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionACK));
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK);
+ msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionACK));
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK);
msg->cid = *GMC_get_id (c);
LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n");
- return sizeof (struct GNUNET_MESH_ConnectionACK);
+ return sizeof (struct GNUNET_CADET_ConnectionACK);
}
@@ -567,7 +567,7 @@
* @return CORE priority to use.
*/
static enum GNUNET_CORE_Priority
-get_priority (struct MeshPeerQueue *q)
+get_priority (struct CadetPeerQueue *q)
{
enum GNUNET_CORE_Priority low;
enum GNUNET_CORE_Priority high;
@@ -591,7 +591,7 @@
}
/* Bulky payload has lower priority, control traffic has higher. */
- if (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED == q->type)
+ if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == q->type)
return low;
else
return high;
@@ -612,8 +612,8 @@
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct MeshPeer *p = value;
- struct MeshTunnel3 *t = p->tunnel;
+ struct CadetPeer *p = value;
+ struct CadetTunnel3 *t = p->tunnel;
if (NULL != t)
GMT_destroy (t);
@@ -629,11 +629,11 @@
* @return GNUNET_OK on success
*/
static int
-peer_destroy (struct MeshPeer *peer)
+peer_destroy (struct CadetPeer *peer)
{
struct GNUNET_PeerIdentity id;
- struct MeshPeerPath *p;
- struct MeshPeerPath *nextp;
+ struct CadetPeerPath *p;
+ struct CadetPeerPath *nextp;
GNUNET_PEER_resolve (peer->id, &id);
GNUNET_PEER_change_rc (peer->id, -1);
@@ -672,9 +672,9 @@
* @return #GNUNET_YES if peer is in use.
*/
static int
-peer_is_used (struct MeshPeer *peer)
+peer_is_used (struct CadetPeer *peer)
{
- struct MeshPeerPath *p;
+ struct CadetPeerPath *p;
if (NULL != peer->tunnel)
return GNUNET_YES;
@@ -700,7 +700,7 @@
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct MeshPeer *p = value;
+ struct CadetPeer *p = value;
struct GNUNET_TIME_Absolute *abs = cls;
/* Don't count active peers */
@@ -726,7 +726,7 @@
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct MeshPeer *p = value;
+ struct CadetPeer *p = value;
struct GNUNET_TIME_Absolute *abs = cls;
LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -769,11 +769,11 @@
*
* @return Best current known path towards the peer, if any.
*/
-static struct MeshPeerPath *
-peer_get_best_path (const struct MeshPeer *peer)
+static struct CadetPeerPath *
+peer_get_best_path (const struct CadetPeer *peer)
{
- struct MeshPeerPath *best_p;
- struct MeshPeerPath *p;
+ struct CadetPeerPath *best_p;
+ struct CadetPeerPath *p;
unsigned int best_cost;
unsigned int cost;
@@ -807,21 +807,21 @@
* @return #GNUNET_YES if it is sendable, #GNUNET_NO otherwise.
*/
static int
-queue_is_sendable (struct MeshPeerQueue *q)
+queue_is_sendable (struct CadetPeerQueue *q)
{
/* Is PID-independent? */
switch (q->type)
{
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
- case GNUNET_MESSAGE_TYPE_MESH_KX:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
return GNUNET_YES;
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
break;
default:
@@ -839,10 +839,10 @@
*
* @return First transmittable message, if any. Otherwise, NULL.
*/
-static struct MeshPeerQueue *
-peer_get_first_message (const struct MeshPeer *peer)
+static struct CadetPeerQueue *
+peer_get_first_message (const struct CadetPeer *peer)
{
- struct MeshPeerQueue *q;
+ struct CadetPeerQueue *q;
for (q = peer->queue_head; NULL != q; q = q->next)
{
@@ -864,9 +864,9 @@
* @param path
*/
static void
-search_handler (void *cls, const struct MeshPeerPath *path)
+search_handler (void *cls, const struct CadetPeerPath *path)
{
- struct MeshPeer *peer = cls;
+ struct CadetPeer *peer = cls;
unsigned int connection_count;
GMP_add_path_to_all (path, GNUNET_NO);
@@ -878,7 +878,7 @@
if (3 <= connection_count)
return;
- if (MESH_TUNNEL3_SEARCHING == GMT_get_cstate (peer->tunnel))
+ if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (peer->tunnel))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n");
GMP_connect (peer);
@@ -900,9 +900,9 @@
static size_t
queue_send (void *cls, size_t size, void *buf)
{
- struct MeshPeer *peer = cls;
- struct MeshConnection *c;
- struct MeshPeerQueue *queue;
+ struct CadetPeer *peer = cls;
+ struct CadetConnection *c;
+ struct CadetPeerQueue *queue;
const struct GNUNET_PeerIdentity *dst_id;
size_t data_size;
uint32_t pid;
@@ -950,28 +950,28 @@
/* Fill buf */
switch (queue->type)
{
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
pid = GMC_get_pid (queue->c, queue->fwd);
LOG (GNUNET_ERROR_TYPE_DEBUG, " payload ID %u\n", pid);
data_size = send_core_data_raw (queue->cls, size, buf);
- ((struct GNUNET_MESH_Encrypted *) buf)->pid = htonl (pid);
+ ((struct GNUNET_CADET_Encrypted *) buf)->pid = htonl (pid);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
- case GNUNET_MESSAGE_TYPE_MESH_KX:
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GM_m2s (queue->type));
data_size = send_core_data_raw (queue->cls, size, buf);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
LOG (GNUNET_ERROR_TYPE_DEBUG, " path create\n");
if (GMC_is_origin (c, GNUNET_YES))
data_size = send_core_connection_create (queue->c, size, buf);
else
data_size = send_core_data_raw (queue->cls, size, buf);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
LOG (GNUNET_ERROR_TYPE_DEBUG, " path ack\n");
if (GMC_is_origin (c, GNUNET_NO) ||
GMC_is_origin (c, GNUNET_YES))
@@ -979,9 +979,9 @@
else
data_size = send_core_data_raw (queue->cls, size, buf);
break;
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
/* This should be encapsulted */
GNUNET_break (0);
data_size = 0;
@@ -1060,10 +1060,10 @@
* @param pid PID, if relevant (was sent and was a payload message).
*/
void
-GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls,
+GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls,
int sent, uint32_t pid)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
peer = queue->peer;
@@ -1073,17 +1073,17 @@
GM_m2s (queue->type));
switch (queue->type)
{
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
/* fall through */
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
- case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
- case GNUNET_MESSAGE_TYPE_MESH_KX:
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
+ case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
GNUNET_free_non_null (queue->cls);
break;
@@ -1095,8 +1095,8 @@
}
GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue);
- if (queue->type != GNUNET_MESSAGE_TYPE_MESH_ACK &&
- queue->type != GNUNET_MESSAGE_TYPE_MESH_POLL)
+ if (queue->type != GNUNET_MESSAGE_TYPE_CADET_ACK &&
+ queue->type != GNUNET_MESSAGE_TYPE_CADET_POLL)
{
peer->queue_n--;
}
@@ -1136,13 +1136,13 @@
* @return Handle to cancel the message before it is sent. Once cont is called
* message has been sent and therefore the handle is no longer valid.
*/
-struct MeshPeerQueue *
-GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
+struct CadetPeerQueue *
+GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type,
uint16_t payload_type, uint32_t payload_id, size_t size,
- struct MeshConnection *c, int fwd,
+ struct CadetConnection *c, int fwd,
GMP_sent cont, void *cont_cls)
{
- struct MeshPeerQueue *queue;
+ struct CadetPeerQueue *queue;
int priority;
int call_core;
@@ -1162,8 +1162,8 @@
priority = 0;
- if (GNUNET_MESSAGE_TYPE_MESH_POLL == type ||
- GNUNET_MESSAGE_TYPE_MESH_ACK == type)
+ if (GNUNET_MESSAGE_TYPE_CADET_POLL == type ||
+ GNUNET_MESSAGE_TYPE_CADET_ACK == type)
{
priority = 100;
}
@@ -1171,7 +1171,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority);
call_core = NULL == c ? GNUNET_YES : GMC_is_sendable (c, fwd);
- queue = GNUNET_new (struct MeshPeerQueue);
+ queue = GNUNET_new (struct CadetPeerQueue);
queue->cls = cls;
queue->type = type;
queue->payload_type = payload_type;
@@ -1233,11 +1233,11 @@
* the sent continuation call.
*/
void
-GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c)
+GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c)
{
- struct MeshPeerQueue *q;
- struct MeshPeerQueue *next;
- struct MeshPeerQueue *prev;
+ struct CadetPeerQueue *q;
+ struct CadetPeerQueue *next;
+ struct CadetPeerQueue *prev;
for (q = peer->queue_head; NULL != q; q = next)
{
@@ -1245,7 +1245,7 @@
if (q->c == c)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GM_m2s (q->type));
- if (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY != q->type)
+ if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY != q->type)
{
q->c = NULL;
}
@@ -1286,10 +1286,10 @@
*
* @return First transmittable message.
*/
-static struct MeshPeerQueue *
-connection_get_first_message (struct MeshPeer *peer, struct MeshConnection *c)
+static struct CadetPeerQueue *
+connection_get_first_message (struct CadetPeer *peer, struct CadetConnection
*c)
{
- struct MeshPeerQueue *q;
+ struct CadetPeerQueue *q;
for (q = peer->queue_head; NULL != q; q = q->next)
{
@@ -1316,10 +1316,10 @@
* @return First message for this connection.
*/
struct GNUNET_MessageHeader *
-GMP_connection_pop (struct MeshPeer *peer, struct MeshConnection *c)
+GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c)
{
- struct MeshPeerQueue *q;
- struct MeshPeerQueue *next;
+ struct CadetPeerQueue *q;
+ struct CadetPeerQueue *next;
struct GNUNET_MessageHeader *msg;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GMC_2s (c));
@@ -1330,17 +1330,17 @@
continue;
switch (q->type)
{
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0);
continue;
- case GNUNET_MESSAGE_TYPE_MESH_KX:
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
msg = (struct GNUNET_MessageHeader *) q->cls;
GMP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0);
return msg;
@@ -1355,9 +1355,9 @@
void
-GMP_queue_unlock (struct MeshPeer *peer, struct MeshConnection *c)
+GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c)
{
- struct MeshPeerQueue *q;
+ struct CadetPeerQueue *q;
size_t size;
if (NULL != peer->core_transmit)
@@ -1396,16 +1396,16 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_PEERS",
+ GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_PEERS",
&max_peers))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
- "MESH", "MAX_PEERS", "USING DEFAULT");
+ "CADET", "MAX_PEERS", "USING DEFAULT");
max_peers = 1000;
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DROP_PERCENT",
+ GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DROP_PERCENT",
&drop_percent))
{
drop_percent = 0;
@@ -1413,14 +1413,14 @@
else
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"**************************************\n");
- LOG (GNUNET_ERROR_TYPE_WARNING, "Mesh is running with DROP enabled.\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Cadet is running with DROP enabled.\n");
LOG (GNUNET_ERROR_TYPE_WARNING, "This is NOT a good idea!\n");
LOG (GNUNET_ERROR_TYPE_WARNING, "Remove DROP_PERCENT from config file.\n");
LOG (GNUNET_ERROR_TYPE_WARNING,
"**************************************\n");
}
core_handle = GNUNET_CORE_connect (c, /* Main configuration */
- NULL, /* Closure passed to MESH
functions */
+ NULL, /* Closure passed to CADET
functions */
&core_init, /* Call core_init once
connected */
&core_connect, /* Handle connects */
&core_disconnect, /* remove peers on
disconnects */
@@ -1430,7 +1430,7 @@
GNUNET_NO, /* For header-only out
notification */
core_handlers); /* Register these
handlers */
if (GNUNET_YES !=
- GNUNET_CONFIGURATION_get_value_yesno (c, "MESH", "DISABLE_TRY_CONNECT"))
+ GNUNET_CONFIGURATION_get_value_yesno (c, "CADET", "DISABLE_TRY_CONNECT"))
{
transport_handle = GNUNET_TRANSPORT_connect (c, &my_full_id, NULL, /* cls
*/
/* Notify callbacks */
@@ -1478,22 +1478,22 @@
}
/**
- * Retrieve the MeshPeer stucture associated with the peer, create one
+ * Retrieve the CadetPeer stucture associated with the peer, create one
* and insert it in the appropriate structures if the peer is not known yet.
*
* @param peer_id Full identity of the peer.
*
* @return Existing or newly created peer structure.
*/
-struct MeshPeer *
+struct CadetPeer *
GMP_get (const struct GNUNET_PeerIdentity *peer_id)
{
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id);
if (NULL == peer)
{
- peer = GNUNET_new (struct MeshPeer);
+ peer = GNUNET_new (struct CadetPeer);
if (GNUNET_CONTAINER_multipeermap_size (peers) > max_peers)
{
peer_delete_oldest ();
@@ -1509,14 +1509,14 @@
/**
- * Retrieve the MeshPeer stucture associated with the peer, create one
+ * Retrieve the CadetPeer stucture associated with the peer, create one
* and insert it in the appropriate structures if the peer is not known yet.
*
* @param peer Short identity of the peer.
*
* @return Existing or newly created peer structure.
*/
-struct MeshPeer *
+struct CadetPeer *
GMP_get_short (const GNUNET_PEER_Id peer)
{
return GMP_get (GNUNET_PEER_resolve2 (peer));
@@ -1532,7 +1532,7 @@
static void
try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshPeer *peer = cls;
+ struct CadetPeer *peer = cls;
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
@@ -1550,11 +1550,11 @@
* @param peer Peer to connect to.
*/
void
-GMP_connect (struct MeshPeer *peer)
+GMP_connect (struct CadetPeer *peer)
{
- struct MeshTunnel3 *t;
- struct MeshPeerPath *p;
- struct MeshConnection *c;
+ struct CadetTunnel3 *t;
+ struct CadetPeerPath *p;
+ struct CadetConnection *c;
int rerun_search;
LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer));
@@ -1584,7 +1584,7 @@
/* This case can happen when the path includes a first hop that is
* not yet known to be connected.
*
- * This happens quite often during testing when running mesh
+ * This happens quite often during testing when running cadet
* under valgrind: core connect notifications come very late and the
* DHT result has already come and created a valid path.
* In this case, the peer->connections hashmap will be NULL and
@@ -1627,8 +1627,8 @@
LOG (GNUNET_ERROR_TYPE_DEBUG,
" Starting DHT GET for peer %s\n", GMP_2s (peer));
peer->search_h = GMD_search (id, &search_handler, peer);
- if (MESH_TUNNEL3_NEW == GMT_get_cstate (t))
- GMT_change_cstate (t, MESH_TUNNEL3_SEARCHING);
+ if (CADET_TUNNEL3_NEW == GMT_get_cstate (t))
+ GMT_change_cstate (t, CADET_TUNNEL3_SEARCHING);
}
}
@@ -1641,9 +1641,9 @@
* @return #GNUNET_YES if there is a direct connection.
*/
int
-GMP_is_neighbor (const struct MeshPeer *peer)
+GMP_is_neighbor (const struct CadetPeer *peer)
{
- struct MeshPeerPath *path;
+ struct CadetPeerPath *path;
if (NULL == peer->connections)
return GNUNET_NO;
@@ -1668,7 +1668,7 @@
* @param peer Peer towards which to create the tunnel.
*/
void
-GMP_add_tunnel (struct MeshPeer *peer)
+GMP_add_tunnel (struct CadetPeer *peer)
{
if (NULL != peer->tunnel)
return;
@@ -1689,8 +1689,8 @@
* @return GNUNET_OK on success.
*/
int
-GMP_add_connection (struct MeshPeer *peer,
- struct MeshConnection *c)
+GMP_add_connection (struct CadetPeer *peer,
+ struct CadetConnection *c)
{
int result;
LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GMC_2s (c));
@@ -1732,11 +1732,11 @@
* @return path if path was taken, pointer to existing duplicate if exists
* NULL on error.
*/
-struct MeshPeerPath *
-GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *path,
+struct CadetPeerPath *
+GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path,
int trusted)
{
- struct MeshPeerPath *aux;
+ struct CadetPeerPath *aux;
unsigned int l;
unsigned int l2;
@@ -1838,9 +1838,9 @@
* @return path if path was taken, pointer to existing duplicate if exists
* NULL on error.
*/
-struct MeshPeerPath *
-GMP_add_path_to_origin (struct MeshPeer *peer,
- struct MeshPeerPath *path,
+struct CadetPeerPath *
+GMP_add_path_to_origin (struct CadetPeer *peer,
+ struct CadetPeerPath *path,
int trusted)
{
if (NULL == path)
@@ -1857,7 +1857,7 @@
* @param confirmed Whether we know if the path works or not.
*/
void
-GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed)
+GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed)
{
unsigned int i;
@@ -1865,8 +1865,8 @@
for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ;
for (i++; i < p->length; i++)
{
- struct MeshPeer *aux;
- struct MeshPeerPath *copy;
+ struct CadetPeer *aux;
+ struct CadetPeerPath *copy;
aux = GMP_get_short (p->peers[i]);
copy = path_duplicate (p);
@@ -1883,10 +1883,10 @@
* @param path Path to remove. Is always destroyed .
*/
void
-GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path)
+GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path)
{
- struct MeshPeerPath *iter;
- struct MeshPeerPath *next;
+ struct CadetPeerPath *iter;
+ struct CadetPeerPath *next;
GNUNET_assert (myid == path->peers[0]);
GNUNET_assert (peer->id == path->peers[path->length - 1]);
@@ -1915,8 +1915,8 @@
* @return GNUNET_OK on success.
*/
int
-GMP_remove_connection (struct MeshPeer *peer,
- const struct MeshConnection *c)
+GMP_remove_connection (struct CadetPeer *peer,
+ const struct CadetConnection *c)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GMC_2s (c));
LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GMP_2s (peer));
@@ -1944,7 +1944,7 @@
* @param peer Destination peer.
*/
void
-GMP_start_search (struct MeshPeer *peer)
+GMP_start_search (struct CadetPeer *peer)
{
if (NULL != peer->search_h)
{
@@ -1963,7 +1963,7 @@
* @param peer Destination peer.
*/
void
-GMP_stop_search (struct MeshPeer *peer)
+GMP_stop_search (struct CadetPeer *peer)
{
if (NULL == peer->search_h)
{
@@ -1983,7 +1983,7 @@
* @return Full ID of peer.
*/
const struct GNUNET_PeerIdentity *
-GMP_get_id (const struct MeshPeer *peer)
+GMP_get_id (const struct CadetPeer *peer)
{
return GNUNET_PEER_resolve2 (peer->id);
}
@@ -1997,7 +1997,7 @@
* @return Short ID of peer.
*/
GNUNET_PEER_Id
-GMP_get_short_id (const struct MeshPeer *peer)
+GMP_get_short_id (const struct CadetPeer *peer)
{
return peer->id;
}
@@ -2010,7 +2010,7 @@
* @param t Tunnel.
*/
void
-GMP_set_tunnel (struct MeshPeer *peer, struct MeshTunnel3 *t)
+GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t)
{
peer->tunnel = t;
if (NULL == t && NULL != peer->search_h)
@@ -2027,8 +2027,8 @@
*
* @return Tunnel towards peer.
*/
-struct MeshTunnel3 *
-GMP_get_tunnel (const struct MeshPeer *peer)
+struct CadetTunnel3 *
+GMP_get_tunnel (const struct CadetPeer *peer)
{
return peer->tunnel;
}
@@ -2041,7 +2041,7 @@
* @param hello Hello message.
*/
void
-GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello)
+GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message
*hello)
{
struct GNUNET_HELLO_Message *old;
size_t size;
@@ -2076,7 +2076,7 @@
* @return Hello message.
*/
struct GNUNET_HELLO_Message *
-GMP_get_hello (struct MeshPeer *peer)
+GMP_get_hello (struct CadetPeer *peer)
{
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_TIME_Relative remaining;
@@ -2103,7 +2103,7 @@
* @param peer Peer to whom to connect.
*/
void
-GMP_try_connect (struct MeshPeer *peer)
+GMP_try_connect (struct CadetPeer *peer)
{
struct GNUNET_HELLO_Message *hello;
struct GNUNET_MessageHeader *mh;
@@ -2129,12 +2129,12 @@
* @param peer2 Peer whose link is broken.
*/
void
-GMP_notify_broken_link (struct MeshPeer *peer,
+GMP_notify_broken_link (struct CadetPeer *peer,
struct GNUNET_PeerIdentity *peer1,
struct GNUNET_PeerIdentity *peer2)
{
- struct MeshPeerPath *iter;
- struct MeshPeerPath *next;
+ struct CadetPeerPath *iter;
+ struct CadetPeerPath *next;
unsigned int i;
GNUNET_PEER_Id p1;
GNUNET_PEER_Id p2;
@@ -2178,9 +2178,9 @@
* @return Number of known paths.
*/
unsigned int
-GMP_count_paths (const struct MeshPeer *peer)
+GMP_count_paths (const struct CadetPeer *peer)
{
- struct MeshPeerPath *iter;
+ struct CadetPeerPath *iter;
unsigned int i;
for (iter = peer->path_head, i = 0; NULL != iter; iter = iter->next)
@@ -2211,7 +2211,7 @@
* @return Static string for it's ID.
*/
const char *
-GMP_2s (const struct MeshPeer *peer)
+GMP_2s (const struct CadetPeer *peer)
{
if (NULL == peer)
return "(NULL)";
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h 2014-05-07 12:06:50 UTC (rev
33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_peer.h
- * @brief mesh service; dealing with remote peers
+ * @file cadet/gnunet-service-cadet_peer.h
+ * @brief cadet service; dealing with remote peers
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GMP (Gnunet Mesh Peer)
+ * All functions in this file should use the prefix GMP (Gnunet Cadet Peer)
*/
-#ifndef GNUNET_SERVICE_MESH_PEER_H
-#define GNUNET_SERVICE_MESH_PEER_H
+#ifndef GNUNET_SERVICE_CADET_PEER_H
+#define GNUNET_SERVICE_CADET_PEER_H
#ifdef __cplusplus
extern "C"
@@ -43,14 +43,14 @@
/**
* Struct containing all information regarding a given peer
*/
-struct MeshPeer;
+struct CadetPeer;
/**
* Struct containing info about a queued transmission to this peer
*/
-struct MeshPeerQueue;
+struct CadetPeerQueue;
-#include "gnunet-service-mesh_connection.h"
+#include "gnunet-service-cadet_connection.h"
/**
* Callback called when a queued message is sent.
@@ -65,7 +65,7 @@
* @param wait Time spent waiting for core (only the time for THIS message)
*/
typedef void (*GMP_sent) (void *cls,
- struct MeshConnection *c, int sent,
+ struct CadetConnection *c, int sent,
uint16_t type, uint32_t pid, int fwd, size_t size,
struct GNUNET_TIME_Relative wait);
@@ -89,26 +89,26 @@
/**
- * Retrieve the MeshPeer stucture associated with the peer, create one
+ * Retrieve the CadetPeer stucture associated with the peer, create one
* and insert it in the appropriate structures if the peer is not known yet.
*
* @param peer_id Full identity of the peer.
*
* @return Existing or newly created peer structure.
*/
-struct MeshPeer *
+struct CadetPeer *
GMP_get (const struct GNUNET_PeerIdentity *peer_id);
/**
- * Retrieve the MeshPeer stucture associated with the peer, create one
+ * Retrieve the CadetPeer stucture associated with the peer, create one
* and insert it in the appropriate structures if the peer is not known yet.
*
* @param peer Short identity of the peer.
*
* @return Existing or newly created peer structure.
*/
-struct MeshPeer *
+struct CadetPeer *
GMP_get_short (const GNUNET_PEER_Id peer);
/**
@@ -119,7 +119,7 @@
* @param peer Peer to connect to.
*/
void
-GMP_connect (struct MeshPeer *peer);
+GMP_connect (struct CadetPeer *peer);
/**
* Free a transmission that was already queued with all resources
@@ -131,7 +131,7 @@
* @param pid PID, if relevant (was sent and was a payload message).
*/
void
-GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls,
+GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls,
int sent, uint32_t pid);
/**
@@ -150,10 +150,10 @@
* @return Handle to cancel the message before it is sent. Once cont is called
* message has been sent and therefore the handle is no longer valid.
*/
-struct MeshPeerQueue *
-GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
+struct CadetPeerQueue *
+GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type,
uint16_t payload_type, uint32_t payload_id,
- size_t size, struct MeshConnection *c, int fwd,
+ size_t size, struct CadetConnection *c, int fwd,
GMP_sent cont, void *cont_cls);
/**
@@ -164,7 +164,7 @@
* the sent continuation call.
*/
void
-GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c);
+GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c);
/**
* Get the first message for a connection and unqueue it.
@@ -175,10 +175,10 @@
* @return First message for this connection.
*/
struct GNUNET_MessageHeader *
-GMP_connection_pop (struct MeshPeer *peer, struct MeshConnection *c);
+GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c);
void
-GMP_queue_unlock (struct MeshPeer *peer, struct MeshConnection *c);
+GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c);
/**
* Set tunnel.
@@ -187,7 +187,7 @@
* @param t Tunnel.
*/
void
-GMP_set_tunnel (struct MeshPeer *peer, struct MeshTunnel3 *t);
+GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t);
/**
* Check whether there is a direct (core level) connection to peer.
@@ -197,7 +197,7 @@
* @return #GNUNET_YES if there is a direct connection.
*/
int
-GMP_is_neighbor (const struct MeshPeer *peer);
+GMP_is_neighbor (const struct CadetPeer *peer);
/**
* Create and initialize a new tunnel towards a peer, in case it has none.
@@ -207,7 +207,7 @@
* @param peer Peer towards which to create the tunnel.
*/
void
-GMP_add_tunnel (struct MeshPeer *peer);
+GMP_add_tunnel (struct CadetPeer *peer);
/**
* Add a connection to a neighboring peer.
@@ -222,7 +222,7 @@
* @return GNUNET_OK on success.
*/
int
-GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c);
+GMP_add_connection (struct CadetPeer *peer, struct CadetConnection *c);
/**
* Add the path to the peer and update the path used to reach it in case this
@@ -236,8 +236,8 @@
* @return path if path was taken, pointer to existing duplicate if exists
* NULL on error.
*/
-struct MeshPeerPath *
-GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *p, int trusted);
+struct CadetPeerPath *
+GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *p, int trusted);
/**
* Add the path to the origin peer and update the path used to reach it in case
@@ -253,9 +253,9 @@
* @return path if path was taken, pointer to existing duplicate if exists
* NULL on error.
*/
-struct MeshPeerPath *
-GMP_add_path_to_origin (struct MeshPeer *peer,
- struct MeshPeerPath *path,
+struct CadetPeerPath *
+GMP_add_path_to_origin (struct CadetPeer *peer,
+ struct CadetPeerPath *path,
int trusted);
/**
@@ -265,7 +265,7 @@
* @param confirmed Whether we know if the path works or not.
*/
void
-GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed);
+GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed);
/**
* Remove any path to the peer that has the extact same peers as the one given.
@@ -274,7 +274,7 @@
* @param path Path to remove. Is always destroyed .
*/
void
-GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path);
+GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path);
/**
* Remove a connection from a neighboring peer.
@@ -285,7 +285,7 @@
* @return GNUNET_OK on success.
*/
int
-GMP_remove_connection (struct MeshPeer *peer, const struct MeshConnection *c);
+GMP_remove_connection (struct CadetPeer *peer, const struct CadetConnection
*c);
/**
* Start the DHT search for new paths towards the peer: we don't have
@@ -294,7 +294,7 @@
* @param peer Destination peer.
*/
void
-GMP_start_search (struct MeshPeer *peer);
+GMP_start_search (struct CadetPeer *peer);
/**
* Stop the DHT search for new paths towards the peer: we already have
@@ -303,7 +303,7 @@
* @param peer Destination peer.
*/
void
-GMP_stop_search (struct MeshPeer *peer);
+GMP_stop_search (struct CadetPeer *peer);
/**
* Get the Full ID of a peer.
@@ -313,7 +313,7 @@
* @return Full ID of peer.
*/
const struct GNUNET_PeerIdentity *
-GMP_get_id (const struct MeshPeer *peer);
+GMP_get_id (const struct CadetPeer *peer);
/**
* Get the Short ID of a peer.
@@ -323,7 +323,7 @@
* @return Short ID of peer.
*/
GNUNET_PEER_Id
-GMP_get_short_id (const struct MeshPeer *peer);
+GMP_get_short_id (const struct CadetPeer *peer);
/**
* Get the tunnel towards a peer.
@@ -332,8 +332,8 @@
*
* @return Tunnel towards peer.
*/
-struct MeshTunnel3 *
-GMP_get_tunnel (const struct MeshPeer *peer);
+struct CadetTunnel3 *
+GMP_get_tunnel (const struct CadetPeer *peer);
/**
* Set the hello message.
@@ -342,7 +342,7 @@
* @param hello Hello message.
*/
void
-GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message
*hello);
+GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message
*hello);
/**
* Get the hello message.
@@ -352,7 +352,7 @@
* @return Hello message.
*/
struct GNUNET_HELLO_Message *
-GMP_get_hello (struct MeshPeer *peer);
+GMP_get_hello (struct CadetPeer *peer);
/**
@@ -361,7 +361,7 @@
* @param peer Peer to whom to connect.
*/
void
-GMP_try_connect (struct MeshPeer *peer);
+GMP_try_connect (struct CadetPeer *peer);
/**
* Notify a peer that a link between two other peers is broken. If any path
@@ -372,7 +372,7 @@
* @param peer2 Peer whose link is broken.
*/
void
-GMP_notify_broken_link (struct MeshPeer *peer,
+GMP_notify_broken_link (struct CadetPeer *peer,
struct GNUNET_PeerIdentity *peer1,
struct GNUNET_PeerIdentity *peer2);
@@ -384,7 +384,7 @@
* @return Number of known paths.
*/
unsigned int
-GMP_count_paths (const struct MeshPeer *peer);
+GMP_count_paths (const struct CadetPeer *peer);
/**
* Iterate all known peers.
@@ -403,7 +403,7 @@
* @return Static string for it's ID.
*/
const char *
-GMP_2s (const struct MeshPeer *peer);
+GMP_2s (const struct CadetPeer *peer);
#if 0 /* keep Emacsens' auto-indent happy */
@@ -413,6 +413,6 @@
}
#endif
-/* ifndef GNUNET_MESH_SERVICE_PEER_H */
+/* ifndef GNUNET_CADET_SERVICE_PEER_H */
#endif
-/* end of gnunet-mesh-service_peer.h */
+/* end of gnunet-cadet-service_peer.h */
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -24,15 +24,15 @@
#include "gnunet_signatures.h"
#include "gnunet_statistics_service.h"
-#include "mesh_protocol.h"
-#include "mesh_path.h"
+#include "cadet_protocol.h"
+#include "cadet_path.h"
-#include "gnunet-service-mesh_tunnel.h"
-#include "gnunet-service-mesh_connection.h"
-#include "gnunet-service-mesh_channel.h"
-#include "gnunet-service-mesh_peer.h"
+#include "gnunet-service-cadet_tunnel.h"
+#include "gnunet-service-cadet_connection.h"
+#include "gnunet-service-cadet_channel.h"
+#include "gnunet-service-cadet_peer.h"
-#define LOG(level, ...) GNUNET_log_from(level,"mesh-tun",__VA_ARGS__)
+#define LOG(level, ...) GNUNET_log_from(level,"cadet-tun",__VA_ARGS__)
#define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
@@ -42,33 +42,33 @@
/******************************** STRUCTS
**********************************/
/******************************************************************************/
-struct MeshTChannel
+struct CadetTChannel
{
- struct MeshTChannel *next;
- struct MeshTChannel *prev;
- struct MeshChannel *ch;
+ struct CadetTChannel *next;
+ struct CadetTChannel *prev;
+ struct CadetChannel *ch;
};
/**
* Connection list and metadata.
*/
-struct MeshTConnection
+struct CadetTConnection
{
/**
* Next in DLL.
*/
- struct MeshTConnection *next;
+ struct CadetTConnection *next;
/**
* Prev in DLL.
*/
- struct MeshTConnection *prev;
+ struct CadetTConnection *prev;
/**
* Connection handle.
*/
- struct MeshConnection *c;
+ struct CadetConnection *c;
/**
* Creation time, to keep oldest connection alive.
@@ -84,7 +84,7 @@
/**
* Structure used during a Key eXchange.
*/
-struct MeshTunnelKXCtx
+struct CadetTunnelKXCtx
{
/**
* Decryption ("their") old key, for decrypting traffic sent by the
@@ -101,27 +101,27 @@
/**
* Struct containing all information regarding a tunnel to a peer.
*/
-struct MeshTunnel3
+struct CadetTunnel3
{
/**
* Endpoint of the tunnel.
*/
- struct MeshPeer *peer;
+ struct CadetPeer *peer;
/**
* State of the tunnel connectivity.
*/
- enum MeshTunnel3CState cstate;
+ enum CadetTunnel3CState cstate;
/**
* State of the tunnel encryption.
*/
- enum MeshTunnel3EState estate;
+ enum CadetTunnel3EState estate;
/**
* Key eXchange context.
*/
- struct MeshTunnelKXCtx *kx_ctx;
+ struct CadetTunnelKXCtx *kx_ctx;
/**
* Encryption ("our") key.
@@ -141,8 +141,8 @@
/**
* Paths that are actively used to reach the destination peer.
*/
- struct MeshTConnection *connection_head;
- struct MeshTConnection *connection_tail;
+ struct CadetTConnection *connection_head;
+ struct CadetTConnection *connection_tail;
/**
* Next connection number.
@@ -152,13 +152,13 @@
/**
* Channels inside this tunnel.
*/
- struct MeshTChannel *channel_head;
- struct MeshTChannel *channel_tail;
+ struct CadetTChannel *channel_head;
+ struct CadetTChannel *channel_tail;
/**
* Channel ID for the next created channel.
*/
- MESH_ChannelNumber next_chid;
+ CADET_ChannelNumber next_chid;
/**
* Destroy flag: if true, destroy on last message.
@@ -168,31 +168,31 @@
/**
* Queued messages, to transmit once tunnel gets connected.
*/
- struct MeshTunnelDelayed *tq_head;
- struct MeshTunnelDelayed *tq_tail;
+ struct CadetTunnelDelayed *tq_head;
+ struct CadetTunnelDelayed *tq_tail;
};
/**
* Struct used to save messages in a non-ready tunnel to send once connected.
*/
-struct MeshTunnelDelayed
+struct CadetTunnelDelayed
{
/**
* DLL
*/
- struct MeshTunnelDelayed *next;
- struct MeshTunnelDelayed *prev;
+ struct CadetTunnelDelayed *next;
+ struct CadetTunnelDelayed *prev;
/**
* Tunnel.
*/
- struct MeshTunnel3 *t;
+ struct CadetTunnel3 *t;
/**
* Tunnel queue given to the channel to cancel request. Update on
send_queued.
*/
- struct MeshTunnel3Queue *tq;
+ struct CadetTunnel3Queue *tq;
/**
* Message to send.
@@ -204,17 +204,17 @@
/**
* Handle for messages queued but not yet sent.
*/
-struct MeshTunnel3Queue
+struct CadetTunnel3Queue
{
/**
* Connection queue handle, to cancel if necessary.
*/
- struct MeshConnectionQueue *cq;
+ struct CadetConnectionQueue *cq;
/**
* Handle in case message hasn't been given to a connection yet.
*/
- struct MeshTunnelDelayed *tqd;
+ struct CadetTunnelDelayed *tqd;
/**
* Continuation to call once sent.
@@ -278,7 +278,7 @@
/**
* Cached message used to perform a key exchange.
*/
-static struct GNUNET_MESH_KX_Ephemeral kx_msg;
+static struct GNUNET_CADET_KX_Ephemeral kx_msg;
/**
* Task to generate a new ephemeral key.
@@ -302,20 +302,20 @@
* @return String representation.
*/
static const char *
-cstate2s (enum MeshTunnel3CState cs)
+cstate2s (enum CadetTunnel3CState cs)
{
static char buf[128];
switch (cs)
{
- case MESH_TUNNEL3_NEW:
- return "MESH_TUNNEL3_NEW";
- case MESH_TUNNEL3_SEARCHING:
- return "MESH_TUNNEL3_SEARCHING";
- case MESH_TUNNEL3_WAITING:
- return "MESH_TUNNEL3_WAITING";
- case MESH_TUNNEL3_READY:
- return "MESH_TUNNEL3_READY";
+ case CADET_TUNNEL3_NEW:
+ return "CADET_TUNNEL3_NEW";
+ case CADET_TUNNEL3_SEARCHING:
+ return "CADET_TUNNEL3_SEARCHING";
+ case CADET_TUNNEL3_WAITING:
+ return "CADET_TUNNEL3_WAITING";
+ case CADET_TUNNEL3_READY:
+ return "CADET_TUNNEL3_READY";
default:
sprintf (buf, "%u (UNKNOWN STATE)", cs);
@@ -333,20 +333,20 @@
* @return String representation.
*/
static const char *
-estate2s (enum MeshTunnel3EState es)
+estate2s (enum CadetTunnel3EState es)
{
static char buf[128];
switch (es)
{
- case MESH_TUNNEL3_KEY_UNINITIALIZED:
- return "MESH_TUNNEL3_KEY_UNINITIALIZED";
- case MESH_TUNNEL3_KEY_SENT:
- return "MESH_TUNNEL3_KEY_SENT";
- case MESH_TUNNEL3_KEY_PING:
- return "MESH_TUNNEL3_KEY_PING";
- case MESH_TUNNEL3_KEY_OK:
- return "MESH_TUNNEL3_KEY_OK";
+ case CADET_TUNNEL3_KEY_UNINITIALIZED:
+ return "CADET_TUNNEL3_KEY_UNINITIALIZED";
+ case CADET_TUNNEL3_KEY_SENT:
+ return "CADET_TUNNEL3_KEY_SENT";
+ case CADET_TUNNEL3_KEY_PING:
+ return "CADET_TUNNEL3_KEY_PING";
+ case CADET_TUNNEL3_KEY_OK:
+ return "CADET_TUNNEL3_KEY_OK";
default:
sprintf (buf, "%u (UNKNOWN STATE)", es);
@@ -366,12 +366,12 @@
* @return #GNUNET_YES if ready, #GNUNET_NO otherwise
*/
static int
-is_ready (struct MeshTunnel3 *t)
+is_ready (struct CadetTunnel3 *t)
{
int ready;
GMT_debug (t);
- ready = (MESH_TUNNEL3_READY == t->cstate && MESH_TUNNEL3_KEY_OK ==
t->estate);
+ ready = (CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK ==
t->estate);
ready = ready || GMT_is_loopback (t);
return ready;
}
@@ -413,7 +413,7 @@
* @return Amount of messages the channel can still buffer towards the client.
*/
static unsigned int
-get_channel_buffer (const struct MeshTChannel *tch)
+get_channel_buffer (const struct CadetTChannel *tch)
{
int fwd;
@@ -432,7 +432,7 @@
* @return #GNUNET_YES if we allowed the client to send data to us.
*/
static int
-get_channel_allowed (const struct MeshTChannel *tch)
+get_channel_allowed (const struct CadetTChannel *tch)
{
int fwd;
@@ -451,7 +451,7 @@
* @return Amount of messages the connection can still buffer.
*/
static unsigned int
-get_connection_buffer (const struct MeshTConnection *tc)
+get_connection_buffer (const struct CadetTConnection *tc)
{
int fwd;
@@ -470,7 +470,7 @@
* @return Amount of messages we have allowed the next peer to send us.
*/
static unsigned int
-get_connection_allowed (const struct MeshTConnection *tc)
+get_connection_allowed (const struct CadetTConnection *tc)
{
int fwd;
@@ -490,11 +490,11 @@
* @return GNUNET_OK if message is fine, GNUNET_SYSERR otherwise.
*/
int
-check_ephemeral (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_KX_Ephemeral *msg)
+check_ephemeral (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_KX_Ephemeral *msg)
{
/* Check message size */
- if (ntohs (msg->header.size) != sizeof (struct GNUNET_MESH_KX_Ephemeral))
+ if (ntohs (msg->header.size) != sizeof (struct GNUNET_CADET_KX_Ephemeral))
return GNUNET_SYSERR;
/* Check signature size */
@@ -509,7 +509,7 @@
/* Check signature */
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_MESH_KX,
+ GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_CADET_KX,
&msg->purpose,
&msg->signature,
&msg->origin_identity.public_key))
@@ -529,7 +529,7 @@
* @param iv Initialization Vector to use.
*/
static int
-t_encrypt (struct MeshTunnel3 *t,
+t_encrypt (struct CadetTunnel3 *t,
void *dst, const void *src,
size_t size, uint32_t iv)
{
@@ -556,7 +556,7 @@
* @param iv Initialization Vector to use.
*/
static int
-t_decrypt (struct MeshTunnel3 *t,
+t_decrypt (struct CadetTunnel3 *t,
void *dst, const void *src,
size_t size, uint32_t iv)
{
@@ -565,7 +565,7 @@
size_t out_size;
LOG (GNUNET_ERROR_TYPE_DEBUG, " t_decrypt start\n");
- if (t->estate == MESH_TUNNEL3_KEY_OK || t->estate == MESH_TUNNEL3_KEY_PING)
+ if (t->estate == CADET_TUNNEL3_KEY_OK || t->estate == CADET_TUNNEL3_KEY_PING)
{
key = &t->d_key;
}
@@ -627,7 +627,7 @@
const struct GNUNET_PeerIdentity *receiver,
const struct GNUNET_HashCode *key_material)
{
- const char salt[] = "MESH kx salt";
+ const char salt[] = "CADET kx salt";
GNUNET_CRYPTO_kdf (key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
salt, sizeof (salt),
@@ -644,11 +644,11 @@
*
* @return The connection on which to send the next message.
*/
-static struct MeshConnection *
-tunnel_get_connection (struct MeshTunnel3 *t)
+static struct CadetConnection *
+tunnel_get_connection (struct CadetTunnel3 *t)
{
- struct MeshTConnection *iter;
- struct MeshConnection *best;
+ struct CadetTConnection *iter;
+ struct CadetConnection *best;
unsigned int qn;
unsigned int lowest_q;
@@ -659,7 +659,7 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n",
GMC_2s (iter->c), GMC_get_state (iter->c));
- if (MESH_CONNECTION_READY == GMC_get_state (iter->c))
+ if (CADET_CONNECTION_READY == GMC_get_state (iter->c))
{
qn = GMC_get_qn (iter->c, GMC_is_origin (iter->c, GNUNET_YES));
LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", qn);
@@ -689,12 +689,12 @@
*/
static void
tun_message_sent (void *cls,
- struct MeshConnection *c,
- struct MeshConnectionQueue *q,
+ struct CadetConnection *c,
+ struct CadetConnectionQueue *q,
uint16_t type, int fwd, size_t size)
{
- struct MeshTunnel3Queue *qt = cls;
- struct MeshTunnel3 *t;
+ struct CadetTunnel3Queue *qt = cls;
+ struct CadetTunnel3 *t;
LOG (GNUNET_ERROR_TYPE_DEBUG, "tun_message_sent\n");
@@ -712,7 +712,7 @@
* @param tqd Delayed queue handle.
*/
static void
-unqueue_data (struct MeshTunnelDelayed *tqd)
+unqueue_data (struct CadetTunnelDelayed *tqd)
{
GNUNET_CONTAINER_DLL_remove (tqd->t->tq_head, tqd->t->tq_tail, tqd);
GNUNET_free (tqd);
@@ -725,10 +725,10 @@
* @param t Tunnel to hold the message.
* @param msg Message itself (copy will be made).
*/
-static struct MeshTunnelDelayed *
-queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg)
+static struct CadetTunnelDelayed *
+queue_data (struct CadetTunnel3 *t, const struct GNUNET_MessageHeader *msg)
{
- struct MeshTunnelDelayed *tqd;
+ struct CadetTunnelDelayed *tqd;
uint16_t size = ntohs (msg->size);
LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GMT_2s (t));
@@ -739,7 +739,7 @@
return NULL;
}
- tqd = GNUNET_malloc (sizeof (struct MeshTunnelDelayed) + size);
+ tqd = GNUNET_malloc (sizeof (struct CadetTunnelDelayed) + size);
tqd->t = t;
memcpy (&tqd[1], msg, size);
@@ -759,11 +759,11 @@
* @param hmac Destination to store the HMAC.
*/
static void
-t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv,
- int outgoing, struct GNUNET_MESH_Hash *hmac)
+t_hmac (struct CadetTunnel3 *t, const void *plaintext, size_t size, uint32_t
iv,
+ int outgoing, struct GNUNET_CADET_Hash *hmac)
{
struct GNUNET_CRYPTO_AuthKey auth_key;
- static const char ctx[] = "mesh authentication key";
+ static const char ctx[] = "cadet authentication key";
struct GNUNET_CRYPTO_SymmetricSessionKey *key;
struct GNUNET_HashCode hash;
@@ -794,16 +794,16 @@
*
* @return Handle to cancel message. NULL if @c cont is NULL.
*/
-static struct MeshTunnel3Queue *
+static struct CadetTunnel3Queue *
send_prebuilt_message (const struct GNUNET_MessageHeader *message,
- struct MeshTunnel3 *t, struct MeshConnection *c,
+ struct CadetTunnel3 *t, struct CadetConnection *c,
int force, GMT_sent cont, void *cont_cls,
- struct MeshTunnel3Queue *existing_q)
+ struct CadetTunnel3Queue *existing_q)
{
- struct MeshTunnel3Queue *tq;
- struct GNUNET_MESH_Encrypted *msg;
+ struct CadetTunnel3Queue *tq;
+ struct GNUNET_CADET_Encrypted *msg;
size_t size = ntohs (message->size);
- char cbuf[sizeof (struct GNUNET_MESH_Encrypted) + size];
+ char cbuf[sizeof (struct GNUNET_CADET_Encrypted) + size];
uint32_t mid;
uint32_t iv;
uint16_t type;
@@ -813,7 +813,7 @@
if (GNUNET_NO == is_ready (t))
{
- struct MeshTunnelDelayed *tqd;
+ struct CadetTunnelDelayed *tqd;
/* A non null existing_q indicates sending of queued data.
* Should only happen after tunnel becomes ready.
*/
@@ -821,7 +821,7 @@
tqd = queue_data (t, message);
if (NULL == cont)
return NULL;
- tq = GNUNET_new (struct MeshTunnel3Queue);
+ tq = GNUNET_new (struct CadetTunnel3Queue);
tq->tqd = tqd;
tqd->tq = tq;
tq->cont = cont;
@@ -832,19 +832,19 @@
GNUNET_assert (GNUNET_NO == GMT_is_loopback (t));
iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
- msg = (struct GNUNET_MESH_Encrypted *) cbuf;
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED);
+ msg = (struct GNUNET_CADET_Encrypted *) cbuf;
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED);
msg->iv = iv;
GNUNET_assert (t_encrypt (t, &msg[1], message, size, iv) == size);
t_hmac (t, &msg[1], size, iv, GNUNET_YES, &msg->hmac);
- msg->header.size = htons (sizeof (struct GNUNET_MESH_Encrypted) + size);
+ msg->header.size = htons (sizeof (struct GNUNET_CADET_Encrypted) + size);
if (NULL == c)
c = tunnel_get_connection (t);
if (NULL == c)
{
if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task
- || MESH_TUNNEL3_SEARCHING != t->cstate)
+ || CADET_TUNNEL3_SEARCHING != t->cstate)
{
GNUNET_break (0);
GMT_debug (t);
@@ -856,18 +856,18 @@
type = ntohs (message->type);
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
- case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
- if (GNUNET_MESSAGE_TYPE_MESH_DATA == type)
- mid = ntohl (((struct GNUNET_MESH_Data *) message)->mid);
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
+ if (GNUNET_MESSAGE_TYPE_CADET_DATA == type)
+ mid = ntohl (((struct GNUNET_CADET_Data *) message)->mid);
else
- mid = ntohl (((struct GNUNET_MESH_DataACK *) message)->mid);
+ mid = ntohl (((struct GNUNET_CADET_DataACK *) message)->mid);
/* Fall thru */
- case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
+ case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
msg->cid = *GMC_get_id (c);
msg->ttl = htonl (default_ttl);
break;
@@ -887,7 +887,7 @@
}
if (NULL == existing_q)
{
- tq = GNUNET_new (struct MeshTunnel3Queue); /* FIXME valgrind: leak*/
+ tq = GNUNET_new (struct CadetTunnel3Queue); /* FIXME valgrind: leak*/
}
else
{
@@ -909,10 +909,10 @@
* @param t Tunnel that holds the messages. Cannot be loopback.
*/
static void
-send_queued_data (struct MeshTunnel3 *t)
+send_queued_data (struct CadetTunnel3 *t)
{
- struct MeshTunnelDelayed *tqd;
- struct MeshTunnelDelayed *next;
+ struct CadetTunnelDelayed *tqd;
+ struct CadetTunnelDelayed *next;
unsigned int room;
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -959,13 +959,13 @@
* @param message Message to send. Function modifies it.
*/
static void
-send_kx (struct MeshTunnel3 *t,
+send_kx (struct CadetTunnel3 *t,
const struct GNUNET_MessageHeader *message)
{
- struct MeshConnection *c;
- struct GNUNET_MESH_KX *msg;
+ struct CadetConnection *c;
+ struct GNUNET_CADET_KX *msg;
size_t size = ntohs (message->size);
- char cbuf[sizeof (struct GNUNET_MESH_KX) + size];
+ char cbuf[sizeof (struct GNUNET_CADET_KX) + size];
uint16_t type;
int fwd;
@@ -988,28 +988,28 @@
/* Must have a connection. */
if (NULL == t->connection_head)
{
- GNUNET_break (MESH_TUNNEL3_SEARCHING == t->cstate);
+ GNUNET_break (CADET_TUNNEL3_SEARCHING == t->cstate);
GMT_debug (t);
return;
}
- msg = (struct GNUNET_MESH_KX *) cbuf;
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX);
- msg->header.size = htons (sizeof (struct GNUNET_MESH_KX) + size);
+ msg = (struct GNUNET_CADET_KX *) cbuf;
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX);
+ msg->header.size = htons (sizeof (struct GNUNET_CADET_KX) + size);
c = tunnel_get_connection (t);
if (NULL == c)
{
GNUNET_break (GNUNET_SCHEDULER_NO_TASK != t->destroy_task
- || MESH_TUNNEL3_READY != t->cstate);
+ || CADET_TUNNEL3_READY != t->cstate);
GMT_debug (t);
return;
}
type = ntohs (message->type);
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL:
- case GNUNET_MESSAGE_TYPE_MESH_KX_PING:
- case GNUNET_MESSAGE_TYPE_MESH_KX_PONG:
+ case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL:
+ case GNUNET_MESSAGE_TYPE_CADET_KX_PING:
+ case GNUNET_MESSAGE_TYPE_CADET_KX_PONG:
memcpy (&msg[1], message, size);
break;
default:
@@ -1020,7 +1020,7 @@
fwd = GMC_is_origin (t->connection_head->c, GNUNET_YES);
/* TODO save handle and cancel in case of a unneeded retransmission */
- GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_MESH_KX,
+ GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX,
message->type, c, fwd, GNUNET_YES, NULL, NULL);
}
@@ -1031,7 +1031,7 @@
* @param t Tunnel on which to send the key.
*/
static void
-send_ephemeral (struct MeshTunnel3 *t)
+send_ephemeral (struct CadetTunnel3 *t)
{
LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GMT_2s (t));
@@ -1045,13 +1045,13 @@
* @param t Tunnel on which to send the ping.
*/
static void
-send_ping (struct MeshTunnel3 *t)
+send_ping (struct CadetTunnel3 *t)
{
- struct GNUNET_MESH_KX_Ping msg;
+ struct GNUNET_CADET_KX_Ping msg;
LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GMT_2s (t));
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_PING);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PING);
msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
msg.target = *GMP_get_id (t->peer);
msg.nonce = t->kx_ctx->challenge;
@@ -1073,13 +1073,13 @@
* @param challenge Value sent in the ping that we have to send back.
*/
static void
-send_pong (struct MeshTunnel3 *t, uint32_t challenge)
+send_pong (struct CadetTunnel3 *t, uint32_t challenge)
{
- struct GNUNET_MESH_KX_Pong msg;
+ struct GNUNET_CADET_KX_Pong msg;
LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GMT_2s (t));
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_PONG);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PONG);
msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
msg.nonce = challenge;
LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %u\n", msg.nonce);
@@ -1099,7 +1099,7 @@
static void
rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshTunnel3 *t = cls;
+ struct CadetTunnel3 *t = cls;
t->rekey_task = GNUNET_SCHEDULER_NO_TASK;
@@ -1110,7 +1110,7 @@
if (NULL == t->kx_ctx)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " new kx ctx\n");
- t->kx_ctx = GNUNET_new (struct MeshTunnelKXCtx);
+ t->kx_ctx = GNUNET_new (struct CadetTunnelKXCtx);
t->kx_ctx->challenge =
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
t->kx_ctx->d_key_old = t->d_key;
@@ -1120,15 +1120,15 @@
send_ephemeral (t);
switch (t->estate)
{
- case MESH_TUNNEL3_KEY_UNINITIALIZED:
- t->estate = MESH_TUNNEL3_KEY_SENT;
+ case CADET_TUNNEL3_KEY_UNINITIALIZED:
+ t->estate = CADET_TUNNEL3_KEY_SENT;
break;
- case MESH_TUNNEL3_KEY_SENT:
+ case CADET_TUNNEL3_KEY_SENT:
break;
- case MESH_TUNNEL3_KEY_PING:
- case MESH_TUNNEL3_KEY_OK:
+ case CADET_TUNNEL3_KEY_PING:
+ case CADET_TUNNEL3_KEY_OK:
send_ping (t);
- t->estate = MESH_TUNNEL3_KEY_PING;
+ t->estate = CADET_TUNNEL3_KEY_PING;
break;
default:
LOG (GNUNET_ERROR_TYPE_DEBUG, "Unexpected state %u\n", t->estate);
@@ -1154,7 +1154,7 @@
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct MeshTunnel3 *t = value;
+ struct CadetTunnel3 *t = value;
struct GNUNET_TIME_Relative delay;
long n = (long) cls;
uint32_t r;
@@ -1226,7 +1226,7 @@
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct MeshTunnel3 *t = value;
+ struct CadetTunnel3 *t = value;
LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_shutdown destroying tunnel at %p\n", t);
GMT_destroy (t);
@@ -1242,11 +1242,11 @@
* @param gid ID of the channel.
*/
static void
-send_channel_destroy (struct MeshTunnel3 *t, unsigned int gid)
+send_channel_destroy (struct CadetTunnel3 *t, unsigned int gid)
{
- struct GNUNET_MESH_ChannelManage msg;
+ struct GNUNET_CADET_ChannelManage msg;
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
msg.header.size = htons (sizeof (msg));
msg.chid = htonl (gid);
@@ -1268,17 +1268,17 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
static void
-handle_data (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_Data *msg,
+handle_data (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_Data *msg,
int fwd)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
size_t size;
/* Check size */
size = ntohs (msg->header.size);
if (size <
- sizeof (struct GNUNET_MESH_Data) +
+ sizeof (struct GNUNET_CADET_Data) +
sizeof (struct GNUNET_MessageHeader))
{
GNUNET_break (0);
@@ -1314,16 +1314,16 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
static void
-handle_data_ack (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_DataACK *msg,
+handle_data_ack (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_DataACK *msg,
int fwd)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
size_t size;
/* Check size */
size = ntohs (msg->header.size);
- if (size != sizeof (struct GNUNET_MESH_DataACK))
+ if (size != sizeof (struct GNUNET_CADET_DataACK))
{
GNUNET_break (0);
return;
@@ -1351,15 +1351,15 @@
* @param msg Data message.
*/
static void
-handle_ch_create (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_ChannelCreate *msg)
+handle_ch_create (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_ChannelCreate *msg)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
size_t size;
/* Check size */
size = ntohs (msg->header.size);
- if (size != sizeof (struct GNUNET_MESH_ChannelCreate))
+ if (size != sizeof (struct GNUNET_CADET_ChannelCreate))
{
GNUNET_break (0);
return;
@@ -1386,15 +1386,15 @@
* @param msg NACK message.
*/
static void
-handle_ch_nack (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_ChannelManage *msg)
+handle_ch_nack (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_ChannelManage *msg)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
size_t size;
/* Check size */
size = ntohs (msg->header.size);
- if (size != sizeof (struct GNUNET_MESH_ChannelManage))
+ if (size != sizeof (struct GNUNET_CADET_ChannelManage))
{
GNUNET_break (0);
return;
@@ -1426,16 +1426,16 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
static void
-handle_ch_ack (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_ChannelManage *msg,
+handle_ch_ack (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_ChannelManage *msg,
int fwd)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
size_t size;
/* Check size */
size = ntohs (msg->header.size);
- if (size != sizeof (struct GNUNET_MESH_ChannelManage))
+ if (size != sizeof (struct GNUNET_CADET_ChannelManage))
{
GNUNET_break (0);
return;
@@ -1468,16 +1468,16 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
static void
-handle_ch_destroy (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_ChannelManage *msg,
+handle_ch_destroy (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_ChannelManage *msg,
int fwd)
{
- struct MeshChannel *ch;
+ struct CadetChannel *ch;
size_t size;
/* Check size */
size = ntohs (msg->header.size);
- if (size != sizeof (struct GNUNET_MESH_ChannelManage))
+ if (size != sizeof (struct GNUNET_CADET_ChannelManage))
{
GNUNET_break (0);
return;
@@ -1502,8 +1502,8 @@
* @param msg Key eXchange message.
*/
static void
-handle_ephemeral (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_KX_Ephemeral *msg)
+handle_ephemeral (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_KX_Ephemeral *msg)
{
struct GNUNET_HashCode km;
LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GMT_2s (t));
@@ -1517,11 +1517,11 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " km is %s\n", GNUNET_h2s (&km));
derive_symmertic (&t->e_key, &my_full_id, GMP_get_id (t->peer), &km);
derive_symmertic (&t->d_key, GMP_get_id (t->peer), &my_full_id, &km);
- if (MESH_TUNNEL3_KEY_SENT == t->estate)
+ if (CADET_TUNNEL3_KEY_SENT == t->estate)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " our key was sent, send ping\n");
send_ping (t);
- t->estate = MESH_TUNNEL3_KEY_PING;
+ t->estate = CADET_TUNNEL3_KEY_PING;
}
}
@@ -1534,10 +1534,10 @@
* @param msg Key eXchange Ping message.
*/
static void
-handle_ping (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_KX_Ping *msg)
+handle_ping (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_KX_Ping *msg)
{
- struct GNUNET_MESH_KX_Ping res;
+ struct GNUNET_CADET_KX_Ping res;
if (ntohs (msg->header.size) != sizeof (res))
{
@@ -1572,8 +1572,8 @@
* @param msg Key eXchange Pong message.
*/
static void
-handle_pong (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_KX_Pong *msg)
+handle_pong (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_KX_Pong *msg)
{
uint32_t challenge;
@@ -1597,7 +1597,7 @@
t->rekey_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_free (t->kx_ctx);
t->kx_ctx = NULL;
- GMT_change_estate (t, MESH_TUNNEL3_KEY_OK);
+ GMT_change_estate (t, CADET_TUNNEL3_KEY_OK);
}
@@ -1613,7 +1613,7 @@
* #GNUNET_SYSERR if message on a one-ended channel (remote)
*/
static void
-handle_decrypted (struct MeshTunnel3 *t,
+handle_decrypted (struct CadetTunnel3 *t,
const struct GNUNET_MessageHeader *msgh,
int fwd)
{
@@ -1624,39 +1624,39 @@
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
+ case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
/* Do nothing, connection aleady got updated. */
GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO);
break;
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
/* Don't send hop ACK, wait for client to ACK */
- handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
+ handle_data (t, (struct GNUNET_CADET_Data *) msgh, fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
- handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd);
+ case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
+ handle_data_ack (t, (struct GNUNET_CADET_DataACK *) msgh, fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
handle_ch_create (t,
- (struct GNUNET_MESH_ChannelCreate *) msgh);
+ (struct GNUNET_CADET_ChannelCreate *) msgh);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
handle_ch_nack (t,
- (struct GNUNET_MESH_ChannelManage *) msgh);
+ (struct GNUNET_CADET_ChannelManage *) msgh);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
handle_ch_ack (t,
- (struct GNUNET_MESH_ChannelManage *) msgh,
+ (struct GNUNET_CADET_ChannelManage *) msgh,
fwd);
break;
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
handle_ch_destroy (t,
- (struct GNUNET_MESH_ChannelManage *) msgh,
+ (struct GNUNET_CADET_ChannelManage *) msgh,
fwd);
break;
@@ -1681,16 +1681,16 @@
* @param msg Encrypted message.
*/
void
-GMT_handle_encrypted (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_Encrypted *msg)
+GMT_handle_encrypted (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_Encrypted *msg)
{
size_t size = ntohs (msg->header.size);
- size_t payload_size = size - sizeof (struct GNUNET_MESH_Encrypted);
+ size_t payload_size = size - sizeof (struct GNUNET_CADET_Encrypted);
size_t decrypted_size;
char cbuf [payload_size];
struct GNUNET_MessageHeader *msgh;
unsigned int off;
- struct GNUNET_MESH_Hash hmac;
+ struct GNUNET_CADET_Hash hmac;
decrypted_size = t_decrypt (t, cbuf, &msg[1], payload_size, msg->iv);
t_hmac (t, &msg[1], payload_size, msg->iv, GNUNET_NO, &hmac);
@@ -1720,7 +1720,7 @@
* @param message Payload of KX message.
*/
void
-GMT_handle_kx (struct MeshTunnel3 *t,
+GMT_handle_kx (struct CadetTunnel3 *t,
const struct GNUNET_MessageHeader *message)
{
uint16_t type;
@@ -1729,16 +1729,16 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "kx message received\n", type);
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL:
- handle_ephemeral (t, (struct GNUNET_MESH_KX_Ephemeral *) message);
+ case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL:
+ handle_ephemeral (t, (struct GNUNET_CADET_KX_Ephemeral *) message);
break;
- case GNUNET_MESSAGE_TYPE_MESH_KX_PING:
- handle_ping (t, (struct GNUNET_MESH_KX_Ping *) message);
+ case GNUNET_MESSAGE_TYPE_CADET_KX_PING:
+ handle_ping (t, (struct GNUNET_CADET_KX_Ping *) message);
break;
- case GNUNET_MESSAGE_TYPE_MESH_KX_PONG:
- handle_pong (t, (struct GNUNET_MESH_KX_Pong *) message);
+ case GNUNET_MESSAGE_TYPE_CADET_KX_PONG:
+ handle_pong (t, (struct GNUNET_CADET_KX_Pong *) message);
break;
default:
@@ -1760,15 +1760,15 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DEFAULT_TTL",
+ GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DEFAULT_TTL",
&default_ttl))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
- "MESH", "DEFAULT_TTL", "USING DEFAULT");
+ "CADET", "DEFAULT_TTL", "USING DEFAULT");
default_ttl = 64;
}
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (c, "MESH", "REKEY_PERIOD",
+ GNUNET_CONFIGURATION_get_value_time (c, "CADET", "REKEY_PERIOD",
&rekey_period))
{
rekey_period = GNUNET_TIME_UNIT_DAYS;
@@ -1776,8 +1776,8 @@
my_private_key = key;
kx_msg.header.size = htons (sizeof (kx_msg));
- kx_msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL);
- kx_msg.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_MESH_KX);
+ kx_msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL);
+ kx_msg.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CADET_KX);
kx_msg.purpose.size = htonl (ephemeral_purpose_size ());
kx_msg.origin_identity = my_full_id;
rekey_task = GNUNET_SCHEDULER_add_now (&rekey, NULL);
@@ -1807,12 +1807,12 @@
*
* @param destination Peer this tunnel is towards.
*/
-struct MeshTunnel3 *
-GMT_new (struct MeshPeer *destination)
+struct CadetTunnel3 *
+GMT_new (struct CadetPeer *destination)
{
- struct MeshTunnel3 *t;
+ struct CadetTunnel3 *t;
- t = GNUNET_new (struct MeshTunnel3);
+ t = GNUNET_new (struct CadetTunnel3);
t->next_chid = 0;
t->peer = destination;
@@ -1835,23 +1835,23 @@
* @param cstate New connection state.
*/
void
-GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate)
+GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate)
{
if (NULL == t)
return;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s cstate %s => %s\n",
GMP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate));
if (myid != GMP_get_short_id (t->peer) &&
- MESH_TUNNEL3_READY != t->cstate &&
- MESH_TUNNEL3_READY == cstate)
+ CADET_TUNNEL3_READY != t->cstate &&
+ CADET_TUNNEL3_READY == cstate)
{
t->cstate = cstate;
- if (MESH_TUNNEL3_KEY_OK == t->estate)
+ if (CADET_TUNNEL3_KEY_OK == t->estate)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered send queued data\n");
send_queued_data (t);
}
- else if (MESH_TUNNEL3_KEY_UNINITIALIZED == t->estate)
+ else if (CADET_TUNNEL3_KEY_UNINITIALIZED == t->estate)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered rekey\n");
rekey_tunnel (t, NULL);
@@ -1859,7 +1859,7 @@
}
t->cstate = cstate;
- if (MESH_TUNNEL3_READY == cstate
+ if (CADET_TUNNEL3_READY == cstate
&& CONNECTIONS_PER_TUNNEL <= GMT_count_connections (t))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered stop dht\n");
@@ -1874,7 +1874,7 @@
* @param state New encryption state.
*/
void
-GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state)
+GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state)
{
if (NULL == t)
return;
@@ -1885,7 +1885,7 @@
"Tunnel %s estate is now %s\n",
GMP_2s (t->peer), estate2s (state));
if (myid != GMP_get_short_id (t->peer) &&
- MESH_TUNNEL3_KEY_OK != t->estate && MESH_TUNNEL3_KEY_OK == state)
+ CADET_TUNNEL3_KEY_OK != t->estate && CADET_TUNNEL3_KEY_OK == state)
{
t->estate = state;
send_queued_data (t);
@@ -1908,15 +1908,15 @@
static void
trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshTunnel3 *t = cls;
+ struct CadetTunnel3 *t = cls;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
if (GMT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL)
{
- struct MeshTConnection *iter;
- struct MeshTConnection *c;
+ struct CadetTConnection *iter;
+ struct CadetTConnection *c;
for (c = iter = t->connection_head; NULL != iter; iter = iter->next)
{
@@ -1949,9 +1949,9 @@
* @param c Connection.
*/
void
-GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c)
+GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c)
{
- struct MeshTConnection *aux;
+ struct CadetTConnection *aux;
GNUNET_assert (NULL != c);
@@ -1961,7 +1961,7 @@
if (aux->c == c)
return;
- aux = GNUNET_new (struct MeshTConnection);
+ aux = GNUNET_new (struct CadetTConnection);
aux->c = c;
aux->created = GNUNET_TIME_absolute_get ();
@@ -1978,7 +1978,7 @@
* @param path Invalid path to remove. Is destroyed after removal.
*/
void
-GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path)
+GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path)
{
GMP_remove_path (t->peer, path);
}
@@ -1991,11 +1991,11 @@
* @param c Connection.
*/
void
-GMT_remove_connection (struct MeshTunnel3 *t,
- struct MeshConnection *c)
+GMT_remove_connection (struct CadetTunnel3 *t,
+ struct CadetConnection *c)
{
- struct MeshTConnection *aux;
- struct MeshTConnection *next;
+ struct CadetTConnection *aux;
+ struct CadetTConnection *next;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n",
GMC_2s (c), GMT_2s (t));
@@ -2012,25 +2012,25 @@
/* Start new connections if needed */
if (CONNECTIONS_PER_TUNNEL < GMT_count_connections (t)
&& GNUNET_SCHEDULER_NO_TASK == t->destroy_task
- && MESH_TUNNEL3_SHUTDOWN != t->cstate
+ && CADET_TUNNEL3_SHUTDOWN != t->cstate
&& GNUNET_NO == shutting_down)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n");
- t->cstate = MESH_TUNNEL3_SEARCHING;
+ t->cstate = CADET_TUNNEL3_SEARCHING;
GMP_connect (t->peer);
return;
}
/* If not marked as ready, no change is needed */
- if (MESH_TUNNEL3_READY != t->cstate)
+ if (CADET_TUNNEL3_READY != t->cstate)
return;
/* Check if any connection is ready to maintaing cstate */
for (aux = t->connection_head; aux != NULL; aux = aux->next)
- if (MESH_CONNECTION_READY == GMC_get_state (aux->c))
+ if (CADET_CONNECTION_READY == GMC_get_state (aux->c))
return;
- t->cstate = MESH_TUNNEL3_WAITING;
+ t->cstate = CADET_TUNNEL3_WAITING;
}
@@ -2041,9 +2041,9 @@
* @param ch Channel.
*/
void
-GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch)
+GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch)
{
- struct MeshTChannel *aux;
+ struct CadetTChannel *aux;
GNUNET_assert (NULL != ch);
@@ -2056,7 +2056,7 @@
return;
}
- aux = GNUNET_new (struct MeshTChannel);
+ aux = GNUNET_new (struct CadetTChannel);
aux->ch = ch;
LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head);
GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux);
@@ -2077,9 +2077,9 @@
* @param ch Channel.
*/
void
-GMT_remove_channel (struct MeshTunnel3 *t, struct MeshChannel *ch)
+GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch)
{
- struct MeshTChannel *aux;
+ struct CadetTChannel *aux;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing channel %p from tunnel %p\n", ch, t);
for (aux = t->channel_head; aux != NULL; aux = aux->next)
@@ -2103,10 +2103,10 @@
*
* @return channel handler, NULL if doesn't exist
*/
-struct MeshChannel *
-GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid)
+struct CadetChannel *
+GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid)
{
- struct MeshTChannel *iter;
+ struct CadetTChannel *iter;
if (NULL == t)
return NULL;
@@ -2134,8 +2134,8 @@
static void
delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshTunnel3 *t = cls;
- struct MeshTConnection *iter;
+ struct CadetTunnel3 *t = cls;
+ struct CadetTConnection *iter;
LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t);
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
@@ -2146,7 +2146,7 @@
return;
}
t->destroy_task = GNUNET_SCHEDULER_NO_TASK;
- t->cstate = MESH_TUNNEL3_SHUTDOWN;
+ t->cstate = CADET_TUNNEL3_SHUTDOWN;
for (iter = t->connection_head; NULL != iter; iter = iter->next)
{
@@ -2164,7 +2164,7 @@
* @param t Tunnel to destroy.
*/
void
-GMT_destroy_empty (struct MeshTunnel3 *t)
+GMT_destroy_empty (struct CadetTunnel3 *t)
{
if (GNUNET_YES == shutting_down)
return; /* Will be destroyed immediately anyway */
@@ -2198,7 +2198,7 @@
* @param t Tunnel to destroy if empty.
*/
void
-GMT_destroy_if_empty (struct MeshTunnel3 *t)
+GMT_destroy_if_empty (struct CadetTunnel3 *t)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GMT_2s (t));
if (1 < GMT_count_channels (t))
@@ -2220,12 +2220,12 @@
* @param t The tunnel to destroy.
*/
void
-GMT_destroy (struct MeshTunnel3 *t)
+GMT_destroy (struct CadetTunnel3 *t)
{
- struct MeshTConnection *iter_c;
- struct MeshTConnection *next_c;
- struct MeshTChannel *iter_ch;
- struct MeshTChannel *next_ch;
+ struct CadetTConnection *iter_c;
+ struct CadetTConnection *next_c;
+ struct CadetTChannel *iter_ch;
+ struct CadetTChannel *next_ch;
if (NULL == t)
return;
@@ -2282,11 +2282,11 @@
*
* @return Connection created.
*/
-struct MeshConnection *
-GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p)
+struct CadetConnection *
+GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p)
{
- struct MeshConnection *c;
- struct GNUNET_MESH_Hash cid;
+ struct CadetConnection *c;
+ struct GNUNET_CADET_Hash cid;
unsigned int own_pos;
if (NULL == t || NULL == p)
@@ -2295,7 +2295,7 @@
return NULL;
}
- if (MESH_TUNNEL3_SHUTDOWN == t->cstate)
+ if (CADET_TUNNEL3_SHUTDOWN == t->cstate)
{
GNUNET_break (0);
return NULL;
@@ -2332,16 +2332,16 @@
* @return Number of connections.
*/
unsigned int
-GMT_count_connections (struct MeshTunnel3 *t)
+GMT_count_connections (struct CadetTunnel3 *t)
{
- struct MeshTConnection *iter;
+ struct CadetTConnection *iter;
unsigned int count;
if (NULL == t)
return 0;
for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next)
- if (MESH_CONNECTION_DESTROYED != GMC_get_state (iter->c))
+ if (CADET_CONNECTION_DESTROYED != GMC_get_state (iter->c))
count++;
return count;
@@ -2355,9 +2355,9 @@
* @return Number of channels.
*/
unsigned int
-GMT_count_channels (struct MeshTunnel3 *t)
+GMT_count_channels (struct CadetTunnel3 *t)
{
- struct MeshTChannel *iter;
+ struct CadetTChannel *iter;
unsigned int count;
for (count = 0, iter = t->channel_head;
@@ -2375,13 +2375,13 @@
*
* @return Tunnel's connectivity state.
*/
-enum MeshTunnel3CState
-GMT_get_cstate (struct MeshTunnel3 *t)
+enum CadetTunnel3CState
+GMT_get_cstate (struct CadetTunnel3 *t)
{
if (NULL == t)
{
GNUNET_assert (0);
- return (enum MeshTunnel3CState) -1;
+ return (enum CadetTunnel3CState) -1;
}
return t->cstate;
}
@@ -2394,13 +2394,13 @@
*
* @return Tunnel's encryption state.
*/
-enum MeshTunnel3EState
-GMT_get_estate (struct MeshTunnel3 *t)
+enum CadetTunnel3EState
+GMT_get_estate (struct CadetTunnel3 *t)
{
if (NULL == t)
{
GNUNET_assert (0);
- return (enum MeshTunnel3EState) -1;
+ return (enum CadetTunnel3EState) -1;
}
return t->estate;
}
@@ -2413,9 +2413,9 @@
* @return Biggest buffer space offered by any channel in the tunnel.
*/
unsigned int
-GMT_get_channels_buffer (struct MeshTunnel3 *t)
+GMT_get_channels_buffer (struct CadetTunnel3 *t)
{
- struct MeshTChannel *iter;
+ struct CadetTChannel *iter;
unsigned int buffer;
unsigned int ch_buf;
@@ -2444,15 +2444,15 @@
* @return Buffer space offered by all connections in the tunnel.
*/
unsigned int
-GMT_get_connections_buffer (struct MeshTunnel3 *t)
+GMT_get_connections_buffer (struct CadetTunnel3 *t)
{
- struct MeshTConnection *iter;
+ struct CadetTConnection *iter;
unsigned int buffer;
buffer = 0;
for (iter = t->connection_head; NULL != iter; iter = iter->next)
{
- if (GMC_get_state (iter->c) != MESH_CONNECTION_READY)
+ if (GMC_get_state (iter->c) != CADET_CONNECTION_READY)
{
continue;
}
@@ -2471,7 +2471,7 @@
* @return ID of the destination peer.
*/
const struct GNUNET_PeerIdentity *
-GMT_get_destination (struct MeshTunnel3 *t)
+GMT_get_destination (struct CadetTunnel3 *t)
{
return GMP_get_id (t->peer);
}
@@ -2484,11 +2484,11 @@
*
* @return GID of a channel free to use.
*/
-MESH_ChannelNumber
-GMT_get_next_chid (struct MeshTunnel3 *t)
+CADET_ChannelNumber
+GMT_get_next_chid (struct CadetTunnel3 *t)
{
- MESH_ChannelNumber chid;
- MESH_ChannelNumber mask;
+ CADET_ChannelNumber chid;
+ CADET_ChannelNumber mask;
int result;
/* Set bit 30 depending on the ID relationship. Bit 31 is always 0 for GID.
@@ -2505,11 +2505,11 @@
while (NULL != GMT_get_channel (t, t->next_chid))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid);
- t->next_chid = (t->next_chid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI;
+ t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
t->next_chid |= mask;
}
chid = t->next_chid;
- t->next_chid = (t->next_chid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI;
+ t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
t->next_chid |= mask;
return chid;
@@ -2522,13 +2522,13 @@
* @param t Channel which has some free buffer space.
*/
void
-GMT_unchoke_channels (struct MeshTunnel3 *t)
+GMT_unchoke_channels (struct CadetTunnel3 *t)
{
- struct MeshTChannel *iter;
+ struct CadetTChannel *iter;
unsigned int buffer;
unsigned int channels = GMT_count_channels (t);
unsigned int choked_n;
- struct MeshChannel *choked[channels];
+ struct CadetChannel *choked[channels];
LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_unchoke_channels on %s\n", GMT_2s (t));
LOG (GNUNET_ERROR_TYPE_DEBUG, " head: %p\n", t->channel_head);
@@ -2573,9 +2573,9 @@
* @param t Tunnel.
*/
void
-GMT_send_connection_acks (struct MeshTunnel3 *t)
+GMT_send_connection_acks (struct CadetTunnel3 *t)
{
- struct MeshTConnection *iter;
+ struct CadetTConnection *iter;
uint32_t allowed;
uint32_t to_allow;
uint32_t allow_per_connection;
@@ -2640,7 +2640,7 @@
* @param q Handle to the queue.
*/
void
-GMT_cancel (struct MeshTunnel3Queue *q)
+GMT_cancel (struct CadetTunnel3Queue *q)
{
if (NULL != q->cq)
{
@@ -2675,9 +2675,9 @@
*
* @return Handle to cancel message. NULL if @c cont is NULL.
*/
-struct MeshTunnel3Queue *
+struct CadetTunnel3Queue *
GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
- struct MeshTunnel3 *t, struct MeshConnection *c,
+ struct CadetTunnel3 *t, struct CadetConnection *c,
int force, GMT_sent cont, void *cont_cls)
{
return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL);
@@ -2692,7 +2692,7 @@
* @return #GNUNET_YES if it is loopback.
*/
int
-GMT_is_loopback (const struct MeshTunnel3 *t)
+GMT_is_loopback (const struct CadetTunnel3 *t)
{
return (myid == GMP_get_short_id (t->peer));
}
@@ -2707,9 +2707,9 @@
* @return #GNUNET_YES a connection uses this path.
*/
int
-GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p)
+GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p)
{
- struct MeshTConnection *iter;
+ struct CadetTConnection *iter;
for (iter = t->connection_head; NULL != iter; iter = iter->next)
if (GMC_get_path (iter->c) == p)
@@ -2728,11 +2728,11 @@
* @return Cost of the path (path length + number of overlapping nodes)
*/
unsigned int
-GMT_get_path_cost (const struct MeshTunnel3 *t,
- const struct MeshPeerPath *path)
+GMT_get_path_cost (const struct CadetTunnel3 *t,
+ const struct CadetPeerPath *path)
{
- struct MeshTConnection *iter;
- const struct MeshPeerPath *aux;
+ struct CadetTConnection *iter;
+ const struct CadetPeerPath *aux;
unsigned int overlap;
unsigned int i;
unsigned int j;
@@ -2773,7 +2773,7 @@
* @return Static string the destination peer's ID.
*/
const char *
-GMT_2s (const struct MeshTunnel3 *t)
+GMT_2s (const struct CadetTunnel3 *t)
{
if (NULL == t)
return "(NULL)";
@@ -2793,10 +2793,10 @@
* @param t Tunnel to debug.
*/
void
-GMT_debug (const struct MeshTunnel3 *t)
+GMT_debug (const struct CadetTunnel3 *t)
{
- struct MeshTChannel *iterch;
- struct MeshTConnection *iterc;
+ struct CadetTChannel *iterch;
+ struct CadetTConnection *iterc;
LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GMT_2s (t));
LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT cstate %s, estate %s\n",
@@ -2861,9 +2861,9 @@
* @param cls Closure for @c iter.
*/
void
-GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls)
+GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls)
{
- struct MeshTConnection *ct;
+ struct CadetTConnection *ct;
for (ct = t->connection_head; NULL != ct; ct = ct->next)
iter (cls, ct->c);
@@ -2878,9 +2878,9 @@
* @param cls Closure for @c iter.
*/
void
-GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls)
+GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls)
{
- struct MeshTChannel *cht;
+ struct CadetTChannel *cht;
for (cht = t->channel_head; NULL != cht; cht = cht->next)
iter (cls, cht->ch);
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.h 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.h 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/gnunet-service-mesh_tunnel.h
- * @brief mesh service; dealing with tunnels and crypto
+ * @file cadet/gnunet-service-cadet_tunnel.h
+ * @brief cadet service; dealing with tunnels and crypto
* @author Bartlomiej Polot
*
- * All functions in this file should use the prefix GMT (Gnunet Mesh Tunnel)
+ * All functions in this file should use the prefix GMT (Gnunet Cadet Tunnel)
*/
-#ifndef GNUNET_SERVICE_MESH_TUNNEL_H
-#define GNUNET_SERVICE_MESH_TUNNEL_H
+#ifndef GNUNET_SERVICE_CADET_TUNNEL_H
+#define GNUNET_SERVICE_CADET_TUNNEL_H
#ifdef __cplusplus
extern "C"
@@ -43,77 +43,77 @@
/**
* All the connectivity states a tunnel can be in.
*/
-enum MeshTunnel3CState
+enum CadetTunnel3CState
{
/**
* Uninitialized status, should never appear in operation.
*/
- MESH_TUNNEL3_NEW,
+ CADET_TUNNEL3_NEW,
/**
* Path to the peer not known yet.
*/
- MESH_TUNNEL3_SEARCHING,
+ CADET_TUNNEL3_SEARCHING,
/**
* Request sent, not yet answered.
*/
- MESH_TUNNEL3_WAITING,
+ CADET_TUNNEL3_WAITING,
/**
* Peer connected and ready to accept data.
*/
- MESH_TUNNEL3_READY,
+ CADET_TUNNEL3_READY,
/**
* Tunnel being shut down, don't try to keep it alive.
*/
- MESH_TUNNEL3_SHUTDOWN
+ CADET_TUNNEL3_SHUTDOWN
};
/**
* All the encryption states a tunnel can be in.
*/
-enum MeshTunnel3EState
+enum CadetTunnel3EState
{
/**
* Uninitialized status, should never appear in operation.
*/
- MESH_TUNNEL3_KEY_UNINITIALIZED,
+ CADET_TUNNEL3_KEY_UNINITIALIZED,
/**
* Ephemeral key sent, waiting for peer's key.
*/
- MESH_TUNNEL3_KEY_SENT,
+ CADET_TUNNEL3_KEY_SENT,
/**
* New ephemeral key and ping sent, waiting for pong.
* This means that we DO have the peer's ephemeral key, otherwise the
* state would be KEY_SENT.
*/
- MESH_TUNNEL3_KEY_PING,
+ CADET_TUNNEL3_KEY_PING,
/**
* Handshake completed: session key available.
*/
- MESH_TUNNEL3_KEY_OK,
+ CADET_TUNNEL3_KEY_OK,
};
/**
* Struct containing all information regarding a given peer
*/
-struct MeshTunnel3;
+struct CadetTunnel3;
-#include "gnunet-service-mesh_channel.h"
-#include "gnunet-service-mesh_connection.h"
-#include "gnunet-service-mesh_peer.h"
+#include "gnunet-service-cadet_channel.h"
+#include "gnunet-service-cadet_connection.h"
+#include "gnunet-service-cadet_peer.h"
/**
* Handle for messages queued but not yet sent.
*/
-struct MeshTunnel3Queue;
+struct CadetTunnel3Queue;
/**
* Callback called when a queued message is sent.
@@ -124,12 +124,12 @@
* @param size Size of the message.
*/
typedef void (*GMT_sent) (void *cls,
- struct MeshTunnel3 *t,
- struct MeshTunnel3Queue *q,
+ struct CadetTunnel3 *t,
+ struct CadetTunnel3Queue *q,
uint16_t type, size_t size);
-typedef void (*GMT_conn_iter) (void *cls, struct MeshConnection *c);
-typedef void (*GMT_chan_iter) (void *cls, struct MeshChannel *ch);
+typedef void (*GMT_conn_iter) (void *cls, struct CadetConnection *c);
+typedef void (*GMT_chan_iter) (void *cls, struct CadetChannel *ch);
/******************************************************************************/
@@ -157,8 +157,8 @@
*
* @param destination Peer this tunnel is towards.
*/
-struct MeshTunnel3 *
-GMT_new (struct MeshPeer *destination);
+struct CadetTunnel3 *
+GMT_new (struct CadetPeer *destination);
/**
* Tunnel is empty: destroy it.
@@ -168,7 +168,7 @@
* @param t Tunnel to destroy.
*/
void
-GMT_destroy_empty (struct MeshTunnel3 *t);
+GMT_destroy_empty (struct CadetTunnel3 *t);
/**
* Destroy tunnel if empty (no more channels).
@@ -176,7 +176,7 @@
* @param t Tunnel to destroy if empty.
*/
void
-GMT_destroy_if_empty (struct MeshTunnel3 *t);
+GMT_destroy_if_empty (struct CadetTunnel3 *t);
/**
* Destroy the tunnel.
@@ -190,7 +190,7 @@
* @param t The tunnel to destroy.
*/
void
-GMT_destroy (struct MeshTunnel3 *t);
+GMT_destroy (struct CadetTunnel3 *t);
/**
@@ -200,7 +200,7 @@
* @param cstate New connection state.
*/
void
-GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate);
+GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate);
/**
@@ -210,7 +210,7 @@
* @param state New encryption state.
*/
void
-GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state);
+GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state);
/**
* Add a connection to a tunnel.
@@ -219,7 +219,7 @@
* @param c Connection.
*/
void
-GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c);
+GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c);
/**
* Mark a path as no longer valid for this tunnel: has been tried and failed.
@@ -228,7 +228,7 @@
* @param path Invalid path to remove. Is destroyed after removal.
*/
void
-GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path);
+GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path);
/**
* Remove a connection from a tunnel.
@@ -237,7 +237,7 @@
* @param c Connection.
*/
void
-GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c);
+GMT_remove_connection (struct CadetTunnel3 *t, struct CadetConnection *c);
/**
* Add a channel to a tunnel.
@@ -246,7 +246,7 @@
* @param ch Channel.
*/
void
-GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch);
+GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch);
/**
* Remove a channel from a tunnel.
@@ -255,7 +255,7 @@
* @param ch Channel.
*/
void
-GMT_remove_channel (struct MeshTunnel3 *t, struct MeshChannel *ch);
+GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch);
/**
* Search for a channel by global ID.
@@ -265,8 +265,8 @@
*
* @return channel handler, NULL if doesn't exist
*/
-struct MeshChannel *
-GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid);
+struct CadetChannel *
+GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid);
/**
* Decrypt and demultiplex by message type. Call appropriate handler
@@ -277,8 +277,8 @@
* @param msg Message header.
*/
void
-GMT_handle_encrypted (struct MeshTunnel3 *t,
- const struct GNUNET_MESH_Encrypted *msg);
+GMT_handle_encrypted (struct CadetTunnel3 *t,
+ const struct GNUNET_CADET_Encrypted *msg);
/**
* Demultiplex an encapsulated KX message by message type.
@@ -287,7 +287,7 @@
* @param message KX message itself.
*/
void
-GMT_handle_kx (struct MeshTunnel3 *t,
+GMT_handle_kx (struct CadetTunnel3 *t,
const struct GNUNET_MessageHeader *message);
/**
@@ -300,8 +300,8 @@
*
* @return Connection created.
*/
-struct MeshConnection *
-GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p);
+struct CadetConnection *
+GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p);
/**
* Count established (ready) connections of a tunnel.
@@ -311,7 +311,7 @@
* @return Number of connections.
*/
unsigned int
-GMT_count_connections (struct MeshTunnel3 *t);
+GMT_count_connections (struct CadetTunnel3 *t);
/**
* Count channels of a tunnel.
@@ -321,7 +321,7 @@
* @return Number of channels.
*/
unsigned int
-GMT_count_channels (struct MeshTunnel3 *t);
+GMT_count_channels (struct CadetTunnel3 *t);
/**
* Get the connectivity state of a tunnel.
@@ -330,8 +330,8 @@
*
* @return Tunnel's connectivity state.
*/
-enum MeshTunnel3CState
-GMT_get_cstate (struct MeshTunnel3 *t);
+enum CadetTunnel3CState
+GMT_get_cstate (struct CadetTunnel3 *t);
/**
* Get the encryption state of a tunnel.
@@ -340,8 +340,8 @@
*
* @return Tunnel's encryption state.
*/
-enum MeshTunnel3EState
-GMT_get_estate (struct MeshTunnel3 *t);
+enum CadetTunnel3EState
+GMT_get_estate (struct CadetTunnel3 *t);
/**
* Get the maximum buffer space for a tunnel towards a local client.
@@ -351,7 +351,7 @@
* @return Biggest buffer space offered by any channel in the tunnel.
*/
unsigned int
-GMT_get_channels_buffer (struct MeshTunnel3 *t);
+GMT_get_channels_buffer (struct CadetTunnel3 *t);
/**
* Get the total buffer space for a tunnel for P2P traffic.
@@ -361,7 +361,7 @@
* @return Buffer space offered by all connections in the tunnel.
*/
unsigned int
-GMT_get_connections_buffer (struct MeshTunnel3 *t);
+GMT_get_connections_buffer (struct CadetTunnel3 *t);
/**
* Get the tunnel's destination.
@@ -371,7 +371,7 @@
* @return ID of the destination peer.
*/
const struct GNUNET_PeerIdentity *
-GMT_get_destination (struct MeshTunnel3 *t);
+GMT_get_destination (struct CadetTunnel3 *t);
/**
* Get the tunnel's next free Channel ID.
@@ -380,8 +380,8 @@
*
* @return ID of a channel free to use.
*/
-MESH_ChannelNumber
-GMT_get_next_chid (struct MeshTunnel3 *t);
+CADET_ChannelNumber
+GMT_get_next_chid (struct CadetTunnel3 *t);
/**
* Send ACK on one or more channels due to buffer in connections.
@@ -389,7 +389,7 @@
* @param t Channel which has some free buffer space.
*/
void
-GMT_unchoke_channels (struct MeshTunnel3 *t);
+GMT_unchoke_channels (struct CadetTunnel3 *t);
/**
* Send ACK on one or more connections due to buffer space to the client.
@@ -399,7 +399,7 @@
* @param t Tunnel which has some free buffer space.
*/
void
-GMT_send_connection_acks (struct MeshTunnel3 *t);
+GMT_send_connection_acks (struct CadetTunnel3 *t);
/**
* Cancel a previously sent message while it's in the queue.
@@ -411,7 +411,7 @@
* @param q Handle to the queue.
*/
void
-GMT_cancel (struct MeshTunnel3Queue *q);
+GMT_cancel (struct CadetTunnel3Queue *q);
/**
* Sends an already built message on a tunnel, encrypting it and
@@ -426,9 +426,9 @@
*
* @return Handle to cancel message. NULL if @c cont is NULL.
*/
-struct MeshTunnel3Queue *
+struct CadetTunnel3Queue *
GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
- struct MeshTunnel3 *t, struct MeshConnection *c,
+ struct CadetTunnel3 *t, struct CadetConnection *c,
int force, GMT_sent cont, void *cont_cls);
/**
@@ -439,7 +439,7 @@
* @return #GNUNET_YES if it is loopback.
*/
int
-GMT_is_loopback (const struct MeshTunnel3 *t);
+GMT_is_loopback (const struct CadetTunnel3 *t);
/**
* Is the tunnel using this path already?
@@ -450,7 +450,7 @@
* @return #GNUNET_YES a connection uses this path.
*/
int
-GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p);
+GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p);
/**
* Get a cost of a path for a tunnel considering existing connections.
@@ -461,8 +461,8 @@
* @return Cost of the path (path length + number of overlapping nodes)
*/
unsigned int
-GMT_get_path_cost (const struct MeshTunnel3 *t,
- const struct MeshPeerPath *path);
+GMT_get_path_cost (const struct CadetTunnel3 *t,
+ const struct CadetPeerPath *path);
/**
* Get the static string for the peer this tunnel is directed.
@@ -472,7 +472,7 @@
* @return Static string the destination peer's ID.
*/
const char *
-GMT_2s (const struct MeshTunnel3 *t);
+GMT_2s (const struct CadetTunnel3 *t);
/**
* Log all possible info about the tunnel state.
@@ -480,7 +480,7 @@
* @param t Tunnel to debug.
*/
void
-GMT_debug (const struct MeshTunnel3 *t);
+GMT_debug (const struct CadetTunnel3 *t);
/**
* Iterate all tunnels.
@@ -507,7 +507,7 @@
* @param cls Closure for @c iter.
*/
void
-GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls);
+GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void
*cls);
/**
* Iterate all channels of a tunnel.
@@ -517,7 +517,7 @@
* @param cls Closure for @c iter.
*/
void
-GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls);
+GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls);
#if 0 /* keep Emacsens' auto-indent happy */
{
@@ -526,6 +526,6 @@
}
#endif
-/* ifndef GNUNET_MESH_SERVICE_TUNNEL_H */
+/* ifndef GNUNET_CADET_SERVICE_TUNNEL_H */
#endif
-/* end of gnunet-mesh-service_tunnel.h */
+/* end of gnunet-cadet-service_tunnel.h */
Modified: gnunet/src/mesh/mesh.h
===================================================================
--- gnunet/src/mesh/mesh.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -20,11 +20,11 @@
/**
* @author Bartlomiej Polot
- * @file mesh/mesh.h
+ * @file cadet/cadet.h
*/
-#ifndef MESH_H_
-#define MESH_H_
+#ifndef CADET_H_
+#define CADET_H_
#ifdef __cplusplus
extern "C"
@@ -36,21 +36,21 @@
#include <stdint.h>
-#define MESH_DEBUG GNUNET_YES
+#define CADET_DEBUG GNUNET_YES
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_peer_lib.h"
#include "gnunet_core_service.h"
#include "gnunet_protocols.h"
-#include <gnunet_mesh_service.h>
+#include <gnunet_cadet_service.h>
/******************************************************************************/
/************************** CONSTANTS
******************************/
/******************************************************************************/
-#define GNUNET_MESH_LOCAL_CHANNEL_ID_CLI 0x80000000
-#define GNUNET_MESH_LOCAL_CHANNEL_ID_SERV 0xB0000000
+#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000
+#define GNUNET_CADET_LOCAL_CHANNEL_ID_SERV 0xB0000000
#define HIGH_PID 0xFFFF0000
#define LOW_PID 0x0000FFFF
@@ -66,13 +66,13 @@
/**
* Message for a client to register to the service
*/
-struct GNUNET_MESH_ClientConnect
+struct GNUNET_CADET_ClientConnect
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT
*
- * Size: sizeof(struct GNUNET_MESH_ClientConnect) +
- * sizeof(MESH_ApplicationType) * applications +
+ * Size: sizeof(struct GNUNET_CADET_ClientConnect) +
+ * sizeof(CADET_ApplicationType) * applications +
* sizeof(uint16_t) * types
*/
struct GNUNET_MessageHeader header;
@@ -86,25 +86,25 @@
* - Local channel numbers given by the client (created) are >= 0x80000000
* - Global channel numbers are < 0x80000000
*/
-typedef uint32_t MESH_ChannelNumber;
+typedef uint32_t CADET_ChannelNumber;
/**
* Message for a client to create and destroy channels.
*/
-struct GNUNET_MESH_ChannelMessage
+struct GNUNET_CADET_ChannelMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY]
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_[CREATE|DESTROY]
*
- * Size: sizeof(struct GNUNET_MESH_ChannelMessage)
+ * Size: sizeof(struct GNUNET_CADET_ChannelMessage)
*/
struct GNUNET_MessageHeader header;
/**
* ID of a channel controlled by this client.
*/
- MESH_ChannelNumber channel_id GNUNET_PACKED;
+ CADET_ChannelNumber channel_id GNUNET_PACKED;
/**
* Channel's peer
@@ -124,12 +124,12 @@
/**
- * Message for mesh data traffic.
+ * Message for cadet data traffic.
*/
-struct GNUNET_MESH_LocalData
+struct GNUNET_CADET_LocalData
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA
*/
struct GNUNET_MessageHeader header;
@@ -148,17 +148,17 @@
* Message to allow the client send more data to the service
* (always service -> client).
*/
-struct GNUNET_MESH_LocalAck
+struct GNUNET_CADET_LocalAck
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel allowed to send more data.
*/
- MESH_ChannelNumber channel_id GNUNET_PACKED;
+ CADET_ChannelNumber channel_id GNUNET_PACKED;
};
@@ -166,17 +166,17 @@
/**
* Message to inform the client about channels in the service.
*/
-struct GNUNET_MESH_LocalInfo
+struct GNUNET_CADET_LocalInfo
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO[_TUNNEL,_PEER]
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO[_TUNNEL,_PEER]
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel allowed to send more data.
*/
- MESH_ChannelNumber channel_id GNUNET_PACKED;
+ CADET_ChannelNumber channel_id GNUNET_PACKED;
/**
* ID of the owner of the channel (can be local peer).
@@ -193,10 +193,10 @@
/**
* Message to inform the client about one of the peers in the service.
*/
-struct GNUNET_MESH_LocalInfoPeer
+struct GNUNET_CADET_LocalInfoPeer
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER[S]
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER[S]
*/
struct GNUNET_MessageHeader header;
@@ -222,10 +222,10 @@
/**
* Message to inform the client about one of the tunnels in the service.
*/
-struct GNUNET_MESH_LocalInfoTunnel
+struct GNUNET_CADET_LocalInfoTunnel
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL[S]
+ * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL[S]
*/
struct GNUNET_MessageHeader header;
@@ -311,7 +311,7 @@
/**
- * Convert a 256 bit MeshHash into a 512 HashCode to use in GNUNET_h2s,
+ * Convert a 256 bit CadetHash into a 512 HashCode to use in GNUNET_h2s,
* multihashmap, and other HashCode-based functions.
*
* @param id A 256 bit hash to expand.
@@ -319,14 +319,14 @@
* @return A HashCode containing the original 256 bit hash right-padded with 0.
*/
const struct GNUNET_HashCode *
-GM_h2hc (const struct GNUNET_MESH_Hash *id);
+GM_h2hc (const struct GNUNET_CADET_Hash *id);
/**
- * Get a string from a Mesh Hash (256 bits).
+ * Get a string from a Cadet Hash (256 bits).
* WARNING: Not reentrant (based on GNUNET_h2s).
*/
const char *
-GM_h2s (const struct GNUNET_MESH_Hash *id);
+GM_h2s (const struct GNUNET_CADET_Hash *id);
/**
* Convert a message type into a string to help debug
Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_api.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -16,18 +16,18 @@
*/
/**
- * @file mesh/mesh_api.c
- * @brief mesh api: client implementation of new mesh service
+ * @file cadet/cadet_api.c
+ * @brief cadet api: client implementation of new cadet service
* @author Bartlomiej Polot
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_mesh_service.h"
-#include "mesh.h"
-#include "mesh_protocol.h"
+#include "gnunet_cadet_service.h"
+#include "cadet.h"
+#include "cadet_protocol.h"
-#define LOG(kind,...) GNUNET_log_from (kind, "mesh-api",__VA_ARGS__)
+#define LOG(kind,...) GNUNET_log_from (kind, "cadet-api",__VA_ARGS__)
/******************************************************************************/
/************************ DATA STRUCTURES
****************************/
@@ -36,23 +36,23 @@
/**
* Transmission queue to the service
*/
-struct GNUNET_MESH_TransmitHandle
+struct GNUNET_CADET_TransmitHandle
{
/**
* Double Linked list
*/
- struct GNUNET_MESH_TransmitHandle *next;
+ struct GNUNET_CADET_TransmitHandle *next;
/**
* Double Linked list
*/
- struct GNUNET_MESH_TransmitHandle *prev;
+ struct GNUNET_CADET_TransmitHandle *prev;
/**
* Channel this message is sent on / for (may be NULL for control
messages).
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
/**
* Callback to obtain the message to transmit, or NULL if we
@@ -86,39 +86,39 @@
size_t size;
};
-union MeshInfoCB {
+union CadetInfoCB {
/**
* Channel callback.
*/
- GNUNET_MESH_ChannelCB channel_cb;
+ GNUNET_CADET_ChannelCB channel_cb;
/**
* Monitor callback
*/
- GNUNET_MESH_PeersCB peers_cb;
+ GNUNET_CADET_PeersCB peers_cb;
/**
* Monitor callback
*/
- GNUNET_MESH_PeerCB peer_cb;
+ GNUNET_CADET_PeerCB peer_cb;
/**
* Monitor callback
*/
- GNUNET_MESH_TunnelsCB tunnels_cb;
+ GNUNET_CADET_TunnelsCB tunnels_cb;
/**
* Tunnel callback.
*/
- GNUNET_MESH_TunnelCB tunnel_cb;
+ GNUNET_CADET_TunnelCB tunnel_cb;
};
/**
* Opaque handle to the service.
*/
-struct GNUNET_MESH_Handle
+struct GNUNET_CADET_Handle
{
/**
@@ -129,7 +129,7 @@
/**
* Set of handlers used for processing incoming messages in the channels
*/
- const struct GNUNET_MESH_MessageHandler *message_handlers;
+ const struct GNUNET_CADET_MessageHandler *message_handlers;
/**
* Number of handlers in the handlers array.
@@ -149,22 +149,22 @@
/**
* Double linked list of the channels this client is connected to, head.
*/
- struct GNUNET_MESH_Channel *channels_head;
+ struct GNUNET_CADET_Channel *channels_head;
/**
* Double linked list of the channels this client is connected to, tail.
*/
- struct GNUNET_MESH_Channel *channels_tail;
+ struct GNUNET_CADET_Channel *channels_tail;
/**
* Callback for inbound channel creation
*/
- GNUNET_MESH_InboundChannelNotificationHandler *new_channel;
+ GNUNET_CADET_InboundChannelNotificationHandler *new_channel;
/**
* Callback for inbound channel disconnection
*/
- GNUNET_MESH_ChannelEndHandler *cleaner;
+ GNUNET_CADET_ChannelEndHandler *cleaner;
/**
* Handle to cancel pending transmissions in case of disconnection
@@ -179,21 +179,21 @@
/**
* Messages to send to the service, head.
*/
- struct GNUNET_MESH_TransmitHandle *th_head;
+ struct GNUNET_CADET_TransmitHandle *th_head;
/**
* Messages to send to the service, tail.
*/
- struct GNUNET_MESH_TransmitHandle *th_tail;
+ struct GNUNET_CADET_TransmitHandle *th_tail;
/**
* chid of the next channel to create (to avoid reusing IDs often)
*/
- MESH_ChannelNumber next_chid;
+ CADET_ChannelNumber next_chid;
/**
* Have we started the task to receive messages from the service
- * yet? We do this after we send the 'MESH_LOCAL_CONNECT' message.
+ * yet? We do this after we send the 'CADET_LOCAL_CONNECT' message.
*/
int in_receive;
@@ -215,7 +215,7 @@
/**
* Callback for an info task (only one active at a time).
*/
- union MeshInfoCB info_cb;
+ union CadetInfoCB info_cb;
/**
* Info callback closure for @c info_cb.
@@ -227,7 +227,7 @@
/**
* Description of a peer
*/
-struct GNUNET_MESH_Peer
+struct GNUNET_CADET_Peer
{
/**
* ID of the peer in short form
@@ -237,35 +237,35 @@
/**
* Channel this peer belongs to
*/
- struct GNUNET_MESH_Channel *t;
+ struct GNUNET_CADET_Channel *t;
};
/**
* Opaque handle to a channel.
*/
-struct GNUNET_MESH_Channel
+struct GNUNET_CADET_Channel
{
/**
* DLL next
*/
- struct GNUNET_MESH_Channel *next;
+ struct GNUNET_CADET_Channel *next;
/**
* DLL prev
*/
- struct GNUNET_MESH_Channel *prev;
+ struct GNUNET_CADET_Channel *prev;
/**
- * Handle to the mesh this channel belongs to
+ * Handle to the cadet this channel belongs to
*/
- struct GNUNET_MESH_Handle *mesh;
+ struct GNUNET_CADET_Handle *cadet;
/**
* Local ID of the channel
*/
- MESH_ChannelNumber chid;
+ CADET_ChannelNumber chid;
/**
* Port number.
@@ -290,7 +290,7 @@
/**
* Channel options: reliability, etc.
*/
- enum GNUNET_MESH_ChannelOption options;
+ enum GNUNET_CADET_ChannelOption options;
/**
* Are we allowed to send to the service?
@@ -301,20 +301,20 @@
/**
- * Implementation state for mesh's message queue.
+ * Implementation state for cadet's message queue.
*/
-struct MeshMQState
+struct CadetMQState
{
/**
* The current transmit handle, or NULL
* if no transmit is active.
*/
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *th;
/**
* Channel to send the data over.
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
};
@@ -327,7 +327,7 @@
* "buf" will be NULL and "size" zero if the socket was closed for writing in
* the meantime.
*
- * @param cls closure, the mesh handle
+ * @param cls closure, the cadet handle
* @param size number of bytes available in buf
* @param buf where the callee should write the connect message
* @return number of bytes written to buf
@@ -346,10 +346,10 @@
* @param th Transmission handle.
*
* @return GNUNET_YES if it is a payload packet,
- * GNUNET_NO if it is a mesh management packet.
+ * GNUNET_NO if it is a cadet management packet.
*/
static int
-th_is_payload (struct GNUNET_MESH_TransmitHandle *th)
+th_is_payload (struct GNUNET_CADET_TransmitHandle *th)
{
return (th->notify != NULL) ? GNUNET_YES : GNUNET_NO;
}
@@ -358,16 +358,16 @@
/**
* Check whether there is any message ready in the queue and find the size.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
*
* @return The size of the first ready message in the queue,
* 0 if there is none.
*/
static size_t
-message_ready_size (struct GNUNET_MESH_Handle *h)
+message_ready_size (struct GNUNET_CADET_Handle *h)
{
- struct GNUNET_MESH_TransmitHandle *th;
- struct GNUNET_MESH_Channel *ch;
+ struct GNUNET_CADET_TransmitHandle *th;
+ struct GNUNET_CADET_Channel *ch;
for (th = h->th_head; NULL != th; th = th->next)
{
@@ -389,14 +389,14 @@
/**
* Get the channel handler for the channel specified by id from the given
handle
- * @param h Mesh handle
+ * @param h Cadet handle
* @param chid ID of the wanted channel
* @return handle to the required channel or NULL if not found
*/
-static struct GNUNET_MESH_Channel *
-retrieve_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid)
+static struct GNUNET_CADET_Channel *
+retrieve_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid)
{
- struct GNUNET_MESH_Channel *ch;
+ struct GNUNET_CADET_Channel *ch;
ch = h->channels_head;
while (ch != NULL)
@@ -410,29 +410,29 @@
/**
- * Create a new channel and insert it in the channel list of the mesh handle
+ * Create a new channel and insert it in the channel list of the cadet handle
*
- * @param h Mesh handle
+ * @param h Cadet handle
* @param chid Desired chid of the channel, 0 to assign one automatically.
*
* @return Handle to the created channel.
*/
-static struct GNUNET_MESH_Channel *
-create_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid)
+static struct GNUNET_CADET_Channel *
+create_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid)
{
- struct GNUNET_MESH_Channel *ch;
+ struct GNUNET_CADET_Channel *ch;
- ch = GNUNET_new (struct GNUNET_MESH_Channel);
+ ch = GNUNET_new (struct GNUNET_CADET_Channel);
GNUNET_CONTAINER_DLL_insert (h->channels_head, h->channels_tail, ch);
- ch->mesh = h;
+ ch->cadet = h;
if (0 == chid)
{
ch->chid = h->next_chid;
while (NULL != retrieve_channel (h, h->next_chid))
{
h->next_chid++;
- h->next_chid &= ~GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
- h->next_chid |= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI;
+ h->next_chid &= ~GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
+ h->next_chid |= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
}
}
else
@@ -457,11 +457,11 @@
* @return Handle to the required channel or NULL if not found.
*/
static void
-destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner)
+destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner)
{
- struct GNUNET_MESH_Handle *h;
- struct GNUNET_MESH_TransmitHandle *th;
- struct GNUNET_MESH_TransmitHandle *next;
+ struct GNUNET_CADET_Handle *h;
+ struct GNUNET_CADET_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *next;
LOG (GNUNET_ERROR_TYPE_DEBUG, " destroy_channel %X\n", ch->chid);
@@ -470,7 +470,7 @@
GNUNET_break (0);
return;
}
- h = ch->mesh;
+ h = ch->cadet;
GNUNET_CONTAINER_DLL_remove (h->channels_head, h->channels_tail, ch);
@@ -501,7 +501,7 @@
GNUNET_free (th);
}
- /* if there are no more pending requests with mesh service, cancel active
request */
+ /* if there are no more pending requests with cadet service, cancel active
request */
/* Note: this should be unnecessary... */
if ((0 == message_ready_size (h)) && (NULL != h->th))
{
@@ -525,20 +525,20 @@
static void
timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_MESH_TransmitHandle *th = cls;
- struct GNUNET_MESH_Handle *mesh;
+ struct GNUNET_CADET_TransmitHandle *th = cls;
+ struct GNUNET_CADET_Handle *cadet;
- mesh = th->channel->mesh;
- GNUNET_CONTAINER_DLL_remove (mesh->th_head, mesh->th_tail, th);
+ cadet = th->channel->cadet;
+ GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
th->channel->packet_size = 0;
if (GNUNET_YES == th_is_payload (th))
th->notify (th->notify_cls, 0, NULL);
GNUNET_free (th);
- if ((0 == message_ready_size (mesh)) && (NULL != mesh->th))
+ if ((0 == message_ready_size (cadet)) && (NULL != cadet->th))
{
/* nothing ready to transmit, no point in asking for transmission */
- GNUNET_CLIENT_notify_transmit_ready_cancel (mesh->th);
- mesh->th = NULL;
+ GNUNET_CLIENT_notify_transmit_ready_cancel (cadet->th);
+ cadet->th = NULL;
}
}
@@ -547,12 +547,12 @@
* Add a transmit handle to the transmission queue and set the
* timeout if needed.
*
- * @param h mesh handle with the queue head and tail
+ * @param h cadet handle with the queue head and tail
* @param th handle to the packet to be transmitted
*/
static void
-add_to_queue (struct GNUNET_MESH_Handle *h,
- struct GNUNET_MESH_TransmitHandle *th)
+add_to_queue (struct GNUNET_CADET_Handle *h,
+ struct GNUNET_CADET_TransmitHandle *th)
{
GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th);
if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == th->timeout.abs_value_us)
@@ -568,14 +568,14 @@
* Takes care of creating a new queue element, copying the message and
* calling the tmt_rdy function if necessary.
*
- * @param h mesh handle
+ * @param h cadet handle
* @param msg message to transmit
* @param channel channel this send is related to (NULL if N/A)
*/
static void
-send_packet (struct GNUNET_MESH_Handle *h,
+send_packet (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *msg,
- struct GNUNET_MESH_Channel *channel);
+ struct GNUNET_CADET_Channel *channel);
/**
@@ -584,16 +584,16 @@
* @param ch Channel on which to send the ACK.
*/
static void
-send_ack (struct GNUNET_MESH_Channel *ch)
+send_ack (struct GNUNET_CADET_Channel *ch)
{
- struct GNUNET_MESH_LocalAck msg;
+ struct GNUNET_CADET_LocalAck msg;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ACK on channel %X\n", ch->chid);
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK);
msg.header.size = htons (sizeof (msg));
msg.channel_id = htonl (ch->chid);
- send_packet (ch->mesh, &msg.header, ch);
+ send_packet (ch->cadet, &msg.header, ch);
return;
}
@@ -602,7 +602,7 @@
/**
* Reconnect callback: tries to reconnect again after a failer previous
* reconnecttion
- * @param cls closure (mesh handle)
+ * @param cls closure (cadet handle)
* @param tc task context
*/
static void
@@ -613,25 +613,25 @@
* Send a connect packet to the service with the applications and types
* requested by the user.
*
- * @param h The mesh handle.
+ * @param h The cadet handle.
*
*/
static void
-send_connect (struct GNUNET_MESH_Handle *h)
+send_connect (struct GNUNET_CADET_Handle *h)
{
size_t size;
- size = sizeof (struct GNUNET_MESH_ClientConnect);
+ size = sizeof (struct GNUNET_CADET_ClientConnect);
size += h->n_ports * sizeof (uint32_t);
{
char buf[size] GNUNET_ALIGN;
- struct GNUNET_MESH_ClientConnect *msg;
+ struct GNUNET_CADET_ClientConnect *msg;
uint32_t *ports;
uint16_t i;
/* build connection packet */
- msg = (struct GNUNET_MESH_ClientConnect *) buf;
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT);
+ msg = (struct GNUNET_CADET_ClientConnect *) buf;
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT);
msg->header.size = htons (size);
ports = (uint32_t *) &msg[1];
for (i = 0; i < h->n_ports; i++)
@@ -652,12 +652,12 @@
* Reconnect to the service, retransmit all infomation to try to restore the
* original state.
*
- * @param h handle to the mesh
+ * @param h handle to the cadet
*
* @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...)
*/
static int
-do_reconnect (struct GNUNET_MESH_Handle *h)
+do_reconnect (struct GNUNET_CADET_Handle *h)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, "******* RECONNECT *******\n");
@@ -677,7 +677,7 @@
}
/* connect again */
- h->client = GNUNET_CLIENT_connect ("mesh", h->cfg);
+ h->client = GNUNET_CLIENT_connect ("cadet", h->cfg);
if (h->client == NULL)
{
h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time,
@@ -703,13 +703,13 @@
/**
* Reconnect callback: tries to reconnect again after a failer previous
* reconnecttion
- * @param cls closure (mesh handle)
+ * @param cls closure (cadet handle)
* @param tc task context
*/
static void
reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_MESH_Handle *h = cls;
+ struct GNUNET_CADET_Handle *h = cls;
h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -722,15 +722,15 @@
* Reconnect to the service, retransmit all infomation to try to restore the
* original state.
*
- * @param h handle to the mesh
+ * @param h handle to the cadet
*
* @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...)
*/
static void
-reconnect (struct GNUNET_MESH_Handle *h)
+reconnect (struct GNUNET_CADET_Handle *h)
{
- struct GNUNET_MESH_Channel *ch;
- struct GNUNET_MESH_Channel *next;
+ struct GNUNET_CADET_Channel *ch;
+ struct GNUNET_CADET_Channel *next;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Requested RECONNECT, destroying all channels\n");
@@ -753,21 +753,21 @@
/**
* Process the new channel notification and add it to the channels in the
handle
*
- * @param h The mesh handle
+ * @param h The cadet handle
* @param msg A message with the details of the new incoming channel
*/
static void
-process_channel_created (struct GNUNET_MESH_Handle *h,
- const struct GNUNET_MESH_ChannelMessage *msg)
+process_channel_created (struct GNUNET_CADET_Handle *h,
+ const struct GNUNET_CADET_ChannelMessage *msg)
{
- struct GNUNET_MESH_Channel *ch;
- MESH_ChannelNumber chid;
+ struct GNUNET_CADET_Channel *ch;
+ CADET_ChannelNumber chid;
uint32_t port;
chid = ntohl (msg->channel_id);
port = ntohl (msg->port);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating incoming channel %X:%u\n", chid,
port);
- if (chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ if (chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
{
GNUNET_break (0);
return;
@@ -779,7 +779,7 @@
ch = create_channel (h, chid);
ch->allow_send = GNUNET_NO;
ch->peer = GNUNET_PEER_intern (&msg->peer);
- ch->mesh = h;
+ ch->cadet = h;
ch->chid = chid;
ch->port = port;
ch->options = ntohl (msg->opt);
@@ -792,12 +792,12 @@
}
else
{
- struct GNUNET_MESH_ChannelMessage d_msg;
+ struct GNUNET_CADET_ChannelMessage d_msg;
LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channels\n");
- d_msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
- d_msg.header.size = htons (sizeof (struct GNUNET_MESH_ChannelMessage));
+ d_msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ d_msg.header.size = htons (sizeof (struct GNUNET_CADET_ChannelMessage));
d_msg.channel_id = msg->channel_id;
memset (&d_msg.peer, 0, sizeof (struct GNUNET_PeerIdentity));
d_msg.port = 0;
@@ -812,15 +812,15 @@
/**
* Process the channel destroy notification and free associated resources
*
- * @param h The mesh handle
+ * @param h The cadet handle
* @param msg A message with the details of the channel being destroyed
*/
static void
-process_channel_destroy (struct GNUNET_MESH_Handle *h,
- const struct GNUNET_MESH_ChannelMessage *msg)
+process_channel_destroy (struct GNUNET_CADET_Handle *h,
+ const struct GNUNET_CADET_ChannelMessage *msg)
{
- struct GNUNET_MESH_Channel *ch;
- MESH_ChannelNumber chid;
+ struct GNUNET_CADET_Channel *ch;
+ CADET_ChannelNumber chid;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel Destroy received from service\n");
chid = ntohl (msg->channel_id);
@@ -839,23 +839,23 @@
/**
* Process the incoming data packets, call appropriate handlers.
*
- * @param h The mesh handle
+ * @param h The cadet handle
* @param message A message encapsulating the data
*/
static void
-process_incoming_data (struct GNUNET_MESH_Handle *h,
+process_incoming_data (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_MessageHeader *payload;
- const struct GNUNET_MESH_MessageHandler *handler;
- struct GNUNET_MESH_LocalData *dmsg;
- struct GNUNET_MESH_Channel *ch;
+ const struct GNUNET_CADET_MessageHandler *handler;
+ struct GNUNET_CADET_LocalData *dmsg;
+ struct GNUNET_CADET_Channel *ch;
size_t size;
unsigned int i;
uint16_t type;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a data message!\n");
- dmsg = (struct GNUNET_MESH_LocalData *) message;
+ dmsg = (struct GNUNET_CADET_LocalData *) message;
ch = retrieve_channel (h, ntohl (dmsg->id));
if (NULL == ch)
{
@@ -865,7 +865,7 @@
payload = (struct GNUNET_MessageHeader *) &dmsg[1];
LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n",
- GM_f2s (ch->chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV),
+ GM_f2s (ch->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV),
GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), ntohl (dmsg->id));
size = ntohs (message->size);
@@ -891,7 +891,7 @@
handler->callback (h->cls, ch, &ch->ctx, payload))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "callback caused disconnection\n");
- GNUNET_MESH_channel_destroy (ch);
+ GNUNET_CADET_channel_destroy (ch);
return;
}
else
@@ -909,19 +909,19 @@
* Process a local ACK message, enabling the client to send
* more data to the service.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
static void
-process_ack (struct GNUNET_MESH_Handle *h,
+process_ack (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalAck *msg;
- struct GNUNET_MESH_Channel *ch;
- MESH_ChannelNumber chid;
+ struct GNUNET_CADET_LocalAck *msg;
+ struct GNUNET_CADET_Channel *ch;
+ CADET_ChannelNumber chid;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n");
- msg = (struct GNUNET_MESH_LocalAck *) message;
+ msg = (struct GNUNET_CADET_LocalAck *) message;
chid = ntohl (msg->channel_id);
ch = retrieve_channel (h, chid);
if (NULL == ch)
@@ -944,14 +944,14 @@
/*
* Process a local reply about info on all channels, pass info to the user.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
// static void
-// process_get_channels (struct GNUNET_MESH_Handle *h,
+// process_get_channels (struct GNUNET_CADET_Handle *h,
// const struct GNUNET_MessageHeader *message)
// {
-// struct GNUNET_MESH_LocalInfo *msg;
+// struct GNUNET_CADET_LocalInfo *msg;
//
// GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Get Channels messasge received\n");
//
@@ -961,16 +961,16 @@
// return;
// }
//
-// msg = (struct GNUNET_MESH_LocalInfo *) message;
+// msg = (struct GNUNET_CADET_LocalInfo *) message;
// if (ntohs (message->size) !=
-// (sizeof (struct GNUNET_MESH_LocalInfo) +
+// (sizeof (struct GNUNET_CADET_LocalInfo) +
// sizeof (struct GNUNET_PeerIdentity)))
// {
// GNUNET_break_op (0);
// GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
// "Get channels message: size %hu - expected %u\n",
// ntohs (message->size),
-// sizeof (struct GNUNET_MESH_LocalInfo));
+// sizeof (struct GNUNET_CADET_LocalInfo));
// return;
// }
// h->channels_cb (h->channels_cls,
@@ -984,14 +984,14 @@
/*
* Process a local monitor_channel reply, pass info to the user.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
// static void
-// process_show_channel (struct GNUNET_MESH_Handle *h,
+// process_show_channel (struct GNUNET_CADET_Handle *h,
// const struct GNUNET_MessageHeader *message)
// {
-// struct GNUNET_MESH_LocalInfo *msg;
+// struct GNUNET_CADET_LocalInfo *msg;
// size_t esize;
//
// GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Show Channel messasge received\n");
@@ -1003,8 +1003,8 @@
// }
//
// /* Verify message sanity */
-// msg = (struct GNUNET_MESH_LocalInfo *) message;
-// esize = sizeof (struct GNUNET_MESH_LocalInfo);
+// msg = (struct GNUNET_CADET_LocalInfo *) message;
+// esize = sizeof (struct GNUNET_CADET_LocalInfo);
// if (ntohs (message->size) != esize)
// {
// GNUNET_break_op (0);
@@ -1030,14 +1030,14 @@
/**
* Process a local reply about info on all tunnels, pass info to the user.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
static void
-process_get_peers (struct GNUNET_MESH_Handle *h,
+process_get_peers (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalInfoPeer *msg;
+ struct GNUNET_CADET_LocalInfoPeer *msg;
uint16_t size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Peer messasge received\n");
@@ -1049,7 +1049,7 @@
}
size = ntohs (message->size);
- if (sizeof (struct GNUNET_MESH_LocalInfoPeer) > size)
+ if (sizeof (struct GNUNET_CADET_LocalInfoPeer) > size)
{
h->info_cb.peers_cb (h->info_cls, NULL, -1, 0, 0);
h->info_cb.peers_cb = NULL;
@@ -1057,7 +1057,7 @@
return;
}
- msg = (struct GNUNET_MESH_LocalInfoPeer *) message;
+ msg = (struct GNUNET_CADET_LocalInfoPeer *) message;
h->info_cb.peers_cb (h->info_cls, &msg->destination,
(int) ntohs (msg->tunnel),
(unsigned int ) ntohs (msg->paths),
@@ -1068,20 +1068,20 @@
/**
* Process a local peer info reply, pass info to the user.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
static void
-process_get_peer (struct GNUNET_MESH_Handle *h,
+process_get_peer (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalInfoTunnel *msg;
+ struct GNUNET_CADET_LocalInfoTunnel *msg;
size_t esize;
size_t msize;
unsigned int ch_n;
unsigned int c_n;
- struct GNUNET_MESH_Hash *conns;
- MESH_ChannelNumber *chns;
+ struct GNUNET_CADET_Hash *conns;
+ CADET_ChannelNumber *chns;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n");
if (NULL == h->info_cb.tunnel_cb)
@@ -1091,9 +1091,9 @@
}
/* Verify message sanity */
- msg = (struct GNUNET_MESH_LocalInfoTunnel *) message;
+ msg = (struct GNUNET_CADET_LocalInfoTunnel *) message;
msize = ntohs (message->size);
- esize = sizeof (struct GNUNET_MESH_LocalInfoTunnel);
+ esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
if (esize > msize)
{
GNUNET_break_op (0);
@@ -1102,23 +1102,23 @@
}
ch_n = ntohl (msg->channels);
c_n = ntohl (msg->connections);
- esize += ch_n * sizeof (MESH_ChannelNumber);
- esize += c_n * sizeof (struct GNUNET_MESH_Hash);
+ esize += ch_n * sizeof (CADET_ChannelNumber);
+ esize += c_n * sizeof (struct GNUNET_CADET_Hash);
if (msize != esize)
{
GNUNET_break_op (0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n",
msize, esize, ch_n, c_n);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n",
- sizeof (struct GNUNET_MESH_LocalInfoTunnel),
- sizeof (MESH_ChannelNumber), sizeof (struct GNUNET_HashCode));
+ sizeof (struct GNUNET_CADET_LocalInfoTunnel),
+ sizeof (CADET_ChannelNumber), sizeof (struct GNUNET_HashCode));
h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0);
goto clean_cls;
}
/* Call Callback with tunnel info. */
- conns = (struct GNUNET_MESH_Hash *) &msg[1];
- chns = (MESH_ChannelNumber *) &conns[c_n];
+ conns = (struct GNUNET_CADET_Hash *) &msg[1];
+ chns = (CADET_ChannelNumber *) &conns[c_n];
h->info_cb.tunnel_cb (h->info_cls, &msg->destination,
ch_n, c_n, chns, conns,
ntohs (msg->estate), ntohs (msg->cstate));
@@ -1132,14 +1132,14 @@
/**
* Process a local reply about info on all tunnels, pass info to the user.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
static void
-process_get_tunnels (struct GNUNET_MESH_Handle *h,
+process_get_tunnels (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalInfoTunnel *msg;
+ struct GNUNET_CADET_LocalInfoTunnel *msg;
uint16_t size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnels messasge received\n");
@@ -1151,7 +1151,7 @@
}
size = ntohs (message->size);
- if (sizeof (struct GNUNET_MESH_LocalInfoTunnel) > size)
+ if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) > size)
{
h->info_cb.tunnels_cb (h->info_cls, NULL, 0, 0, 0, 0);
h->info_cb.tunnels_cb = NULL;
@@ -1159,7 +1159,7 @@
return;
}
- msg = (struct GNUNET_MESH_LocalInfoTunnel *) message;
+ msg = (struct GNUNET_CADET_LocalInfoTunnel *) message;
h->info_cb.tunnels_cb (h->info_cls, &msg->destination,
ntohl (msg->channels), ntohl (msg->connections),
ntohs (msg->estate), ntohs (msg->cstate));
@@ -1170,20 +1170,20 @@
/**
* Process a local tunnel info reply, pass info to the user.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
* @param message Message itself.
*/
static void
-process_get_tunnel (struct GNUNET_MESH_Handle *h,
+process_get_tunnel (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_MESH_LocalInfoTunnel *msg;
+ struct GNUNET_CADET_LocalInfoTunnel *msg;
size_t esize;
size_t msize;
unsigned int ch_n;
unsigned int c_n;
- struct GNUNET_MESH_Hash *conns;
- MESH_ChannelNumber *chns;
+ struct GNUNET_CADET_Hash *conns;
+ CADET_ChannelNumber *chns;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n");
if (NULL == h->info_cb.tunnel_cb)
@@ -1193,9 +1193,9 @@
}
/* Verify message sanity */
- msg = (struct GNUNET_MESH_LocalInfoTunnel *) message;
+ msg = (struct GNUNET_CADET_LocalInfoTunnel *) message;
msize = ntohs (message->size);
- esize = sizeof (struct GNUNET_MESH_LocalInfoTunnel);
+ esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
if (esize > msize)
{
GNUNET_break_op (0);
@@ -1204,23 +1204,23 @@
}
ch_n = ntohl (msg->channels);
c_n = ntohl (msg->connections);
- esize += ch_n * sizeof (MESH_ChannelNumber);
- esize += c_n * sizeof (struct GNUNET_MESH_Hash);
+ esize += ch_n * sizeof (CADET_ChannelNumber);
+ esize += c_n * sizeof (struct GNUNET_CADET_Hash);
if (msize != esize)
{
GNUNET_break_op (0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n",
msize, esize, ch_n, c_n);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n",
- sizeof (struct GNUNET_MESH_LocalInfoTunnel),
- sizeof (MESH_ChannelNumber), sizeof (struct GNUNET_HashCode));
+ sizeof (struct GNUNET_CADET_LocalInfoTunnel),
+ sizeof (CADET_ChannelNumber), sizeof (struct GNUNET_HashCode));
h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0);
goto clean_cls;
}
/* Call Callback with tunnel info. */
- conns = (struct GNUNET_MESH_Hash *) &msg[1];
- chns = (MESH_ChannelNumber *) &conns[c_n];
+ conns = (struct GNUNET_CADET_Hash *) &msg[1];
+ chns = (CADET_ChannelNumber *) &conns[c_n];
h->info_cb.tunnel_cb (h->info_cls, &msg->destination,
ch_n, c_n, chns, conns,
ntohs (msg->estate), ntohs (msg->cstate));
@@ -1240,13 +1240,13 @@
static void
msg_received (void *cls, const struct GNUNET_MessageHeader *msg)
{
- struct GNUNET_MESH_Handle *h = cls;
+ struct GNUNET_CADET_Handle *h = cls;
uint16_t type;
if (msg == NULL)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Mesh service disconnected, reconnecting\n", h);
+ "Cadet service disconnected, reconnecting\n", h);
reconnect (h);
return;
}
@@ -1257,39 +1257,39 @@
switch (type)
{
/* Notify of a new incoming channel */
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- process_channel_created (h, (struct GNUNET_MESH_ChannelMessage *) msg);
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ process_channel_created (h, (struct GNUNET_CADET_ChannelMessage *) msg);
break;
/* Notify of a channel disconnection */
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: /* TODO separate(gid
problem)*/
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
- process_channel_destroy (h, (struct GNUNET_MESH_ChannelMessage *) msg);
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: /* TODO separate(gid
problem)*/
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
+ process_channel_destroy (h, (struct GNUNET_CADET_ChannelMessage *) msg);
break;
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA:
process_incoming_data (h, msg);
break;
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK:
process_ack (h, msg);
break;
-// case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS:
+// case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS:
// process_get_channels (h, msg);
// break;
-// case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL:
+// case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL:
// process_show_channel (h, msg);
// break;
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS:
process_get_peers (h, msg);
break;
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER:
process_get_peer (h, msg);
break;
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS:
process_get_tunnels (h, msg);
break;
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL:
process_get_tunnel (h, msg);
break;
-// case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL:
+// case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL:
// process_show_channel (h, msg);
// break;
default:
@@ -1321,7 +1321,7 @@
* "buf" will be NULL and "size" zero if the socket was closed for writing in
* the meantime.
*
- * @param cls closure, the mesh handle
+ * @param cls closure, the cadet handle
* @param size number of bytes available in buf
* @param buf where the callee should write the connect message
* @return number of bytes written to buf
@@ -1329,10 +1329,10 @@
static size_t
send_callback (void *cls, size_t size, void *buf)
{
- struct GNUNET_MESH_Handle *h = cls;
- struct GNUNET_MESH_TransmitHandle *th;
- struct GNUNET_MESH_TransmitHandle *next;
- struct GNUNET_MESH_Channel *ch;
+ struct GNUNET_CADET_Handle *h = cls;
+ struct GNUNET_CADET_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *next;
+ struct GNUNET_CADET_Channel *ch;
char *cbuf = buf;
size_t tsize;
size_t psize;
@@ -1355,7 +1355,7 @@
ch = th->channel;
if (GNUNET_YES == th_is_payload (th))
{
- struct GNUNET_MESH_LocalData *dmsg;
+ struct GNUNET_CADET_LocalData *dmsg;
struct GNUNET_MessageHeader *mh;
LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload\n");
@@ -1367,18 +1367,18 @@
}
ch->packet_size = 0;
GNUNET_assert (size >= th->size);
- dmsg = (struct GNUNET_MESH_LocalData *) cbuf;
+ dmsg = (struct GNUNET_CADET_LocalData *) cbuf;
mh = (struct GNUNET_MessageHeader *) &dmsg[1];
psize = th->notify (th->notify_cls,
- size - sizeof (struct GNUNET_MESH_LocalData),
+ size - sizeof (struct GNUNET_CADET_LocalData),
mh);
if (psize > 0)
{
- psize += sizeof (struct GNUNET_MESH_LocalData);
+ psize += sizeof (struct GNUNET_CADET_LocalData);
GNUNET_assert (size >= psize);
dmsg->header.size = htons (psize);
dmsg->id = htonl (ch->chid);
- dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA);
+ dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload type %s\n",
GM_m2s (ntohs (mh->type)));
ch->allow_send = GNUNET_NO;
@@ -1394,7 +1394,7 @@
{
struct GNUNET_MessageHeader *mh = (struct GNUNET_MessageHeader *) &th[1];
- LOG (GNUNET_ERROR_TYPE_DEBUG, "# mesh internal traffic, type %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n",
GM_m2s (ntohs (mh->type)));
memcpy (cbuf, &th[1], th->size);
psize = th->size;
@@ -1444,22 +1444,22 @@
* Takes care of creating a new queue element, copying the message and
* calling the tmt_rdy function if necessary.
*
- * @param h mesh handle
+ * @param h cadet handle
* @param msg message to transmit
* @param channel channel this send is related to (NULL if N/A)
*/
static void
-send_packet (struct GNUNET_MESH_Handle *h,
+send_packet (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MessageHeader *msg,
- struct GNUNET_MESH_Channel *channel)
+ struct GNUNET_CADET_Channel *channel)
{
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *th;
size_t msize;
LOG (GNUNET_ERROR_TYPE_DEBUG, " Sending message to service: %s\n",
GM_m2s(ntohs(msg->type)));
msize = ntohs (msg->size);
- th = GNUNET_malloc (sizeof (struct GNUNET_MESH_TransmitHandle) + msize);
+ th = GNUNET_malloc (sizeof (struct GNUNET_CADET_TransmitHandle) + msize);
th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
th->size = msize;
th->channel = channel;
@@ -1480,22 +1480,22 @@
/********************** API CALL DEFINITIONS
*************************/
/******************************************************************************/
-struct GNUNET_MESH_Handle *
-GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
- GNUNET_MESH_InboundChannelNotificationHandler new_channel,
- GNUNET_MESH_ChannelEndHandler cleaner,
- const struct GNUNET_MESH_MessageHandler *handlers,
+struct GNUNET_CADET_Handle *
+GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
+ GNUNET_CADET_InboundChannelNotificationHandler
new_channel,
+ GNUNET_CADET_ChannelEndHandler cleaner,
+ const struct GNUNET_CADET_MessageHandler *handlers,
const uint32_t *ports)
{
- struct GNUNET_MESH_Handle *h;
+ struct GNUNET_CADET_Handle *h;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_MESH_connect()\n");
- h = GNUNET_new (struct GNUNET_MESH_Handle);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CADET_connect()\n");
+ h = GNUNET_new (struct GNUNET_CADET_Handle);
LOG (GNUNET_ERROR_TYPE_DEBUG, " addr %p\n", h);
h->cfg = cfg;
h->new_channel = new_channel;
h->cleaner = cleaner;
- h->client = GNUNET_CLIENT_connect ("mesh", cfg);
+ h->client = GNUNET_CLIENT_connect ("cadet", cfg);
if (h->client == NULL)
{
GNUNET_break (0);
@@ -1505,7 +1505,7 @@
h->cls = cls;
h->message_handlers = handlers;
h->ports = ports;
- h->next_chid = GNUNET_MESH_LOCAL_CHANNEL_ID_CLI;
+ h->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS;
h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
@@ -1529,25 +1529,25 @@
ports && ports[h->n_ports];
h->n_ports++) ;
send_connect (h);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_MESH_connect() END\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CADET_connect() END\n");
return h;
}
void
-GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle)
+GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
{
- struct GNUNET_MESH_Channel *ch;
- struct GNUNET_MESH_Channel *aux;
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_Channel *ch;
+ struct GNUNET_CADET_Channel *aux;
+ struct GNUNET_CADET_TransmitHandle *th;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH DISCONNECT\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET DISCONNECT\n");
ch = handle->channels_head;
while (NULL != ch)
{
aux = ch->next;
- if (ch->chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ if (ch->chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
{
GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_DEBUG, "channel %X not destroyed\n", ch->chid);
@@ -1566,15 +1566,15 @@
msg = (struct GNUNET_MessageHeader *) &th[1];
switch (ntohs(msg->type))
{
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL:
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS:
break;
default:
GNUNET_break (0);
@@ -1609,26 +1609,26 @@
* Create a new channel towards a remote peer.
*
* If the destination port is not open by any peer or the destination peer
- * does not accept the channel, #GNUNET_MESH_ChannelEndHandler will be called
+ * does not accept the channel, #GNUNET_CADET_ChannelEndHandler will be called
* for this channel.
*
- * @param h mesh handle
+ * @param h cadet handle
* @param channel_ctx client's channel context to associate with the channel
* @param peer peer identity the channel should go to
* @param port Port number.
- * @param options MeshOption flag field, with all desired option bits set to 1.
+ * @param options CadetOption flag field, with all desired option bits set to
1.
*
* @return handle to the channel
*/
-struct GNUNET_MESH_Channel *
-GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h,
+struct GNUNET_CADET_Channel *
+GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h,
void *channel_ctx,
const struct GNUNET_PeerIdentity *peer,
uint32_t port,
- enum GNUNET_MESH_ChannelOption options)
+ enum GNUNET_CADET_ChannelOption options)
{
- struct GNUNET_MESH_Channel *ch;
- struct GNUNET_MESH_ChannelMessage msg;
+ struct GNUNET_CADET_Channel *ch;
+ struct GNUNET_CADET_ChannelMessage msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Creating new channel to %s:%u\n",
@@ -1638,8 +1638,8 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n", ch->chid);
ch->ctx = channel_ctx;
ch->peer = GNUNET_PEER_intern (peer);
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE);
- msg.header.size = htons (sizeof (struct GNUNET_MESH_ChannelMessage));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE);
+ msg.header.size = htons (sizeof (struct GNUNET_CADET_ChannelMessage));
msg.channel_id = htonl (ch->chid);
msg.port = htonl (port);
msg.peer = *peer;
@@ -1651,17 +1651,17 @@
void
-GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel)
+GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
{
- struct GNUNET_MESH_Handle *h;
- struct GNUNET_MESH_ChannelMessage msg;
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_Handle *h;
+ struct GNUNET_CADET_ChannelMessage msg;
+ struct GNUNET_CADET_TransmitHandle *th;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying channel\n");
- h = channel->mesh;
+ h = channel->cadet;
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
- msg.header.size = htons (sizeof (struct GNUNET_MESH_ChannelMessage));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ msg.header.size = htons (sizeof (struct GNUNET_CADET_ChannelMessage));
msg.channel_id = htonl (channel->chid);
memset (&msg.peer, 0, sizeof (struct GNUNET_PeerIdentity));
msg.port = 0;
@@ -1669,7 +1669,7 @@
th = h->th_head;
while (th != NULL)
{
- struct GNUNET_MESH_TransmitHandle *aux;
+ struct GNUNET_CADET_TransmitHandle *aux;
if (th->channel == channel)
{
aux = th->next;
@@ -1693,31 +1693,31 @@
* Get information about a channel.
*
* @param channel Channel handle.
- * @param option Query (GNUNET_MESH_OPTION_*).
+ * @param option Query (GNUNET_CADET_OPTION_*).
* @param ... dependant on option, currently not used
*
* @return Union with an answer to the query.
*/
-const union GNUNET_MESH_ChannelInfo *
-GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel,
- enum GNUNET_MESH_ChannelOption option, ...)
+const union GNUNET_CADET_ChannelInfo *
+GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
+ enum GNUNET_CADET_ChannelOption option, ...)
{
static int bool_flag;
- const union GNUNET_MESH_ChannelInfo *ret;
+ const union GNUNET_CADET_ChannelInfo *ret;
switch (option)
{
- case GNUNET_MESH_OPTION_NOBUFFER:
- case GNUNET_MESH_OPTION_RELIABLE:
- case GNUNET_MESH_OPTION_OOORDER:
+ case GNUNET_CADET_OPTION_NOBUFFER:
+ case GNUNET_CADET_OPTION_RELIABLE:
+ case GNUNET_CADET_OPTION_OOORDER:
if (0 != (option & channel->options))
bool_flag = GNUNET_YES;
else
bool_flag = GNUNET_NO;
- ret = (const union GNUNET_MESH_ChannelInfo *) &bool_flag;
+ ret = (const union GNUNET_CADET_ChannelInfo *) &bool_flag;
break;
- case GNUNET_MESH_OPTION_PEER:
- ret = (const union GNUNET_MESH_ChannelInfo *) GNUNET_PEER_resolve2
(channel->peer);
+ case GNUNET_CADET_OPTION_PEER:
+ ret = (const union GNUNET_CADET_ChannelInfo *) GNUNET_PEER_resolve2
(channel->peer);
break;
default:
GNUNET_break (0);
@@ -1727,79 +1727,79 @@
return ret;
}
-struct GNUNET_MESH_TransmitHandle *
-GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Channel *channel, int
cork,
+struct GNUNET_CADET_TransmitHandle *
+GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, int
cork,
struct GNUNET_TIME_Relative maxdelay,
size_t notify_size,
GNUNET_CONNECTION_TransmitReadyNotify
notify,
void *notify_cls)
{
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *th;
GNUNET_assert (NULL != channel);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH NOTIFY TRANSMIT READY\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid);
LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send);
- if (channel->chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ if (channel->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n");
else
LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n");
LOG (GNUNET_ERROR_TYPE_DEBUG, " payload size %u\n", notify_size);
GNUNET_assert (NULL != notify);
GNUNET_assert (0 == channel->packet_size); // Only one data packet allowed
- th = GNUNET_new (struct GNUNET_MESH_TransmitHandle);
+ th = GNUNET_new (struct GNUNET_CADET_TransmitHandle);
th->channel = channel;
th->timeout = GNUNET_TIME_relative_to_absolute (maxdelay);
- th->size = notify_size + sizeof (struct GNUNET_MESH_LocalData);
+ th->size = notify_size + sizeof (struct GNUNET_CADET_LocalData);
channel->packet_size = th->size;
LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size);
th->notify = notify;
th->notify_cls = notify_cls;
- add_to_queue (channel->mesh, th);
- if (NULL != channel->mesh->th)
+ add_to_queue (channel->cadet, th);
+ if (NULL != channel->cadet->th)
return th;
if (GNUNET_NO == channel->allow_send)
return th;
LOG (GNUNET_ERROR_TYPE_DEBUG, " call client notify tmt rdy\n");
- channel->mesh->th =
- GNUNET_CLIENT_notify_transmit_ready (channel->mesh->client, th->size,
+ channel->cadet->th =
+ GNUNET_CLIENT_notify_transmit_ready (channel->cadet->client, th->size,
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_YES, &send_callback,
- channel->mesh);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH NOTIFY TRANSMIT READY END\n");
+ channel->cadet);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY END\n");
return th;
}
void
-GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
*th)
+GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle
*th)
{
- struct GNUNET_MESH_Handle *mesh;
+ struct GNUNET_CADET_Handle *cadet;
th->channel->packet_size = 0;
- mesh = th->channel->mesh;
+ cadet = th->channel->cadet;
if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (th->timeout_task);
- GNUNET_CONTAINER_DLL_remove (mesh->th_head, mesh->th_tail, th);
+ GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
GNUNET_free (th);
- if ((0 == message_ready_size (mesh)) && (NULL != mesh->th))
+ if ((0 == message_ready_size (cadet)) && (NULL != cadet->th))
{
/* queue empty, no point in asking for transmission */
- GNUNET_CLIENT_notify_transmit_ready_cancel (mesh->th);
- mesh->th = NULL;
+ GNUNET_CLIENT_notify_transmit_ready_cancel (cadet->th);
+ cadet->th = NULL;
}
}
void
-GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel)
+GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel)
{
send_ack (channel);
}
static void
-send_info_request (struct GNUNET_MESH_Handle *h, uint16_t type)
+send_info_request (struct GNUNET_CADET_Handle *h, uint16_t type)
{
struct GNUNET_MessageHeader msg;
@@ -1810,22 +1810,22 @@
/**
- * Request information about peers known to the running mesh service.
+ * Request information about peers known to the running cadet service.
* The callback will be called for every peer known to the service.
* Only one info request (of any kind) can be active at once.
*
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
*
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h,
- GNUNET_MESH_PeersCB callback,
+GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
+ GNUNET_CADET_PeersCB callback,
void *callback_cls)
{
if (NULL != h->info_cb.peers_cb)
@@ -1833,7 +1833,7 @@
GNUNET_break (0);
return GNUNET_SYSERR;
}
- send_info_request (h, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS);
+ send_info_request (h, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
h->info_cb.peers_cb = callback;
h->info_cls = callback_cls;
return GNUNET_OK;
@@ -1845,12 +1845,12 @@
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
*
- * @return Closure given to GNUNET_MESH_get_peers.
+ * @return Closure given to GNUNET_CADET_get_peers.
*/
void *
-GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h)
+GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h)
{
void *cls;
@@ -1862,13 +1862,13 @@
/**
- * Request information about a peer known to the running mesh peer.
+ * Request information about a peer known to the running cadet peer.
* The callback will be called for the tunnel once.
* Only one info request (of any kind) can be active at once.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param id Peer whose tunnel to examine.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
@@ -1876,12 +1876,12 @@
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h,
+GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
const struct GNUNET_PeerIdentity *id,
- GNUNET_MESH_PeerCB callback,
+ GNUNET_CADET_PeerCB callback,
void *callback_cls)
{
- struct GNUNET_MESH_LocalInfo msg;
+ struct GNUNET_CADET_LocalInfo msg;
if (NULL != h->info_cb.peer_cb)
{
@@ -1891,7 +1891,7 @@
memset (&msg, 0, sizeof (msg));
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER);
msg.peer = *id;
send_packet (h, &msg.header, NULL);
h->info_cb.peer_cb = callback;
@@ -1901,21 +1901,21 @@
/**
- * Request information about tunnels of the running mesh peer.
+ * Request information about tunnels of the running cadet peer.
* The callback will be called for every tunnel of the service.
* Only one info request (of any kind) can be active at once.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
*
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h,
- GNUNET_MESH_TunnelsCB callback,
+GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h,
+ GNUNET_CADET_TunnelsCB callback,
void *callback_cls)
{
if (NULL != h->info_cb.tunnels_cb)
@@ -1923,7 +1923,7 @@
GNUNET_break (0);
return GNUNET_SYSERR;
}
- send_info_request (h, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
+ send_info_request (h, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
h->info_cb.tunnels_cb = callback;
h->info_cls = callback_cls;
return GNUNET_OK;
@@ -1933,12 +1933,12 @@
/**
* Cancel a monitor request. The monitor callback will not be called.
*
- * @param h Mesh handle.
+ * @param h Cadet handle.
*
- * @return Closure given to GNUNET_MESH_get_tunnels.
+ * @return Closure given to GNUNET_CADET_get_tunnels.
*/
void *
-GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h)
+GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h)
{
void *cls;
@@ -1952,13 +1952,13 @@
/**
- * Request information about a tunnel of the running mesh peer.
+ * Request information about a tunnel of the running cadet peer.
* The callback will be called for the tunnel once.
* Only one info request (of any kind) can be active at once.
*
* WARNING: unstable API, likely to change in the future!
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param id Peer whose tunnel to examine.
* @param callback Function to call with the requested data.
* @param callback_cls Closure for @c callback.
@@ -1966,12 +1966,12 @@
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h,
+GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h,
const struct GNUNET_PeerIdentity *id,
- GNUNET_MESH_TunnelCB callback,
+ GNUNET_CADET_TunnelCB callback,
void *callback_cls)
{
- struct GNUNET_MESH_LocalInfo msg;
+ struct GNUNET_CADET_LocalInfo msg;
if (NULL != h->info_cb.tunnel_cb)
{
@@ -1981,7 +1981,7 @@
memset (&msg, 0, sizeof (msg));
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
msg.peer = *id;
send_packet (h, &msg.header, NULL);
h->info_cb.tunnel_cb = callback;
@@ -1991,12 +1991,12 @@
/**
- * Request information about a specific channel of the running mesh peer.
+ * Request information about a specific channel of the running cadet peer.
*
* WARNING: unstable API, likely to change in the future!
* FIXME Add destination option.
*
- * @param h Handle to the mesh peer.
+ * @param h Handle to the cadet peer.
* @param initiator ID of the owner of the channel.
* @param channel_number Channel number.
* @param callback Function to call with the requested data.
@@ -2005,13 +2005,13 @@
* @return #GNUNET_OK / #GNUNET_SYSERR
*/
int
-GNUNET_MESH_show_channel (struct GNUNET_MESH_Handle *h,
+GNUNET_CADET_show_channel (struct GNUNET_CADET_Handle *h,
struct GNUNET_PeerIdentity *initiator,
unsigned int channel_number,
- GNUNET_MESH_ChannelCB callback,
+ GNUNET_CADET_ChannelCB callback,
void *callback_cls)
{
- struct GNUNET_MESH_LocalInfo msg;
+ struct GNUNET_CADET_LocalInfo msg;
if (NULL != h->info_cb.channel_cb)
{
@@ -2020,7 +2020,7 @@
}
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL);
msg.peer = *initiator;
msg.channel_id = htonl (channel_number);
// msg.reserved = 0;
@@ -2043,11 +2043,11 @@
* @return number of bytes written to buf
*/
static size_t
-mesh_mq_ntr (void *cls, size_t size,
+cadet_mq_ntr (void *cls, size_t size,
void *buf)
{
struct GNUNET_MQ_Handle *mq = cls;
- struct MeshMQState *state = GNUNET_MQ_impl_state (mq);
+ struct CadetMQState *state = GNUNET_MQ_impl_state (mq);
const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq);
uint16_t msize;
@@ -2074,19 +2074,19 @@
* @param impl_state state of the implementation
*/
static void
-mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq,
+cadet_mq_send_impl (struct GNUNET_MQ_Handle *mq,
const struct GNUNET_MessageHeader *msg, void *impl_state)
{
- struct MeshMQState *state = impl_state;
+ struct CadetMQState *state = impl_state;
GNUNET_assert (NULL == state->th);
state->th =
- GNUNET_MESH_notify_transmit_ready (state->channel,
+ GNUNET_CADET_notify_transmit_ready (state->channel,
/* FIXME: add option for corking */
GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
ntohs (msg->size),
- mesh_mq_ntr, mq);
+ cadet_mq_ntr, mq);
}
@@ -2101,19 +2101,19 @@
* @param impl_state state of the implementation
*/
static void
-mesh_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
+cadet_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
{
- struct MeshMQState *state = impl_state;
+ struct CadetMQState *state = impl_state;
if (NULL != state->th)
- GNUNET_MESH_notify_transmit_ready_cancel (state->th);
+ GNUNET_CADET_notify_transmit_ready_cancel (state->th);
GNUNET_free (state);
}
/**
- * Create a message queue for a mesh channel.
+ * Create a message queue for a cadet channel.
* The message queue can only be used to transmit messages,
* not to receive them.
*
@@ -2121,16 +2121,16 @@
* @return a message queue to messages over the channel
*/
struct GNUNET_MQ_Handle *
-GNUNET_MESH_mq_create (struct GNUNET_MESH_Channel *channel)
+GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel)
{
struct GNUNET_MQ_Handle *mq;
- struct MeshMQState *state;
+ struct CadetMQState *state;
- state = GNUNET_new (struct MeshMQState);
+ state = GNUNET_new (struct CadetMQState);
state->channel = channel;
- mq = GNUNET_MQ_queue_for_callbacks (mesh_mq_send_impl,
- mesh_mq_destroy_impl,
+ mq = GNUNET_MQ_queue_for_callbacks (cadet_mq_send_impl,
+ cadet_mq_destroy_impl,
NULL, /* FIXME: cancel impl. */
state,
NULL, /* no msg handlers */
Modified: gnunet/src/mesh/mesh_common.c
===================================================================
--- gnunet/src/mesh/mesh_common.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_common.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,12 +19,12 @@
*/
/**
- * @file mesh/mesh_common.c
- * @brief MESH helper functions
+ * @file cadet/cadet_common.c
+ * @brief CADET helper functions
* @author Bartlomiej Polot
*/
-#include "mesh.h"
+#include "cadet.h"
/**
* @brief Translate a fwd variable into a string representation, for logging.
@@ -78,7 +78,7 @@
const struct GNUNET_HashCode *
-GM_h2hc (const struct GNUNET_MESH_Hash *id)
+GM_h2hc (const struct GNUNET_CADET_Hash *id)
{
static struct GNUNET_HashCode hc;
memcpy (&hc, id, sizeof (*id));
@@ -88,7 +88,7 @@
const char *
-GM_h2s (const struct GNUNET_MESH_Hash *id)
+GM_h2s (const struct GNUNET_CADET_Hash *id)
{
static char s[53];
@@ -111,217 +111,217 @@
/**
* Request the creation of a path
*/
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
t = "CONNECTION_CREATE";
break;
/**
* Request the modification of an existing path
*/
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
t = "CONNECTION_ACK";
break;
/**
* Notify that a connection of a path is no longer valid
*/
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
t = "CONNECTION_BROKEN";
break;
/**
* At some point, the route will spontaneously change
*/
- case GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED:
+ case GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED:
t = "PATH_CHANGED";
break;
/**
* Transport payload data.
*/
- case GNUNET_MESSAGE_TYPE_MESH_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA:
t = "DATA";
break;
/**
* Confirm receipt of payload data.
*/
- case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
t = "DATA_ACK";
break;
/**
* Key exchange encapsulation.
*/
- case GNUNET_MESSAGE_TYPE_MESH_KX:
+ case GNUNET_MESSAGE_TYPE_CADET_KX:
t = "KX";
break;
/**
* New ephemeral key.
*/
- case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL:
+ case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL:
t = "KX_EPHEMERAL";
break;
/**
* Challenge to test peer's session key.
*/
- case GNUNET_MESSAGE_TYPE_MESH_KX_PING:
+ case GNUNET_MESSAGE_TYPE_CADET_KX_PING:
t = "KX_PING";
break;
/**
* Answer to session key challenge.
*/
- case GNUNET_MESSAGE_TYPE_MESH_KX_PONG:
+ case GNUNET_MESSAGE_TYPE_CADET_KX_PONG:
t = "KX_PONG";
break;
/**
* Request the destuction of a path
*/
- case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
t = "CONNECTION_DESTROY";
break;
/**
* ACK for a data packet.
*/
- case GNUNET_MESSAGE_TYPE_MESH_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_ACK:
t = "ACK";
break;
/**
* POLL for ACK.
*/
- case GNUNET_MESSAGE_TYPE_MESH_POLL:
+ case GNUNET_MESSAGE_TYPE_CADET_POLL:
t = "POLL";
break;
/**
* Announce origin is still alive.
*/
- case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
+ case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
t = "KEEPALIVE";
break;
/**
- * Connect to the mesh service, specifying subscriptions
+ * Connect to the cadet service, specifying subscriptions
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT:
t = "LOCAL_CONNECT";
break;
/**
- * Ask the mesh service to create a new tunnel
+ * Ask the cadet service to create a new tunnel
*/
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
t = "CHANNEL_CREATE";
break;
/**
- * Ask the mesh service to destroy a tunnel
+ * Ask the cadet service to destroy a tunnel
*/
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
t = "CHANNEL_DESTROY";
break;
/**
* Confirm the creation of a channel.
*/
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
t = "CHANNEL_ACK";
break;
/**
* Confirm the creation of a channel.
*/
- case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
t = "CHANNEL_NACK";
break;
/**
* Encrypted payload.
*/
- case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
+ case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
t = "ENCRYPTED";
break;
/**
* Local payload traffic
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA:
t = "LOCAL_DATA";
break;
/**
* Local ACK for data.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK:
t = "LOCAL_ACK";
break;
/**
* Local monitoring of channels.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS:
t = "LOCAL_INFO_CHANNELS";
break;
/**
* Local monitoring of a channel.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL:
t = "LOCAL_INFO_CHANNEL";
break;
/**
* Local monitoring of service.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS:
t = "LOCAL_INFO_TUNNELS";
break;
/**
* Local monitoring of service.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL:
t = "LOCAL_INFO_TUNNEL";
break;
/**
* Local information about all connections of service.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTIONS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTIONS:
t = "LOCAL_INFO_CONNECTIONS";
break;
/**
* Local information of service about a specific connection.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTION:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTION:
t = "LOCAL_INFO_CONNECTION";
break;
/**
* Local information about all peers known to the service.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS:
t = "LOCAL_INFO_PEERS";
break;
/**
* Local information of service about a specific peer.
*/
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER:
+ case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER:
t = "LOCAL_INFO_PEER";
break;
/**
* Traffic (net-cat style) used by the Command Line Interface.
*/
- case GNUNET_MESSAGE_TYPE_MESH_CLI:
+ case GNUNET_MESSAGE_TYPE_CADET_CLI:
t = "CLI";
break;
Modified: gnunet/src/mesh/mesh_path.c
===================================================================
--- gnunet/src/mesh/mesh_path.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_path.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,14 +19,14 @@
*/
/**
- * @file mesh/mesh_path.c
+ * @file cadet/cadet_path.c
* @brief Path handling functions
* @author Bartlomiej Polot
*/
-#include "mesh.h"
-#include "mesh_path.h"
-#include "gnunet-service-mesh_peer.h"
+#include "cadet.h"
+#include "cadet_path.h"
+#include "gnunet-service-cadet_peer.h"
/**
* @brief Destroy a path after some time has past.
@@ -39,8 +39,8 @@
static void
path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct MeshPeerPath *path = cls;
- struct MeshPeer *peer;
+ struct CadetPeerPath *path = cls;
+ struct CadetPeer *peer;
path->path_delete = GNUNET_SCHEDULER_NO_TASK;
peer = GMP_get_short (path->peers[path->length - 1]);
@@ -55,12 +55,12 @@
*
* @return A newly allocated path with a peer array of the specified length.
*/
-struct MeshPeerPath *
+struct CadetPeerPath *
path_new (unsigned int length)
{
- struct MeshPeerPath *p;
+ struct CadetPeerPath *p;
- p = GNUNET_new (struct MeshPeerPath);
+ p = GNUNET_new (struct CadetPeerPath);
if (length > 0)
{
p->length = length;
@@ -76,7 +76,7 @@
* @param path the path to invert
*/
void
-path_invert (struct MeshPeerPath *path)
+path_invert (struct CadetPeerPath *path)
{
GNUNET_PEER_Id aux;
unsigned int i;
@@ -95,10 +95,10 @@
*
* @param path The path to duplicate.
*/
-struct MeshPeerPath *
-path_duplicate (const struct MeshPeerPath *path)
+struct CadetPeerPath *
+path_duplicate (const struct CadetPeerPath *path)
{
- struct MeshPeerPath *aux;
+ struct CadetPeerPath *aux;
unsigned int i;
aux = path_new (path->length);
@@ -118,7 +118,7 @@
* UINT_MAX in case the peer is not in the path.
*/
unsigned int
-path_get_length (struct MeshPeerPath *path)
+path_get_length (struct CadetPeerPath *path)
{
if (NULL == path)
return UINT_MAX;
@@ -136,7 +136,7 @@
* @param p Path to invalidate.
*/
void
-path_invalidate (struct MeshPeerPath *p)
+path_invalidate (struct CadetPeerPath *p)
{
if (GNUNET_SCHEDULER_NO_TASK != p->path_delete)
return;
@@ -155,7 +155,7 @@
* #GNUNET_NO If the path is known to be invalid.
*/
int
-path_is_valid (const struct MeshPeerPath *path)
+path_is_valid (const struct CadetPeerPath *path)
{
return (GNUNET_SCHEDULER_NO_TASK == path->path_delete);
}
@@ -169,7 +169,7 @@
* @return GNUNET_OK on success
*/
int
-path_destroy (struct MeshPeerPath *p)
+path_destroy (struct CadetPeerPath *p)
{
if (NULL == p)
return GNUNET_OK;
@@ -183,7 +183,7 @@
}
char *
-path_2s (struct MeshPeerPath *p)
+path_2s (struct CadetPeerPath *p)
{
char *s;
char *old;
@@ -201,7 +201,7 @@
}
void
-path_debug (struct MeshPeerPath *p)
+path_debug (struct CadetPeerPath *p)
{
unsigned int i;
Modified: gnunet/src/mesh/mesh_path.h
===================================================================
--- gnunet/src/mesh/mesh_path.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_path.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,15 +19,15 @@
*/
/**
- * @file mesh/mesh_path.h
+ * @file cadet/cadet_path.h
* @brief Path handling functions
* @author Bartlomiej Polot
*/
-#include "gnunet-service-mesh_connection.h"
+#include "gnunet-service-cadet_connection.h"
-#ifndef MESH_PATH_H_
-#define MESH_PATH_H_
+#ifndef CADET_PATH_H_
+#define CADET_PATH_H_
#ifdef __cplusplus
extern "C"
@@ -44,14 +44,14 @@
/**
* Information regarding a possible path to reach a single peer
*/
-struct MeshPeerPath
+struct CadetPeerPath
{
/**
* Linked list
*/
- struct MeshPeerPath *next;
- struct MeshPeerPath *prev;
+ struct CadetPeerPath *next;
+ struct CadetPeerPath *prev;
/**
* List of all the peers that form the path from origin to target.
@@ -66,7 +66,7 @@
/**
* User defined data store.
*/
- struct MeshConnection *c;
+ struct CadetConnection *c;
/**
* Path's score, how reliable is the path.
@@ -92,7 +92,7 @@
*
* @return A newly allocated path with a peer array of the specified length.
*/
-struct MeshPeerPath *
+struct CadetPeerPath *
path_new (unsigned int length);
@@ -102,7 +102,7 @@
* @param path The path to invert.
*/
void
-path_invert (struct MeshPeerPath *path);
+path_invert (struct CadetPeerPath *path);
/**
@@ -110,8 +110,8 @@
*
* @param path The path to duplicate.
*/
-struct MeshPeerPath *
-path_duplicate (const struct MeshPeerPath *path);
+struct CadetPeerPath *
+path_duplicate (const struct CadetPeerPath *path);
/**
@@ -123,7 +123,7 @@
* UINT_MAX in case the peer is not in the path.
*/
unsigned int
-path_get_length (struct MeshPeerPath *path);
+path_get_length (struct CadetPeerPath *path);
/**
* Mark path as invalid: keep it aroud for a while to avoid trying it in a
loop.
@@ -134,7 +134,7 @@
* @param p Path to invalidate.
*/
void
-path_invalidate (struct MeshPeerPath *p);
+path_invalidate (struct CadetPeerPath *p);
/**
* Test if a path is valid (or at least not known to be invalid).
@@ -145,7 +145,7 @@
* #GNUNET_NO If the path is known to be invalid.
*/
int
-path_is_valid (const struct MeshPeerPath *path);
+path_is_valid (const struct CadetPeerPath *path);
/**
* Destroy the path and free any allocated resources linked to it
@@ -155,7 +155,7 @@
* @return GNUNET_OK on success
*/
int
-path_destroy (struct MeshPeerPath *p);
+path_destroy (struct CadetPeerPath *p);
/**
* Path -> allocated one line string. Caller must free.
@@ -163,7 +163,7 @@
* @param p Path.
*/
char *
-path_2s (struct MeshPeerPath *p);
+path_2s (struct CadetPeerPath *p);
/**
* Print info about the path for debug.
@@ -171,7 +171,7 @@
* @param p Path to debug.
*/
void
-path_debug (struct MeshPeerPath *p);
+path_debug (struct CadetPeerPath *p);
#if 0 /* keep Emacsens' auto-indent happy */
{
@@ -181,5 +181,5 @@
#endif
-/* ifndef MESH_PATH_H */
+/* ifndef CADET_PATH_H */
#endif
Modified: gnunet/src/mesh/mesh_protocol.h
===================================================================
--- gnunet/src/mesh/mesh_protocol.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_protocol.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -20,19 +20,19 @@
/**
* @author Bartlomiej Polot
- * @file mesh/mesh_protocol.h
+ * @file cadet/cadet_protocol.h
*/
-#ifndef MESH_PROTOCOL_H_
-#define MESH_PROTOCOL_H_
+#ifndef CADET_PROTOCOL_H_
+#define CADET_PROTOCOL_H_
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "mesh.h"
+#include "cadet.h"
#ifdef __cplusplus
-struct GNUNET_MESH_TunnelMessage;
+struct GNUNET_CADET_TunnelMessage;
extern "C"
{
#if 0
@@ -42,20 +42,20 @@
#endif
/******************************************************************************/
-/******************** MESH NETWORK MESSAGES
**************************/
+/******************** CADET NETWORK MESSAGES
**************************/
/******************************************************************************/
GNUNET_NETWORK_STRUCT_BEGIN
/**
- * Message for mesh connection creation.
+ * Message for cadet connection creation.
*/
-struct GNUNET_MESH_ConnectionCreate
+struct GNUNET_CADET_ConnectionCreate
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE
+ * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
*
- * Size: sizeof (struct GNUNET_MESH_ConnectionCreate) +
+ * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
* path_length * sizeof (struct GNUNET_PeerIdentity)
*/
struct GNUNET_MessageHeader header;
@@ -63,7 +63,7 @@
/**
* ID of the connection
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
/**
* path_length structs defining the *whole* path from the origin [0] to the
@@ -75,17 +75,17 @@
/**
* Message for ack'ing a connection
*/
-struct GNUNET_MESH_ConnectionACK
+struct GNUNET_CADET_ConnectionACK
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK
+ * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
*/
struct GNUNET_MessageHeader header;
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
};
@@ -93,17 +93,17 @@
/**
* Message for encapsulation of a Key eXchange message in a connection.
*/
-struct GNUNET_MESH_KX
+struct GNUNET_CADET_KX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_KX.
+ * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
*/
struct GNUNET_MessageHeader header;
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
/* Specific KX message follows. */
};
@@ -115,11 +115,11 @@
*
* As far as possible, same as CORE's EphemeralKeyMessage.
*/
-struct GNUNET_MESH_KX_Ephemeral
+struct GNUNET_CADET_KX_Ephemeral
{
/**
- * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL.
+ * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL.
*/
struct GNUNET_MessageHeader header;
@@ -167,10 +167,10 @@
* can decrypt. The other peer should respond with a PONG with the
* same content, except this time encrypted with the receiver's key.
*/
-struct GNUNET_MESH_KX_Ping
+struct GNUNET_CADET_KX_Ping
{
/**
- * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PING.
+ * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PING.
*/
struct GNUNET_MessageHeader header;
@@ -195,10 +195,10 @@
/**
* Response to a PING. Includes data from the original PING.
*/
-struct GNUNET_MESH_KX_Pong
+struct GNUNET_CADET_KX_Pong
{
/**
- * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PONG.
+ * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
*/
struct GNUNET_MessageHeader header;
@@ -217,17 +217,17 @@
/**
* Tunnel(ed) message.
*/
-struct GNUNET_MESH_Encrypted
+struct GNUNET_CADET_Encrypted
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED
+ * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
*/
struct GNUNET_MessageHeader header;
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
/**
* ID of the packet (hop by hop).
@@ -248,7 +248,7 @@
* MAC of the encrypted message, used to verify message integrity.
* Everything after this value will be encrypted and authenticated.
*/
- struct GNUNET_MESH_Hash hmac;
+ struct GNUNET_CADET_Hash hmac;
/**
* Encrypted content follows.
@@ -259,17 +259,17 @@
/**
* Message to create a Channel.
*/
-struct GNUNET_MESH_ChannelCreate
+struct GNUNET_CADET_ChannelCreate
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
+ * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel
*/
- MESH_ChannelNumber chid GNUNET_PACKED;
+ CADET_ChannelNumber chid GNUNET_PACKED;
/**
* Destination port.
@@ -286,28 +286,28 @@
/**
* Message to manage a Channel (ACK, NACK, Destroy).
*/
-struct GNUNET_MESH_ChannelManage
+struct GNUNET_CADET_ChannelManage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|NACK|DESTROY}
+ * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel
*/
- MESH_ChannelNumber chid GNUNET_PACKED;
+ CADET_ChannelNumber chid GNUNET_PACKED;
};
/**
- * Message for mesh data traffic.
+ * Message for cadet data traffic.
*/
-struct GNUNET_MESH_Data
+struct GNUNET_CADET_Data
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
- * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
+ * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
+ * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
*/
struct GNUNET_MessageHeader header;
@@ -319,7 +319,7 @@
/**
* ID of the channel
*/
- MESH_ChannelNumber chid GNUNET_PACKED;
+ CADET_ChannelNumber chid GNUNET_PACKED;
/**
* Payload follows
@@ -330,17 +330,17 @@
/**
* Message to acknowledge end-to-end data.
*/
-struct GNUNET_MESH_DataACK
+struct GNUNET_CADET_DataACK
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
+ * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
*/
struct GNUNET_MessageHeader header;
/**
* ID of the channel
*/
- MESH_ChannelNumber chid GNUNET_PACKED;
+ CADET_ChannelNumber chid GNUNET_PACKED;
/**
* Bitfield of already-received newer messages
@@ -357,12 +357,12 @@
/**
- * Message to acknowledge mesh encrypted traffic.
+ * Message to acknowledge cadet encrypted traffic.
*/
-struct GNUNET_MESH_ACK
+struct GNUNET_CADET_ACK
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
+ * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
*/
struct GNUNET_MessageHeader header;
@@ -374,17 +374,17 @@
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
};
/**
* Message to query a peer about its Flow Control status regarding a tunnel.
*/
-struct GNUNET_MESH_Poll
+struct GNUNET_CADET_Poll
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
+ * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
*/
struct GNUNET_MessageHeader header;
@@ -396,7 +396,7 @@
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
};
@@ -404,17 +404,17 @@
/**
* Message for notifying a disconnection in a path
*/
-struct GNUNET_MESH_ConnectionBroken
+struct GNUNET_CADET_ConnectionBroken
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
+ * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
*/
struct GNUNET_MessageHeader header;
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
/**
* ID of the endpoint
@@ -431,17 +431,17 @@
/**
* Message to destroy a connection.
*/
-struct GNUNET_MESH_ConnectionDestroy
+struct GNUNET_CADET_ConnectionDestroy
{
/**
- * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
+ * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
*/
struct GNUNET_MessageHeader header;
/**
* ID of the connection.
*/
- struct GNUNET_MESH_Hash cid;
+ struct GNUNET_CADET_Hash cid;
};
@@ -454,6 +454,6 @@
}
#endif
-/* ifndef MESH_PROTOCOL_H */
+/* ifndef CADET_PROTOCOL_H */
#endif
-/* end of mesh_protocol.h */
+/* end of cadet_protocol.h */
Modified: gnunet/src/mesh/mesh_test_lib.c
===================================================================
--- gnunet/src/mesh/mesh_test_lib.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_test_lib.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -18,19 +18,19 @@
Boston, MA 02111-1307, USA.
*/
/**
- * @file mesh/mesh_test_lib.c
+ * @file cadet/cadet_test_lib.c
* @author Bartlomiej Polot
- * @brief library for writing MESH tests
+ * @brief library for writing CADET tests
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "mesh_test_lib.h"
-#include "gnunet_mesh_service.h"
+#include "cadet_test_lib.h"
+#include "gnunet_cadet_service.h"
/**
- * Test context for a MESH Test.
+ * Test context for a CADET Test.
*/
-struct GNUNET_MESH_TEST_Context
+struct GNUNET_CADET_TEST_Context
{
/**
* Array of running peers.
@@ -38,19 +38,19 @@
struct GNUNET_TESTBED_Peer **peers;
/**
- * Array of handles to the MESH for each peer.
+ * Array of handles to the CADET for each peer.
*/
- struct GNUNET_MESH_Handle **meshes;
+ struct GNUNET_CADET_Handle **cadetes;
/**
- * Operation associated with the connection to the MESH.
+ * Operation associated with the connection to the CADET.
*/
struct GNUNET_TESTBED_Operation **ops;
/**
- * Main function of the test to run once all MESHs are available.
+ * Main function of the test to run once all CADETs are available.
*/
- GNUNET_MESH_TEST_AppMain app_main;
+ GNUNET_CADET_TEST_AppMain app_main;
/**
* Closure for 'app_main'.
@@ -65,17 +65,17 @@
/**
* Handler for incoming tunnels.
*/
- GNUNET_MESH_InboundChannelNotificationHandler *new_channel;
+ GNUNET_CADET_InboundChannelNotificationHandler *new_channel;
/**
* Cleaner for destroyed incoming tunnels.
*/
- GNUNET_MESH_ChannelEndHandler *cleaner;
+ GNUNET_CADET_ChannelEndHandler *cleaner;
/**
* Message handlers.
*/
- struct GNUNET_MESH_MessageHandler* handlers;
+ struct GNUNET_CADET_MessageHandler* handlers;
/**
* Application ports.
@@ -86,9 +86,9 @@
/**
- * Context for a mesh adapter callback.
+ * Context for a cadet adapter callback.
*/
-struct GNUNET_MESH_TEST_AdapterContext
+struct GNUNET_CADET_TEST_AdapterContext
{
/**
* Peer number for the particular peer.
@@ -98,13 +98,13 @@
/**
* General context.
*/
- struct GNUNET_MESH_TEST_Context *ctx;
+ struct GNUNET_CADET_TEST_Context *ctx;
};
/**
* Adapter function called to establish a connection to
- * the MESH service.
+ * the CADET service.
*
* @param cls closure
* @param cfg configuration of the peer to connect to; will be available until
@@ -113,14 +113,14 @@
* @return service handle to return in 'op_result', NULL on error
*/
static void *
-mesh_connect_adapter (void *cls,
+cadet_connect_adapter (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- struct GNUNET_MESH_TEST_AdapterContext *actx = cls;
- struct GNUNET_MESH_TEST_Context *ctx = actx->ctx;
- struct GNUNET_MESH_Handle *h;
+ struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
+ struct GNUNET_CADET_TEST_Context *ctx = actx->ctx;
+ struct GNUNET_CADET_Handle *h;
- h = GNUNET_MESH_connect (cfg,
+ h = GNUNET_CADET_connect (cfg,
(void *) (long) actx->peer,
ctx->new_channel,
ctx->cleaner,
@@ -132,20 +132,20 @@
/**
* Adapter function called to destroy a connection to
- * the MESH service.
+ * the CADET service.
*
* @param cls closure
* @param op_result service handle returned from the connect adapter
*/
static void
-mesh_disconnect_adapter (void *cls,
+cadet_disconnect_adapter (void *cls,
void *op_result)
{
- struct GNUNET_MESH_Handle *mesh = op_result;
- struct GNUNET_MESH_TEST_AdapterContext *actx = cls;
+ struct GNUNET_CADET_Handle *cadet = op_result;
+ struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
GNUNET_free (actx);
- GNUNET_MESH_disconnect (mesh);
+ GNUNET_CADET_disconnect (cadet);
}
@@ -155,22 +155,22 @@
* @param cls The callback closure from functions generating an operation.
* @param op The operation that has been finished.
* @param ca_result The service handle returned from
- * GNUNET_TESTBED_ConnectAdapter() (mesh handle).
+ * GNUNET_TESTBED_ConnectAdapter() (cadet handle).
* @param emsg Error message in case the operation has failed.
* NULL if operation has executed successfully.
*/
static void
-mesh_connect_cb (void *cls,
+cadet_connect_cb (void *cls,
struct GNUNET_TESTBED_Operation *op,
void *ca_result,
const char *emsg)
{
- struct GNUNET_MESH_TEST_Context *ctx = cls;
+ struct GNUNET_CADET_TEST_Context *ctx = cls;
unsigned int i;
if (NULL != emsg)
{
- fprintf (stderr, "Failed to connect to MESH service: %s\n",
+ fprintf (stderr, "Failed to connect to CADET service: %s\n",
emsg);
GNUNET_SCHEDULER_shutdown ();
return;
@@ -178,23 +178,23 @@
for (i = 0; i < ctx->num_peers; i++)
if (op == ctx->ops[i])
{
- ctx->meshes[i] = ca_result;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "...mesh %u connected\n", i);
+ ctx->cadetes[i] = ca_result;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "...cadet %u connected\n", i);
}
for (i = 0; i < ctx->num_peers; i++)
- if (NULL == ctx->meshes[i])
- return; /* still some MESH connections missing */
- /* all MESH connections ready! */
+ if (NULL == ctx->cadetes[i])
+ return; /* still some CADET connections missing */
+ /* all CADET connections ready! */
ctx->app_main (ctx->app_main_cls,
ctx,
ctx->num_peers,
ctx->peers,
- ctx->meshes);
+ ctx->cadetes);
}
void
-GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx)
+GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx)
{
unsigned int i;
@@ -205,7 +205,7 @@
ctx->ops[i] = NULL;
}
GNUNET_free (ctx->ops);
- GNUNET_free (ctx->meshes);
+ GNUNET_free (ctx->cadetes);
GNUNET_free (ctx);
GNUNET_SCHEDULER_shutdown ();
}
@@ -225,14 +225,14 @@
* failed
*/
static void
-mesh_test_run (void *cls,
+cadet_test_run (void *cls,
struct GNUNET_TESTBED_RunHandle *h,
unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers,
unsigned int links_succeeded,
unsigned int links_failed)
{
- struct GNUNET_MESH_TEST_Context *ctx = cls;
+ struct GNUNET_CADET_TEST_Context *ctx = cls;
unsigned int i;
if (num_peers != ctx->num_peers)
@@ -244,18 +244,18 @@
ctx->peers = peers;
for (i = 0; i < num_peers; i++)
{
- struct GNUNET_MESH_TEST_AdapterContext *newctx;
- newctx = GNUNET_new (struct GNUNET_MESH_TEST_AdapterContext);
+ struct GNUNET_CADET_TEST_AdapterContext *newctx;
+ newctx = GNUNET_new (struct GNUNET_CADET_TEST_AdapterContext);
newctx->peer = i;
newctx->ctx = ctx;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting to mesh %u\n", i);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting to cadet %u\n", i);
ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx,
peers[i],
- "mesh",
- &mesh_connect_cb,
+ "cadet",
+ &cadet_connect_cb,
ctx,
- &mesh_connect_adapter,
- &mesh_disconnect_adapter,
+ &cadet_connect_adapter,
+ &cadet_disconnect_adapter,
newctx);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "op handle %p\n", ctx->ops[i]);
}
@@ -263,22 +263,22 @@
void
-GNUNET_MESH_TEST_run (const char *testname,
+GNUNET_CADET_TEST_run (const char *testname,
const char *cfgname,
unsigned int num_peers,
- GNUNET_MESH_TEST_AppMain tmain,
+ GNUNET_CADET_TEST_AppMain tmain,
void *tmain_cls,
- GNUNET_MESH_InboundChannelNotificationHandler
new_channel,
- GNUNET_MESH_ChannelEndHandler cleaner,
- struct GNUNET_MESH_MessageHandler* handlers,
+ GNUNET_CADET_InboundChannelNotificationHandler
new_channel,
+ GNUNET_CADET_ChannelEndHandler cleaner,
+ struct GNUNET_CADET_MessageHandler* handlers,
const uint32_t *ports)
{
- struct GNUNET_MESH_TEST_Context *ctx;
+ struct GNUNET_CADET_TEST_Context *ctx;
- ctx = GNUNET_new (struct GNUNET_MESH_TEST_Context);
+ ctx = GNUNET_new (struct GNUNET_CADET_TEST_Context);
ctx->num_peers = num_peers;
ctx->ops = GNUNET_malloc (num_peers * sizeof (struct
GNUNET_TESTBED_Operation *));
- ctx->meshes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_MESH_Handle
*));
+ ctx->cadetes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_CADET_Handle
*));
ctx->app_main = tmain;
ctx->app_main_cls = tmain_cls;
ctx->new_channel = new_channel;
@@ -289,7 +289,7 @@
cfgname,
num_peers,
0LL, NULL, NULL,
- &mesh_test_run, ctx);
+ &cadet_test_run, ctx);
}
-/* end of mesh_test_lib.c */
+/* end of cadet_test_lib.c */
Modified: gnunet/src/mesh/mesh_test_lib.h
===================================================================
--- gnunet/src/mesh/mesh_test_lib.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_test_lib.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -18,12 +18,12 @@
Boston, MA 02111-1307, USA.
*/
/**
- * @file mesh/mesh_test_lib.h
+ * @file cadet/cadet_test_lib.h
* @author Bartlomiej Polot
- * @brief library for writing MESH tests
+ * @brief library for writing CADET tests
*/
-#ifndef MESH_TEST_LIB_H
-#define MESH_TEST_LIB_H
+#ifndef CADET_TEST_LIB_H
+#define CADET_TEST_LIB_H
#ifdef __cplusplus
extern "C"
@@ -34,34 +34,34 @@
#endif
#include "gnunet_testbed_service.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
/**
- * Test context for a MESH Test.
+ * Test context for a CADET Test.
*/
-struct GNUNET_MESH_TEST_Context;
+struct GNUNET_CADET_TEST_Context;
/**
- * Main function of a MESH test.
+ * Main function of a CADET test.
*
* @param cls Closure.
- * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end.
+ * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
* @param num_peers Number of peers that are running.
* @param peers Array of peers.
- * @param meshes Handle to each of the MESHs of the peers.
+ * @param cadetes Handle to each of the CADETs of the peers.
*/
-typedef void (*GNUNET_MESH_TEST_AppMain) (void *cls,
- struct GNUNET_MESH_TEST_Context *ctx,
+typedef void (*GNUNET_CADET_TEST_AppMain) (void *cls,
+ struct GNUNET_CADET_TEST_Context
*ctx,
unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers,
- struct GNUNET_MESH_Handle **meshes);
+ struct GNUNET_CADET_Handle
**cadetes);
/**
* Run a test using the given name, configuration file and number of
* peers.
- * All mesh callbacks will receive the peer number as the closure.
+ * All cadet callbacks will receive the peer number as the closure.
*
* @param testname Name of the test (for logging).
* @param cfgname Name of the configuration file.
@@ -74,14 +74,14 @@
* @param ports Ports the peers offer.
*/
void
-GNUNET_MESH_TEST_run (const char *testname,
+GNUNET_CADET_TEST_run (const char *testname,
const char *cfgname,
unsigned int num_peers,
- GNUNET_MESH_TEST_AppMain tmain,
+ GNUNET_CADET_TEST_AppMain tmain,
void *tmain_cls,
- GNUNET_MESH_InboundChannelNotificationHandler
new_channel,
- GNUNET_MESH_ChannelEndHandler cleaner,
- struct GNUNET_MESH_MessageHandler* handlers,
+ GNUNET_CADET_InboundChannelNotificationHandler
new_channel,
+ GNUNET_CADET_ChannelEndHandler cleaner,
+ struct GNUNET_CADET_MessageHandler* handlers,
const uint32_t* ports);
@@ -91,7 +91,7 @@
* @param ctx handle for the testbed
*/
void
-GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx);
+GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx);
#if 0 /* keep Emacsens' auto-indent happy */
@@ -102,5 +102,5 @@
#endif
-/* ifndef MESH_TEST_LIB_H */
+/* ifndef CADET_TEST_LIB_H */
#endif
Modified: gnunet/src/mesh/mesh_tunnel_tree.c
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_tunnel_tree.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,21 +19,21 @@
*/
/**
- * @file mesh/mesh_tunnel_tree.c
+ * @file cadet/cadet_tunnel_tree.c
* @brief Tunnel tree handling functions
* @author Bartlomiej Polot
*/
-#include "mesh.h"
-#include "mesh_tunnel_tree.h"
+#include "cadet.h"
+#include "cadet_tunnel_tree.h"
-#define MESH_TREE_DEBUG GNUNET_YES
+#define CADET_TREE_DEBUG GNUNET_YES
/**
* Node of path tree for a tunnel
*/
-struct MeshTunnelTreeNode
+struct CadetTunnelTreeNode
{
/**
* Peer this node describes
@@ -43,59 +43,59 @@
/**
* Parent node in the tree
*/
- struct MeshTunnelTreeNode *parent;
+ struct CadetTunnelTreeNode *parent;
/**
* DLL of siblings
*/
- struct MeshTunnelTreeNode *next;
+ struct CadetTunnelTreeNode *next;
/**
* DLL of siblings
*/
- struct MeshTunnelTreeNode *prev;
+ struct CadetTunnelTreeNode *prev;
/**
* DLL of children
*/
- struct MeshTunnelTreeNode *children_head;
+ struct CadetTunnelTreeNode *children_head;
/**
* DLL of children
*/
- struct MeshTunnelTreeNode *children_tail;
+ struct CadetTunnelTreeNode *children_tail;
/**
* Status of the peer in the tunnel
*/
- enum MeshPeerState status;
+ enum CadetPeerState status;
};
/**
* Tree to reach all peers in the tunnel
*/
-struct MeshTunnelTree
+struct CadetTunnelTree
{
/**
* Root node of peer tree
*/
- struct MeshTunnelTreeNode *root;
+ struct CadetTunnelTreeNode *root;
/**
* Node that represents our position in the tree (for non local tunnels)
*/
- struct MeshTunnelTreeNode *me;
+ struct CadetTunnelTreeNode *me;
/**
* DLL of disconneted nodes
*/
- struct MeshTunnelTreeNode *disconnected_head;
+ struct CadetTunnelTreeNode *disconnected_head;
/**
* DLL of disconneted nodes
*/
- struct MeshTunnelTreeNode *disconnected_tail;
+ struct CadetTunnelTreeNode *disconnected_tail;
/**
* Cache of all peers and the first hop to them.
@@ -114,12 +114,12 @@
*
* @return A newly allocated path with a peer array of the specified length.
*/
-struct MeshPeerPath *
+struct CadetPeerPath *
path_new (unsigned int length)
{
- struct MeshPeerPath *p;
+ struct CadetPeerPath *p;
- p = GNUNET_new (struct MeshPeerPath);
+ p = GNUNET_new (struct CadetPeerPath);
if (length > 0)
{
p->length = length;
@@ -135,7 +135,7 @@
* @param path the path to invert
*/
void
-path_invert (struct MeshPeerPath *path)
+path_invert (struct CadetPeerPath *path)
{
GNUNET_PEER_Id aux;
unsigned int i;
@@ -154,10 +154,10 @@
*
* @param path The path to duplicate.
*/
-struct MeshPeerPath *
-path_duplicate (struct MeshPeerPath *path)
+struct CadetPeerPath *
+path_duplicate (struct CadetPeerPath *path)
{
- struct MeshPeerPath *aux;
+ struct CadetPeerPath *aux;
unsigned int i;
aux = path_new (path->length);
@@ -177,8 +177,8 @@
* If not known, NULL to find out and pass on children.
*/
static void
-tree_node_update_first_hops (struct MeshTunnelTree *tree,
- struct MeshTunnelTreeNode *parent,
+tree_node_update_first_hops (struct CadetTunnelTree *tree,
+ struct CadetTunnelTreeNode *parent,
struct GNUNET_PeerIdentity *hop);
@@ -191,7 +191,7 @@
* UINT_MAX in case the peer is not in the path.
*/
unsigned int
-path_get_length (struct MeshPeerPath *path)
+path_get_length (struct CadetPeerPath *path)
{
if (NULL == path)
return UINT_MAX;
@@ -207,7 +207,7 @@
* @return GNUNET_OK on success
*/
int
-path_destroy (struct MeshPeerPath *p)
+path_destroy (struct CadetPeerPath *p)
{
if (NULL == p)
return GNUNET_OK;
@@ -228,12 +228,12 @@
*
* @return Newly allocated node
*/
-static struct MeshTunnelTreeNode *
-tree_node_new (struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id peer)
+static struct CadetTunnelTreeNode *
+tree_node_new (struct CadetTunnelTreeNode *parent, GNUNET_PEER_Id peer)
{
- struct MeshTunnelTreeNode *node;
+ struct CadetTunnelTreeNode *node;
- node = GNUNET_new (struct MeshTunnelTreeNode);
+ node = GNUNET_new (struct CadetTunnelTreeNode);
node->peer = peer;
GNUNET_PEER_change_rc (peer, 1);
node->parent = parent;
@@ -253,11 +253,11 @@
*
* @return Pointer to the node of the peer. NULL if not found.
*/
-static struct MeshTunnelTreeNode *
-tree_node_find_peer (struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id peer_id)
+static struct CadetTunnelTreeNode *
+tree_node_find_peer (struct CadetTunnelTreeNode *parent, GNUNET_PEER_Id
peer_id)
{
- struct MeshTunnelTreeNode *n;
- struct MeshTunnelTreeNode *r;
+ struct CadetTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *r;
if (parent->peer == peer_id)
return parent;
@@ -280,29 +280,29 @@
* If not known, NULL to find out and pass on children.
*/
static void
-tree_node_update_first_hops (struct MeshTunnelTree *tree,
- struct MeshTunnelTreeNode *parent,
+tree_node_update_first_hops (struct CadetTunnelTree *tree,
+ struct CadetTunnelTreeNode *parent,
struct GNUNET_PeerIdentity *hop)
{
struct GNUNET_PeerIdentity pi;
struct GNUNET_PeerIdentity *copy;
struct GNUNET_PeerIdentity id;
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (parent->peer, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Finding first hop for %s.\n",
GNUNET_i2s (&id));
#endif
if (NULL == hop)
{
- struct MeshTunnelTreeNode *aux;
- struct MeshTunnelTreeNode *old;
+ struct CadetTunnelTreeNode *aux;
+ struct CadetTunnelTreeNode *old;
aux = old = parent;
while (aux != tree->me)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (aux->peer, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: ... checking %s.\n",
GNUNET_i2s (&id));
@@ -311,7 +311,7 @@
aux = aux->parent;
GNUNET_assert (NULL != aux);
}
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (old->peer, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: It's %s!\n",
GNUNET_i2s (&id));
@@ -337,21 +337,21 @@
static void
-tree_node_debug (struct MeshTunnelTreeNode *n, uint16_t level)
+tree_node_debug (struct CadetTunnelTreeNode *n, uint16_t level)
{
- struct MeshTunnelTreeNode *c;
+ struct CadetTunnelTreeNode *c;
struct GNUNET_PeerIdentity id;;
uint16_t i;
for (i = 0; i < level; i++)
FPRINTF (stderr, "%s", " ");
- if (n->status == MESH_PEER_READY)
+ if (n->status == CADET_PEER_READY)
FPRINTF (stderr, "%s", "#");
- if (n->status == MESH_PEER_SEARCHING)
+ if (n->status == CADET_PEER_SEARCHING)
FPRINTF (stderr, "%s", "+");
- if (n->status == MESH_PEER_RELAY)
+ if (n->status == CADET_PEER_RELAY)
FPRINTF (stderr, "%s", "-");
- if (n->status == MESH_PEER_RECONNECTING)
+ if (n->status == CADET_PEER_RECONNECTING)
FPRINTF (stderr, "%s", "*");
GNUNET_PEER_resolve (n->peer, &id);
@@ -374,14 +374,14 @@
* @param parent Parent node to be destroyed
*/
static void
-tree_node_destroy (struct MeshTunnelTreeNode *parent)
+tree_node_destroy (struct CadetTunnelTreeNode *parent)
{
- struct MeshTunnelTreeNode *n;
- struct MeshTunnelTreeNode *next;
+ struct CadetTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *next;
if (NULL == parent)
return;
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
struct GNUNET_PeerIdentity id;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Destroying node %u\n",
@@ -412,15 +412,15 @@
*
* @return A newly allocated and initialized tunnel tree.
*/
-struct MeshTunnelTree *
+struct CadetTunnelTree *
tree_new (GNUNET_PEER_Id peer)
{
- struct MeshTunnelTree *tree;
+ struct CadetTunnelTree *tree;
- tree = GNUNET_new (struct MeshTunnelTree);
+ tree = GNUNET_new (struct CadetTunnelTree);
tree->first_hops = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
tree->root = tree_node_new (NULL, peer);
- tree->root->status = MESH_PEER_ROOT;
+ tree->root->status = CADET_PEER_ROOT;
if (1 == peer)
{
@@ -439,10 +439,10 @@
* @param status New status to set.
*/
void
-tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer,
- enum MeshPeerState status)
+tree_set_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer,
+ enum CadetPeerState status)
{
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
n = tree_find_peer (tree, peer);
if (NULL == n)
@@ -459,14 +459,14 @@
*
* @return Status of the peer.
*/
-enum MeshPeerState
-tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer)
+enum CadetPeerState
+tree_get_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer)
{
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
n = tree_find_peer (tree, peer);
if (NULL == n)
- return MESH_PEER_INVALID;
+ return CADET_PEER_INVALID;
return n->status;
}
@@ -479,7 +479,7 @@
* @return Short peer id of local peer.
*/
GNUNET_PEER_Id
-tree_get_predecessor (struct MeshTunnelTree *tree)
+tree_get_predecessor (struct CadetTunnelTree *tree)
{
if (NULL != tree->me && NULL != tree->me->parent)
return tree->me->parent->peer;
@@ -500,7 +500,7 @@
* FIXME use PEER_Id
*/
struct GNUNET_PeerIdentity *
-tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
+tree_get_first_hop (struct CadetTunnelTree *t, GNUNET_PEER_Id peer)
{
struct GNUNET_PeerIdentity id;
struct GNUNET_PeerIdentity *r;
@@ -509,7 +509,7 @@
r = GNUNET_CONTAINER_multihashmap_get (t->first_hops, &id.hashPubKey);
if (NULL == r)
{
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
n = tree_find_peer (t, peer);
if (NULL != t->me && NULL != n)
@@ -538,8 +538,8 @@
*
* @return Pointer to the node of the peer. NULL if not found.
*/
-struct MeshTunnelTreeNode *
-tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id)
+struct CadetTunnelTreeNode *
+tree_find_peer (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer_id)
{
return tree_node_find_peer (tree->root, peer_id);
}
@@ -554,23 +554,23 @@
* @param cbcls Closure for cb.
*/
static void
-tree_mark_peers_disconnected (struct MeshTunnelTree *tree,
- struct MeshTunnelTreeNode *parent,
- MeshTreeCallback cb, void *cbcls)
+tree_mark_peers_disconnected (struct CadetTunnelTree *tree,
+ struct CadetTunnelTreeNode *parent,
+ CadetTreeCallback cb, void *cbcls)
{
struct GNUNET_PeerIdentity *pi;
struct GNUNET_PeerIdentity id;
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
for (n = parent->children_head; NULL != n; n = n->next)
{
tree_mark_peers_disconnected (tree, n, cb, cbcls);
}
- if (MESH_PEER_READY == parent->status)
+ if (CADET_PEER_READY == parent->status)
{
if (NULL != cb)
cb (cbcls, parent->peer);
- parent->status = MESH_PEER_RECONNECTING;
+ parent->status = CADET_PEER_RECONNECTING;
}
/* Remove and free info about first hop */
@@ -590,10 +590,10 @@
* @param cb_cls Closure for @c cb.
*/
void
-tree_iterate_children (struct MeshTunnelTree *tree, MeshTreeCallback cb,
+tree_iterate_children (struct CadetTunnelTree *tree, CadetTreeCallback cb,
void *cb_cls)
{
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
if (NULL == tree->me)
return;
@@ -607,22 +607,22 @@
/**
* Struct to contain a list of pending nodes when iterating a tree.
*/
-struct MeshTreePendingNode {
+struct CadetTreePendingNode {
/**
* DLL next.
*/
- struct MeshTreePendingNode *next;
+ struct CadetTreePendingNode *next;
/**
* DLL prev.
*/
- struct MeshTreePendingNode *prev;
+ struct CadetTreePendingNode *prev;
/**
* Pending node.
*/
- struct MeshTunnelTreeNode *node;
+ struct CadetTunnelTreeNode *node;
};
@@ -636,18 +636,18 @@
* TODO: recursive implementation? (s/heap/stack/g)
*/
void
-tree_iterate_all (struct MeshTunnelTree *tree,
- MeshWholeTreeCallback cb,
+tree_iterate_all (struct CadetTunnelTree *tree,
+ CadetWholeTreeCallback cb,
void *cb_cls)
{
- struct MeshTunnelTreeNode *parent;
- struct MeshTunnelTreeNode *n;
- struct MeshTreePendingNode *head;
- struct MeshTreePendingNode *tail;
- struct MeshTreePendingNode *pending;
+ struct CadetTunnelTreeNode *parent;
+ struct CadetTunnelTreeNode *n;
+ struct CadetTreePendingNode *head;
+ struct CadetTreePendingNode *tail;
+ struct CadetTreePendingNode *pending;
cb (cb_cls, tree->root->peer, 0);
- pending = GNUNET_new (struct MeshTreePendingNode);
+ pending = GNUNET_new (struct CadetTreePendingNode);
pending->node = tree->root;
head = tail = NULL;
GNUNET_CONTAINER_DLL_insert (head, tail, pending);
@@ -661,7 +661,7 @@
for (n = parent->children_head; NULL != n; n = n->next)
{
cb (cb_cls, n->peer, parent->peer);
- pending = GNUNET_new (struct MeshTreePendingNode);
+ pending = GNUNET_new (struct CadetTreePendingNode);
pending->node = n;
/* Insert_tail: breadth first, Insert: depth first */
GNUNET_CONTAINER_DLL_insert (head, tail, pending);
@@ -688,7 +688,7 @@
* @param tree Tree to use. Must have "me" set.
*/
unsigned int
-tree_count_children (struct MeshTunnelTree *tree)
+tree_count_children (struct CadetTunnelTree *tree)
{
unsigned int i;
@@ -707,7 +707,7 @@
* If not known, NULL to find out and pass on children.
*/
void
-tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id,
+tree_update_first_hops (struct CadetTunnelTree *tree, GNUNET_PEER_Id parent_id,
struct GNUNET_PeerIdentity *hop)
{
tree_node_update_first_hops (tree, tree_find_peer (tree, parent_id), hop);
@@ -727,15 +727,15 @@
* @return pointer to the pathless node.
* NULL when not found
*/
-struct MeshTunnelTreeNode *
-tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
- MeshTreeCallback cb, void *cbcls)
+struct CadetTunnelTreeNode *
+tree_del_path (struct CadetTunnelTree *t, GNUNET_PEER_Id peer_id,
+ CadetTreeCallback cb, void *cbcls)
{
- struct MeshTunnelTreeNode *parent;
- struct MeshTunnelTreeNode *node;
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *parent;
+ struct CadetTunnelTreeNode *node;
+ struct CadetTunnelTreeNode *n;
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
struct GNUNET_PeerIdentity id;
GNUNET_PEER_resolve (peer_id, &id);
@@ -764,10 +764,10 @@
GNUNET_CONTAINER_DLL_remove (parent->children_head, parent->children_tail,
n);
n->parent = NULL;
- while (MESH_PEER_RELAY == parent->status &&
+ while (CADET_PEER_RELAY == parent->status &&
NULL == parent->children_head)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (parent->peer, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Deleting node %s.\n",
GNUNET_i2s (&id));
@@ -778,7 +778,7 @@
tree_node_destroy (parent);
parent = n;
}
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (parent->peer, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Not deleted peer %s.\n",
GNUNET_i2s (&id));
@@ -800,11 +800,11 @@
* @return A newly allocated individual path to reach the destination peer.
* Path must be destroyed afterwards.
*/
-struct MeshPeerPath *
-tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
+struct CadetPeerPath *
+tree_get_path_to_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer)
{
- struct MeshTunnelTreeNode *n;
- struct MeshPeerPath *p;
+ struct CadetTunnelTreeNode *n;
+ struct CadetPeerPath *p;
n = tree_find_peer (t, peer);
if (NULL == n)
@@ -859,18 +859,18 @@
* - do not disconnect peers until new path is created & connected
*/
int
-tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
- MeshTreeCallback cb, void *cbcls)
+tree_add_path (struct CadetTunnelTree *t, const struct CadetPeerPath *p,
+ CadetTreeCallback cb, void *cbcls)
{
- struct MeshTunnelTreeNode *parent;
- struct MeshTunnelTreeNode *oldnode;
- struct MeshTunnelTreeNode *n;
- struct MeshTunnelTreeNode *c;
+ struct CadetTunnelTreeNode *parent;
+ struct CadetTunnelTreeNode *oldnode;
+ struct CadetTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *c;
struct GNUNET_PeerIdentity id;
int me;
unsigned int i;
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (p->peers[p->length - 1], &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"tree: Adding path [%u] towards peer %s.\n", p->length,
@@ -896,7 +896,7 @@
me = t->root->peer == 1 ? 0 : -1;
for (i = 1; i < p->length; i++)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (p->peers[i], &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Looking for peer %s.\n",
GNUNET_i2s (&id));
@@ -908,7 +908,7 @@
{
if (c->peer == p->peers[i])
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_PEER_resolve (parent->peer, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"tree: Found in children of %s.\n", GNUNET_i2s (&id));
@@ -922,13 +922,13 @@
if (parent == n)
break;
}
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: All childen visited.\n");
#endif
/* Add the rest of the path as a branch from parent. */
while (i < p->length)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Adding peer %u to %u.\n",
p->peers[i], parent->peer);
GNUNET_PEER_resolve (p->peers[i], &id);
@@ -941,7 +941,7 @@
if (i == p->length - 1 && NULL != oldnode)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"tree: Putting old node into place.\n");
#endif
@@ -953,11 +953,11 @@
}
else
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Creating new node.\n");
#endif
n = tree_node_new (parent, p->peers[i]);
- n->status = MESH_PEER_RELAY;
+ n->status = CADET_PEER_RELAY;
}
if (n->peer == 1)
{
@@ -967,26 +967,26 @@
i++;
parent = n;
}
- n->status = MESH_PEER_SEARCHING;
+ n->status = CADET_PEER_SEARCHING;
GNUNET_break (-1 != me);
/* Add info about first hop into hashmap. */
if (-1 != me && me < p->length - 1)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: finding first hop (own pos %d/%u)\n", me,
+ "CADET: finding first hop (own pos %d/%u)\n", me,
p->length - 1);
#endif
GNUNET_PEER_resolve (p->peers[me + 1], &id);
tree_update_first_hops (t, p->peers[me + 1], &id);
}
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MESH: was last in path, not updating first hops (%d/%u)\n",
+ "CADET: was last in path, not updating first hops (%d/%u)\n",
me, p->length - 1);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: New node added.\n");
@@ -1010,12 +1010,12 @@
* @return Short ID of the first disconnected peer in the tree.
*/
GNUNET_PEER_Id
-tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1,
- GNUNET_PEER_Id p2, MeshTreeCallback cb,
+tree_notify_connection_broken (struct CadetTunnelTree *t, GNUNET_PEER_Id p1,
+ GNUNET_PEER_Id p2, CadetTreeCallback cb,
void *cbcls)
{
- struct MeshTunnelTreeNode *n;
- struct MeshTunnelTreeNode *c;
+ struct CadetTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *c;
n = tree_find_peer (t, p1);
if (NULL == n)
@@ -1057,10 +1057,10 @@
* @return GNUNET_OK or GNUNET_SYSERR
*/
int
-tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer,
- MeshTreeCallback cb, void *cbcls)
+tree_del_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer,
+ CadetTreeCallback cb, void *cbcls)
{
- struct MeshTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *n;
n = tree_del_path (t, peer, cb, cbcls);
if (NULL == n)
@@ -1094,10 +1094,10 @@
* TODO: take in account state of the nodes
*/
unsigned int
-tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path)
+tree_get_path_cost (struct CadetTunnelTree *t, struct CadetPeerPath *path)
{
- struct MeshTunnelTreeNode *n;
- struct MeshTunnelTreeNode *p;
+ struct CadetTunnelTreeNode *n;
+ struct CadetTunnelTreeNode *p;
unsigned int i;
unsigned int l;
@@ -1131,7 +1131,7 @@
* @param t The tree
*/
void
-tree_debug (struct MeshTunnelTree *t)
+tree_debug (struct CadetTunnelTree *t)
{
tree_node_debug (t->root, 0);
FPRINTF (stderr, "root: %p\n", t->root);
@@ -1162,9 +1162,9 @@
* @param t Tree to be destroyed
*/
void
-tree_destroy (struct MeshTunnelTree *t)
+tree_destroy (struct CadetTunnelTree *t)
{
-#if MESH_TREE_DEBUG
+#if CADET_TREE_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Destroying tree\n");
#endif
tree_node_destroy (t->root);
Modified: gnunet/src/mesh/mesh_tunnel_tree.h
===================================================================
--- gnunet/src/mesh/mesh_tunnel_tree.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/mesh_tunnel_tree.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,12 +19,12 @@
*/
/**
- * @file mesh/mesh_tunnel_tree.h
+ * @file cadet/cadet_tunnel_tree.h
* @brief Tunnel tree handling functions
* @author Bartlomiej Polot
*/
-#include "mesh.h"
+#include "cadet.h"
/******************************************************************************/
/************************ DATA STRUCTURES
****************************/
@@ -33,14 +33,14 @@
/**
* Information regarding a possible path to reach a single peer
*/
-struct MeshPeerPath
+struct CadetPeerPath
{
/**
* Linked list
*/
- struct MeshPeerPath *next;
- struct MeshPeerPath *prev;
+ struct CadetPeerPath *next;
+ struct CadetPeerPath *prev;
/**
* List of all the peers that form the path from origin to target.
@@ -58,13 +58,13 @@
/**
* Node of path tree for a tunnel
*/
-struct MeshTunnelTreeNode;
+struct CadetTunnelTreeNode;
/**
* Tree to reach all peers in the tunnel
*/
-struct MeshTunnelTree;
+struct CadetTunnelTree;
/******************************************************************************/
@@ -78,7 +78,7 @@
*
* @return A newly allocated path with a peer array of the specified length.
*/
-struct MeshPeerPath *
+struct CadetPeerPath *
path_new (unsigned int length);
@@ -88,7 +88,7 @@
* @param path The path to invert.
*/
void
-path_invert (struct MeshPeerPath *path);
+path_invert (struct CadetPeerPath *path);
/**
@@ -96,8 +96,8 @@
*
* @param path The path to duplicate.
*/
-struct MeshPeerPath *
-path_duplicate (struct MeshPeerPath *path);
+struct CadetPeerPath *
+path_duplicate (struct CadetPeerPath *path);
/**
@@ -109,7 +109,7 @@
* UINT_MAX in case the peer is not in the path.
*/
unsigned int
-path_get_length (struct MeshPeerPath *path);
+path_get_length (struct CadetPeerPath *path);
/**
@@ -120,7 +120,7 @@
* @return GNUNET_OK on success
*/
int
-path_destroy (struct MeshPeerPath *p);
+path_destroy (struct CadetPeerPath *p);
/******************************************************************************/
@@ -131,7 +131,7 @@
* @param cls Closure.
* @param peer_id Short ID of the peer.
*/
-typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id);
+typedef void (*CadetTreeCallback) (void *cls, GNUNET_PEER_Id peer_id);
/**
@@ -141,7 +141,7 @@
* @param peer_id Short ID of the peer.
* @param peer_id Short ID of the parent of the peer.
*/
-typedef void (*MeshWholeTreeCallback) (void *cls,
+typedef void (*CadetWholeTreeCallback) (void *cls,
GNUNET_PEER_Id peer_id,
GNUNET_PEER_Id parent_id);
@@ -152,7 +152,7 @@
*
* @return A newly allocated and initialized tunnel tree
*/
-struct MeshTunnelTree *
+struct CadetTunnelTree *
tree_new (GNUNET_PEER_Id peer);
@@ -164,8 +164,8 @@
* @param status New status to set.
*/
void
-tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer,
- enum MeshPeerState status);
+tree_set_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer,
+ enum CadetPeerState status);
/**
@@ -176,8 +176,8 @@
*
* @return Short peer id of local peer.
*/
-enum MeshPeerState
-tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer);
+enum CadetPeerState
+tree_get_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer);
/**
@@ -188,7 +188,7 @@
* @return Short peer id of local peer.
*/
GNUNET_PEER_Id
-tree_get_predecessor (struct MeshTunnelTree *tree);
+tree_get_predecessor (struct CadetTunnelTree *tree);
/**
@@ -201,7 +201,7 @@
* NULL on error
*/
struct GNUNET_PeerIdentity *
-tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer);
+tree_get_first_hop (struct CadetTunnelTree *t, GNUNET_PEER_Id peer);
/**
@@ -212,8 +212,8 @@
*
* @return Pointer to the node of the peer. NULL if not found.
*/
-struct MeshTunnelTreeNode *
-tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id);
+struct CadetTunnelTreeNode *
+tree_find_peer (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer_id);
/**
@@ -224,8 +224,8 @@
* @param cb_cls Closure for @c cb.
*/
void
-tree_iterate_children (struct MeshTunnelTree *tree,
- MeshTreeCallback cb,
+tree_iterate_children (struct CadetTunnelTree *tree,
+ CadetTreeCallback cb,
void *cb_cls);
@@ -239,8 +239,8 @@
* TODO: recursive implementation? (s/heap/stack/g)
*/
void
-tree_iterate_all (struct MeshTunnelTree *tree,
- MeshWholeTreeCallback cb,
+tree_iterate_all (struct CadetTunnelTree *tree,
+ CadetWholeTreeCallback cb,
void *cb_cls);
/**
@@ -249,7 +249,7 @@
* @param tree Tree to use. Must have "me" set.
*/
unsigned int
-tree_count_children (struct MeshTunnelTree *tree);
+tree_count_children (struct CadetTunnelTree *tree);
/**
@@ -261,7 +261,7 @@
* If not known, NULL to find out and pass on children.
*/
void
-tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id,
+tree_update_first_hops (struct CadetTunnelTree *tree, GNUNET_PEER_Id parent_id,
struct GNUNET_PeerIdentity *hop);
/**
@@ -278,9 +278,9 @@
* @return pointer to the pathless node.
* NULL when not found
*/
-struct MeshTunnelTreeNode *
-tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
- MeshTreeCallback cb, void *cbcls);
+struct CadetTunnelTreeNode *
+tree_del_path (struct CadetTunnelTree *t, GNUNET_PEER_Id peer_id,
+ CadetTreeCallback cb, void *cbcls);
/**
@@ -293,8 +293,8 @@
* @return A newly allocated individual path to reach the destination peer.
* Path must be destroyed afterwards.
*/
-struct MeshPeerPath *
-tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer);
+struct CadetPeerPath *
+tree_get_path_to_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer);
/**
@@ -309,8 +309,8 @@
* GNUNET_SYSERR in case of error.
*/
int
-tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
- MeshTreeCallback cb, void *cbcls);
+tree_add_path (struct CadetTunnelTree *t, const struct CadetPeerPath *p,
+ CadetTreeCallback cb, void *cbcls);
/**
@@ -326,8 +326,8 @@
* @return Short ID of the first disconnected peer in the tree.
*/
GNUNET_PEER_Id
-tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1,
- GNUNET_PEER_Id p2, MeshTreeCallback cb,
+tree_notify_connection_broken (struct CadetTunnelTree *t, GNUNET_PEER_Id p1,
+ GNUNET_PEER_Id p2, CadetTreeCallback cb,
void *cbcls);
@@ -347,8 +347,8 @@
* @return GNUNET_YES if the tunnel still has nodes
*/
int
-tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer,
- MeshTreeCallback cb, void *cbcls);
+tree_del_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer,
+ CadetTreeCallback cb, void *cbcls);
/**
@@ -361,7 +361,7 @@
* in the path
*/
unsigned int
-tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path);
+tree_get_path_cost (struct CadetTunnelTree *t, struct CadetPeerPath *path);
/**
@@ -370,7 +370,7 @@
* @param t The tree
*/
void
-tree_debug (struct MeshTunnelTree *t);
+tree_debug (struct CadetTunnelTree *t);
/**
@@ -379,4 +379,4 @@
* @param t Tree to be destroyed
*/
void
-tree_destroy (struct MeshTunnelTree *t);
+tree_destroy (struct CadetTunnelTree *t);
Modified: gnunet/src/mesh/test_mesh.c
===================================================================
--- gnunet/src/mesh/test_mesh.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/test_mesh.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -18,14 +18,14 @@
Boston, MA 02111-1307, USA.
*/
/**
- * @file mesh/test_mesh.c
+ * @file cadet/test_cadet.c
*
- * @brief Test for the mesh service: retransmission of traffic.
+ * @brief Test for the cadet service: retransmission of traffic.
*/
#include <stdio.h>
#include "platform.h"
-#include "mesh_test_lib.h"
-#include "gnunet_mesh_service.h"
+#include "cadet_test_lib.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
#include <gauger.h>
@@ -129,7 +129,7 @@
/**
* Test context (to shut down).
*/
-struct GNUNET_MESH_TEST_Context *test_ctx;
+struct GNUNET_CADET_TEST_Context *test_ctx;
/**
* Task called to disconnect peers.
@@ -147,24 +147,24 @@
static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
/**
- * Mesh handle for the root peer
+ * Cadet handle for the root peer
*/
-static struct GNUNET_MESH_Handle *h1;
+static struct GNUNET_CADET_Handle *h1;
/**
- * Mesh handle for the first leaf peer
+ * Cadet handle for the first leaf peer
*/
-static struct GNUNET_MESH_Handle *h2;
+static struct GNUNET_CADET_Handle *h2;
/**
* Channel handle for the root peer
*/
-static struct GNUNET_MESH_Channel *ch;
+static struct GNUNET_CADET_Channel *ch;
/**
* Channel handle for the dest peer
*/
-static struct GNUNET_MESH_Channel *incoming_ch;
+static struct GNUNET_CADET_Channel *incoming_ch;
/**
* Time we started the data transmission (after channel has been established
@@ -212,7 +212,7 @@
4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); //
4bytes * ms
FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); //
packets * ms
- GAUGER ("MESH", test_name,
+ GAUGER ("CADET", test_name,
TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
"packets/s");
}
@@ -233,19 +233,19 @@
/**
- * Disconnect from mesh services af all peers, call shutdown.
+ * Disconnect from cadet services af all peers, call shutdown.
*
* @param cls Closure (unused).
* @param tc Task Context.
*/
static void
-disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext
*tc)
+disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext
*tc)
{
long line = (long) cls;
unsigned int i;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "disconnecting mesh service of peers, called from line %ld\n",
+ "disconnecting cadet service of peers, called from line %ld\n",
line);
disconnect_task = GNUNET_SCHEDULER_NO_TASK;
for (i = 0; i < 2; i++)
@@ -254,15 +254,15 @@
}
if (NULL != ch)
{
- GNUNET_MESH_channel_destroy (ch);
+ GNUNET_CADET_channel_destroy (ch);
ch = NULL;
}
if (NULL != incoming_ch)
{
- GNUNET_MESH_channel_destroy (incoming_ch);
+ GNUNET_CADET_channel_destroy (incoming_ch);
incoming_ch = NULL;
}
- GNUNET_MESH_TEST_cleanup (test_ctx);
+ GNUNET_CADET_TEST_cleanup (test_ctx);
if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
{
GNUNET_SCHEDULER_cancel (shutdown_handle);
@@ -282,7 +282,7 @@
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
(void *) line);
}
}
@@ -309,8 +309,8 @@
static void
data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_MESH_TransmitHandle *th;
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_TransmitHandle *th;
+ struct GNUNET_CADET_Channel *channel;
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -324,7 +324,7 @@
{
channel = ch;
}
- th = GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
+ th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
size_payload, &tmt_rdy, (void *) 1L);
if (NULL == th)
@@ -405,7 +405,7 @@
/**
* Function is called whenever a message is received.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end
* @param channel_ctx place to store local state associated with the channel
* @param message the actual message
@@ -413,7 +413,7 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
int
-data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
+data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -423,7 +423,7 @@
ok++;
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
if ((ok % 20) == 0)
{
@@ -431,7 +431,7 @@
{
GNUNET_SCHEDULER_cancel (disconnect_task);
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
}
}
@@ -480,7 +480,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received);
if (SPEED != test || (ok_goal - 2) == ok)
{
- GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
size_payload, &tmt_rdy, (void *) 1L);
return GNUNET_OK;
@@ -497,7 +497,7 @@
{
data_ack++;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", data_ack);
- GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
size_payload, &tmt_rdy, (void *) 1L);
if (data_ack < TOTAL_PACKETS && SPEED != test)
@@ -508,12 +508,12 @@
}
if (test == P2P_SIGNAL)
{
- GNUNET_MESH_channel_destroy (incoming_ch);
+ GNUNET_CADET_channel_destroy (incoming_ch);
incoming_ch = NULL;
}
else
{
- GNUNET_MESH_channel_destroy (ch);
+ GNUNET_CADET_channel_destroy (ch);
ch = NULL;
}
}
@@ -522,7 +522,7 @@
{
GNUNET_SCHEDULER_cancel (disconnect_task);
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
}
@@ -551,7 +551,7 @@
if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
(void *) __LINE__);
}
@@ -604,9 +604,9 @@
disconnect_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n");
- GNUNET_MESH_channel_destroy (ch);
+ GNUNET_CADET_channel_destroy (ch);
stats_op = GNUNET_TESTBED_get_statistics (5, testbed_peers,
- "mesh", NULL,
+ "cadet", NULL,
stats_iterator, stats_cont, NULL);
}
@@ -614,7 +614,7 @@
/**
* Handlers, for diverse services
*/
-static struct GNUNET_MESH_MessageHandler handlers[] = {
+static struct GNUNET_CADET_MessageHandler handlers[] = {
{&data_callback, 1, sizeof (struct GNUNET_MessageHeader)},
{NULL, 0, 0}
};
@@ -633,9 +633,9 @@
* (can be NULL -- that's not an error).
*/
static void *
-incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel,
+incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Incoming channel from %s to peer %d\n",
@@ -662,7 +662,7 @@
}
else
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
}
@@ -673,13 +673,13 @@
* Function called whenever an inbound channel is destroyed. Should clean up
* any associated state.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
-channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
+channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
long i = (long) cls;
@@ -709,7 +709,7 @@
if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
(void *) __LINE__);
}
@@ -718,7 +718,7 @@
/**
- * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES.
+ * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
*
* Testcase continues when the root receives confirmation of connected peers,
* on callback funtion ch.
@@ -729,7 +729,7 @@
static void
do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- enum GNUNET_MESH_ChannelOption flags;
+ enum GNUNET_CADET_ChannelOption flags;
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
@@ -741,16 +741,16 @@
GNUNET_SCHEDULER_cancel (disconnect_task);
}
- flags = GNUNET_MESH_OPTION_DEFAULT;
+ flags = GNUNET_CADET_OPTION_DEFAULT;
if (SPEED_REL == test)
{
test = SPEED;
- flags |= GNUNET_MESH_OPTION_RELIABLE;
+ flags |= GNUNET_CADET_OPTION_RELIABLE;
}
- ch = GNUNET_MESH_channel_create (h1, NULL, p_id[1], 1, flags);
+ ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags);
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
if (KEEPALIVE == test)
return; /* Don't send any data. */
@@ -760,7 +760,7 @@
data_ack = 0;
data_received = 0;
data_sent = 0;
- GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
size_payload, &tmt_rdy, (void *) 1L);
}
@@ -804,27 +804,27 @@
* test main: start test when all peers are connected
*
* @param cls Closure.
- * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end.
+ * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
* @param num_peers Number of peers that are running.
* @param peers Array of peers.
- * @param meshes Handle to each of the MESHs of the peers.
+ * @param cadetes Handle to each of the CADETs of the peers.
*/
static void
tmain (void *cls,
- struct GNUNET_MESH_TEST_Context *ctx,
+ struct GNUNET_CADET_TEST_Context *ctx,
unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers,
- struct GNUNET_MESH_Handle **meshes)
+ struct GNUNET_CADET_Handle **cadetes)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n");
ok = 0;
test_ctx = ctx;
peers_running = num_peers;
testbed_peers = peers;
- h1 = meshes[0];
- h2 = meshes[num_peers - 1];
+ h1 = cadetes[0];
+ h2 = cadetes[num_peers - 1];
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
+ &disconnect_cadet_peers,
(void *) __LINE__);
shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&shutdown_task, NULL);
@@ -849,24 +849,24 @@
const char *config_file;
GNUNET_log_setup ("test", "DEBUG", NULL);
- config_file = "test_mesh.conf";
+ config_file = "test_cadet.conf";
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
- if (strstr (argv[0], "_mesh_forward") != NULL)
+ if (strstr (argv[0], "_cadet_forward") != NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
test = FORWARD;
test_name = "unicast";
ok_goal = 4;
}
- else if (strstr (argv[0], "_mesh_signal") != NULL)
+ else if (strstr (argv[0], "_cadet_signal") != NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
test = P2P_SIGNAL;
test_name = "signal";
ok_goal = 4;
}
- else if (strstr (argv[0], "_mesh_speed_ack") != NULL)
+ else if (strstr (argv[0], "_cadet_speed_ack") != NULL)
{
/* Test is supposed to generate the following callbacks:
* 1 incoming channel (@dest)
@@ -879,7 +879,7 @@
test = SPEED_ACK;
test_name = "speed ack";
}
- else if (strstr (argv[0], "_mesh_speed") != NULL)
+ else if (strstr (argv[0], "_cadet_speed") != NULL)
{
/* Test is supposed to generate the following callbacks:
* 1 incoming channel (@dest)
@@ -894,7 +894,7 @@
{
test = SPEED_REL;
test_name = "speed reliable";
- config_file = "test_mesh_drop.conf";
+ config_file = "test_cadet_drop.conf";
}
else
{
@@ -929,7 +929,7 @@
p_ids = 0;
ports[0] = 1;
ports[1] = 0;
- GNUNET_MESH_TEST_run ("test_mesh_small",
+ GNUNET_CADET_TEST_run ("test_cadet_small",
config_file,
5,
&tmain,
@@ -949,5 +949,5 @@
return 0;
}
-/* end of test_mesh.c */
+/* end of test_cadet.c */
Modified: gnunet/src/mesh/test_mesh_local.c
===================================================================
--- gnunet/src/mesh/test_mesh_local.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/test_mesh_local.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,8 +19,8 @@
*/
/**
- * @file mesh/test_mesh_local.c
- * @brief test mesh local: test of mesh channels with just one peer
+ * @file cadet/test_cadet_local.c
+ * @brief test cadet local: test of cadet channels with just one peer
* @author Bartlomiej Polot
*/
@@ -28,15 +28,15 @@
#include "gnunet_util_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_testing_lib.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
struct GNUNET_TESTING_Peer *me;
-static struct GNUNET_MESH_Handle *mesh_peer_1;
+static struct GNUNET_CADET_Handle *cadet_peer_1;
-static struct GNUNET_MESH_Handle *mesh_peer_2;
+static struct GNUNET_CADET_Handle *cadet_peer_2;
-static struct GNUNET_MESH_Channel *ch;
+static struct GNUNET_CADET_Channel *ch;
static int result = GNUNET_OK;
@@ -46,7 +46,7 @@
static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
-static struct GNUNET_MESH_TransmitHandle *mth;
+static struct GNUNET_CADET_TransmitHandle *mth;
/**
@@ -72,17 +72,17 @@
}
if (NULL != ch)
{
- GNUNET_MESH_channel_destroy (ch);
+ GNUNET_CADET_channel_destroy (ch);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n");
- if (NULL != mesh_peer_1)
+ if (NULL != cadet_peer_1)
{
- GNUNET_MESH_disconnect (mesh_peer_1);
+ GNUNET_CADET_disconnect (cadet_peer_1);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n");
- if (NULL != mesh_peer_2)
+ if (NULL != cadet_peer_2)
{
- GNUNET_MESH_disconnect (mesh_peer_2);
+ GNUNET_CADET_disconnect (cadet_peer_2);
}
}
@@ -108,7 +108,7 @@
/**
* Function is called whenever a message is received.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end
* @param channel_ctx place to store local state associated with the channel
* @param message the actual message
@@ -117,7 +117,7 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
-data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
+data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -128,7 +128,7 @@
shutdown_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown,
NULL);
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
return GNUNET_OK;
}
@@ -146,9 +146,9 @@
* (can be NULL -- that's not an error)
*/
static void *
-inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel,
+inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
long id = (long) cls;
@@ -169,13 +169,13 @@
* Function called whenever an channel is destroyed. Should clean up
* any associated state.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
-channel_end (void *cls, const struct GNUNET_MESH_Channel *channel,
+channel_end (void *cls, const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
long id = (long) cls;
@@ -185,7 +185,7 @@
id);
if (NULL != mth)
{
- GNUNET_MESH_notify_transmit_ready_cancel (mth);
+ GNUNET_CADET_notify_transmit_ready_cancel (mth);
mth = NULL;
}
if (GNUNET_NO == got_data)
@@ -201,7 +201,7 @@
/**
* Handler array for traffic received on peer1
*/
-static struct GNUNET_MESH_MessageHandler handlers1[] = {
+static struct GNUNET_CADET_MessageHandler handlers1[] = {
{&data_callback, 1, 0},
{NULL, 0, 0}
};
@@ -210,7 +210,7 @@
/**
* Handler array for traffic received on peer2 (none expected)
*/
-static struct GNUNET_MESH_MessageHandler handlers2[] = {
+static struct GNUNET_CADET_MessageHandler handlers2[] = {
{&data_callback, 1, 0},
{NULL, 0, 0}
};
@@ -259,9 +259,9 @@
GNUNET_TESTING_peer_get_identity (me, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n");
- ch = GNUNET_MESH_channel_create (mesh_peer_1, NULL, &id, 1,
- GNUNET_MESH_OPTION_DEFAULT);
- mth = GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO,
+ ch = GNUNET_CADET_channel_create (cadet_peer_1, NULL, &id, 1,
+ GNUNET_CADET_OPTION_DEFAULT);
+ mth = GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
sizeof (struct
GNUNET_MessageHeader),
&do_send, NULL);
@@ -287,28 +287,28 @@
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 15), &do_abort,
NULL);
- mesh_peer_1 = GNUNET_MESH_connect (cfg, /* configuration */
+ cadet_peer_1 = GNUNET_CADET_connect (cfg, /* configuration */
(void *) 1L, /* cls */
NULL, /* inbound new hndlr */
&channel_end, /* channel end hndlr */
handlers1, /* traffic handlers */
NULL); /* ports offered */
- mesh_peer_2 = GNUNET_MESH_connect (cfg, /* configuration */
+ cadet_peer_2 = GNUNET_CADET_connect (cfg, /* configuration */
(void *) 2L, /* cls */
&inbound_channel, /* inbound new hndlr
*/
&channel_end, /* channel end hndlr */
handlers2, /* traffic handlers */
ports); /* ports offered */
- if (NULL == mesh_peer_1 || NULL == mesh_peer_2)
+ if (NULL == cadet_peer_1 || NULL == cadet_peer_2)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to mesh :(\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to cadet :(\n");
result = GNUNET_SYSERR;
return;
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO MESH :D\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO CADET :D\n");
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
GNUNET_TIME_UNIT_SECONDS,
@@ -323,8 +323,8 @@
int
main (int argc, char *argv[])
{
- if (0 != GNUNET_TESTING_peer_run ("test-mesh-local",
- "test_mesh.conf",
+ if (0 != GNUNET_TESTING_peer_run ("test-cadet-local",
+ "test_cadet.conf",
&run, NULL))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n");
@@ -334,4 +334,4 @@
return (result == GNUNET_OK) ? 0 : 1;
}
-/* end of test_mesh_local_1.c */
+/* end of test_cadet_local_1.c */
Modified: gnunet/src/mesh/test_mesh_single.c
===================================================================
--- gnunet/src/mesh/test_mesh_single.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/mesh/test_mesh_single.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -19,8 +19,8 @@
*/
/**
- * @file mesh/test_mesh_single.c
- * @brief test mesh single: test of mesh channels with just one client
+ * @file cadet/test_cadet_single.c
+ * @brief test cadet single: test of cadet channels with just one client
* @author Bartlomiej Polot
*/
@@ -28,18 +28,18 @@
#include "gnunet_util_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_testing_lib.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#define REPETITIONS 5
#define DATA_SIZE 35000
struct GNUNET_TESTING_Peer *me;
-static struct GNUNET_MESH_Handle *mesh;
+static struct GNUNET_CADET_Handle *cadet;
-static struct GNUNET_MESH_Channel *ch1;
+static struct GNUNET_CADET_Channel *ch1;
-static struct GNUNET_MESH_Channel *ch2;
+static struct GNUNET_CADET_Channel *ch2;
static int result;
@@ -68,14 +68,14 @@
}
if (NULL != ch1)
{
- GNUNET_MESH_channel_destroy (ch1);
+ GNUNET_CADET_channel_destroy (ch1);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n");
- if (NULL != mesh)
+ if (NULL != cadet)
{
- GNUNET_MESH_disconnect (mesh);
- mesh = NULL;
+ GNUNET_CADET_disconnect (cadet);
+ cadet = NULL;
}
else
{
@@ -115,7 +115,7 @@
/**
* Function is called whenever a message is received.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end
* @param channel_ctx place to store local state associated with the channel
* @param message the actual message
@@ -124,7 +124,7 @@
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
-data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
+data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -134,21 +134,21 @@
repetition = repetition + 1;
if (repetition < REPETITIONS)
{
- struct GNUNET_MESH_Channel *my_channel;
+ struct GNUNET_CADET_Channel *my_channel;
if (repetition % 2 == 0)
my_channel = ch1;
else
my_channel = ch2;
- GNUNET_MESH_notify_transmit_ready (my_channel, GNUNET_NO,
+ GNUNET_CADET_notify_transmit_ready (my_channel, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
sizeof (struct GNUNET_MessageHeader)
+ DATA_SIZE,
&do_send, NULL);
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All data OK. Destroying channel.\n");
- GNUNET_MESH_channel_destroy (ch1);
+ GNUNET_CADET_channel_destroy (ch1);
ch1 = NULL;
return GNUNET_OK;
}
@@ -167,9 +167,9 @@
* (can be NULL -- that's not an error)
*/
static void *
-inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel,
+inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"received incoming channel on port %u\n",
@@ -183,13 +183,13 @@
* Function called whenever an inbound channel is destroyed. Should clean up
* any associated state.
*
- * @param cls closure (set from GNUNET_MESH_connect)
+ * @param cls closure (set from GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
-channel_end (void *cls, const struct GNUNET_MESH_Channel *channel,
+channel_end (void *cls, const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
long id = (long) cls;
@@ -210,7 +210,7 @@
/**
* Handler array for traffic received on peer1
*/
-static struct GNUNET_MESH_MessageHandler handlers1[] = {
+static struct GNUNET_CADET_MessageHandler handlers1[] = {
{&data_callback, 1, 0},
{NULL, 0, 0}
};
@@ -260,9 +260,9 @@
GNUNET_TESTING_peer_get_identity (me, &id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n");
- ch1 = GNUNET_MESH_channel_create (mesh, NULL, &id, 1,
- GNUNET_MESH_OPTION_DEFAULT);
- GNUNET_MESH_notify_transmit_ready (ch1, GNUNET_NO,
+ ch1 = GNUNET_CADET_channel_create (cadet, NULL, &id, 1,
+ GNUNET_CADET_OPTION_DEFAULT);
+ GNUNET_CADET_notify_transmit_ready (ch1, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
size, &do_send, NULL);
}
@@ -287,22 +287,22 @@
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 15), &do_abort,
NULL);
- mesh = GNUNET_MESH_connect (cfg, /* configuration */
+ cadet = GNUNET_CADET_connect (cfg, /* configuration */
(void *) 1L, /* cls */
&inbound_channel, /* inbound new hndlr */
&channel_end, /* inbound end hndlr */
handlers1, /* traffic handlers */
ports); /* ports offered */
- if (NULL == mesh)
+ if (NULL == cadet)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to mesh :(\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to cadet :(\n");
result = GNUNET_SYSERR;
return;
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO MESH :D\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO CADET :D\n");
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_connect, NULL);
}
@@ -315,8 +315,8 @@
main (int argc, char *argv[])
{
result = GNUNET_NO;
- if (0 != GNUNET_TESTING_peer_run ("test-mesh-local",
- "test_mesh.conf",
+ if (0 != GNUNET_TESTING_peer_run ("test-cadet-local",
+ "test_cadet.conf",
&run, NULL))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n");
@@ -326,4 +326,4 @@
return (result == GNUNET_OK) ? 0 : 1;
}
-/* end of test_mesh_single.c */
+/* end of test_cadet_single.c */
Modified: gnunet/src/pt/gnunet-daemon-pt.c
===================================================================
--- gnunet/src/pt/gnunet-daemon-pt.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/pt/gnunet-daemon-pt.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -27,7 +27,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_dns_service.h"
#include "gnunet_dnsparser_lib.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_tun_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_vpn_service.h"
@@ -37,7 +37,7 @@
/**
- * After how long do we time out if we could not get an IP from VPN or MESH?
+ * After how long do we time out if we could not get an IP from VPN or CADET?
*/
#define TIMEOUT GNUNET_TIME_UNIT_MINUTES
@@ -126,24 +126,24 @@
* as a DNS exit. We try to keep a few channels open and a few
* peers in reserve.
*/
-struct MeshExit
+struct CadetExit
{
/**
* Kept in a DLL.
*/
- struct MeshExit *next;
+ struct CadetExit *next;
/**
* Kept in a DLL.
*/
- struct MeshExit *prev;
+ struct CadetExit *prev;
/**
- * Channel we use for DNS requests over MESH, NULL if we did
+ * Channel we use for DNS requests over CADET, NULL if we did
* not initialze a channel to this peer yet.
*/
- struct GNUNET_MESH_Channel *mesh_channel;
+ struct GNUNET_CADET_Channel *cadet_channel;
/**
* At what time did the peer's advertisement expire?
@@ -161,19 +161,19 @@
struct RequestContext *receive_queue_tail;
/**
- * Head of DLL of requests to be transmitted to a mesh_channel.
+ * Head of DLL of requests to be transmitted to a cadet_channel.
*/
struct RequestContext *transmit_queue_head;
/**
- * Tail of DLL of requests to be transmitted to a mesh_channel.
+ * Tail of DLL of requests to be transmitted to a cadet_channel.
*/
struct RequestContext *transmit_queue_tail;
/**
* Active transmission request for this channel (or NULL).
*/
- struct GNUNET_MESH_TransmitHandle *mesh_th;
+ struct GNUNET_CADET_TransmitHandle *cadet_th;
/**
* Identity of the peer that is providing the exit for us.
@@ -195,7 +195,7 @@
/**
- * State we keep for a request that is going out via MESH.
+ * State we keep for a request that is going out via CADET.
*/
struct RequestContext
{
@@ -212,7 +212,7 @@
/**
* Exit that was chosen for this request.
*/
- struct MeshExit *exit;
+ struct CadetExit *exit;
/**
* Handle for interaction with DNS service.
@@ -220,10 +220,10 @@
struct GNUNET_DNS_RequestHandle *rh;
/**
- * Message we're sending out via MESH, allocated at the
+ * Message we're sending out via CADET, allocated at the
* end of this struct.
*/
- const struct GNUNET_MessageHeader *mesh_message;
+ const struct GNUNET_MessageHeader *cadet_message;
/**
* Task used to abort this operation with timeout.
@@ -250,16 +250,16 @@
/**
- * Head of DLL of mesh exits. Mesh exits with an open channel are
+ * Head of DLL of cadet exits. Cadet exits with an open channel are
* always at the beginning (so we do not have to traverse the entire
* list to find them).
*/
-static struct MeshExit *exit_head;
+static struct CadetExit *exit_head;
/**
- * Tail of DLL of mesh exits.
+ * Tail of DLL of cadet exits.
*/
-static struct MeshExit *exit_tail;
+static struct CadetExit *exit_tail;
/**
* The handle to the configuration used throughout the process
@@ -272,9 +272,9 @@
static struct GNUNET_VPN_Handle *vpn_handle;
/**
- * The handle to the MESH service
+ * The handle to the CADET service
*/
-static struct GNUNET_MESH_Handle *mesh_handle;
+static struct GNUNET_CADET_Handle *cadet_handle;
/**
* Statistics.
@@ -317,43 +317,43 @@
static int dns_channel;
/**
- * Number of DNS exit peers we currently have in the mesh channel.
- * Used to see if using the mesh channel makes any sense right now,
+ * Number of DNS exit peers we currently have in the cadet channel.
+ * Used to see if using the cadet channel makes any sense right now,
* as well as to decide if we should open new channels.
*/
static unsigned int dns_exit_available;
/**
- * We are short on mesh exits, try to open another one.
+ * We are short on cadet exits, try to open another one.
*/
static void
try_open_exit ()
{
- struct MeshExit *pos;
+ struct CadetExit *pos;
uint32_t candidate_count;
uint32_t candidate_selected;
candidate_count = 0;
for (pos = exit_head; NULL != pos; pos = pos->next)
- if (NULL == pos->mesh_channel)
+ if (NULL == pos->cadet_channel)
candidate_count++;
candidate_selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
candidate_count);
candidate_count = 0;
for (pos = exit_head; NULL != pos; pos = pos->next)
- if (NULL == pos->mesh_channel)
+ if (NULL == pos->cadet_channel)
{
candidate_count++;
if (candidate_selected < candidate_count)
{
/* move to the head of the DLL */
- pos->mesh_channel = GNUNET_MESH_channel_create (mesh_handle,
+ pos->cadet_channel = GNUNET_CADET_channel_create (cadet_handle,
pos,
&pos->peer,
GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
-
GNUNET_MESH_OPTION_DEFAULT);
- if (NULL == pos->mesh_channel)
+
GNUNET_CADET_OPTION_DEFAULT);
+ if (NULL == pos->cadet_channel)
{
GNUNET_break (0);
continue;
@@ -382,7 +382,7 @@
* @return weight of the channel
*/
static uint32_t
-get_channel_weight (struct MeshExit *exit)
+get_channel_weight (struct CadetExit *exit)
{
uint32_t dropped;
uint32_t drop_percent;
@@ -406,7 +406,7 @@
/**
- * Choose a mesh exit for a DNS request. We try to use a channel
+ * Choose a cadet exit for a DNS request. We try to use a channel
* that is reliable and currently available. All existing
* channels are given a base weight of 1, plus a score relating
* to the total number of queries answered in relation to the
@@ -416,10 +416,10 @@
* @return NULL if no exit is known, otherwise the
* exit that we should use to queue a message with
*/
-static struct MeshExit *
+static struct CadetExit *
choose_exit ()
{
- struct MeshExit *pos;
+ struct CadetExit *pos;
uint64_t total_transmitted;
uint64_t selected_offset;
uint32_t channel_weight;
@@ -427,12 +427,12 @@
total_transmitted = 0;
for (pos = exit_head; NULL != pos; pos = pos->next)
{
- if (NULL == pos->mesh_channel)
+ if (NULL == pos->cadet_channel)
break;
channel_weight = get_channel_weight (pos);
total_transmitted += channel_weight;
/* double weight for idle channels */
- if (NULL == pos->mesh_th)
+ if (NULL == pos->cadet_th)
total_transmitted += channel_weight;
}
if (0 == total_transmitted)
@@ -445,12 +445,12 @@
total_transmitted = 0;
for (pos = exit_head; NULL != pos; pos = pos->next)
{
- if (NULL == pos->mesh_channel)
+ if (NULL == pos->cadet_channel)
break;
channel_weight = get_channel_weight (pos);
total_transmitted += channel_weight;
/* double weight for idle channels */
- if (NULL == pos->mesh_th)
+ if (NULL == pos->cadet_th)
total_transmitted += channel_weight;
if (total_transmitted > selected_offset)
return pos;
@@ -696,7 +696,7 @@
* This function is called AFTER we got an IP address for a
* DNS request. Now, the PT daemon has the chance to substitute
* the IP address with one from the VPN range to channel requests
- * destined for this IP address via VPN and MESH.
+ * destined for this IP address via VPN and CADET.
*
* @param cls closure
* @param rh request handle to user for reply
@@ -744,39 +744,39 @@
/**
- * Transmit a DNS request via MESH and move the request
+ * Transmit a DNS request via CADET and move the request
* handle to the receive queue.
*
- * @param cls the `struct MeshExit`
+ * @param cls the `struct CadetExit`
* @param size number of bytes available in buf
* @param buf where to copy the message
* @return number of bytes written to buf
*/
static size_t
-transmit_dns_request_to_mesh (void *cls,
+transmit_dns_request_to_cadet (void *cls,
size_t size,
void *buf)
{
- struct MeshExit *exit = cls;
+ struct CadetExit *exit = cls;
struct RequestContext *rc;
size_t mlen;
- exit->mesh_th = NULL;
+ exit->cadet_th = NULL;
if (NULL == (rc = exit->transmit_queue_head))
return 0;
mlen = rc->mlen;
if (mlen > size)
{
- exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel,
+ exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
GNUNET_NO,
TIMEOUT,
mlen,
-
&transmit_dns_request_to_mesh,
+
&transmit_dns_request_to_cadet,
exit);
return 0;
}
GNUNET_assert (GNUNET_NO == rc->was_transmitted);
- memcpy (buf, rc->mesh_message, mlen);
+ memcpy (buf, rc->cadet_message, mlen);
GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head,
exit->transmit_queue_tail,
rc);
@@ -786,18 +786,18 @@
rc);
rc = exit->transmit_queue_head;
if (NULL != rc)
- exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel,
+ exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
GNUNET_NO,
TIMEOUT,
rc->mlen,
-
&transmit_dns_request_to_mesh,
+
&transmit_dns_request_to_cadet,
exit);
return mlen;
}
/**
- * Task run if the time to answer a DNS request via MESH is over.
+ * Task run if the time to answer a DNS request via CADET is over.
*
* @param cls the `struct RequestContext` to abort
* @param tc scheduler context
@@ -807,7 +807,7 @@
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RequestContext *rc = cls;
- struct MeshExit *exit = rc->exit;
+ struct CadetExit *exit = rc->exit;
if (rc->was_transmitted)
{
@@ -833,9 +833,9 @@
{
/* this straw broke the camel's back: this channel now has
such a low score that it will not be used; close it! */
- GNUNET_assert (NULL == exit->mesh_th);
- GNUNET_MESH_channel_destroy (exit->mesh_channel);
- exit->mesh_channel = NULL;
+ GNUNET_assert (NULL == exit->cadet_th);
+ GNUNET_CADET_channel_destroy (exit->cadet_channel);
+ exit->cadet_channel = NULL;
GNUNET_CONTAINER_DLL_remove (exit_head,
exit_tail,
exit);
@@ -859,7 +859,7 @@
/**
* This function is called *before* the DNS request has been
* given to a "local" DNS resolver. Channeling for DNS requests
- * was enabled, so we now need to send the request via some MESH
+ * was enabled, so we now need to send the request via some CADET
* channel to a DNS EXIT for resolution.
*
* @param cls closure
@@ -877,7 +877,7 @@
size_t mlen;
struct GNUNET_MessageHeader hdr;
struct GNUNET_TUN_DnsHeader dns;
- struct MeshExit *exit;
+ struct CadetExit *exit;
GNUNET_STATISTICS_update (stats,
gettext_noop ("# DNS requests intercepted"),
@@ -885,7 +885,7 @@
if (0 == dns_exit_available)
{
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# DNS requests dropped (DNS mesh
channel down)"),
+ gettext_noop ("# DNS requests dropped (DNS cadet
channel down)"),
1, GNUNET_NO);
GNUNET_DNS_request_drop (rh);
return;
@@ -902,11 +902,11 @@
mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
exit = choose_exit ();
GNUNET_assert (NULL != exit);
- GNUNET_assert (NULL != exit->mesh_channel);
+ GNUNET_assert (NULL != exit->cadet_channel);
rc = GNUNET_malloc (sizeof (struct RequestContext) + mlen);
rc->exit = exit;
rc->rh = rh;
- rc->mesh_message = (const struct GNUNET_MessageHeader*) &rc[1];
+ rc->cadet_message = (const struct GNUNET_MessageHeader*) &rc[1];
rc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
&timeout_request,
rc);
@@ -921,33 +921,33 @@
GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head,
exit->transmit_queue_tail,
rc);
- if (NULL == exit->mesh_th)
- exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel,
+ if (NULL == exit->cadet_th)
+ exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
GNUNET_NO,
TIMEOUT,
mlen,
-
&transmit_dns_request_to_mesh,
+
&transmit_dns_request_to_cadet,
exit);
}
/**
- * Process a request via mesh to perform a DNS query.
+ * Process a request via cadet to perform a DNS query.
*
* @param cls NULL
* @param channel connection to the other end
- * @param channel_ctx pointer to our `struct MeshExit`
+ * @param channel_ctx pointer to our `struct CadetExit`
* @param message the actual message
* @return #GNUNET_OK to keep the connection open,
* #GNUNET_SYSERR to close it (signal serious error)
*/
static int
receive_dns_response (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
- struct MeshExit *exit = *channel_ctx;
+ struct CadetExit *exit = *channel_ctx;
struct GNUNET_TUN_DnsHeader dns;
size_t mlen;
struct RequestContext *rc;
@@ -989,12 +989,12 @@
/**
- * Abort all pending DNS requests with the given mesh exit.
+ * Abort all pending DNS requests with the given cadet exit.
*
- * @param exit mesh exit to abort requests for
+ * @param exit cadet exit to abort requests for
*/
static void
-abort_all_requests (struct MeshExit *exit)
+abort_all_requests (struct CadetExit *exit)
{
struct RequestContext *rc;
@@ -1029,7 +1029,7 @@
cleanup (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tskctx)
{
- struct MeshExit *exit;
+ struct CadetExit *exit;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Protocol translation daemon is shutting down now\n");
@@ -1043,23 +1043,23 @@
GNUNET_CONTAINER_DLL_remove (exit_head,
exit_tail,
exit);
- if (NULL != exit->mesh_th)
+ if (NULL != exit->cadet_th)
{
- GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th);
- exit->mesh_th = NULL;
+ GNUNET_CADET_notify_transmit_ready_cancel (exit->cadet_th);
+ exit->cadet_th = NULL;
}
- if (NULL != exit->mesh_channel)
+ if (NULL != exit->cadet_channel)
{
- GNUNET_MESH_channel_destroy (exit->mesh_channel);
- exit->mesh_channel = NULL;
+ GNUNET_CADET_channel_destroy (exit->cadet_channel);
+ exit->cadet_channel = NULL;
}
abort_all_requests (exit);
GNUNET_free (exit);
}
- if (NULL != mesh_handle)
+ if (NULL != cadet_handle)
{
- GNUNET_MESH_disconnect (mesh_handle);
- mesh_handle = NULL;
+ GNUNET_CADET_disconnect (cadet_handle);
+ cadet_handle = NULL;
}
if (NULL != dns_post_handle)
{
@@ -1093,32 +1093,32 @@
* Function called whenever a channel is destroyed. Should clean up
* the associated state and attempt to build a new one.
*
- * It must NOT call #GNUNET_MESH_channel_destroy on the channel.
+ * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
*
- * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect)
+ * @param cls closure (the `struct CadetExit` set from #GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
-mesh_channel_end_cb (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+cadet_channel_end_cb (void *cls,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
- struct MeshExit *exit = channel_ctx;
- struct MeshExit *alt;
+ struct CadetExit *exit = channel_ctx;
+ struct CadetExit *alt;
struct RequestContext *rc;
- if (NULL != exit->mesh_th)
+ if (NULL != exit->cadet_th)
{
- GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th);
- exit->mesh_th = NULL;
+ GNUNET_CADET_notify_transmit_ready_cancel (exit->cadet_th);
+ exit->cadet_th = NULL;
}
- exit->mesh_channel = NULL;
+ exit->cadet_channel = NULL;
dns_exit_available--;
/* open alternative channels */
try_open_exit ();
- if (NULL == exit->mesh_channel)
+ if (NULL == exit->cadet_channel)
{
/* our channel is now closed, move our requests to an alternative
channel */
@@ -1150,20 +1150,20 @@
/* the same peer was chosen, just make sure the queue processing is
restarted */
alt = exit;
}
- if ( (NULL == alt->mesh_th) &&
+ if ( (NULL == alt->cadet_th) &&
(NULL != (rc = alt->transmit_queue_head)) )
- alt->mesh_th = GNUNET_MESH_notify_transmit_ready (alt->mesh_channel,
+ alt->cadet_th = GNUNET_CADET_notify_transmit_ready (alt->cadet_channel,
GNUNET_NO,
TIMEOUT,
rc->mlen,
-
&transmit_dns_request_to_mesh,
+
&transmit_dns_request_to_cadet,
alt);
}
/**
* Function called whenever we find an advertisement for a
- * DNS exit in the DHT. If we don't have a mesh channel,
+ * DNS exit in the DHT. If we don't have a cadet channel,
* we should build one; otherwise, we should save the
* advertisement for later use.
*
@@ -1192,7 +1192,7 @@
size_t size, const void *data)
{
const struct GNUNET_DNS_Advertisement *ad;
- struct MeshExit *exit;
+ struct CadetExit *exit;
if (sizeof (struct GNUNET_DNS_Advertisement) != size)
{
@@ -1207,7 +1207,7 @@
break;
if (NULL == exit)
{
- exit = GNUNET_new (struct MeshExit);
+ exit = GNUNET_new (struct CadetExit);
exit->peer = ad->peer;
/* channel is closed, so insert at the end */
GNUNET_CONTAINER_DLL_insert_tail (exit_head,
@@ -1275,7 +1275,7 @@
}
if (dns_channel)
{
- static struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
+ static struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
{&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0},
{NULL, 0, 0}
};
@@ -1292,14 +1292,14 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
- mesh_handle = GNUNET_MESH_connect (cfg, NULL, NULL,
- &mesh_channel_end_cb,
- mesh_handlers, NULL);
- if (NULL == mesh_handle)
+ cadet_handle = GNUNET_CADET_connect (cfg, NULL, NULL,
+ &cadet_channel_end_cb,
+ cadet_handlers, NULL);
+ if (NULL == cadet_handle)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to connect to %s service. Exiting.\n"),
- "MESH");
+ "CADET");
GNUNET_SCHEDULER_shutdown ();
return;
}
Modified: gnunet/src/regex/gnunet-daemon-regexprofiler.c
===================================================================
--- gnunet/src/regex/gnunet-daemon-regexprofiler.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/regex/gnunet-daemon-regexprofiler.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -20,9 +20,9 @@
/**
* @file regex/gnunet-daemon-regexprofiler.c
- * @brief daemon that uses mesh to announce a regular expression. Used in
+ * @brief daemon that uses cadet to announce a regular expression. Used in
* conjunction with gnunet-regex-profiler to announce regexes on serveral peers
- * without the need to explicitly connect to the mesh service running on the
+ * without the need to explicitly connect to the cadet service running on the
* peer from within the profiler.
* @author Maximilian Szengel
* @author Bartlomiej Polot
@@ -192,7 +192,7 @@
* Announce the given regular expression using regex and the path compression
* length read from config.
*
- * @param regex regular expression to announce on this peer's mesh.
+ * @param regex regular expression to announce on this peer's cadet.
*/
static void
announce_regex (const char * regex)
@@ -377,7 +377,7 @@
return (GNUNET_OK ==
GNUNET_PROGRAM_run (argc, argv, "regexprofiler",
gettext_noop
- ("Daemon to announce regular expressions for the
peer using mesh."),
+ ("Daemon to announce regular expressions for the
peer using cadet."),
options, &run, NULL)) ? global_ret : 1;
}
Modified: gnunet/src/regex/gnunet-regex-simulation-profiler.c
===================================================================
--- gnunet/src/regex/gnunet-regex-simulation-profiler.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/regex/gnunet-regex-simulation-profiler.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -21,7 +21,7 @@
/**
* @file regex/gnunet-regex-simulation-profiler.c
* @brief Regex profiler that dumps all DFAs into a database instead of
- * using the DHT (with mesh).
+ * using the DHT (with cadet).
* @author Maximilian Szengel
*
*/
Modified: gnunet/src/regex/regex_internal_dht.c
===================================================================
--- gnunet/src/regex/regex_internal_dht.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/regex/regex_internal_dht.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -487,7 +487,7 @@
/**
- * Iterator over found existing mesh regex blocks that match an ongoing search.
+ * Iterator over found existing cadet regex blocks that match an ongoing
search.
*
* @param cls Closure (current context)-
* @param key Current key code (key for cached block).
@@ -519,7 +519,7 @@
GNUNET_BLOCK_is_accepting (block, result->size));
regex_next_edge (block, result->size, ctx);
- GNUNET_STATISTICS_update (ctx->info->stats, "# regex mesh blocks iterated",
+ GNUNET_STATISTICS_update (ctx->info->stats, "# regex cadet blocks iterated",
1, GNUNET_NO);
return GNUNET_YES;
@@ -763,12 +763,12 @@
/**
- * Iterator over hash map entries to free MeshRegexBlocks stored during the
+ * Iterator over hash map entries to free CadetRegexBlocks stored during the
* search for connect_by_string.
*
* @param cls Closure (unused).
* @param key Current key code (unused).
- * @param value MeshRegexBlock in the hash map.
+ * @param value CadetRegexBlock in the hash map.
* @return GNUNET_YES if we should continue to iterate,
* GNUNET_NO if not.
*/
Modified: gnunet/src/regex/regex_test_lib.c
===================================================================
--- gnunet/src/regex/regex_test_lib.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/regex/regex_test_lib.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -21,7 +21,7 @@
* @file src/regex/regex_test_lib.c
* @brief library to read regexes representing IP networks from a file.
* and simplyfinying the into one big regex, in order to run
- * tests (regex performance, mesh profiler).
+ * tests (regex performance, cadet profiler).
* @author Bartlomiej Polot
*/
Modified: gnunet/src/set/gnunet-service-set.c
===================================================================
--- gnunet/src/set/gnunet-service-set.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/set/gnunet-service-set.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -104,10 +104,10 @@
static const struct GNUNET_CONFIGURATION_Handle *configuration;
/**
- * Handle to the mesh service, used
+ * Handle to the cadet service, used
* to listen for and connect to remote peers.
*/
-static struct GNUNET_MESH_Handle *mesh;
+static struct GNUNET_CADET_Handle *cadet;
/**
* Sets are held in a doubly linked list.
@@ -289,7 +289,7 @@
_GSS_operation_destroy (struct Operation *op)
{
struct Set *set;
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
if (NULL == op->vt)
return;
@@ -325,7 +325,7 @@
if (NULL != (channel = op->channel))
{
op->channel = NULL;
- GNUNET_MESH_channel_destroy (channel);
+ GNUNET_CADET_channel_destroy (channel);
}
collect_generation_garbage (set);
@@ -466,7 +466,7 @@
}
if (NULL != incoming->channel)
{
- GNUNET_MESH_channel_destroy (incoming->channel);
+ GNUNET_CADET_channel_destroy (incoming->channel);
incoming->channel = NULL;
}
}
@@ -847,7 +847,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"peer request rejected by client\n");
- GNUNET_MESH_channel_destroy (incoming->channel);
+ GNUNET_CADET_channel_destroy (incoming->channel);
//channel destruction handler called immediately upon destruction
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -980,11 +980,11 @@
op->vt = set->vt;
GNUNET_CONTAINER_DLL_insert (set->ops_head, set->ops_tail, op);
- op->channel = GNUNET_MESH_channel_create (mesh, op, &msg->target_peer,
+ op->channel = GNUNET_CADET_channel_create (cadet, op, &msg->target_peer,
GNUNET_APPLICATION_TYPE_SET,
- GNUNET_MESH_OPTION_RELIABLE);
+ GNUNET_CADET_OPTION_RELIABLE);
- op->mq = GNUNET_MESH_mq_create (op->channel);
+ op->mq = GNUNET_CADET_mq_create (op->channel);
set->vt->evaluate (op);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1173,12 +1173,12 @@
while (NULL != sets_head)
set_destroy (sets_head);
- /* it's important to destroy mesh at the end, as all channels
- * must be destroyed before the mesh handle! */
- if (NULL != mesh)
+ /* it's important to destroy cadet at the end, as all channels
+ * must be destroyed before the cadet handle! */
+ if (NULL != cadet)
{
- GNUNET_MESH_disconnect (mesh);
- mesh = NULL;
+ GNUNET_CADET_disconnect (cadet);
+ cadet = NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"handled shutdown request\n");
@@ -1233,7 +1233,7 @@
* Method called whenever another peer has added us to a channel
* the other peer initiated.
* Only called (once) upon reception of data with a message type which was
- * subscribed to in GNUNET_MESH_connect().
+ * subscribed to in GNUNET_CADET_connect().
*
* The channel context represents the operation itself and gets added to a DLL,
* from where it gets looked up when our local listener client responds
@@ -1249,9 +1249,9 @@
*/
static void *
channel_new_cb (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_MESH_ChannelOption options)
+ uint32_t port, enum GNUNET_CADET_ChannelOption options)
{
struct Operation *incoming;
static const struct SetVT incoming_vt = {
@@ -1265,7 +1265,7 @@
if (GNUNET_APPLICATION_TYPE_SET != port)
{
GNUNET_break (0);
- GNUNET_MESH_channel_destroy (channel);
+ GNUNET_CADET_channel_destroy (channel);
return NULL;
}
@@ -1274,7 +1274,7 @@
incoming->state = GNUNET_new (struct OperationState);
incoming->state->peer = *initiator;
incoming->channel = channel;
- incoming->mq = GNUNET_MESH_mq_create (incoming->channel);
+ incoming->mq = GNUNET_CADET_mq_create (incoming->channel);
incoming->vt = &incoming_vt;
incoming->state->timeout_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
@@ -1288,7 +1288,7 @@
/**
* Function called whenever a channel is destroyed. Should clean up
* any associated state. It must NOT call
- * GNUNET_MESH_channel_destroy() on the channel.
+ * GNUNET_CADET_channel_destroy() on the channel.
*
* The peer_disconnect function is part of a a virtual table set initially
either
* when a peer creates a new channel with us (channel_new_cb), or once we
create
@@ -1297,14 +1297,14 @@
* Once we know the exact type of operation (union/intersection), the vt is
* replaced with an operation specific instance (_GSS_[op]_vt).
*
- * @param cls closure (set from GNUNET_MESH_connect())
+ * @param cls closure (set from GNUNET_CADET_connect())
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored
*/
static void
channel_end_cb (void *cls,
- const struct GNUNET_MESH_Channel *channel, void *channel_ctx)
+ const struct GNUNET_CADET_Channel *channel, void *channel_ctx)
{
struct Operation *op = channel_ctx;
@@ -1322,7 +1322,7 @@
if (GNUNET_YES == op->keep)
return;
- /* mesh will never call us with the context again! */
+ /* cadet will never call us with the context again! */
GNUNET_free (channel_ctx);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"channel end cb finished\n");
@@ -1331,7 +1331,7 @@
/**
* Functions with this signature are called whenever a message is
- * received via a mesh channel.
+ * received via a cadet channel.
*
* The msg_handler is a virtual table set in initially either when a peer
* creates a new channel with us (channel_new_cb), or once we create a new
channel
@@ -1340,7 +1340,7 @@
* Once we know the exact type of operation (union/intersection), the vt is
* replaced with an operation specific instance (_GSS_[op]_vt).
*
- * @param cls Closure (set from GNUNET_MESH_connect()).
+ * @param cls Closure (set from GNUNET_CADET_connect()).
* @param channel Connection to the other end.
* @param channel_ctx Place to store local state associated with the channel.
* @param message The actual message.
@@ -1349,7 +1349,7 @@
*/
static int
dispatch_p2p_message (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1357,16 +1357,16 @@
int ret;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "dispatching mesh message (type: %u)\n",
+ "dispatching cadet message (type: %u)\n",
ntohs (message->type));
/* do this before the handler, as the handler might kill the channel */
- GNUNET_MESH_receive_done (channel);
+ GNUNET_CADET_receive_done (channel);
if (NULL != op->vt)
ret = op->vt->msg_handler (op, message);
else
ret = GNUNET_SYSERR;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "handled mesh message (type: %u)\n",
+ "handled cadet message (type: %u)\n",
ntohs (message->type));
return ret;
}
@@ -1403,7 +1403,7 @@
sizeof (struct GNUNET_SET_CancelMessage)},
{NULL, NULL, 0, 0}
};
- static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
+ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 0},
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF, 0},
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 0},
@@ -1415,7 +1415,7 @@
{dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF_PART,
0},
{NULL, 0, 0}
};
- static const uint32_t mesh_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};
+ static const uint32_t cadet_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};
configuration = cfg;
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -1423,12 +1423,12 @@
GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
GNUNET_SERVER_add_handlers (server, server_handlers);
- mesh = GNUNET_MESH_connect (cfg, NULL, channel_new_cb, channel_end_cb,
- mesh_handlers, mesh_ports);
- if (NULL == mesh)
+ cadet = GNUNET_CADET_connect (cfg, NULL, channel_new_cb, channel_end_cb,
+ cadet_handlers, cadet_ports);
+ if (NULL == cadet)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Could not connect to mesh service\n"));
+ _("Could not connect to cadet service\n"));
return;
}
}
Modified: gnunet/src/set/gnunet-service-set.h
===================================================================
--- gnunet/src/set/gnunet-service-set.h 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/set/gnunet-service-set.h 2014-05-07 12:06:50 UTC (rev 33183)
@@ -32,7 +32,7 @@
#include "gnunet_protocols.h"
#include "gnunet_applications.h"
#include "gnunet_core_service.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_set_service.h"
#include "set.h"
@@ -301,7 +301,7 @@
/**
* Tunnel to the peer.
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
/**
* Message queue for the tunnel.
Modified: gnunet/src/set/gnunet-service-set_intersection.c
===================================================================
--- gnunet/src/set/gnunet-service-set_intersection.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/set/gnunet-service-set_intersection.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -982,7 +982,7 @@
handle_p2p_done (op, mh);
break;
default:
- /* something wrong with mesh's message handlers? */
+ /* something wrong with cadet's message handlers? */
GNUNET_assert (0);
}
return GNUNET_OK;
Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c 2014-05-07 10:42:58 UTC (rev
33182)
+++ gnunet/src/set/gnunet-service-set_union.c 2014-05-07 12:06:50 UTC (rev
33183)
@@ -854,7 +854,7 @@
struct GNUNET_MQ_Envelope *ev;
struct GNUNET_MessageHeader *msg;
- /* It may be nice to merge multiple requests, but with mesh's corking it
is not worth
+ /* It may be nice to merge multiple requests, but with cadet's corking
it is not worth
* the effort additional complexity. */
ev = GNUNET_MQ_msg_header_extra (msg, sizeof (struct IBF_Key),
GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS);
@@ -1327,7 +1327,7 @@
handle_p2p_done (op, mh);
break;
default:
- /* something wrong with mesh's message handlers? */
+ /* something wrong with cadet's message handlers? */
GNUNET_assert (0);
}
return GNUNET_OK;
Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c 2014-05-07 10:42:58 UTC
(rev 33182)
+++ gnunet/src/topology/gnunet-daemon-topology.c 2014-05-07 12:06:50 UTC
(rev 33183)
@@ -20,7 +20,7 @@
/**
* @file topology/gnunet-daemon-topology.c
- * @brief code for maintaining the mesh topology
+ * @brief code for maintaining the cadet topology
* @author Christian Grothoff
*/
#include "platform.h"
@@ -1293,7 +1293,7 @@
(GNUNET_OK ==
GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-topology",
_
- ("GNUnet topology control (maintaining P2P mesh and
F2F constraints)"),
+ ("GNUnet topology control (maintaining P2P cadet
and F2F constraints)"),
options, &run, NULL)) ? 0 : 1;
GNUNET_free ((void*) argv);
return ret;
Modified: gnunet/src/vpn/gnunet-service-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-service-vpn.c 2014-05-07 10:42:58 UTC (rev 33182)
+++ gnunet/src/vpn/gnunet-service-vpn.c 2014-05-07 12:06:50 UTC (rev 33183)
@@ -22,12 +22,12 @@
* @file vpn/gnunet-service-vpn.c
* @brief service that opens a virtual interface and allows its clients
* to allocate IPs on the virtual interface and to then redirect
- * IP traffic received on those IPs via the GNUnet mesh
+ * IP traffic received on those IPs via the GNUnet cadet
* @author Philipp Toelke
* @author Christian Grothoff
*
* TODO:
- * - keep multiple peers/mesh channels ready as alternative exits /
+ * - keep multiple peers/cadet channels ready as alternative exits /
* detect & recover from channel-to-exit failure gracefully
*/
#include "platform.h"
@@ -35,7 +35,7 @@
#include "gnunet_common.h"
#include "gnunet_protocols.h"
#include "gnunet_applications.h"
-#include "gnunet_mesh_service.h"
+#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
#include "gnunet_constants.h"
#include "gnunet_tun_lib.h"
@@ -45,7 +45,7 @@
/**
- * Maximum number of messages we allow in the queue for mesh.
+ * Maximum number of messages we allow in the queue for cadet.
*/
#define MAX_MESSAGE_QUEUE_SIZE 4
@@ -218,7 +218,7 @@
* Information about the channel to use, NULL if no channel
* is available right now.
*/
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
/**
* Active query with REGEX to locate exit.
@@ -228,7 +228,7 @@
/**
* Active transmission handle, NULL for none.
*/
- struct GNUNET_MESH_TransmitHandle *th;
+ struct GNUNET_CADET_TransmitHandle *th;
/**
* Entry for this entry in the channel_heap, NULL as long as this
@@ -334,13 +334,13 @@
static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
- * Handle to the mesh service.
+ * Handle to the cadet service.
*/
-static struct GNUNET_MESH_Handle *mesh_handle;
+static struct GNUNET_CADET_Handle *cadet_handle;
/**
* Map from IP address to destination information (possibly with a
- * MESH channel handle for fast setup).
+ * CADET channel handle for fast setup).
*/
static struct GNUNET_CONTAINER_MultiHashMap *destination_map;
@@ -351,7 +351,7 @@
/**
* Map from source and destination address (IP+port) to connection
- * information (mostly with the respective MESH channel handle).
+ * information (mostly with the respective CADET channel handle).
*/
static struct GNUNET_CONTAINER_MultiHashMap *channel_map;
@@ -542,7 +542,7 @@
{
struct GNUNET_HashCode key;
struct ChannelMessageQueueEntry *tnq;
- struct GNUNET_MESH_Channel *channel;
+ struct GNUNET_CADET_Channel *channel;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Cleaning up channel state\n");
@@ -560,14 +560,14 @@
GNUNET_assert (0 == ts->tmq_length);
if (NULL != ts->th)
{
- GNUNET_MESH_notify_transmit_ready_cancel (ts->th);
+ GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
ts->th = NULL;
}
GNUNET_assert (NULL == ts->destination.heap_node);
if (NULL != (channel = ts->channel))
{
ts->channel = NULL;
- GNUNET_MESH_channel_destroy (channel);
+ GNUNET_CADET_channel_destroy (channel);
}
if (NULL != ts->search)
{
@@ -601,7 +601,7 @@
/**
- * Send a message from the message queue via mesh.
+ * Send a message from the message queue via cadet.
*
* @param cls the `struct ChannelState` with the message queue
* @param size number of bytes available in @a buf
@@ -622,7 +622,7 @@
GNUNET_assert (NULL != tnq);
GNUNET_assert (size >= tnq->len);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending %u bytes via mesh channel\n",
+ "Sending %u bytes via cadet channel\n",
tnq->len);
GNUNET_CONTAINER_DLL_remove (ts->tmq_head,
ts->tmq_tail,
@@ -632,14 +632,14 @@
ret = tnq->len;
GNUNET_free (tnq);
if (NULL != (tnq = ts->tmq_head))
- ts->th = GNUNET_MESH_notify_transmit_ready (ts->channel,
+ ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
GNUNET_NO /* cork */,
GNUNET_TIME_UNIT_FOREVER_REL,
tnq->len,
&send_to_peer_notify_callback,
ts);
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes given to mesh for
transmission"),
+ gettext_noop ("# Bytes given to cadet for
transmission"),
ret, GNUNET_NO);
return ret;
}
@@ -657,7 +657,7 @@
struct ChannelState *ts)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Queueing %u bytes for transmission via mesh channel\n",
+ "Queueing %u bytes for transmission via cadet channel\n",
tnq->len);
GNUNET_assert (NULL != ts->channel);
GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head,
@@ -674,16 +674,16 @@
ts->tmq_tail,
dq);
ts->tmq_length--;
- GNUNET_MESH_notify_transmit_ready_cancel (ts->th);
+ GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
ts->th = NULL;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Bytes dropped in mesh queue
(overflow)"),
+ gettext_noop ("# Bytes dropped in cadet queue
(overflow)"),
dq->len,
GNUNET_NO);
GNUNET_free (dq);
}
if (NULL == ts->th)
- ts->th = GNUNET_MESH_notify_transmit_ready (ts->channel,
+ ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
GNUNET_NO /* cork */,
GNUNET_TIME_UNIT_FOREVER_REL,
tnq->len,
@@ -727,16 +727,16 @@
GNUNET_break (0);
return;
}
- ts->channel = GNUNET_MESH_channel_create (mesh_handle,
+ ts->channel = GNUNET_CADET_channel_create (cadet_handle,
ts,
id,
apptype,
- GNUNET_MESH_OPTION_DEFAULT);
+ GNUNET_CADET_OPTION_DEFAULT);
}
/**
- * Initialize the given destination entry's mesh channel.
+ * Initialize the given destination entry's cadet channel.
*
* @param dt destination channel for which we need to setup a channel
* @param client_af address family of the address returned to the client
@@ -750,7 +750,7 @@
unsigned int apptype;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# Mesh channels created"),
+ gettext_noop ("# Cadet channels created"),
1, GNUNET_NO);
GNUNET_assert (NULL == dt->ts);
switch (client_af)
@@ -773,15 +773,15 @@
ts->destination_container = dt; /* we are referenced from dt */
if (dt->destination->is_service)
{
- ts->channel = GNUNET_MESH_channel_create (mesh_handle,
+ ts->channel = GNUNET_CADET_channel_create (cadet_handle,
ts,
&dt->destination->details.service_destination.target,
apptype,
- GNUNET_MESH_OPTION_DEFAULT);
+ GNUNET_CADET_OPTION_DEFAULT);
if (NULL == ts->channel)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to setup mesh channel!\n"));
+ _("Failed to setup cadet channel!\n"));
GNUNET_free (ts);
return NULL;
}
@@ -857,7 +857,7 @@
/**
- * Route a packet via mesh to the given destination.
+ * Route a packet via cadet to the given destination.
*
* @param destination description of the destination
* @param af address family on this end (AF_INET or AF_INET6)
@@ -1510,7 +1510,7 @@
/**
* Receive packets from the helper-process (someone send to the local
* virtual channel interface). Find the destination mapping, and if it
- * exists, identify the correct MESH channel (or possibly create it)
+ * exists, identify the correct CADET channel (or possibly create it)
* and forward the packet.
*
* @param cls closure, NULL
@@ -1682,7 +1682,7 @@
/**
- * We got an ICMP packet back from the MESH channel. Pass it on to the
+ * We got an ICMP packet back from the CADET channel. Pass it on to the
* local virtual interface via the helper.
*
* @param cls closure, NULL
@@ -1694,7 +1694,7 @@
*/
static int
receive_icmp_back (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -1703,7 +1703,7 @@
size_t mlen;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# ICMP packets received from mesh"),
+ gettext_noop ("# ICMP packets received from cadet"),
1, GNUNET_NO);
mlen = ntohs (message->size);
if (mlen < sizeof (struct GNUNET_EXIT_IcmpToVPNMessage))
@@ -1728,7 +1728,7 @@
char dbuf[INET6_ADDRSTRLEN];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received ICMP packet from mesh, sending %u bytes from %s -> %s
via TUN\n",
+ "Received ICMP packet from cadet, sending %u bytes from %s ->
%s via TUN\n",
(unsigned int) mlen,
inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
inet_ntop (ts->af, &ts->source_ip, dbuf, sizeof (dbuf)));
@@ -2021,7 +2021,7 @@
/**
- * We got a UDP packet back from the MESH channel. Pass it on to the
+ * We got a UDP packet back from the CADET channel. Pass it on to the
* local virtual interface via the helper.
*
* @param cls closure, NULL
@@ -2033,7 +2033,7 @@
*/
static int
receive_udp_back (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -2042,7 +2042,7 @@
size_t mlen;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# UDP packets received from mesh"),
+ gettext_noop ("# UDP packets received from cadet"),
1, GNUNET_NO);
mlen = ntohs (message->size);
if (mlen < sizeof (struct GNUNET_EXIT_UdpReplyMessage))
@@ -2067,7 +2067,7 @@
char dbuf[INET6_ADDRSTRLEN];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received UDP reply from mesh, sending %u bytes from %s:%u ->
%s:%u via TUN\n",
+ "Received UDP reply from cadet, sending %u bytes from %s:%u ->
%s:%u via TUN\n",
(unsigned int) mlen,
inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
ts->destination_port,
@@ -2176,7 +2176,7 @@
/**
- * We got a TCP packet back from the MESH channel. Pass it on to the
+ * We got a TCP packet back from the CADET channel. Pass it on to the
* local virtual interface via the helper.
*
* @param cls closure, NULL
@@ -2188,7 +2188,7 @@
*/
static int
receive_tcp_back (void *cls,
- struct GNUNET_MESH_Channel *channel,
+ struct GNUNET_CADET_Channel *channel,
void **channel_ctx,
const struct GNUNET_MessageHeader *message)
{
@@ -2197,7 +2197,7 @@
size_t mlen;
GNUNET_STATISTICS_update (stats,
- gettext_noop ("# TCP packets received from mesh"),
+ gettext_noop ("# TCP packets received from cadet"),
1, GNUNET_NO);
mlen = ntohs (message->size);
if (mlen < sizeof (struct GNUNET_EXIT_TcpDataMessage))
@@ -2217,7 +2217,7 @@
char dbuf[INET6_ADDRSTRLEN];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received TCP reply from mesh, sending %u bytes from %s:%u ->
%s:%u via TUN\n",
+ "Received TCP reply from cadet, sending %u bytes from %s:%u ->
%s:%u via TUN\n",
(unsigned int) mlen,
inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
ts->destination_port,
@@ -2774,19 +2774,19 @@
* Function called whenever a channel is destroyed. Should clean up
* any associated state.
*
- * @param cls closure (set from #GNUNET_MESH_connect)
+ * @param cls closure (set from #GNUNET_CADET_connect)
* @param channel connection to the other end (henceforth invalid)
* @param channel_ctx place where local state associated
* with the channel is stored (our `struct ChannelState`)
*/
static void
channel_cleaner (void *cls,
- const struct GNUNET_MESH_Channel *channel,
+ const struct GNUNET_CADET_Channel *channel,
void *channel_ctx)
{
struct ChannelState *ts = channel_ctx;
- ts->channel = NULL; /* we must not call GNUNET_MESH_channel_destroy()
anymore */
+ ts->channel = NULL; /* we must not call GNUNET_CADET_channel_destroy()
anymore */
free_channel_state (ts);
}
@@ -2871,10 +2871,10 @@
GNUNET_CONTAINER_heap_destroy (channel_heap);
channel_heap = NULL;
}
- if (NULL != mesh_handle)
+ if (NULL != cadet_handle)
{
- GNUNET_MESH_disconnect (mesh_handle);
- mesh_handle = NULL;
+ GNUNET_CADET_disconnect (cadet_handle);
+ cadet_handle = NULL;
}
if (NULL != helper_handle)
{
@@ -2916,7 +2916,7 @@
sizeof (struct RedirectToServiceRequestMessage) },
{NULL, NULL, 0, 0}
};
- static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
+ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
{ &receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, 0},
{ &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN, 0},
{ &receive_icmp_back, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN, 0},
@@ -3053,11 +3053,11 @@
}
vpn_argv[6] = NULL;
- mesh_handle =
- GNUNET_MESH_connect (cfg_, NULL,
+ cadet_handle =
+ GNUNET_CADET_connect (cfg_, NULL,
NULL,
&channel_cleaner,
- mesh_handlers,
+ cadet_handlers,
NULL);
helper_handle = GNUNET_HELPER_start (GNUNET_NO,
"gnunet-helper-vpn", vpn_argv,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33183 - in gnunet/src: conversation dns exit fs include mesh pt regex set topology vpn,
gnunet <=