gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35567 - in gnunet/src: dht include


From: gnunet
Subject: [GNUnet-SVN] r35567 - in gnunet/src: dht include
Date: Mon, 27 Apr 2015 17:49:13 +0200

Author: arthur
Date: 2015-04-27 17:49:12 +0200 (Mon, 27 Apr 2015)
New Revision: 35567

Modified:
   gnunet/src/dht/gnunet-service-wdht_neighbours.c
   gnunet/src/include/gnunet_protocols.h
Log:
Finish the create of the handler for every message.



Modified: gnunet/src/dht/gnunet-service-wdht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-wdht_neighbours.c     2015-04-27 13:25:49 UTC 
(rev 35566)
+++ gnunet/src/dht/gnunet-service-wdht_neighbours.c     2015-04-27 15:49:12 UTC 
(rev 35567)
@@ -416,11 +416,16 @@
 static struct GNUNET_PeerIdentity my_identity;
 
 /**
- * Peer map of all the friends of a peer
+ * Peer map of all the fingers of a peer
  */
-static struct GNUNET_CONTAINER_MultiPeerMap *friend_peermap;
+static struct GNUNET_CONTAINER_MultiPeerMap *fingers_peermap;
 
 /**
+ * Peer map of all the successors of a peer
+ */
+static struct GNUNET_CONTAINER_MultiPeerMap *successors_peermap;
+
+/**
  * Tail map, mapping tail identifiers to `struct Trail`s
  */
 static struct GNUNET_CONTAINER_MultiHashMap *tail_map;
@@ -596,7 +601,8 @@
 
 
 /**
- * Handle a `struct FingerSetupMessage`.
+ * Handle a `struct FingerSetupMessage` from a 
GNUNET_MESSAGE_TYPE_WDHT_FINGER_SETUP
+ * message.
  *
  * @param cls closure (NULL)
  * @param peer sender identity
@@ -616,7 +622,8 @@
 }
 
 /**
- * Handle a `struct FingerSetupResponseMessage`.
+ * Handle a `struct FingerSetupResponseMessage` from a 
GNUNET_MESSAGE_TYPE_WDHT_FINGER_SETUP_RESPONSE
+ * message.
  *
  * @param cls closure (NULL)
  * @param peer sender identity
@@ -630,7 +637,7 @@
 {
   const struct FingerSetupResponseMessage *fsrm;
 
-  fsm = (const struct  *) message;
+  fsm = (const struct FingerSetupResponseMessage *) message;
 
   return GNUNET_OK;
 }
@@ -651,7 +658,7 @@
 {
   const struct FingerDestroyMessage *fdm;
 
-  fsm = (const struct  *) message;
+  fdm = (const struct FingerDestroyMessage *) message;
 
   return GNUNET_OK;
 }
@@ -671,18 +678,19 @@
 {
   const struct FingerRouteMessage *frm;
 
-  fsm = (const struct  *) message;
+  frm = (const struct FingerRouteMessage *) message;
   /* FIXME: check the size of the message */
 
   return GNUNET_OK;
 }
 
 /**
- * Handle a `struct FingerRouteMessage`.
+ * Handle a `struct FingerSetupMessage` from a 
GNUNET_MESSAGE_TYPE_WDHT_NEIGHBOUR_FIND
+ * message.
  *
  * @param cls closure (NULL)
  * @param peer sender identity
- * @param message the finger route message
+ * @param message the finger setup message
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 static int
@@ -692,12 +700,102 @@
 {
   const struct FingerSetupMessage *fsm;
 
-  fsm = (const struct  *) message;
+  fsm = (const struct FingerSetupMessage *) message;
 
   return GNUNET_OK;
 }
 
 /**
+ * Handle a `struct FingerSetupResponseMessage` from a 
GNUNET_MESSAGE_TYPE_WDHT_NEIGHBOUR_FIND
+ * message.
+ *
+ * @param cls closure (NULL)
+ * @param peer sender identity
+ * @param message the finger setup response message
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+static int
+handle_dht_p2p_neighbour_found (void *cls,
+                             const struct GNUNET_PeerIdentity *peer,
+                             const struct GNUNET_MessageHeader *message)
+{
+  const struct FingerSetupResponseMessage *fsrm;
+
+  fsrm = (const struct FingerSetupResponseMessage *) message;
+
+  return GNUNET_OK;
+}
+
+/**
+ * Handle a `struct PeerGetMessage`.
+ *
+ * @param cls closure (NULL)
+ * @param peer sender identity
+ * @param message the peer get message
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+static int
+handle_dht_p2p_peer_get (void *cls,
+                             const struct GNUNET_PeerIdentity *peer,
+                             const struct GNUNET_MessageHeader *message)
+{
+  const struct PeerGetMessage *pgm;
+
+  pgm = (const struct PeerGetMessage *) message;
+
+   /*
+    * steps :
+    *   1 extract the result
+    *   2 create a peerGetResult struct
+    *   3 send it using the good trail
+    *
+    * What do i do when i don't have the key/value?
+    */
+
+  return GNUNET_OK;
+}
+
+/**
+ * Handle a `struct PeerGetResultMessage`.
+ *
+ * @param cls closure (NULL)
+ * @param peer sender identity
+ * @param message the peer get result message
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+static int
+handle_dht_p2p_peer_get_result (void *cls,
+                             const struct GNUNET_PeerIdentity *peer,
+                             const struct GNUNET_MessageHeader *message)
+{
+  const struct PeerGetResultMessage *pgrm;
+
+  pgrm = (const struct PeerGetResultMessage *) message;
+
+  return GNUNET_OK;
+}
+
+/**
+ * Handle a `struct PeerPutMessage`.
+ *
+ * @param cls closure (NULL)
+ * @param peer sender identity
+ * @param message the peer put message
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+static int
+handle_dht_p2p_peer_put (void *cls,
+                             const struct GNUNET_PeerIdentity *peer,
+                             const struct GNUNET_MessageHeader *message)
+{
+  const struct PeerGetResultMessage *pgrm;
+
+  pgrm = (const struct PeerGetResultMessage *) message;
+
+  return GNUNET_OK;
+}
+
+/**
  * Initialize neighbours subsystem.
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
@@ -720,9 +818,18 @@
     { &handle_dht_p2p_neighbour_find,
       GNUNET_MESSAGE_TYPE_WDHT_NEIGHBOUR_FIND,
       sizeof (struct FingerSetupMessage) },
-       { &handle_dht_p2p_neighbour_find,
+    { &handle_dht_p2p_neighbour_found,
       GNUNET_MESSAGE_TYPE_WDHT_NEIGHBOUR_FOUND,
-      sizeof (struct FingerSetupMessage) },
+      sizeof (struct FingerSetupResponseMessage) },
+    { &handle_dht_p2p_peer_get,
+      GNUNET_MESSAGE_TYPE_WDHT_GET,
+      sizeof (struct PeerGetMessage) },
+    { &handle_dht_p2p_peer_get_result,
+      GNUNET_MESSAGE_TYPE_WDHT_GET_RESULT,
+      0},
+    { &handle_dht_p2p_peer_put,
+      GNUNET_MESSAGE_TYPE_WDHT_PUT,
+      0},
     {NULL, 0, 0}
   };
 
@@ -738,7 +845,9 @@
   if (NULL == core_api)
     return GNUNET_SYSERR;
 
-  friend_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
+  fingers_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
+  successors_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
+
   return GNUNET_OK;
 }
 

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2015-04-27 13:25:49 UTC (rev 
35566)
+++ gnunet/src/include/gnunet_protocols.h       2015-04-27 15:49:12 UTC (rev 
35567)
@@ -2644,47 +2644,47 @@
  
******************************************************************************/
 
 /**
- *
+ * This message contains the query for initialization of a finger
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_FINGER_SETUP 910
 
 /**
- *
+ * This message contains the response to the query for intialization of a 
finger
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_FINGER_SETUP_RESPONSE 911
 
 /**
- *
+ * This message contains a notification for the death of a finger
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_FINGER_DESTROY 912
 
 /**
- *
+ * This message are used to route a query to a peer
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_FINGER_ROUTE 913
 
 /**
- *
+ * This message contains the query to find a successor
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_NEIGHBOUR_FIND 914
 
 /**
- *
+ * Message which contains the response to a new successor found
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_NEIGHBOUR_FOUND 915
 
 /**
- *
+ * Message which contains the get query
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_GET 916
 
 /**
- *
+ * Message which contains the put query
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_PUT 917
 
 /**
- *
+ * Message which contains the get result.
  */
 #define GNUNET_MESSAGE_TYPE_WDHT_GET_RESULT 918
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]