#include "platform.h"
#include "mesh_enc.h"
#include "mesh_protocol_enc.h" // GNUNET_MESH_Data is shared
+
#include "gnunet-service-mesh_local.h"
+#include "gnunet-service-mesh_tunnel.h"
/******************************************************************************/
/******************************** STRUCTS **********************************/
/**
* Struct containing information about a client of the service
- *
+ *
* TODO: add a list of 'waiting' ports
*/
struct MeshClient
* @param cls Closure (unused).
* @param client Client handler.
*/
-void
-GMLH_client_connect (void *cls, struct GNUNET_SERVER_Client *client)
+static void
+handle_client_connect (void *cls, struct GNUNET_SERVER_Client *client)
{
struct MeshClient *c;
* @param client identification of the client; NULL
* for the last call when the server is destroyed
*/
-void
-GMLH_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
+static void
+handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
{
struct MeshClient *c;
* @param client identification of the client
* @param message the actual message, which includes messages the client wants
*/
-void
-GMLH_new_client (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_new_client (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ClientConnect *cc_msg;
struct MeshClient *c;
* @param client Identification of the client.
* @param message The actual message.
*/
-void
-GMLH_channel_create (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ChannelMessage *msg;
struct MeshPeer *peer;
msgcc.port = msg->port;
msgcc.opt = msg->opt;
- tunnel_queue_data (t, ch, &msgcc.header, GNUNET_YES);
+ GMT_queue_data (t, ch, &msgcc.header, GNUNET_YES);
}
GNUNET_SERVER_receive_done (client, GNUNET_OK);
* @param client identification of the client
* @param message the actual message
*/
-void
-GMLH_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_ChannelMessage *msg;
struct MeshClient *c;
{
ch->root = NULL;
}
- else
+ else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
" channel %X client %p (%p, %p)\n",
* @param client identification of the client
* @param message the actual message
*/
-void
-GMLH_data (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_data (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_LocalData *msg;
struct MeshClient *c;
ch->root->handle == client)
||
(!fwd &&
- ch->dest &&
+ ch->dest &&
ch->dest->handle == client) ) )
{
GNUNET_break (0);
* @param client Identification of the client.
* @param message The actual message.
*/
-void
-GMLH_ack (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_LocalAck *msg;
struct MeshChannelReliability *rel;
// struct GNUNET_SERVER_Client *client = cls;
// struct MeshChannel *ch = value;
// struct GNUNET_MESH_LocalMonitor *msg;
-//
+//
// msg = GNUNET_malloc (sizeof(struct GNUNET_MESH_LocalMonitor));
// msg->channel_id = htonl (ch->gid);
// msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor));
// msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
-//
+//
// GNUNET_log (GNUNET_ERROR_TYPE_INFO,
// "* sending info about tunnel %s\n",
// GNUNET_i2s (&msg->owner));
-//
+//
// GNUNET_SERVER_notification_context_unicast (nc, client,
// &msg->header, GNUNET_NO);
// return GNUNET_YES;
* @param client Identification of the client.
* @param message The actual message.
*/
-void
-GMLH_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct MeshClient *c;
* @param message The actual message.
*/
void
-GMLH_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_MESH_LocalMonitor *msg;
struct GNUNET_MESH_LocalMonitor *resp;
* Functions to handle messages from clients
*/
static struct GNUNET_SERVER_MessageHandler client_handlers[] = {
- {&GMLH_new_client, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0},
- {&GMLH_channel_create, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE,
+ {&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)},
- {&GMLH_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY,
+ {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY,
sizeof (struct GNUNET_MESH_ChannelMessage)},
- {&GMLH_data, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0},
- {&GMLH_ack, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK,
+ {&handle_data, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0},
+ {&handle_ack, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK,
sizeof (struct GNUNET_MESH_LocalAck)},
- {&GMLH_get_tunnels, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS,
+ {&handle_get_tunnels, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS,
sizeof (struct GNUNET_MessageHeader)},
- {&GMLH_show_tunnel, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL,
+ {&handle_show_tunnel, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL,
sizeof (struct GNUNET_MESH_LocalMonitor)},
{NULL, NULL, 0, 0}
};
ports = GNUNET_CONTAINER_multihashmap32_create (32);
}
+
/**
* Install server (service) handlers and start listening to clients.
*/
GML_start (void)
{
GNUNET_SERVER_add_handlers (server_handle, client_handlers);
- GNUNET_SERVER_connect_notify (server_handle, &GMLH_client_connect, NULL);
- GNUNET_SERVER_disconnect_notify (server_handle, &GMLH_client_disconnect,
+ GNUNET_SERVER_connect_notify (server_handle, &handle_client_connect, NULL);
+ GNUNET_SERVER_disconnect_notify (server_handle, &handle_client_disconnect,
NULL);
nc = GNUNET_SERVER_notification_context_create (server_handle, 1);