From 60d2660de243053bc0f41657ad9d67537723276c Mon Sep 17 00:00:00 2001 From: Markus Voggenreiter Date: Wed, 9 Oct 2019 19:51:40 +0200 Subject: [PATCH] Adapted Namestore and reclaim REST --- src/include/gnunet_gnsrecord_lib.h | 5 +++ src/reclaim/plugin_gnsrecord_reclaim.c | 3 ++ src/reclaim/plugin_rest_reclaim.c | 43 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 3a49d98b9..41e23e1ab 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h @@ -140,6 +140,11 @@ extern "C" { */ #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 +/** + * Record type for reclaim attestation records + */ +#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR 65554 + /** * Flags that can be set for a record. */ diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c b/src/reclaim/plugin_gnsrecord_reclaim.c index d530ef01d..58345edc4 100644 --- a/src/reclaim/plugin_gnsrecord_reclaim.c +++ b/src/reclaim/plugin_gnsrecord_reclaim.c @@ -54,6 +54,7 @@ value_to_string (void *cls, uint32_t type, const void *data, size_t data_size) case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: + case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR: return GNUNET_STRINGS_data_to_string_alloc (data, data_size); default: @@ -93,6 +94,7 @@ string_to_value (void *cls, uint32_t type, const char *s, void **data, case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: + case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR: return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size); default: @@ -112,6 +114,7 @@ static struct } name_map[] = { { "RECLAIM_ATTR", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR }, { "RECLAIM_ATTR_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF }, + { "RECLAIM_ATTEST", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTEST_ATTR }, { "RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER }, { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT }, { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT }, diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 9a75b2d16..c58b1560b 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c @@ -48,6 +48,11 @@ */ #define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes" +/** + * Attestation namespace + */ +#define GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE "/reclaim/attestation" + /** * Ticket namespace */ @@ -432,7 +437,36 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) GNUNET_free (tmp); GNUNET_RECLAIM_ticket_iteration_next (handle->ticket_it); } +static void +add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, + const char *url, + void *cls) +{ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding Attestations not supported\n"); + GNUNET_SCHEDULER_add_now (&do_error, handle); + return; +} +/*Placeholder*/ +static void +list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, + const char *url, + void *cls) +{ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Listing Attestations not supported\n"); + GNUNET_SCHEDULER_add_now (&do_error, handle); + return; +} +/*Placeholder*/ +static void +delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, + const char *url, + void *cls) +{ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Deleting Attestations not supported\n"); + GNUNET_SCHEDULER_add_now (&do_error, handle); + return; +} /** * List tickets for identity request @@ -968,6 +1002,15 @@ init_cont (struct RequestHandle *handle) { MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont }, + { MHD_HTTP_METHOD_GET, + GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, + &list_attestation_cont }, + { MHD_HTTP_METHOD_POST, + GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, + &add_attestation_cont }, + { MHD_HTTP_METHOD_DELETE, + GNUNET_REST_API_NS_RECLAIM_ATTESTATION_REFERENCE, + &delete_attestation_cont }, { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont }, -- 2.25.1