gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: dhtu: handle connect


From: gnunet
Subject: [gnunet] branch master updated: dhtu: handle connect
Date: Mon, 20 Sep 2021 19:27:41 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 33d31c58c dhtu: handle connect
33d31c58c is described below

commit 33d31c58c1036acdef9f7d6cb3bb27881e6e26cb
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Sep 20 19:08:36 2021 +0200

    dhtu: handle connect
---
 src/dhtu/plugin_dhtu_gnunet.c | 40 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c
index ccd329e8e..e01f90bde 100644
--- a/src/dhtu/plugin_dhtu_gnunet.c
+++ b/src/dhtu/plugin_dhtu_gnunet.c
@@ -40,6 +40,7 @@ struct GNUNET_DHTU_PrivateKey
 
 };
 
+GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
  * Handle for a public key used by this underlay.
@@ -55,11 +56,13 @@ struct PublicKey
   /**
    * GNUnet uses eddsa for peers.
    */
-  struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
+  struct GNUNET_PeerIdentity peer_pub;
 
 };
 
 
+GNUNET_NETWORK_STRUCT_END
+
 /**
  * Opaque handle that the underlay offers for our address to be used when
  * sending messages to another peer.
@@ -86,6 +89,22 @@ struct GNUNET_DHTU_Target
    */
   void *app_ctx;
 
+  /**
+   * CORE MQ to send messages to this peer.
+   */
+  struct GNUNET_MQ_Handle *mq;
+
+  /**
+   * Public key of the peer.
+   */
+  struct PublicKey pk;
+  
+  /**
+   * Hash of the @a pk to identify position of the peer
+   * in the DHT.
+   */
+  struct GNUNET_DHTU_Hash peer_id;
+
   /**
    * Head of preferences expressed for this target.
    */
@@ -204,7 +223,7 @@ ip_verify (void *cls,
       GNUNET_CRYPTO_eddsa_verify_ (ntohl (purpose->purpose),
                                    purpose,
                                    es,
-                                   &pub->eddsa_pub))
+                                   &pub->peer_pub.public_key))
   {
     GNUNET_break_op (0);
     return GNUNET_SYSERR;
@@ -311,7 +330,22 @@ core_connect_cb (void *cls,
                  const struct GNUNET_PeerIdentity *peer,
                  struct GNUNET_MQ_Handle *mq)
 {
-  return NULL;
+  struct Plugin *plugin = cls;
+  struct GNUNET_DHTU_Target *target;
+
+  target = GNUNET_new (struct GNUNET_DHTU_Target);
+  target->mq = mq;
+  target->pk.header.size = htons (sizeof (struct PublicKey));
+  target->pk.peer_pub = *peer;
+  GNUNET_CRYPTO_hash (peer,
+                      sizeof (struct GNUNET_PeerIdentity),
+                      &target->peer_id.hc);
+  plugin->env->connect_cb (plugin->env->cls,
+                           &target->pk.header,
+                           &target->peer_id,
+                           target,
+                           &target->app_ctx);
+  return target;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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