[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 16/25: Listing of References with Attributes
From: |
gnunet |
Subject: |
[gnunet] 16/25: Listing of References with Attributes |
Date: |
Mon, 13 Jan 2020 13:47:01 +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 6fad96b4971e3067168932088dcaf6c3cbdcb124
Author: Markus Voggenreiter <address@hidden>
AuthorDate: Fri Nov 1 10:59:01 2019 +0100
Listing of References with Attributes
---
src/reclaim-attribute/reclaim_attribute.c | 2 +-
src/reclaim/plugin_rest_reclaim.c | 79 +++++++++++++++++++++----------
2 files changed, 55 insertions(+), 26 deletions(-)
diff --git a/src/reclaim-attribute/reclaim_attribute.c
b/src/reclaim-attribute/reclaim_attribute.c
index d958ba7f9..113ec7ef5 100644
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ b/src/reclaim-attribute/reclaim_attribute.c
@@ -426,7 +426,7 @@ GNUNET_RECLAIM_ATTESTATION_reference_new (const char
*attr_name,
GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
attr->name = write_ptr;
- write_ptr = (char *) &attr[1];
+ write_ptr += strlen (attr_name) +1;
GNUNET_memcpy (write_ptr, ref_value_tmp, strlen (ref_value_tmp) + 1);
attr->reference_value = write_ptr;
diff --git a/src/reclaim/plugin_rest_reclaim.c
b/src/reclaim/plugin_rest_reclaim.c
index 7dd658886..f7713c284 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -638,7 +638,7 @@ 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;
@@ -1045,7 +1045,6 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle
*con_handle,
GNUNET_JSON_parse_free (attrspec);
}
-
/**
* Collect all attributes for an ego
*
@@ -1054,47 +1053,77 @@ 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;
const char *type;
- char *tmp_value;
char *id_str;
- if (NULL == attr)
+ if ((NULL == attr)&& (NULL == reference))
{
GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
return;
}
- if ((NULL == attr->name) || (NULL == attr->data))
+ if (NULL == attr)
{
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
+ if ((NULL == reference->name) || (NULL == reference->reference_value))
+ {
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ return;
+ }
- tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
- attr->data,
- attr->data_size);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding reference as attribute: %s\n",
+ reference->name);
+
+
+ attr_obj = json_object ();
+ json_object_set_new (attr_obj, "name", json_string (reference->name));
+ json_object_set_new (attr_obj, "value", json_string (
+ reference->reference_value));
+ id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id,
sizeof(uint64_t));
+ json_object_set_new (attr_obj, "id", json_string (id_str));
+ char *flag;
+ flag = "1";
+ json_object_set_new (attr_obj, "flag", json_string (flag));
+ type = "String";
+ json_object_set_new (attr_obj, "type", json_string (type));
+ json_array_append (handle->resp_object, attr_obj);
+ json_decref (attr_obj);
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
- attr_obj = json_object ();
- json_object_set_new (attr_obj, "value", json_string (tmp_value));
- json_object_set_new (attr_obj, "name", json_string (attr->name));
- type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
- json_object_set_new (attr_obj, "type", json_string (type));
- id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
- json_object_set_new (attr_obj, "id", json_string (id_str));
- json_array_append (handle->resp_object, attr_obj);
- json_decref (attr_obj);
- GNUNET_free (tmp_value);
- GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ }
+ else
+ {
+ if ((NULL == attr->name) || (NULL == attr->data))
+ {
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ return;
+ }
+ char *tmp_value;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", attr->name);
+
+ tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
+ attr->data,
+ attr->data_size);
+
+ attr_obj = json_object ();
+ json_object_set_new (attr_obj, "value", json_string (tmp_value));
+ json_object_set_new (attr_obj, "name", json_string (attr->name));
+ type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
+ json_object_set_new (attr_obj, "type", json_string (type));
+ id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
+ json_object_set_new (attr_obj, "id", json_string (id_str));
+ json_array_append (handle->resp_object, attr_obj);
+ json_decref (attr_obj);
+ GNUNET_free (tmp_value);
+ GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
+ }
}
-
/**
* List attributes for identity request
*
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnunet] 05/25: Direct Namestore Deletion Implemented, (continued)
- [gnunet] 05/25: Direct Namestore Deletion Implemented, gnunet, 2020/01/13
- [gnunet] 06/25: Add Attestations via Reclaim Service, gnunet, 2020/01/13
- [gnunet] 07/25: Delete Attestation via Service, gnunet, 2020/01/13
- [gnunet] 08/25: Prepare Listing Attestations, gnunet, 2020/01/13
- [gnunet] 10/25: some comments, gnunet, 2020/01/13
- [gnunet] 09/25: Listing Attestations through service, gnunet, 2020/01/13
- [gnunet] 11/25: Preparation for Reference Type, gnunet, 2020/01/13
- [gnunet] 12/25: Adding Reference Type Implemented, gnunet, 2020/01/13
- [gnunet] 13/25: Deletion of Reference Type, gnunet, 2020/01/13
- [gnunet] 14/25: Fixed Reference Deletion, gnunet, 2020/01/13
- [gnunet] 16/25: Listing of References with Attributes,
gnunet <=
- [gnunet] 17/25: Pure Listing of References, gnunet, 2020/01/13
- [gnunet] 15/25: Prepared Listing of References, gnunet, 2020/01/13
- [gnunet] 18/25: Prepared JWT Plugin, gnunet, 2020/01/13
- [gnunet] 20/25: JWT Plugin, Prepared Ticketing, gnunet, 2020/01/13
- [gnunet] 22/25: JWT Parser Implemented, gnunet, 2020/01/13
- [gnunet] 19/25: Fixed Open Issues with Listing, gnunet, 2020/01/13
- [gnunet] 23/25: Fixed Adding Attestations, gnunet, 2020/01/13
- [gnunet] 24/25: Fixed Ticket Management, gnunet, 2020/01/13
- [gnunet] 21/25: Basic Functionality Implemented, gnunet, 2020/01/13
- [gnunet] 25/25: JWT Parsing API, gnunet, 2020/01/13