gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 15/25: Prepared Listing of References


From: gnunet
Subject: [gnunet] 15/25: Prepared Listing of References
Date: Mon, 13 Jan 2020 13:47:00 +0100

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 17af2a636fc8fd0c111c7550484b2582cb7eb64a
Author: Markus Voggenreiter <address@hidden>
AuthorDate: Thu Oct 31 17:47:22 2019 +0100

    Prepared Listing of References
---
 src/include/gnunet_protocols.h             |   2 +
 src/include/gnunet_reclaim_attribute_lib.h |   4 +-
 src/include/gnunet_reclaim_service.h       |   3 +-
 src/reclaim-attribute/reclaim_attribute.c  |   8 +-
 src/reclaim/gnunet-reclaim.c               |  12 +--
 src/reclaim/gnunet-service-reclaim.c       | 113 +++++++++++++++++----------
 src/reclaim/plugin_rest_openid_connect.c   |   8 +-
 src/reclaim/plugin_rest_reclaim.c          |   9 ++-
 src/reclaim/reclaim_api.c                  | 121 ++++++++++++++++++++++++++---
 9 files changed, 210 insertions(+), 70 deletions(-)

diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 367f6fd80..8091fb367 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -3311,6 +3311,8 @@ extern "C" {
  */
 #define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE 1500
 
+#define GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT 1501
+
 
 /**
  * Type used to match 'all' message types.
diff --git a/src/include/gnunet_reclaim_attribute_lib.h 
b/src/include/gnunet_reclaim_attribute_lib.h
index cfdecae79..c761d20ed 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_attribute_lib.h
@@ -76,9 +76,9 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
   uint32_t type;
 
   /**
-   * Version
+   * Flags
    */
-  uint32_t version;
+  uint32_t flag;
   /**
    * The name of the attribute. Note "name" must never be individually
    * free'd
diff --git a/src/include/gnunet_reclaim_service.h 
b/src/include/gnunet_reclaim_service.h
index f839123e5..214cdba69 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -118,7 +118,8 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void 
*cls,
 typedef void (*GNUNET_RECLAIM_AttributeResult) (
   void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
   const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest);
+  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
+  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference);
 
 
 /**
diff --git a/src/reclaim-attribute/reclaim_attribute.c 
b/src/reclaim-attribute/reclaim_attribute.c
index 0083ac53e..d958ba7f9 100644
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ b/src/reclaim-attribute/reclaim_attribute.c
@@ -353,7 +353,7 @@ GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name,
                         + strlen (attr_name_tmp) + 1 + data_size);
   attr->type = type;
   attr->data_size = data_size;
-  attr->version = 0;
+  attr->flag = 0;
   write_ptr = (char *) &attr[1];
   GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
   attr->name = write_ptr;
@@ -569,8 +569,8 @@ GNUNET_RECLAIM_ATTRIBUTE_list_dup (
                                           le->claim->type,
                                           le->claim->data,
                                           le->claim->data_size);
-    result_le->claim->version = le->claim->version;
     result_le->claim->id = le->claim->id;
+    result_le->claim->flag = le->claim->flag;
     GNUNET_CONTAINER_DLL_insert (result->list_head,
                                  result->list_tail,
                                  result_le);
@@ -635,7 +635,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (
 
   attr_ser = (struct Attribute *) result;
   attr_ser->attribute_type = htons (attr->type);
-  attr_ser->attribute_version = htonl (attr->version);
+  attr_ser->attribute_version = htonl (attr->flag);
   attr_ser->attribute_id = GNUNET_htonll (attr->id);
   name_len = strlen (attr->name);
   attr_ser->name_len = htons (name_len);
@@ -685,7 +685,7 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, 
size_t data_size)
   attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
                         + data_len + name_len + 1);
   attr->type = ntohs (attr_ser->attribute_type);
-  attr->version = ntohl (attr_ser->attribute_version);
+  attr->flag = ntohl (attr_ser->attribute_version);
   attr->id = GNUNET_ntohll (attr_ser->attribute_id);
   attr->data_size = data_len;
 
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index c8ce1d722..5f9170f05 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -227,7 +227,8 @@ static void
 process_attrs (void *cls,
                const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
                const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-               const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+               const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 
+               const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
 {
   char *value_str;
   char *id;
@@ -254,7 +255,7 @@ process_attrs (void *cls,
            attr->name,
            value_str,
            attr_type,
-           attr->version,
+           attr->flag,
            id);
   GNUNET_free (id);
 }
@@ -447,7 +448,8 @@ static void
 iter_cb (void *cls,
          const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
          const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-         const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+         const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
+         const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
 {
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
   char *attrs_tmp;
@@ -482,7 +484,7 @@ iter_cb (void *cls,
                                                       attr->type,
                                                       attr->data,
                                                       attr->data_size);
-      le->claim->version = attr->version;
+      le->claim->flag = attr->flag;
       le->claim->id = attr->id;
       GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
                                    attr_list->list_tail,
@@ -516,7 +518,7 @@ iter_cb (void *cls,
              attr->name,
              attr_str,
              attr_type,
-             attr->version,
+             attr->flag,
              id);
     GNUNET_free (id);
   }
diff --git a/src/reclaim/gnunet-service-reclaim.c 
b/src/reclaim/gnunet-service-reclaim.c
index 0c27cdbef..11ff2cd2d 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -1452,26 +1452,19 @@ ticket_iter (void *cls,
   int has_changed = GNUNET_NO;
   for (int i = 0; i < rd_count; i++)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Next Zone Iteration %u and record type is %u\n", rd_count,
-                rd[i].record_type);
     if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) &&
         (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE_REF != rd[i].record_type) &&
         (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_REF != rd[i].record_type))
       continue;
     if (&adh->claim != NULL)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Claim is existend: %u \n", 
adh->claim->id);
       if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t)))
         continue;
-    }
     if (&adh->attest != NULL)
       if (0 != memcmp (rd[i].data, &adh->attest->id, sizeof(uint64_t)))
         continue;
     if (&adh->reference != NULL)
       if (0 != memcmp (rd[i].data, &adh->reference->id, sizeof(uint64_t)))
         continue;
-
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Attribute or Attestation/Reference to delete found (%s)\n",
                 adh->label);
@@ -1490,7 +1483,6 @@ ticket_iter (void *cls,
                                  adh->tickets_to_update_tail,
                                  le);
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Next Zone Iteration \n");
   GNUNET_NAMESTORE_zone_iterator_next (adh->ns_it, 1);
 }
 
@@ -2027,7 +2019,7 @@ attr_iter_error (void *cls)
 
 
 /**
- * Got record. Return if it is an attribute or attestation.
+ * Got record. Return if it is an attribute or attestation/reference.
  *
  * @param cls our attribute iterator
  * @param zone zone we are iterating
@@ -2047,48 +2039,83 @@ attr_iter_cb (void *cls,
   struct GNUNET_MQ_Envelope *env;
   char *data_tmp;
 
-  if (rd_count != 1)
+  if (rd_count == 0)
   {
     GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
     return;
   }
-
-  if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type) &&
-      (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd->record_type) )
+  if (rd_count > 1)
   {
-    GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
-    return;
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[0].record_type)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Non-Attestation record with multiple entries found\n");
+      GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
+      return;
+    }
   }
 
-  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd->record_type )
+  for (int i = 0; i<rd_count; i++)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
-                label);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending ATTESTATION_RESULT message\n");
-    env = GNUNET_MQ_msg_extra (arm,
-                               rd->data_size,
-                               GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
-    arm->id = htonl (ai->request_id);
-    arm->attr_len = htons (rd->data_size);
-    GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
-    data_tmp = (char *) &arm[1];
-    GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
-    GNUNET_MQ_send (ai->client->mq, env);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
-    env = GNUNET_MQ_msg_extra (arm,
-                               rd->data_size,
-                               GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
-    arm->id = htonl (ai->request_id);
-    arm->attr_len = htons (rd->data_size);
-    GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
-    data_tmp = (char *) &arm[1];
-    GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
-    GNUNET_MQ_send (ai->client->mq, env);
+    if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd[i].record_type) &&
+        (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR != rd[i].record_type) &&
+        (GNUNET_GNSRECORD_TYPE_RECLAIM_REFERENCE != rd[i].record_type))
+    {
+      GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
+      return;
+    }
+
+    if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR == rd[i].record_type )
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
+                  label);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Sending ATTRIBUTE_RESULT message\n");
+      env = GNUNET_MQ_msg_extra (arm,
+                                 rd[i].data_size,
+                                 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+      arm->id = htonl (ai->request_id);
+      arm->attr_len = htons (rd[i].data_size);
+      GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+      data_tmp = (char *) &arm[1];
+      GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
+      GNUNET_MQ_send (ai->client->mq, env);
+    }
+    else
+    {
+      if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR == rd[i].record_type )
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
+                    label);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Sending ATTESTATION_RESULT message\n");
+        env = GNUNET_MQ_msg_extra (arm,
+                                   rd[i].data_size,
+                                   
GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
+        arm->id = htonl (ai->request_id);
+        arm->attr_len = htons (rd[i].data_size);
+        GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+        data_tmp = (char *) &arm[1];
+        GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
+        GNUNET_MQ_send (ai->client->mq, env);
+      }
+      else
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found reference under: %s\n",
+                    label);
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Sending REFERENCE_RESULT message\n");
+        env = GNUNET_MQ_msg_extra (arm,
+                                   rd[i].data_size,
+                                   
GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT);
+        arm->id = htonl (ai->request_id);
+        arm->attr_len = htons (rd[i].data_size);
+        GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+        data_tmp = (char *) &arm[1];
+        GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
+        GNUNET_MQ_send (ai->client->mq, env);
+      }
+    }
   }
 }
 
diff --git a/src/reclaim/plugin_rest_openid_connect.c 
b/src/reclaim/plugin_rest_openid_connect.c
index 2dde89950..435cc3bf3 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -979,7 +979,8 @@ static void
 oidc_attr_collect (void *cls,
                    const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
                    const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                   const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+                   const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
+                   const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE 
*reference)
 {
   struct RequestHandle *handle = cls;
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
@@ -1015,7 +1016,7 @@ oidc_attr_collect (void *cls,
                                                   attr->data,
                                                   attr->data_size);
   le->claim->id = attr->id;
-  le->claim->version = attr->version;
+  le->claim->flag = attr->flag;
   GNUNET_CONTAINER_DLL_insert (handle->attr_list->list_head,
                                handle->attr_list->list_tail,
                                le);
@@ -1864,7 +1865,8 @@ static void
 consume_ticket (void *cls,
                 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
                 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+                const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
+                const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
 {
   struct RequestHandle *handle = cls;
   char *tmp_value;
diff --git a/src/reclaim/plugin_rest_reclaim.c 
b/src/reclaim/plugin_rest_reclaim.c
index 5066eef58..7dd658886 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -638,7 +638,8 @@ static void
 attest_collect (void *cls,
                 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
                 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-                const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+                const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 
+                const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
 {
   struct RequestHandle *handle = cls;
   json_t *attr_obj;
@@ -1053,7 +1054,8 @@ static void
 attr_collect (void *cls,
               const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
               const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-              const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+              const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest, 
+              const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
 {
   struct RequestHandle *handle = cls;
   json_t *attr_obj;
@@ -1292,7 +1294,8 @@ static void
 consume_cont (void *cls,
               const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
               const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
-              const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest)
+              const struct GNUNET_RECLAIM_ATTESTATION_Claim *attest,
+              const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *reference)
 {
   struct RequestHandle *handle = cls;
   char *val_str;
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index 7c7261522..ede2daf28 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -504,16 +504,16 @@ handle_consume_ticket_result (void *cls,
     {
       if (NULL == attrs)
       {
-        op->ar_cb (op->cls, &msg->identity, NULL, NULL);
+        op->ar_cb (op->cls, &msg->identity, NULL, NULL, NULL);
       }
       else
       {
         for (le = attrs->list_head; NULL != le; le = le->next)
-          op->ar_cb (op->cls, &msg->identity, le->claim, NULL);
+          op->ar_cb (op->cls, &msg->identity, le->claim, NULL, NULL);
         GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
         attrs = NULL;
       }
-      op->ar_cb (op->cls, NULL, NULL, NULL);
+      op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
     }
     GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
     free_op (op);
@@ -597,7 +597,7 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
     if (NULL != op)
     {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, NULL, NULL, NULL);
+        op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
       GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
       free_op (op);
     }
@@ -610,12 +610,12 @@ handle_attribute_result (void *cls, const struct 
AttributeResultMessage *msg)
     if (NULL != it)
     {
       if (NULL != it->proc)
-        it->proc (it->proc_cls, &msg->identity, attr, NULL);
+        it->proc (it->proc_cls, &msg->identity, attr, NULL, NULL);
     }
     else if (NULL != op)
     {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, &msg->identity, attr, NULL);
+        op->ar_cb (op->cls, &msg->identity, attr, NULL, NULL);
     }
     GNUNET_free (attr);
     return;
@@ -696,7 +696,7 @@ handle_attestation_result (void *cls, const struct 
AttributeResultMessage *msg)
     if (NULL != op)
     {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, NULL, NULL, NULL);
+        op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
       GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
       free_op (op);
     }
@@ -709,12 +709,111 @@ handle_attestation_result (void *cls, const struct 
AttributeResultMessage *msg)
     if (NULL != it)
     {
       if (NULL != it->proc)
-        it->proc (it->proc_cls, &msg->identity, NULL, attr);
+        it->proc (it->proc_cls, &msg->identity, NULL, attr, NULL);
     }
     else if (NULL != op)
     {
       if (NULL != op->ar_cb)
-        op->ar_cb (op->cls, &msg->identity, NULL, attr);
+        op->ar_cb (op->cls, &msg->identity, NULL, attr, NULL);
+    }
+    GNUNET_free (attr);
+    return;
+  }
+  GNUNET_assert (0);
+}
+
+/**
+   * Handle an incoming message of type
+   * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT
+   *
+   * @param cls
+   * @param msg the message we received
+   * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+   */
+static int
+check_reference_result (void *cls, const struct AttributeResultMessage *msg)
+{
+  size_t msg_len;
+  size_t attr_len;
+
+  msg_len = ntohs (msg->header.size);
+  attr_len = ntohs (msg->attr_len);
+  if (msg_len != sizeof(struct AttributeResultMessage) + attr_len)
+  {
+    GNUNET_break (0);
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_OK;
+}
+
+/**
+* Handle an incoming message of type
+* #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT
+*
+* @param cls
+* @param msg the message we received
+*/
+static void
+handle_reference_result (void *cls, const struct AttributeResultMessage *msg)
+{
+  static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
+  struct GNUNET_RECLAIM_Handle *h = cls;
+  struct GNUNET_RECLAIM_AttributeIterator *it;
+  struct GNUNET_RECLAIM_Operation *op;
+  size_t attr_len;
+  uint32_t r_id = ntohl (msg->id);
+
+  attr_len = ntohs (msg->attr_len);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n");
+
+
+  for (it = h->it_head; NULL != it; it = it->next)
+    if (it->r_id == r_id)
+      break;
+  for (op = h->op_head; NULL != op; op = op->next)
+    if (op->r_id == r_id)
+      break;
+  if ((NULL == it) && (NULL == op))
+    return;
+
+  if ((0 ==
+       (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy)))))
+  {
+    if ((NULL == it) && (NULL == op))
+    {
+      GNUNET_break (0);
+      force_reconnect (h);
+      return;
+    }
+    if (NULL != it)
+    {
+      if (NULL != it->finish_cb)
+        it->finish_cb (it->finish_cb_cls);
+      free_it (it);
+    }
+    if (NULL != op)
+    {
+      if (NULL != op->ar_cb)
+        op->ar_cb (op->cls, NULL, NULL, NULL, NULL);
+      GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
+      free_op (op);
+    }
+    return;
+  }
+
+  {
+    struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr;
+    attr = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1],
+                                                       attr_len);
+    if (NULL != it)
+    {
+      if (NULL != it->proc)
+        it->proc (it->proc_cls, &msg->identity, NULL, NULL, attr);
+    }
+    else if (NULL != op)
+    {
+      if (NULL != op->ar_cb)
+        op->ar_cb (op->cls, &msg->identity, NULL, NULL, attr);
     }
     GNUNET_free (attr);
     return;
@@ -844,6 +943,10 @@ reconnect (struct GNUNET_RECLAIM_Handle *h)
                            GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT,
                            struct AttributeResultMessage,
                            h),
+    GNUNET_MQ_hd_var_size (reference_result,
+                           GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT,
+                           struct AttributeResultMessage,
+                           h),
     GNUNET_MQ_hd_fixed_size (ticket_result,
                              GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
                              struct TicketResultMessage,

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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