[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16382 - in gnunet/src: include mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16382 - in gnunet/src: include mesh |
Date: |
Fri, 5 Aug 2011 01:57:55 +0200 |
Author: bartpolot
Date: 2011-08-05 01:57:55 +0200 (Fri, 05 Aug 2011)
New Revision: 16382
Modified:
gnunet/src/include/gnunet_protocols.h
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/mesh_api_new.c
Log:
Changed API<->Service messages
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2011-08-04 21:11:17 UTC (rev
16381)
+++ gnunet/src/include/gnunet_protocols.h 2011-08-04 23:57:55 UTC (rev
16382)
@@ -796,49 +796,49 @@
/*******************************************************************************
- * MESH message types (WiP)
+ * MESH message types START (WiP)
******************************************************************************/
/**
* Request the creation of a path
*/
-#define GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE 256
+#define GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE 256
/**
* Request the modification of an existing path
*/
-#define GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGE 257
+#define GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGE 257
/**
* Request the addition to a new branch to a path
*/
-#define GNUNET_MESSAGE_TYPE_MESH_PATH_ADD 258
+#define GNUNET_MESSAGE_TYPE_MESH_PATH_ADD 258
/**
* At some point, the route will spontaneously change
*/
-#define GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED 259
+#define GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED 259
/**
* Transport data in the mesh (origin->end) unicast
*/
-#define GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN 260
+#define GNUNET_MESSAGE_TYPE_MESH_UNICAST 260
/**
* Transport data to all peers in a tunnel
*/
-#define GNUNET_MESSAGE_TYPE_DATA_MULTICAST 261
+#define GNUNET_MESSAGE_TYPE_MESH_MULTICAST 261
/**
* Transport data back in the mesh (end->origin)
* (not sure if this is the right way, should be some other solution)
*/
-#define GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN 262
+#define GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN 262
/**
* Send origin an ACK that the path is complete
*/
-#define GNUNET_MESSAGE_TYPE_PATH_ACK 263
+#define GNUNET_MESSAGE_TYPE_MESH_PATH_ACK 263
/**
* We need flow control
@@ -848,27 +848,27 @@
/**
* Connect to the mesh service, specifying subscriptions
*/
-#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272
+#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
+#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
+#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
+#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
+#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
@@ -890,21 +890,8 @@
*/
#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
-
-/**
* 640kb should be enough for everybody
*/
#define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 288
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-08-04 21:11:17 UTC (rev
16381)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-08-04 23:57:55 UTC (rev
16382)
@@ -833,7 +833,7 @@
* @return number of bytes written to buf
*/
static size_t
-send_core_data_to_peer (void *cls, size_t size, void *buf)
+send_core_data_unicast (void *cls, size_t size, void *buf)
{
struct MeshDataDescriptor *info = cls;
struct GNUNET_MESH_DataMessageFromOrigin *msg = buf;
@@ -849,7 +849,7 @@
return 0;
}
msg->header.size = htons(total_size);
- msg->header.type = htons(GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN);
+ msg->header.type = htons(GNUNET_MESSAGE_TYPE_MESH_UNICAST);
GNUNET_PEER_resolve(info->origin->oid, &msg->oid);
GNUNET_PEER_resolve(info->destination, &msg->destination);
msg->tid = htonl(info->origin->tid);
@@ -894,7 +894,7 @@
"not enough buffer to send data futher\n");
return 0;
}
- msg->header.type = htons(GNUNET_MESSAGE_TYPE_DATA_MULTICAST);
+ msg->header.type = htons(GNUNET_MESSAGE_TYPE_MESH_MULTICAST);
msg->header.size = htons(total_size);
GNUNET_PEER_resolve(info->origin->oid, &msg->oid);
msg->tid = htonl(info->origin->tid);
@@ -934,7 +934,7 @@
return 0;
}
msg->header.size = htons(sizeof(struct GNUNET_MESH_PathACK));
- msg->header.type = htons(GNUNET_MESSAGE_TYPE_PATH_ACK);
+ msg->header.type = htons(GNUNET_MESSAGE_TYPE_MESH_PATH_ACK);
GNUNET_PEER_resolve(info->origin->oid, &msg->oid);
msg->tid = htonl(info->origin->tid);
GNUNET_PEER_resolve(myid, &msg->peer_id);
@@ -1526,10 +1526,10 @@
*/
static struct GNUNET_CORE_MessageHandler core_handlers[] = {
{&handle_mesh_path_create, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0},
- {&handle_mesh_data_unicast, GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN, 0},
- {&handle_mesh_data_multicast, GNUNET_MESSAGE_TYPE_DATA_MULTICAST, 0},
- {&handle_mesh_data_to_orig, GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN, 0},
- {&handle_mesh_path_ack, GNUNET_MESSAGE_TYPE_PATH_ACK,
+ {&handle_mesh_data_unicast, GNUNET_MESSAGE_TYPE_MESH_UNICAST, 0},
+ {&handle_mesh_data_multicast, GNUNET_MESSAGE_TYPE_MESH_MULTICAST, 0},
+ {&handle_mesh_data_to_orig, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN, 0},
+ {&handle_mesh_path_ack, GNUNET_MESSAGE_TYPE_MESH_PATH_ACK,
sizeof(struct GNUNET_MESH_PathACK)},
{NULL, 0, 0}
};
@@ -2217,7 +2217,7 @@
/* FIXME re-check types */
message->size - sizeof(struct GNUNET_MESH_Data)
+ sizeof(struct GNUNET_MESH_DataMessageFromOrigin),
- &send_core_data_to_peer,
+ &send_core_data_unicast,
info);
return;
}
@@ -2298,9 +2298,11 @@
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE,
sizeof(struct GNUNET_MESH_ConnectPeerByType)},
{&handle_local_network_traffic, NULL,
- GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0},
+ GNUNET_MESSAGE_TYPE_MESH_UNICAST, 0},
+ {&handle_local_network_traffic, NULL,
+ GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN, 0},
{&handle_local_network_traffic_bcast, NULL,
- GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST, 0},
+ GNUNET_MESSAGE_TYPE_MESH_MULTICAST, 0},
{NULL, NULL, 0, 0}
};
Modified: gnunet/src/mesh/mesh_api_new.c
===================================================================
--- gnunet/src/mesh/mesh_api_new.c 2011-08-04 21:11:17 UTC (rev 16381)
+++ gnunet/src/mesh/mesh_api_new.c 2011-08-04 23:57:55 UTC (rev 16382)
@@ -118,9 +118,14 @@
/**
* Local ID of the tunnel
*/
- MESH_TunnelNumber tid;
+ MESH_TunnelNumber tid;
/**
+ * Owner of the tunnel
+ */
+ GNUNET_PEER_Id owner;
+
+ /**
* Callback to execute when peers connect to the tunnel
*/
GNUNET_MESH_TunnelConnectHandler connect_handler;
@@ -309,7 +314,7 @@
* Process the new tunnel notification and add it to the tunnels in the handle
*
* @param h The mesh handle
- * @param msh A message with the details of the new incoming tunnel
+ * @param msg A message with the details of the new incoming tunnel
*/
static void
process_tunnel_create(struct GNUNET_MESH_Handle *h,
@@ -320,9 +325,10 @@
tid = ntohl(msg->tunnel_id);
if (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_MARK) {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: received an incoming tunnel with tid in local range (%X)\n",
tid);
+ GNUNET_break_op(0);
return; //FIXME abort? reconnect?
}
t = GNUNET_malloc(sizeof(struct GNUNET_MESH_Tunnel));
@@ -343,7 +349,7 @@
* @param msh A message encapsulating the data
*/
static void
-process_incoming_data(struct GNUNET_MESH_Handle *h,
+process_incoming_data(struct GNUNET_MESH_Handle *h,
const struct GNUNET_MESH_Data *msg)
{
const struct GNUNET_MESH_Data *payload;
@@ -409,7 +415,9 @@
case GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_DISCONNECTED:
break;
/* Notify of a new data packet in the tunnel */
- case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA:
+ case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
+ case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
+ case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
process_incoming_data(h, (struct GNUNET_MESH_Data *)msg);
break;
/* We shouldn't get any other packages, log and ignore */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16382 - in gnunet/src: include mesh,
gnunet <=