[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14867 - in gnunet/src: include mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14867 - in gnunet/src: include mesh |
Date: |
Tue, 5 Apr 2011 13:59:03 +0200 |
Author: bartpolot
Date: 2011-04-05 13:59:03 +0200 (Tue, 05 Apr 2011)
New Revision: 14867
Modified:
gnunet/src/include/gnunet_protocols.h
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/mesh.h
Log:
Added local mesh messages
Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h 2011-04-05 11:15:26 UTC (rev
14866)
+++ gnunet/src/include/gnunet_protocols.h 2011-04-05 11:59:03 UTC (rev
14867)
@@ -798,6 +798,20 @@
*/
#define GNUNET_MESSAGE_TYPE_MESH_SPEED_NOTIFY 262
+/* FIXME: Document */
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ANY 273
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ALL 274
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD 275
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL 276
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE 277
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL 278
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TRANSMIT_READY 279
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATED 280
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROYED 281
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 282
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST 283
+
/**
* 640kb should be enough for everybody
*/
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-04-05 11:15:26 UTC (rev
14866)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-04-05 11:59:03 UTC (rev
14867)
@@ -422,10 +422,10 @@
*/
static int
handle_mesh_network_traffic (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message,
- const struct GNUNET_TRANSPORT_ATS_Information
- *atsi)
+ const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_TRANSPORT_ATS_Information
+ *atsi)
{
if(GNUNET_MESSAGE_TYPE_MESH_DATA_GO == ntohs(message->type)) {
/* Retransmit to next in path of tunnel identified by message */
@@ -449,14 +449,82 @@
/**
* Functions to handle messages from clients
*/
+/* MESSAGES DEFINED:
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ANY 273
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ALL 274
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD 275
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL 276
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE 277
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL 278
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TRANSMIT_READY 279
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATED 280
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROYED 281
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 282
+#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST 283
+ */
static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = {
- {&handle_local_path_create, NULL, GNUNET_MESSAGE_TYPE_LOCAL_PATH_CREATE, 0},
- {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_LOCAL_DATA_GO, 0},
- {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_LOCAL_DATA_BACK, 0},
+ {&handle_local_new_client, NULL, GNUNET_MESSAGE_TYPE_LOCAL_CONNECT, 0},
+ {&handle_local_connect, NULL,
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ANY, 0},
+ {&handle_local_connect, NULL,
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ALL, 0},
+ {&handle_local_connect, NULL,
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD, 0},
+ {&handle_local_connect, NULL,
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL, 0},
+ {&handle_local_connect, NULL,
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE, sizeof(struct
GNUNET_MESH_ConnectPeerByType)},
+ {&handle_local_connect, NULL,
GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL, sizeof(struct
GNUNET_MESH_Control)},
+ {&handle_local_network_traffic, NULL,
GNUNET_MESSAGE_TYPE_LOCAL_TRANSMIT_READY, sizeof(struct GNUNET_MESH_Control)},
+ {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_DATA, 0}, /*
FIXME needed? */
+ {&handle_local_network_traffic, NULL,
GNUNET_MESSAGE_TYPE_LOCAL_DATA_BROADCAST, 0}, /* FIXME needed? */
{NULL, NULL, 0, 0}
};
+
/**
+ * To be called on core init/fail.
+ *
+ * @param cls service closure
+ * @param server handle to the server for this service
+ * @param identity the public identity of this peer
+ * @param publicKey the public key of this peer
+ */
+static void
+core_init (void *cls,
+ struct GNUNET_CORE_Handle *server,
+ const struct GNUNET_PeerIdentity *identity,
+ const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
+{
+ return;
+}
+
+/**
+ * Method called whenever a given peer connects.
+ *
+ * @param cls closure
+ * @param peer peer identity this notification is about
+ * @param atsi performance data for the connection
+ */
+static void
+core_connect (void *cls,
+ const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_TRANSPORT_ATS_Information *atsi)
+{
+ return;
+}
+
+/**
+ * Method called whenever a peer disconnects.
+ *
+ * @param cls closure
+ * @param peer peer identity this notification is about
+ */
+static void
+core_disconnect (void *cls,
+ const struct
+ GNUNET_PeerIdentity *peer)
+{
+ return;
+}
+
+/**
* Process mesh requests. FIXME NON FUNCTIONAL, COPIED FROM DHT!!
*
* @param cls closure
@@ -471,24 +539,24 @@
struct GNUNET_TIME_Relative next_send_time;
unsigned long long temp_config_num;
char *converge_modifier_buf;
- GNUNET_CORE_Handle *coreAPI;
+ GNUNET_CORE_Handle *core;
GNUNET_SERVER_add_handlers (server, plugin_handlers);
GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
- coreAPI = GNUNET_CORE_connect (c, /* Main configuration */
- 32, /* queue size */
- NULL, /* Closure passed to DHT functions */
- NULL, /* Call core_init once connected */
- NULL, /* Handle connects */
- NULL, /* remove peers on disconnects */
- NULL, /* Do we care about "status" updates?
*/
- NULL, /* Don't want notified about all
incoming messages */
- GNUNET_NO, /* For header only inbound
notification */
- NULL, /* Don't want notified about all
outbound messages */
- GNUNET_NO, /* For header only outbound
notification */
- core_handlers); /* Register these
handlers */
+ core = GNUNET_CORE_connect (c, /* Main configuration */
+ 32, /* queue size */
+ NULL, /* Closure passed to MESH functions */
+ &core_init, /* Call core_init once connected */
+ &core_connect, /* Handle connects */
+ &core_disconnect, /* remove peers on
disconnects */
+ NULL, /* Do we care about "status" updates? */
+ NULL, /* Don't want notified about all incoming
messages */
+ GNUNET_NO, /* For header only inbound
notification */
+ NULL, /* Don't want notified about all outbound
messages */
+ GNUNET_NO, /* For header only outbound
notification */
+ core_handlers); /* Register these handlers
*/
- if (coreAPI == NULL)
+ if (core == NULL)
return;
}
Modified: gnunet/src/mesh/mesh.h
===================================================================
--- gnunet/src/mesh/mesh.h 2011-04-05 11:15:26 UTC (rev 14866)
+++ gnunet/src/mesh/mesh.h 2011-04-05 11:59:03 UTC (rev 14867)
@@ -21,14 +21,13 @@
/**
* @author Bartlomiej Polot
* @file mesh/mesh.h
- *
- * TODO:
- * - API messages!
*/
#ifndef MESH_H_
#define MESH_H_
#include <stdint.h>
+
+#include <gnunet_mesh_service.h>
#include "gnunet_common.h"
/******************************************************************************/
@@ -36,39 +35,31 @@
/******************************************************************************/
/* API CALL MESSAGE USED
* -------- ------------
- * connect GNUNET_MESH_Connect / Server_connect?
FIXME
- * disconnect GNUNET_MESH_Disconnect /
Server_disconnect? FIXME
- *
+ * connect GNUNET_MESH_Connect
+ * disconnect Server_disconnect
+ *
* peer_request_connect_any GNUNET_MESH_ConnectPeer
* peer_request_connect_all GNUNET_MESH_ConnectPeer
* peer_request_connect_add GNUNET_MESH_ConnectPeer
* peer_request_connect_del GNUNET_MESH_ConnectPeer
* peer_request_connect_by_type GNUNET_MESH_ConnectPeerByType
* peer_request_connect_cancel GNUNET_MESH_Control
- *
- * notify_tranmit_ready GNUNET_MESH_Control? FIXME
- * notify_tranmit_ready_cancel GNUNET_MESH_Control? FIXME
+ *
+ * notify_transmit_ready GNUNET_MESH_Control
+ * notify_transmit_ready_cancel None
*/
-// struct GNUNET_MESH_Connect {
-// /**
-// * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
-// *
-// * Size: sizeof(struct GNUNET_MESH_Connect) + messages_subscribed *
sizeof (message_type)
-// */
-// struct GNUNET_MessageHeader header;
-//
-// /* uint16_t messages_subscribed[] */
-// };
-//
-// struct GNUNET_MESH_Disconnect {
-// /**
-// * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DISCONNECT
-// */
-// struct GNUNET_MessageHeader header;
-//
-// };
+struct GNUNET_MESH_Connect {
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
+ *
+ * Size: sizeof(struct GNUNET_MESH_Connect) + messages_subscribed * sizeof
(message_type)
+ */
+ struct GNUNET_MessageHeader header;
+ /* uint16_t messages_subscribed[] */
+};
+
struct GNUNET_MESH_ConnectPeer {
/**
* Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ANY|ALL|ADD|DEL]
@@ -86,19 +77,19 @@
*/
struct GNUNET_MessageHeader header;
- /* FIXME Type specification */
- uint32_t type;
+ /* Type specification */
+ GNUNET_MESH_ApplicationType type;
};
struct GNUNET_MESH_Control {
/**
* Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL
- * more? transmit_ready?
+ * GNUNET_MESSAGE_TYPE_MESH_LOCAL_TRANSMIT_READY
*/
struct GNUNET_MessageHeader header;
uint32_t tunnel_id GNUNET_PACKED;
- uint32_t variable GNUNET_PACKED; /* Size of data to transmit? */
+ uint32_t variable GNUNET_PACKED; /* Size of data / connection ID */
};
struct GNUNET_MESH_TunnelEvent {
@@ -121,11 +112,22 @@
uint32_t tunnel_id GNUNET_PACKED;
- /* FIXME: Broadcast? New Type / NULL destination ? */
- /* FIXME: Reverese order for alignment? 1st ID, 2nd t_id? */
struct GNUNET_PeerIdentity destination GNUNET_PACKED;
/* uint8_t data[] */
};
+struct GNUNET_MESH_DataBroadcast {
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST
+ *
+ * Size: sizeof(struct GNUNET_MESH_DataBroadcast) + sizeof (data)
+ */
+ struct GNUNET_MessageHeader header;
+
+ uint32_t tunnel_id GNUNET_PACKED;
+
+ /* uint8_t data[] */
+};
+
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14867 - in gnunet/src: include mesh,
gnunet <=