#include "platform.h"
#include "gnunet_util_lib.h"
+#include "gnunet_statistics_service.h"
+
#include "mesh_protocol_enc.h"
#include "gnunet-service-mesh_tunnel.h"
/******************************* GLOBALS ***********************************/
/******************************************************************************/
+/**
+ * Global handle to the statistics service.
+ */
+extern struct GNUNET_STATISTICS_Handle *stats;
+
/**
* Default TTL for payload packets.
*/
/******************************** STATIC ***********************************/
/******************************************************************************/
-
/**
* Get string description for tunnel state.
*
}
+/******************************************************************************/
+/******************************** API ***********************************/
+/******************************************************************************/
+
/**
* Cache a message to be sent once tunnel is online.
*
}
-
-/******************************************************************************/
-/******************************** API ***********************************/
-/******************************************************************************/
-
/**
* Initialize the tunnel subsystem.
*
void
GMT_destroy_if_empty (struct MeshTunnel2 *t)
{
- if (1 <= GMCH_count (t->channel_head))
+ if (1 < GMCH_count (t->channel_head))
return;
GMT_destroy_empty (t);
}
GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO);
- t->peer->tunnel = NULL;
+ GMP_set_tunnel (t->peer, NULL);
GNUNET_free (t);
}
{
case GNUNET_MESSAGE_TYPE_MESH_DATA:
/* Don't send hop ACK, wait for client to ACK */
- handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
+ GMCH_handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd);
break;
case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
- handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd);
+ GMCH_handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd);
break;
case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
- handle_channel_create (t,
- (struct GNUNET_MESH_ChannelCreate *) msgh,
- fwd);
+ GMCH_handle_create (t,
+ (struct GNUNET_MESH_ChannelCreate *) msgh,
+ fwd);
break;
case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
- handle_channel_ack (t,
- (struct GNUNET_MESH_ChannelManage *) msgh,
- fwd);
+ GMCH_handle_ack (t,
+ (struct GNUNET_MESH_ChannelManage *) msgh,
+ fwd);
break;
case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
- handle_channel_destroy (t,
- (struct GNUNET_MESH_ChannelManage *) msgh,
- fwd);
+ GMCH_handle_destroy (t,
+ (struct GNUNET_MESH_ChannelManage *) msgh,
+ fwd);
break;
default:
+ GNUNET_break_op (0);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "end-to-end message not known (%u)\n",
- ntohs (msgh->type));
+ "end-to-end message not known (%u)\n",
+ ntohs (msgh->type));
}
}