[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: remaing remaining mandatory
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: remaing remaining mandatory functions for basic operation |
Date: |
Sat, 21 Jan 2017 14:49:27 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 0eec69c59 remaing remaining mandatory functions for basic operation
0eec69c59 is described below
commit 0eec69c59e625ecc41dcff20bf2395613185d342
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Jan 21 14:49:23 2017 +0100
remaing remaining mandatory functions for basic operation
---
src/cadet/cadet.h | 8 ++-
src/cadet/cadet_api.c | 26 +++++-----
src/cadet/gnunet-service-cadet-new.c | 46 ++++++++++--------
src/cadet/gnunet-service-cadet-new.h | 5 ++
src/cadet/gnunet-service-cadet-new_channel.c | 31 ++++++++----
src/cadet/gnunet-service-cadet-new_hello.c | 12 ++++-
src/cadet/gnunet-service-cadet-new_peer.c | 73 +++++++++++++++++++++-------
src/cadet/gnunet-service-cadet-new_peer.h | 4 +-
src/cadet/gnunet-service-cadet-new_tunnels.c | 1 +
src/cadet/gnunet-service-cadet_channel.c | 13 ++---
src/cadet/gnunet-service-cadet_channel.h | 2 +-
src/cadet/gnunet-service-cadet_local.c | 27 +++++-----
src/include/gnunet_protocols.h | 10 ++++
13 files changed, 169 insertions(+), 89 deletions(-)
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h
index 9d154fb99..205955b05 100644
--- a/src/cadet/cadet.h
+++ b/src/cadet/cadet.h
@@ -135,7 +135,7 @@ struct GNUNET_CADET_PortMessage
/**
* Message for a client to create channels.
*/
-struct GNUNET_CADET_ChannelOpenMessageMessage
+struct GNUNET_CADET_TunnelCreateMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE
@@ -167,14 +167,12 @@ struct GNUNET_CADET_ChannelOpenMessageMessage
/**
- * Message for a client to destroy channels.
+ * Message for or to a client to destroy tunnel.
*/
-struct GNUNET_CADET_ChannelDestroyMessage
+struct GNUNET_CADET_TunnelDestroyMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY
- *
- * Size: sizeof(struct GNUNET_CADET_ChannelDestroyMessage)
*/
struct GNUNET_MessageHeader header;
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 5dcf43e46..fa67eb094 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -588,7 +588,7 @@ request_data (void *cls)
*/
static void
handle_channel_created (void *cls,
- const struct GNUNET_CADET_ChannelOpenMessageMessage
*msg)
+ const struct GNUNET_CADET_TunnelCreateMessage *msg)
{
struct GNUNET_CADET_Handle *h = cls;
struct GNUNET_CADET_Channel *ch;
@@ -628,11 +628,12 @@ handle_channel_created (void *cls,
}
else
{
- struct GNUNET_CADET_ChannelDestroyMessage *d_msg;
+ struct GNUNET_CADET_TunnelDestroyMessage *d_msg;
struct GNUNET_MQ_Envelope *env;
LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channels\n");
- env = GNUNET_MQ_msg (d_msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ env = GNUNET_MQ_msg (d_msg,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY);
d_msg->channel_id = msg->channel_id;
GNUNET_MQ_send (h->mq, env);
}
@@ -648,7 +649,7 @@ handle_channel_created (void *cls,
*/
static void
handle_channel_destroy (void *cls,
- const struct GNUNET_CADET_ChannelDestroyMessage *msg)
+ const struct GNUNET_CADET_TunnelDestroyMessage *msg)
{
struct GNUNET_CADET_Handle *h = cls;
struct GNUNET_CADET_Channel *ch;
@@ -1281,12 +1282,12 @@ do_reconnect (struct GNUNET_CADET_Handle *h)
{
struct GNUNET_MQ_MessageHandler handlers[] = {
GNUNET_MQ_hd_fixed_size (channel_created,
- GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN,
- struct GNUNET_CADET_ChannelOpenMessageMessage,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE,
+ struct GNUNET_CADET_TunnelCreateMessage,
h),
GNUNET_MQ_hd_fixed_size (channel_destroy,
- GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY,
- struct GNUNET_CADET_ChannelDestroyMessage,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY,
+ struct GNUNET_CADET_TunnelDestroyMessage,
h),
GNUNET_MQ_hd_var_size (local_data,
GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA,
@@ -1575,7 +1576,7 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle
*h,
const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
- struct GNUNET_CADET_ChannelOpenMessageMessage *msg;
+ struct GNUNET_CADET_TunnelCreateMessage *msg;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_CADET_Channel *ch;
struct GNUNET_CADET_ClientChannelNumber chid;
@@ -1591,7 +1592,7 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle
*h,
ch->ctx = channel_ctx;
ch->peer = GNUNET_PEER_intern (peer);
- env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN);
+ env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE);
msg->channel_id = ch->chid;
msg->port = *port;
msg->peer = *peer;
@@ -1607,7 +1608,7 @@ void
GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel)
{
struct GNUNET_CADET_Handle *h;
- struct GNUNET_CADET_ChannelDestroyMessage *msg;
+ struct GNUNET_CADET_TunnelDestroyMessage *msg;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_CADET_TransmitHandle *th;
struct GNUNET_CADET_TransmitHandle *next;
@@ -1636,7 +1637,8 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel
*channel)
}
}
- env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ env = GNUNET_MQ_msg (msg,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY);
msg->channel_id = channel->chid;
GNUNET_MQ_send (h->mq, env);
diff --git a/src/cadet/gnunet-service-cadet-new.c
b/src/cadet/gnunet-service-cadet-new.c
index 7801708c1..b6bdcc9fc 100644
--- a/src/cadet/gnunet-service-cadet-new.c
+++ b/src/cadet/gnunet-service-cadet-new.c
@@ -115,6 +115,11 @@ struct CadetClient
/****************************** Global variables
******************************/
/**
+ * Handle to our configuration.
+ */
+const struct GNUNET_CONFIGURATION_Handle *cfg;
+
+/**
* Handle to the statistics service.
*/
struct GNUNET_STATISTICS_Handle *stats;
@@ -272,7 +277,7 @@ GSC_bind (struct CadetClient *c,
uint32_t options)
{
struct GNUNET_MQ_Envelope *env;
- struct GNUNET_CADET_ChannelOpenMessageMessage *msg;
+ struct GNUNET_CADET_TunnelCreateMessage *msg;
struct GNUNET_CADET_ClientChannelNumber lid;
lid = client_get_next_lid (c);
@@ -284,7 +289,7 @@ GSC_bind (struct CadetClient *c,
/* notify local client about incoming connection! */
env = GNUNET_MQ_msg (msg,
- GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN);
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE);
msg->channel_id = lid;
msg->port = *port;
msg->opt = htonl (options);
@@ -396,7 +401,7 @@ handle_port_open (void *cls,
c->id);
if (NULL == c->ports)
c->ports = GNUNET_CONTAINER_multihashmap_create (4,
- GNUNET_NO);
+ GNUNET_NO);
if (GNUNET_OK !=
GNUNET_CONTAINER_multihashmap_put (c->ports,
&pmsg->port,
@@ -460,18 +465,18 @@ handle_port_close (void *cls,
* Handler for requests of new channels.
*
* @param cls Identification of the client.
- * @param ccm The actual message.
+ * @param tcm The actual message.
*/
static void
-handle_channel_create (void *cls,
- const struct GNUNET_CADET_ChannelOpenMessageMessage
*ccm)
+handle_tunnel_create (void *cls,
+ const struct GNUNET_CADET_TunnelCreateMessage *tcm)
{
struct CadetClient *c = cls;
struct CadetChannel *ch;
struct GNUNET_CADET_ClientChannelNumber chid;
struct CadetPeer *dst;
- chid = ccm->channel_id;
+ chid = tcm->channel_id;
if (ntohl (chid.channel_of_client) < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
{
/* Channel ID not in allowed range. */
@@ -489,15 +494,15 @@ handle_channel_create (void *cls,
return;
}
- dst = GCP_get (&ccm->peer,
+ dst = GCP_get (&tcm->peer,
GNUNET_YES);
/* Create channel */
ch = GCCH_channel_local_new (c,
chid,
dst,
- &ccm->port,
- ntohl (ccm->opt));
+ &tcm->port,
+ ntohl (tcm->opt));
if (NULL == ch)
{
GNUNET_break (0);
@@ -513,8 +518,8 @@ handle_channel_create (void *cls,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"New channel %s to %s at port %s requested by client %u\n",
GCCH_2s (ch),
- GNUNET_i2s (&ccm->peer),
- GNUNET_h2s (&ccm->port),
+ GNUNET_i2s (&tcm->peer),
+ GNUNET_h2s (&tcm->port),
c->id);
GNUNET_SERVICE_client_continue (c->client);
}
@@ -544,8 +549,8 @@ get_map_by_chid (struct CadetClient *c,
* @param msg the actual message
*/
static void
-handle_channel_destroy (void *cls,
- const struct GNUNET_CADET_ChannelDestroyMessage *msg)
+handle_tunnel_destroy (void *cls,
+ const struct GNUNET_CADET_TunnelDestroyMessage *msg)
{
struct CadetClient *c = cls;
struct GNUNET_CADET_ClientChannelNumber chid;
@@ -1233,6 +1238,7 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SERVICE_Handle *service)
{
+ cfg = c;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c,
"CADET",
@@ -1309,13 +1315,13 @@ GNUNET_SERVICE_MAIN
GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE,
struct GNUNET_CADET_PortMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (channel_create,
- GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN,
- struct GNUNET_CADET_ChannelOpenMessageMessage,
+ GNUNET_MQ_hd_fixed_size (tunnel_create,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE,
+ struct GNUNET_CADET_TunnelCreateMessage,
NULL),
- GNUNET_MQ_hd_fixed_size (channel_destroy,
- GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY,
- struct GNUNET_CADET_ChannelDestroyMessage,
+ GNUNET_MQ_hd_fixed_size (tunnel_destroy,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY,
+ struct GNUNET_CADET_TunnelDestroyMessage,
NULL),
GNUNET_MQ_hd_var_size (data,
GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA,
diff --git a/src/cadet/gnunet-service-cadet-new.h
b/src/cadet/gnunet-service-cadet-new.h
index b3bb85d85..25f02bf89 100644
--- a/src/cadet/gnunet-service-cadet-new.h
+++ b/src/cadet/gnunet-service-cadet-new.h
@@ -167,6 +167,11 @@ struct CadetRoute;
struct CadetChannel;
/**
+ * Handle to our configuration.
+ */
+extern const struct GNUNET_CONFIGURATION_Handle *cfg;
+
+/**
* Handle to the statistics service.
*/
extern struct GNUNET_STATISTICS_Handle *stats;
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c
b/src/cadet/gnunet-service-cadet-new_channel.c
index 75ec81992..aac0d604d 100644
--- a/src/cadet/gnunet-service-cadet-new_channel.c
+++ b/src/cadet/gnunet-service-cadet-new_channel.c
@@ -25,7 +25,8 @@
* @author Christian Grothoff
*
* TODO:
- * - handle destroy
+ * - introduce shutdown so we can have half-closed channels, modify
+ * destroy to include MID to have FIN-ACK equivalents, etc.
* - estimate max bandwidth using bursts and use to for CONGESTION CONTROL!
* - check that '0xFFULL' really is sufficient for flow control!
* - revisit handling of 'unreliable' traffic!
@@ -663,6 +664,8 @@ void
GCCH_bind (struct CadetChannel *ch,
struct CadetClient *c)
{
+ struct GNUNET_MQ_Envelope *env;
+ struct GNUNET_CADET_TunnelCreateMessage *tcm;
uint32_t options;
if (NULL != ch->retry_task)
@@ -690,6 +693,14 @@ GCCH_bind (struct CadetChannel *ch,
ch->retry_task = GNUNET_SCHEDULER_add_now (&send_connect_ack,
ch);
/* give client it's initial supply of ACKs */
+ env = GNUNET_MQ_msg (tcm,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE);
+ tcm->channel_id = ch->lid;
+ tcm->peer = *GCP_get_id (GCT_get_destination (ch->t));
+ tcm->port = ch->port;
+ tcm->opt = htonl (options);
+ GSC_send_to_client (ch->dest,
+ env);
for (unsigned int i=0;i<ch->max_pending_messages;i++)
send_ack_to_client (ch,
ch->owner);
@@ -956,19 +967,21 @@ GCCH_handle_channel_plaintext_data_ack (struct
CadetChannel *ch,
* connection. Also needs to remove this channel from
* the tunnel.
*
- * FIXME: need to make it possible to defer destruction until we have
- * received all messages up to the destroy, and right now the destroy
- * message (and this API) fails to give is the information we need!
- *
- * FIXME: also need to know if the other peer got a destroy from
- * us before!
- *
* @param ch channel to destroy
*/
void
GCCH_handle_remote_destroy (struct CadetChannel *ch)
{
- GNUNET_break (0); // FIXME!
+ struct GNUNET_MQ_Envelope *env;
+ struct GNUNET_CADET_TunnelDestroyMessage *tdm;
+
+ ch->destroy = GNUNET_YES;
+ env = GNUNET_MQ_msg (tdm,
+ GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY);
+ tdm->channel_id = ch->lid;
+ GSC_send_to_client ((NULL != ch->owner) ? ch->owner : ch->dest,
+ env);
+ channel_destroy (ch);
}
diff --git a/src/cadet/gnunet-service-cadet-new_hello.c
b/src/cadet/gnunet-service-cadet-new_hello.c
index 9d4635021..d705cdd5f 100644
--- a/src/cadet/gnunet-service-cadet-new_hello.c
+++ b/src/cadet/gnunet-service-cadet-new_hello.c
@@ -17,7 +17,16 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-
+/**
+ * @file cadet/gnunet-service-cadet-new_hello.c
+ * @brief spread knowledge about how to contact other peers from PEERINFO
+ * @author Bartlomiej Polot
+ * @author Christian Grothoff
+ *
+ * TODO:
+ * - is most of this necessary/helpful?
+ * - should we not simply restrict this to OUR hello?
+ */
#include "platform.h"
#include "gnunet_util_lib.h"
@@ -83,7 +92,6 @@ got_hello (void *cls,
GNUNET_YES);
GCP_set_hello (peer,
hello);
-
}
diff --git a/src/cadet/gnunet-service-cadet-new_peer.c
b/src/cadet/gnunet-service-cadet-new_peer.c
index 47f725e09..1cb79a02f 100644
--- a/src/cadet/gnunet-service-cadet-new_peer.c
+++ b/src/cadet/gnunet-service-cadet-new_peer.c
@@ -26,7 +26,6 @@
* @author Christian Grothoff
*
* TODO:
- * - implement GCP_set_hello() / do HELLO advertising properly
* - optimize stopping/restarting DHT search to situations
* where we actually need it (i.e. not if we have a direct connection,
* or if we already have plenty of good short ones, or maybe even
@@ -904,22 +903,37 @@ GCP_iterate_paths_at (struct CadetPeer *peer,
/**
* Get the tunnel towards a peer.
*
- * @param peer Peer to get from.
+ * @param cp Peer to get from.
* @param create #GNUNET_YES to create a tunnel if we do not have one
* @return Tunnel towards peer.
*/
struct CadetTunnel *
-GCP_get_tunnel (struct CadetPeer *peer,
+GCP_get_tunnel (struct CadetPeer *cp,
int create)
{
- if (NULL == peer)
+ if (NULL == cp)
return NULL;
- if ( (NULL != peer->t) ||
+ if ( (NULL != cp->t) ||
(GNUNET_NO == create) )
- return peer->t;
- peer->t = GCT_create_tunnel (peer);
- consider_peer_activate (peer);
- return peer->t;
+ return cp->t;
+ cp->t = GCT_create_tunnel (cp);
+ consider_peer_activate (cp);
+ return cp->t;
+}
+
+
+/**
+ * Hello offer was passed to the transport service. Mark it
+ * as done.
+ *
+ * @param cls the `struct CadetPeer` where the offer completed
+ */
+static void
+hello_offer_done (void *cls)
+{
+ struct CadetPeer *cp = cls;
+
+ cp->hello_offer = NULL;
}
@@ -927,16 +941,39 @@ GCP_get_tunnel (struct CadetPeer *peer,
* We got a HELLO for a @a peer, remember it, and possibly
* trigger adequate actions (like trying to connect).
*
- * @param peer the peer we got a HELLO for
+ * @param cp the peer we got a HELLO for
* @param hello the HELLO to remember
*/
void
-GCP_set_hello (struct CadetPeer *peer,
+GCP_set_hello (struct CadetPeer *cp,
const struct GNUNET_HELLO_Message *hello)
{
- /* FIXME: keep HELLO, possibly offer to TRANSPORT... */
+ struct GNUNET_HELLO_Message *mrg;
- consider_peer_destroy (peer);
+ if (NULL != cp->hello_offer)
+ {
+ GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer);
+ cp->hello_offer = NULL;
+ }
+ if (NULL != cp->hello)
+ {
+ mrg = GNUNET_HELLO_merge (hello,
+ cp->hello);
+ GNUNET_free (cp->hello);
+ cp->hello = mrg;
+ }
+ else
+ {
+ cp->hello = GNUNET_memdup (hello,
+ GNUNET_HELLO_size (hello));
+ }
+ cp->hello_offer
+ = GNUNET_TRANSPORT_offer_hello (cfg,
+ GNUNET_HELLO_get_header (cp->hello) ,
+ &hello_offer_done,
+ cp);
+ /* New HELLO means cp's destruction time may change... */
+ consider_peer_destroy (cp);
}
@@ -944,16 +981,16 @@ GCP_set_hello (struct CadetPeer *peer,
* The tunnel to the given peer no longer exists, remove it from our
* data structures, and possibly clean up the peer itself.
*
- * @param peer the peer affected
+ * @param cp the peer affected
* @param t the dead tunnel
*/
void
-GCP_drop_tunnel (struct CadetPeer *peer,
+GCP_drop_tunnel (struct CadetPeer *cp,
struct CadetTunnel *t)
{
- GNUNET_assert (peer->t == t);
- peer->t = NULL;
- consider_peer_destroy (peer);
+ GNUNET_assert (cp->t == t);
+ cp->t = NULL;
+ consider_peer_destroy (cp);
}
diff --git a/src/cadet/gnunet-service-cadet-new_peer.h
b/src/cadet/gnunet-service-cadet-new_peer.h
index c633f47e5..b59a43b86 100644
--- a/src/cadet/gnunet-service-cadet-new_peer.h
+++ b/src/cadet/gnunet-service-cadet-new_peer.h
@@ -123,14 +123,14 @@ GCP_iterate_paths (struct CadetPeer *cp,
* Iterate over the paths to @a peer where
* @a peer is at distance @a dist from us.
*
- * @param peer Peer to get path info.
+ * @param cp Peer to get path info.
* @param dist desired distance of @a peer to us on the path
* @param callback Function to call for every path.
* @param callback_cls Closure for @a callback.
* @return Number of iterated paths.
*/
unsigned int
-GCP_iterate_paths_at (struct CadetPeer *peer,
+GCP_iterate_paths_at (struct CadetPeer *cp,
unsigned int dist,
GCP_PathIterator callback,
void *callback_cls);
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c
b/src/cadet/gnunet-service-cadet-new_tunnels.c
index 8f1a19d5b..a6502de01 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -1724,6 +1724,7 @@ handle_plaintext_keepalive (void *cls,
const struct GNUNET_MessageHeader *msg)
{
struct CadetTunnel *t = cls;
+
GNUNET_break (0); // FIXME
}
diff --git a/src/cadet/gnunet-service-cadet_channel.c
b/src/cadet/gnunet-service-cadet_channel.c
index dee0c37d7..750acd8fd 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -1308,17 +1308,18 @@ handle_loopback (struct CadetChannel *ch,
break;
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK:
- GCCH_handle_data_ack (ch, (struct GNUNET_CADET_ChannelDataAckMessage *)
msgh, fwd);
+ GCCH_handle_data_ack (ch,
+ (const struct GNUNET_CADET_ChannelDataAckMessage
*) msgh, fwd);
break;
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN:
GCCH_handle_create (ch->t,
- (struct GNUNET_CADET_ChannelOpenMessage *) msgh);
+ (const struct GNUNET_CADET_ChannelOpenMessage *)
msgh);
break;
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK:
GCCH_handle_ack (ch,
- (struct GNUNET_CADET_ChannelManageMessage *) msgh,
+ (const struct GNUNET_CADET_ChannelManageMessage *) msgh,
fwd);
break;
@@ -1328,7 +1329,7 @@ handle_loopback (struct CadetChannel *ch,
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
GCCH_handle_destroy (ch,
- (struct GNUNET_CADET_ChannelManageMessage *) msgh,
+ (const struct GNUNET_CADET_ChannelManageMessage *)
msgh,
fwd);
break;
@@ -1842,11 +1843,11 @@ GCCH_handle_local_destroy (struct CadetChannel *ch,
* @param c Client that requested the creation (will be the root).
* @param msg Create Channel message.
*
- * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
+ * @return #GNUNET_OK if everything went fine, #GNUNET_SYSERR otherwise.
*/
int
GCCH_handle_local_create (struct CadetClient *c,
- struct GNUNET_CADET_ChannelOpenMessageMessage *msg)
+ struct GNUNET_CADET_TunnelCreateMessage *msg)
{
struct CadetChannel *ch;
struct CadetTunnel *t;
diff --git a/src/cadet/gnunet-service-cadet_channel.h
b/src/cadet/gnunet-service-cadet_channel.h
index 855d85b6c..e3926995f 100644
--- a/src/cadet/gnunet-service-cadet_channel.h
+++ b/src/cadet/gnunet-service-cadet_channel.h
@@ -226,7 +226,7 @@ GCCH_handle_local_destroy (struct CadetChannel *ch,
*/
int
GCCH_handle_local_create (struct CadetClient *c,
- struct GNUNET_CADET_ChannelOpenMessageMessage *msg);
+ struct GNUNET_CADET_TunnelCreateMessage *msg);
/**
* Handler for cadet network payload traffic.
diff --git a/src/cadet/gnunet-service-cadet_local.c
b/src/cadet/gnunet-service-cadet_local.c
index c476f6ac2..bfb4195a5 100644
--- a/src/cadet/gnunet-service-cadet_local.c
+++ b/src/cadet/gnunet-service-cadet_local.c
@@ -440,7 +440,7 @@ handle_channel_create (void *cls, struct
GNUNET_SERVER_Client *client,
LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
/* Message size sanity check */
- if (sizeof (struct GNUNET_CADET_ChannelOpenMessageMessage)
+ if (sizeof (struct GNUNET_CADET_TunnelCreateMessage)
!= ntohs (message->size))
{
GNUNET_break (0);
@@ -450,7 +450,7 @@ handle_channel_create (void *cls, struct
GNUNET_SERVER_Client *client,
if (GNUNET_OK !=
GCCH_handle_local_create (c,
- (struct GNUNET_CADET_ChannelOpenMessageMessage
*)
+ (struct GNUNET_CADET_TunnelCreateMessage *)
message))
{
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -472,7 +472,7 @@ static void
handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- struct GNUNET_CADET_ChannelDestroyMessage *msg;
+ const struct GNUNET_CADET_TunnelDestroyMessage *msg;
struct CadetClient *c;
struct CadetChannel *ch;
struct GNUNET_CADET_ClientChannelNumber chid;
@@ -489,7 +489,7 @@ handle_channel_destroy (void *cls, struct
GNUNET_SERVER_Client *client,
LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
/* Message sanity check */
- if (sizeof (struct GNUNET_CADET_ChannelDestroyMessage)
+ if (sizeof (struct GNUNET_CADET_TunnelDestroyMessage)
!= ntohs (message->size))
{
GNUNET_break (0);
@@ -497,7 +497,7 @@ handle_channel_destroy (void *cls, struct
GNUNET_SERVER_Client *client,
return;
}
- msg = (struct GNUNET_CADET_ChannelDestroyMessage *) message;
+ msg = (const struct GNUNET_CADET_TunnelDestroyMessage *) message;
/* Retrieve tunnel */
chid = msg->channel_id;
@@ -521,7 +521,6 @@ handle_channel_destroy (void *cls, struct
GNUNET_SERVER_Client *client,
ntohl (chid.channel_of_client) <
GNUNET_CADET_LOCAL_CHANNEL_ID_CLI);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
- return;
}
@@ -1128,10 +1127,10 @@ static struct GNUNET_SERVER_MessageHandler
client_handlers[] = {
sizeof (struct GNUNET_CADET_PortMessage)},
{&handle_port_close, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE,
sizeof (struct GNUNET_CADET_PortMessage)},
- {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN,
- sizeof (struct GNUNET_CADET_ChannelOpenMessageMessage)},
- {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY,
- sizeof (struct GNUNET_CADET_ChannelDestroyMessage)},
+ {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE,
+ sizeof (struct GNUNET_CADET_TunnelCreateMessage)},
+ {&handle_channel_destroy, NULL,
GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY,
+ sizeof (struct GNUNET_CADET_TunnelDestroyMessage)},
{&handle_data, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, 0},
{&handle_ack, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK,
sizeof (struct GNUNET_CADET_LocalAck)},
@@ -1434,10 +1433,10 @@ GML_send_channel_create (struct CadetClient *c,
uint32_t opt,
const struct GNUNET_PeerIdentity *peer)
{
- struct GNUNET_CADET_ChannelOpenMessageMessage msg;
+ struct GNUNET_CADET_TunnelCreateMessage msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE);
msg.channel_id = id;
msg.port = *port;
msg.opt = htonl (opt);
@@ -1484,7 +1483,7 @@ void
GML_send_channel_destroy (struct CadetClient *c,
struct GNUNET_CADET_ClientChannelNumber id)
{
- struct GNUNET_CADET_ChannelDestroyMessage msg;
+ struct GNUNET_CADET_TunnelDestroyMessage msg;
if (NULL == c)
{
@@ -1494,7 +1493,7 @@ GML_send_channel_destroy (struct CadetClient *c,
if (GNUNET_YES == c->shutting_down)
return;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY);
msg.channel_id = id;
GNUNET_SERVER_notification_context_unicast (nc, c->handle,
&msg.header, GNUNET_NO);
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index e8f5ead37..cae19d5d8 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2732,6 +2732,16 @@ extern "C"
*/
#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE 1023
+/**
+ * Ask the cadet service to create a new channel.
+ */
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE 1024
+
+/**
+ * Tell client that a channel was destroyed.
+ */
+#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY 1025
+
/********************************** Monitor
*********************************/
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: remaing remaining mandatory functions for basic operation,
gnunet <=