[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15266 - in gnunet/src: include mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15266 - in gnunet/src: include mesh |
Date: |
Thu, 19 May 2011 15:34:47 +0200 |
Author: bartpolot
Date: 2011-05-19 15:34:47 +0200 (Thu, 19 May 2011)
New Revision: 15266
Modified:
gnunet/src/include/gnunet_protocols.h
gnunet/src/mesh/gnunet-service-mesh.c
Log:
WiP
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2011-05-19 11:37:08 UTC (rev
15265)
+++ gnunet/src/include/gnunet_protocols.h 2011-05-19 13:34:47 UTC (rev
15266)
@@ -791,9 +791,9 @@
#define GNUNET_MESSAGE_TYPE_MESH_HELLO 216
-/**
+/*******************************************************************************
* MESH message types (WiP)
- */
+
******************************************************************************/
/**
* Request the creation of a path
@@ -831,21 +831,63 @@
*/
#define GNUNET_MESSAGE_TYPE_MESH_SPEED_NOTIFY 262
-/* FIXME: Document */
+/**
+ * Connect to the mesh service, specifying subscriptions
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272
+
+/**
+ * Ask the mesh service to create a new tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE 273
+
+/**
+ * Ask the mesh service to destroy a tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY 274
+/**
+ * Ask the mesh service to add a peer to an existing tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD 275
+
+/**
+ * Ask the mesh service to remove a peer from a tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL 276
+
+/**
+ * Ask the mesh service to add a peer offering a service to an existing tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE 277
+
+/**
+ * Ask the mesh service to cancel a peer connection request
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL 278
+
+/**
+ * Notify a mesh client that a peer has connected to a tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_CONNECTED 279
+
+/**
+ * Notify a mesh client that a peer has disconnected from a tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DISCONNECTED 280
+/* FIXME needed? */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_REQUEST_TRANSMIT_READY 281
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_NOTIFY_TRANSMIT_READY 282
+
+/**
+ * Message client <-> mesh service to transport payload
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 283
+
+/**
+ * Message client->mesh to send data to all peers connected to a tunnel
+ */
#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST 284
/**
@@ -853,9 +895,9 @@
*/
#define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 288
-/**
+/*******************************************************************************
* MESH message types END
- */
+
******************************************************************************/
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-05-19 11:37:08 UTC (rev
15265)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-05-19 13:34:47 UTC (rev
15266)
@@ -490,6 +490,31 @@
/**
+ * Send another peer a notification to destroy a tunnel
+ * @param cls The tunnel to destroy
+ * @param size Size in the buffer
+ * @param buf Memory where to put the data to transmit
+ * @return Size of data put in buffer
+ */
+static size_t
+send_p2p_tunnel_destroy(void *cls, size_t size, void *buf)
+{
+ struct MeshTunnel *t = cls;
+ struct MeshClient *c;
+ struct GNUNET_MESH_TunnelMessage *msg;
+
+ c = t->client;
+ msg = buf;
+ msg->header.type = htons(GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY);
/*FIXME*/
+ msg->header.size = htons(sizeof(struct GNUNET_MESH_TunnelMessage));
+ msg->tunnel_id = htonl(t->tid);
+
+ destroy_tunnel(c, t);
+ return sizeof(struct GNUNET_MESH_TunnelMessage);
+}
+
+
+/**
* Core handler for path creation
* struct GNUNET_CORE_MessageHandler
*
@@ -636,7 +661,7 @@
GNUNET_SERVER_notify_transmit_ready(
t->client->handle,
sizeof(struct GNUNET_MESH_PeerControl),
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
¬ify_client_connection_failure,
peer_info
);
@@ -664,7 +689,7 @@
GNUNET_CORE_notify_transmit_ready(core_handle,
0,
0,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
get_path[1],
sizeof(struct GNUNET_MESH_ManipulatePath)
+ (p->length
@@ -885,7 +910,14 @@
GNUNET_CRYPTO_hash(&tid, sizeof(MESH_TunnelID), &hash);
t = GNUNET_CONTAINER_multihashmap_get(c->tunnel_ids, &hash);
GNUNET_CONTAINER_multihashmap_remove_all(c->tunnel_ids, &hash);
- destroy_tunnel(c, t);
+ GNUNET_CORE_notify_transmit_ready(core_handle,
+ 1,
+ 1,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ sizeof(struct GNUNET_MESH_TunnelMessage),
+ &send_p2p_tunnel_destroy,
+ t);
GNUNET_SERVER_receive_done(client, GNUNET_OK);
return;
@@ -961,7 +993,7 @@
sizeof(struct GNUNET_PeerIdentity),
&key);
peer_info->dhtget = GNUNET_DHT_get_start(dht_handle,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_BLOCK_TYPE_ANY,
&key,
4, /* replication level */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15266 - in gnunet/src: include mesh,
gnunet <=