$(top_builddir)/src/rest/libgnunetrest.la \
$(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la \
-$(top_builddir)/src/gns/libgnunetgns.la \
+ $(top_builddir)/src/gns/libgnunetgns.la \
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
$(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
$(LTLIBINTL) -ljansson -lmicrohttpd
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/namestore/libgnunetnamestore.la \
- $(top_builddir)/src/identity/libgnunetidentity.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
libgnunetreclaim.la \
#include "gnunet-service-reclaim_tickets.h"
#include "gnunet_constants.h"
#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_identity_service.h"
-#include "gnunet_namestore_service.h"
#include "gnunet_protocols.h"
#include "gnunet_reclaim_attribute_lib.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_signatures.h"
#include "reclaim.h"
-/**
- * First pass state
- */
-#define STATE_INIT 0
-
-/**
- * Normal operation state
- */
-#define STATE_POST_INIT 1
-
-/**
- * Minimum interval between updates
- */
-#define MIN_WAIT_TIME GNUNET_TIME_UNIT_MINUTES
-
-
-/**
- * Identity handle
- */
-static struct GNUNET_IDENTITY_Handle *identity_handle;
/**
* Namestore handle
*/
static struct GNUNET_SCHEDULER_Task *timeout_task;
-/**
- * Update task
- */
-static struct GNUNET_SCHEDULER_Task *update_task;
-
/**
* Our configuration.
*/
};
-/**
- * Updated attribute IDs
- */
-struct TicketAttributeUpdateEntry
-{
- /**
- * DLL
- */
- struct TicketAttributeUpdateEntry *next;
-
- /**
- * DLL
- */
- struct TicketAttributeUpdateEntry *prev;
-
- /**
- * The old ID
- */
- uint64_t old_id;
-
- /**
- * The new ID
- */
- uint64_t new_id;
-};
-
-
/**
* Ticket revocation request handle
*/
};
-/**
- * DLL for ego handles to egos containing the RECLAIM_ATTRS in a
- * map in json_t format
- *
- */
-struct EgoEntry
-{
- /**
- * DLL
- */
- struct EgoEntry *next;
-
- /**
- * DLL
- */
- struct EgoEntry *prev;
-
- /**
- * Ego handle
- */
- struct GNUNET_IDENTITY_Ego *ego;
-
- /**
- * Attribute map. Contains the attributes as json_t
- */
- struct GNUNET_CONTAINER_MultiHashMap *attr_map;
-};
-
-
/**
* Client list
*/
RECLAIM_TICKETS_deinit ();
if (NULL != timeout_task)
GNUNET_SCHEDULER_cancel (timeout_task);
- if (NULL != update_task)
- GNUNET_SCHEDULER_cancel (update_task);
- if (NULL != identity_handle)
- GNUNET_IDENTITY_disconnect (identity_handle);
if (NULL != nsh)
GNUNET_NAMESTORE_disconnect (nsh);
}
*/
static void
handle_ticket_iteration_start (
- void *cls,
- const struct TicketIterationStartMessage *tis_msg)
+ void *cls,
+ const struct TicketIterationStartMessage *tis_msg)
{
struct IdpClient *client = cls;
struct TicketIteration *ti;
"error connecting to namestore");
}
- identity_handle = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
-
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
}
* Define "main" method using service macro.
*/
GNUNET_SERVICE_MAIN (
- "reclaim",
- GNUNET_SERVICE_OPTION_NONE,
- &run,
- &client_connect_cb,
- &client_disconnect_cb,
- NULL,
- GNUNET_MQ_hd_var_size (attribute_store_message,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
- struct AttributeStoreMessage,
- NULL),
- GNUNET_MQ_hd_var_size (attribute_delete_message,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE,
- struct AttributeDeleteMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (
- iteration_start,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
- struct AttributeIterationStartMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (iteration_next,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
- struct AttributeIterationNextMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (iteration_stop,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
- struct AttributeIterationStopMessage,
- NULL),
- GNUNET_MQ_hd_var_size (issue_ticket_message,
- GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
- struct IssueTicketMessage,
- NULL),
- GNUNET_MQ_hd_var_size (consume_ticket_message,
- GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
- struct ConsumeTicketMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
- GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
- struct TicketIterationStartMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
- GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
- struct TicketIterationNextMessage,
- NULL),
- GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
- GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
- struct TicketIterationStopMessage,
- NULL),
- GNUNET_MQ_hd_var_size (revoke_ticket_message,
- GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
- struct RevokeTicketMessage,
- NULL),
- GNUNET_MQ_handler_end ());
+ "reclaim",
+ GNUNET_SERVICE_OPTION_NONE,
+ &run,
+ &client_connect_cb,
+ &client_disconnect_cb,
+ NULL,
+ GNUNET_MQ_hd_var_size (attribute_store_message,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
+ struct AttributeStoreMessage,
+ NULL),
+ GNUNET_MQ_hd_var_size (attribute_delete_message,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE,
+ struct AttributeDeleteMessage,
+ NULL),
+ GNUNET_MQ_hd_fixed_size (
+ iteration_start,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
+ struct AttributeIterationStartMessage,
+ NULL),
+ GNUNET_MQ_hd_fixed_size (iteration_next,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
+ struct AttributeIterationNextMessage,
+ NULL),
+ GNUNET_MQ_hd_fixed_size (iteration_stop,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
+ struct AttributeIterationStopMessage,
+ NULL),
+ GNUNET_MQ_hd_var_size (issue_ticket_message,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
+ struct IssueTicketMessage,
+ NULL),
+ GNUNET_MQ_hd_var_size (consume_ticket_message,
+ GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
+ struct ConsumeTicketMessage,
+ NULL),
+ GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
+ GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
+ struct TicketIterationStartMessage,
+ NULL),
+ GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
+ GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
+ struct TicketIterationNextMessage,
+ NULL),
+ GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
+ GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
+ struct TicketIterationStopMessage,
+ NULL),
+ GNUNET_MQ_hd_var_size (revoke_ticket_message,
+ GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
+ struct RevokeTicketMessage,
+ NULL),
+ GNUNET_MQ_handler_end ());
/* end of gnunet-service-reclaim.c */
*
*/
#include <inttypes.h>
-
#include "gnunet-service-reclaim_tickets.h"
#define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS
}
/** find a new place for this attribute **/
rvk->move_attr->new_id =
- GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+ GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
new_rd = *rd;
claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
sizeof (uint64_t));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
rvk->ns_qe = GNUNET_NAMESTORE_records_store (
- nsh, &rvk->identity, new_label, 1, &new_rd, &move_attr_finished, rvk);
+ nsh, &rvk->identity, new_label, 1, &new_rd, &move_attr_finished, rvk);
GNUNET_free (new_label);
GNUNET_free (claim);
GNUNET_free (attr_data);
}
}
rvk->ns_qe = GNUNET_NAMESTORE_records_store (
- nsh, &rvk->identity, le->label, le->rd_count, rd, &ticket_processed, rvk);
+ nsh, &rvk->identity, le->label, le->rd_count, rd, &ticket_processed, rvk);
GNUNET_free (le->label);
GNUNET_free (le->data);
GNUNET_free (le);
if (NULL == rvk->move_attr) {
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
rvk->ns_it = GNUNET_NAMESTORE_zone_iteration_start (
- nsh, &rvk->identity, &rvk_ns_iter_err, rvk, &rvk_ticket_update, rvk,
- &rvk_ticket_update_finished, rvk);
+ nsh, &rvk->identity, &rvk_ns_iter_err, rvk, &rvk_ticket_update, rvk,
+ &rvk_ticket_update_finished, rvk);
return;
}
label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving attribute %s\n", label);
rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (
- nsh, &rvk->identity, label, &rvk_ns_err, rvk, &rvk_move_attr_cb, rvk);
+ nsh, &rvk->identity, label, &rvk_ns_err, rvk, &rvk_move_attr_cb, rvk);
GNUNET_free (label);
}
label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t));
rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (
- nsh, identity, label, &rvk_attrs_err_cb, rvk, &revoke_attrs_cb, rvk);
+ nsh, identity, label, &rvk_attrs_err_cb, rvk, &revoke_attrs_cb, rvk);
return rvk;
}
GNUNET_free (parallel_lookup->label);
GNUNET_STATISTICS_update (
- stats, "attribute_lookup_time_total",
- GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time)
- .rel_value_us,
- GNUNET_YES);
+ stats, "attribute_lookup_time_total",
+ GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time)
+ .rel_value_us,
+ GNUNET_YES);
GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
if (rd->record_type == GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR) {
attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
attr_le->claim =
- GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size);
+ GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size);
GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, cth->attrs->list_tail,
attr_le);
}
cth->lookup_request = NULL;
GNUNET_STATISTICS_update (
- stats, "reclaim_authz_lookup_time_total",
- GNUNET_TIME_absolute_get_duration (cth->lookup_start_time).rel_value_us,
- GNUNET_YES);
+ stats, "reclaim_authz_lookup_time_total",
+ GNUNET_TIME_absolute_get_duration (cth->lookup_start_time).rel_value_us,
+ GNUNET_YES);
GNUNET_STATISTICS_update (stats, "reclaim_authz_lookups_count", 1,
GNUNET_YES);
parallel_lookup->label = lbl;
parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
parallel_lookup->lookup_request = GNUNET_GNS_lookup (
- gns, lbl, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR,
- GNUNET_GNS_LO_DEFAULT, &process_parallel_lookup_result,
- parallel_lookup);
+ gns, lbl, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR,
+ GNUNET_GNS_LO_DEFAULT, &process_parallel_lookup_result,
+ parallel_lookup);
GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head,
cth->parallel_lookups_tail, parallel_lookup);
}
if (NULL != cth->parallel_lookups_head) {
cth->kill_task = GNUNET_SCHEDULER_add_delayed (
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3),
- &abort_parallel_lookups, cth);
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3),
+ &abort_parallel_lookups, cth);
return;
}
cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL);
cth->cb = cb;
cth->cb_cls = cb_cls;
label =
- GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof (uint64_t));
+ GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof (uint64_t));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking for AuthZ info under %s\n",
label);
cth->lookup_start_time = GNUNET_TIME_absolute_get ();
cth->lookup_request = GNUNET_GNS_lookup (
- gns, label, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF,
- GNUNET_GNS_LO_DEFAULT, &lookup_authz_cb, cth);
+ gns, label, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF,
+ GNUNET_GNS_LO_DEFAULT, &lookup_authz_cb, cth);
GNUNET_free (label);
return cth;
}
list_len++;
attrs_record =
- GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data));
+ GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data));
i = 0;
for (le = ih->attrs->list_head; NULL != le; le = le->next) {
attrs_record[i].data = &le->claim->id;
attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
attrs_record[i].flags =
- GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
+ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
label =
- GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t));
+ GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t));
// Publish record
ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &ih->identity, label,
list_len, attrs_record,
tih->identity = *identity;
GNUNET_CRYPTO_ecdsa_key_get_public (identity, &tih->ticket.identity);
tih->ticket.rnd =
- GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+ GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
tih->ticket.audience = *audience;
issue_ticket (tih);
}
struct RECLAIM_TICKETS_Iterator *
RECLAIM_TICKETS_iteration_start (
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
- RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+ RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
{
struct RECLAIM_TICKETS_Iterator *iter;
iter->cb = cb;
iter->cb_cls = cb_cls;
iter->ns_it = GNUNET_NAMESTORE_zone_iteration_start (
- nsh, identity, &collect_tickets_error_cb, iter, &collect_tickets_cb, iter,
- &collect_tickets_finished_cb, iter);
+ nsh, identity, &collect_tickets_error_cb, iter, &collect_tickets_cb, iter,
+ &collect_tickets_finished_cb, iter);
return iter;
}
"TICKET_REFRESH_INTERVAL",
&ticket_refresh_interval)) {
GNUNET_log (
- GNUNET_ERROR_TYPE_DEBUG,
- "Configured refresh interval for tickets: %s\n",
- GNUNET_STRINGS_relative_time_to_string (ticket_refresh_interval,
- GNUNET_YES));
+ GNUNET_ERROR_TYPE_DEBUG,
+ "Configured refresh interval for tickets: %s\n",
+ GNUNET_STRINGS_relative_time_to_string (ticket_refresh_interval,
+ GNUNET_YES));
} else {
ticket_refresh_interval = DEFAULT_TICKET_REFRESH_INTERVAL;
}
#include "gnunet_constants.h"
#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
-#include "gnunet_namestore_service.h"
#include "gnunet_protocols.h"
#include "gnunet_reclaim_attribute_lib.h"
#include "gnunet_reclaim_service.h"
/*
- This file is part of GNUnet.
- Copyright (C) 2009-2018 GNUnet e.V.
+ This file is part of GNUnet.
+ Copyright (C) 2009-2018 GNUnet e.V.
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
-*/
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file rest-plugins/json_reclaim.c
}
// interpret single attribute
unpack_state =
- json_unpack (root, "{s:s, s?s, s:s, s:s!}", "name", &name_str, "id",
- &id_str, "type", &type_str, "value", &val_str);
+ json_unpack (root, "{s:s, s?s, s:s, s:s!}", "name", &name_str, "id",
+ &id_str, "type", &type_str, "value", &val_str);
if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_str) ||
(NULL == type_str)) {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
}
type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
if (GNUNET_SYSERR == (GNUNET_RECLAIM_ATTRIBUTE_string_to_value (
- type, val_str, (void **)&data, &data_size))) {
+ type, val_str, (void **)&data, &data_size))) {
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n");
return GNUNET_SYSERR;
}
GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr)
{
struct GNUNET_JSON_Specification ret = {.parser = &parse_attr,
- .cleaner = &clean_attr,
- .cls = NULL,
- .field = NULL,
- .ptr = attr,
- .ptr_size = 0,
- .size_ptr = NULL};
+ .cleaner = &clean_attr,
+ .cls = NULL,
+ .field = NULL,
+ .ptr = attr,
+ .ptr_size = 0,
+ .size_ptr = NULL};
*attr = NULL;
return ret;
}
GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket)
{
struct GNUNET_JSON_Specification ret = {.parser = &parse_ticket,
- .cleaner = &clean_ticket,
- .cls = NULL,
- .field = NULL,
- .ptr = ticket,
- .ptr_size = 0,
- .size_ptr = NULL};
+ .cleaner = &clean_ticket,
+ .cls = NULL,
+ .field = NULL,
+ .ptr = ticket,
+ .ptr_size = 0,
+ .size_ptr = NULL};
*ticket = NULL;
return ret;
}
/*
- This file is part of GNUnet.
- Copyright (C) 2009-2018 GNUnet e.V.
+ This file is part of GNUnet.
+ Copyright (C) 2009-2018 GNUnet e.V.
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
-*/
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file rest-plugins/json_reclaim.h
/*
- This file is part of GNUnet
- Copyright (C) 2010-2015 GNUnet e.V.
+ This file is part of GNUnet
+ Copyright (C) 2010-2015 GNUnet e.V.
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
- */
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file reclaim/oidc_helper.c
#include "platform.h"
#include <inttypes.h>
#include <jansson.h>
-
#include "gnunet_util_lib.h"
-
#include "gnunet_reclaim_attribute_lib.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_signatures.h"
#include "oidc_helper.h"
+
+
static char *
create_jwt_header (void)
{
NULL);
GNUNET_CRYPTO_kdf (iv,
sizeof (
- struct GNUNET_CRYPTO_SymmetricInitializationVector),
+ struct GNUNET_CRYPTO_SymmetricInitializationVector),
ctx_iv,
strlen (ctx_iv),
key_material,
calculate_key_pub (&key, &iv, ecdsa_pub, ecdh_priv);
GNUNET_break (
- GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf));
+ GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf));
}
GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, attrs_ser);
}
code_payload_len = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
- sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) +
- signature_payload_len +
- sizeof (struct GNUNET_CRYPTO_EcdsaSignature);
+ sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) +
+ signature_payload_len +
+ sizeof (struct GNUNET_CRYPTO_EcdsaSignature);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Length of data to encode: %lu\n",
code_payload_len);
GNUNET_CRYPTO_ecdsa_sign (issuer,
purpose,
(struct GNUNET_CRYPTO_EcdsaSignature *)
- buf_ptr))
+ buf_ptr))
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n");
code_payload_len =
GNUNET_STRINGS_base64_decode (code, strlen (code), (void **) &code_payload);
if (code_payload_len < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
- sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) +
- sizeof (struct GNUNET_RECLAIM_Ticket) +
- sizeof (uint32_t) +
- sizeof (struct GNUNET_CRYPTO_EcdsaSignature))
+ sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) +
+ sizeof (struct GNUNET_RECLAIM_Ticket) +
+ sizeof (uint32_t) +
+ sizeof (struct GNUNET_CRYPTO_EcdsaSignature))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Authorization code malformed\n");
GNUNET_free_non_null (code_payload);
/*
- This file is part of GNUnet
- Copyright (C) 2010-2015 GNUnet e.V.
+ This file is part of GNUnet
+ Copyright (C) 2010-2015 GNUnet e.V.
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
- */
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file reclaim/oidc_helper.h
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
* @author Martin Schanzenbach
* OIDC ignored parameter array
*/
static char *OIDC_ignored_parameter_array[] = {"display",
- "prompt",
- "ui_locales",
- "response_mode",
- "id_token_hint",
- "login_hint",
- "acr_values"};
+ "prompt",
+ "ui_locales",
+ "response_mode",
+ "id_token_hint",
+ "login_hint",
+ "acr_values"};
/**
* OIDC Hash map that keeps track of issued cookies
strlen (OIDC_COOKIE_HEADER_KEY),
&cache_key);
if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle
- ->header_param_map,
+ ->header_param_map,
&cache_key))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No cookie found\n");
GNUNET_CONTAINER_multihashmap_contains (OIDC_cookie_jar_map, &cache_key))
{
GNUNET_log (
- GNUNET_ERROR_TYPE_WARNING,
- "Found cookie `%s', but no corresponding expiration entry present...\n",
- token);
+ GNUNET_ERROR_TYPE_WARNING,
+ "Found cookie `%s', but no corresponding expiration entry present...\n",
+ token);
GNUNET_free (cookies);
return;
}
{
if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc
- ->login_identity,
+ ->login_identity,
strlen (
- handle->oidc
- ->login_identity),
+ handle->oidc
+ ->login_identity),
&pubkey))
{
handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE);
char *value;
GNUNET_CRYPTO_hash (key, strlen (key), &hc);
if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle
- ->url_param_map,
+ ->url_param_map,
&hc))
return NULL;
value =
&cache_key);
if (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle
- ->url_param_map,
+ ->url_param_map,
&cache_key))
{
handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_ACCESS_DENIED);
if (GNUNET_OK !=
GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id,
strlen (
- handle->oidc->client_id),
+ handle->oidc->client_id),
&handle->oidc->client_pkey))
{
handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT);
{
current_time = GNUNET_new (struct GNUNET_TIME_Absolute);
*current_time = GNUNET_TIME_relative_to_absolute (
- GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (),
- OIDC_COOKIE_EXPIRATION));
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (),
+ OIDC_COOKIE_EXPIRATION));
last_time =
GNUNET_CONTAINER_multihashmap_get (OIDC_cookie_jar_map, &cache_key);
GNUNET_free_non_null (last_time);
strlen (OIDC_AUTHORIZATION_HEADER_KEY),
&cache_key);
if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle
- ->header_param_map,
+ ->header_param_map,
&cache_key))
{
handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_CLIENT);
ticketbuf = GNUNET_new (struct GNUNET_RECLAIM_Ticket);
*ticketbuf = *ticket;
GNUNET_CONTAINER_multihashmap_put (
- OIDC_access_token_map,
- &hc,
- ticketbuf,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ OIDC_access_token_map,
+ &hc,
+ ticketbuf,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
}
/**
strlen (OIDC_AUTHORIZATION_HEADER_KEY),
&cache_key);
if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle
- ->header_param_map,
+ ->header_param_map,
&cache_key))
{
handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN);
{
struct GNUNET_REST_RequestHandlerError err;
static const struct GNUNET_REST_RequestHandler handlers[] =
- {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_AUTHORIZE, &authorize_endpoint},
- {MHD_HTTP_METHOD_POST,
+ {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_AUTHORIZE, &authorize_endpoint},
+ {MHD_HTTP_METHOD_POST,
GNUNET_REST_API_NS_AUTHORIZE,
&authorize_endpoint}, // url-encoded
- {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_LOGIN, &login_cont},
- {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_TOKEN, &token_endpoint},
- {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint},
- {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint},
- {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_OIDC, &options_cont},
- GNUNET_REST_HANDLER_END};
+ {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_LOGIN, &login_cont},
+ {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_TOKEN, &token_endpoint},
+ {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint},
+ {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint},
+ {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_OIDC, &options_cont},
+ GNUNET_REST_HANDLER_END};
if (GNUNET_NO ==
GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
* @author Martin Schanzenbach
*
*/
#include "platform.h"
-
#include "microhttpd.h"
#include <inttypes.h>
#include <jansson.h>
-
#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_identity_service.h"
-#include "gnunet_namestore_service.h"
#include "gnunet_reclaim_attribute_lib.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_rest_lib.h"
#include "gnunet_rest_plugin.h"
#include "gnunet_signatures.h"
#include "json_reclaim.h"
+
/**
* REST root namespace
*/
*/
struct GNUNET_REST_RequestHandle *rest_handle;
- /**
- * Handle to NAMESTORE
- */
- struct GNUNET_NAMESTORE_Handle *namestore_handle;
-
- /**
- * Iterator for NAMESTORE
- */
- struct GNUNET_NAMESTORE_ZoneIterator *namestore_handle_it;
-
/**
* Attribute claim list
*/
GNUNET_free (handle->url);
if (NULL != handle->emsg)
GNUNET_free (handle->emsg);
- if (NULL != handle->namestore_handle)
- GNUNET_NAMESTORE_disconnect (handle->namestore_handle);
if (NULL != handle->attr_list) {
for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;) {
claim_tmp = claim_entry;
json_array_append (handle->resp_object, json_resource);
tmp = GNUNET_STRINGS_data_to_string_alloc (
- &ticket->identity, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ &ticket->identity, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
value = json_string (tmp);
json_object_set_new (json_resource, "issuer", value);
GNUNET_free (tmp);
tmp = GNUNET_STRINGS_data_to_string_alloc (
- &ticket->audience, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ &ticket->audience, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
value = json_string (tmp);
json_object_set_new (json_resource, "audience", value);
GNUNET_free (tmp);
priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
handle->idp = GNUNET_RECLAIM_connect (cfg);
handle->ticket_it = GNUNET_RECLAIM_ticket_iteration_start (
- handle->idp, priv_key, &collect_error_cb, handle, &ticket_collect, handle,
- &collect_finished_cb, handle);
+ handle->idp, priv_key, &collect_error_cb, handle, &ticket_collect, handle,
+ &collect_finished_cb, handle);
}
json_t *data_json;
json_error_t err;
struct GNUNET_JSON_Specification attrspec[] = {
- GNUNET_RECLAIM_JSON_spec_claim (&attribute), GNUNET_JSON_spec_end ()};
+ GNUNET_RECLAIM_JSON_spec_claim (&attribute), GNUNET_JSON_spec_end ()};
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding an attribute for %s.\n",
handle->url);
*/
if (0 == attribute->id)
attribute->id =
- GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
+ GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
handle->idp = GNUNET_RECLAIM_connect (cfg);
exp = GNUNET_TIME_UNIT_HOURS;
handle->idp_op = GNUNET_RECLAIM_attribute_store (
- handle->idp, identity_priv, attribute, &exp, &finished_cont, handle);
+ handle->idp, identity_priv, attribute, &exp, &finished_cont, handle);
GNUNET_JSON_parse_free (attrspec);
}
priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
handle->idp = GNUNET_RECLAIM_connect (cfg);
handle->attr_it = GNUNET_RECLAIM_get_attributes_start (
- handle->idp, priv_key, &collect_error_cb, handle, &attr_collect, handle,
- &collect_finished_cb, handle);
+ handle->idp, priv_key, &collect_error_cb, handle, &attr_collect, handle,
+ &collect_finished_cb, handle);
}
return;
}
identity_id_str =
- strdup (handle->url + strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) + 1);
+ strdup (handle->url + strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) + 1);
identity = strtok (identity_id_str, "/");
id = strtok (NULL, "/");
if ((NULL == identity) || (NULL == id)) {
GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof (uint64_t));
attr.name = "";
handle->idp_op = GNUNET_RECLAIM_attribute_delete (
- handle->idp, priv_key, &attr, &delete_finished_cb, handle);
+ handle->idp, priv_key, &attr, &delete_finished_cb, handle);
GNUNET_free (identity_id_str);
}
json_t *data_json;
json_error_t err;
struct GNUNET_JSON_Specification tktspec[] = {
- GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()};
+ GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()};
if (0 >= handle->rest_handle->data_size) {
GNUNET_SCHEDULER_add_now (&do_error, handle);
handle->idp = GNUNET_RECLAIM_connect (cfg);
handle->idp_op = GNUNET_RECLAIM_ticket_revoke (
- handle->idp, identity_priv, ticket, &finished_cont, handle);
+ handle->idp, identity_priv, ticket, &finished_cont, handle);
GNUNET_JSON_parse_free (tktspec);
}
json_t *data_json;
json_error_t err;
struct GNUNET_JSON_Specification tktspec[] = {
- GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()};
+ GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()};
if (0 >= handle->rest_handle->data_size) {
GNUNET_SCHEDULER_add_now (&do_error, handle);
handle->resp_object = json_object ();
handle->idp = GNUNET_RECLAIM_connect (cfg);
handle->idp_op = GNUNET_RECLAIM_ticket_consume (
- handle->idp, identity_priv, ticket, &consume_cont, handle);
+ handle->idp, identity_priv, ticket, &consume_cont, handle);
GNUNET_JSON_parse_free (tktspec);
}
{
struct GNUNET_REST_RequestHandlerError err;
static const struct GNUNET_REST_RequestHandler handlers[] = {
- {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
- &list_attribute_cont},
- {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
- &add_attribute_cont},
- {MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
- &delete_attribute_cont},
- {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS,
- &list_tickets_cont},
- {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_REVOKE,
- &revoke_ticket_cont},
- {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_CONSUME,
- &consume_ticket_cont},
- {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont},
- GNUNET_REST_HANDLER_END};
+ {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
+ &list_attribute_cont},
+ {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
+ &add_attribute_cont},
+ {MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
+ &delete_attribute_cont},
+ {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS,
+ &list_tickets_cont},
+ {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_REVOKE,
+ &revoke_ticket_cont},
+ {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_CONSUME,
+ &consume_ticket_cont},
+ {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont},
+ GNUNET_REST_HANDLER_END};
if (GNUNET_NO == GNUNET_REST_handle_request (handle->rest_handle, handlers,
&err, handle)) {
handle->url[strlen (handle->url) - 1] = '\0';
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n");
handle->identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, handle);
- handle->namestore_handle = GNUNET_NAMESTORE_connect (cfg);
handle->timeout_task =
- GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle);
+ GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n");
}
/*
- This file is part of GNUnet.
- Copyright (C) 2016 GNUnet e.V.
+ This file is part of GNUnet.
+ Copyright (C) 2016 GNUnet e.V.
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: AGPL3.0-or-later
-*/
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file reclaim/reclaim_api.c
* @author Martin Schanzenbach
*/
#include "platform.h"
-
#include "gnunet_util_lib.h"
-
#include "gnunet_constants.h"
#include "gnunet_mq_lib.h"
#include "gnunet_protocols.h"
GNUNET_MQ_destroy (handle->mq);
handle->mq = NULL;
handle->reconnect_backoff =
- GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff);
+ GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff);
handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (
- handle->reconnect_backoff, &reconnect_task, handle);
+ handle->reconnect_backoff, &reconnect_task, handle);
}
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
attrs =
- GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&msg[1], attrs_len);
+ GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&msg[1], attrs_len);
if (NULL != op->ar_cb) {
if (NULL == attrs) {
op->ar_cb (op->cls, &msg->identity, NULL);
reconnect (struct GNUNET_RECLAIM_Handle *h)
{
struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_fixed_size (success_response,
- GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE,
- struct SuccessResultMessage, h),
- GNUNET_MQ_hd_var_size (attribute_result,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT,
- struct AttributeResultMessage, h),
- GNUNET_MQ_hd_var_size (ticket_result,
- GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
- struct TicketResultMessage, h),
- GNUNET_MQ_hd_var_size (consume_ticket_result,
- GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT,
- struct ConsumeTicketResultMessage, h),
- GNUNET_MQ_hd_fixed_size (revoke_ticket_result,
- GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT,
- struct RevokeTicketResultMessage, h),
- GNUNET_MQ_handler_end ()};
+ GNUNET_MQ_hd_fixed_size (success_response,
+ GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE,
+ struct SuccessResultMessage, h),
+ GNUNET_MQ_hd_var_size (attribute_result,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT,
+ struct AttributeResultMessage, h),
+ GNUNET_MQ_hd_var_size (ticket_result,
+ GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
+ struct TicketResultMessage, h),
+ GNUNET_MQ_hd_var_size (consume_ticket_result,
+ GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT,
+ struct ConsumeTicketResultMessage, h),
+ GNUNET_MQ_hd_fixed_size (revoke_ticket_result,
+ GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT,
+ struct RevokeTicketResultMessage, h),
+ GNUNET_MQ_handler_end ()};
struct GNUNET_RECLAIM_Operation *op;
GNUNET_assert (NULL == h->mq);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to reclaim service.\n");
h->mq =
- GNUNET_CLIENT_connect (h->cfg, "reclaim", handlers, &mq_error_handler, h);
+ GNUNET_CLIENT_connect (h->cfg, "reclaim", handlers, &mq_error_handler, h);
if (NULL == h->mq)
return;
for (op = h->op_head; NULL != op; op = op->next)
*/
struct GNUNET_RECLAIM_Operation *
GNUNET_RECLAIM_attribute_store (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
- const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
- const struct GNUNET_TIME_Relative *exp_interval,
- GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
+ const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+ const struct GNUNET_TIME_Relative *exp_interval,
+ GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
{
struct GNUNET_RECLAIM_Operation *op;
struct AttributeStoreMessage *sam;
*/
struct GNUNET_RECLAIM_Operation *
GNUNET_RECLAIM_attribute_delete (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
- const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
- GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
+ const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
+ GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
{
struct GNUNET_RECLAIM_Operation *op;
struct AttributeDeleteMessage *dam;
*/
struct GNUNET_RECLAIM_AttributeIterator *
GNUNET_RECLAIM_get_attributes_start (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
- GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
- GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
- GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+ GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
+ GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
+ GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
{
struct GNUNET_RECLAIM_AttributeIterator *it;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_MQ_Envelope *env;
env =
- GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT);
+ GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT);
msg->id = htonl (it->r_id);
GNUNET_MQ_send (h->mq, env);
}
*/
struct GNUNET_RECLAIM_Operation *
GNUNET_RECLAIM_ticket_issue (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
- const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
- GNUNET_RECLAIM_TicketCallback cb, void *cb_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
+ const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
+ GNUNET_RECLAIM_TicketCallback cb, void *cb_cls)
{
struct GNUNET_RECLAIM_Operation *op;
struct IssueTicketMessage *tim;
*/
struct GNUNET_RECLAIM_Operation *
GNUNET_RECLAIM_ticket_consume (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
- const struct GNUNET_RECLAIM_Ticket *ticket,
- GNUNET_RECLAIM_AttributeResult cb, void *cb_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+ const struct GNUNET_RECLAIM_Ticket *ticket,
+ GNUNET_RECLAIM_AttributeResult cb, void *cb_cls)
{
struct GNUNET_RECLAIM_Operation *op;
struct ConsumeTicketMessage *ctm;
op->r_id = h->r_id_gen++;
GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
op->env =
- GNUNET_MQ_msg_extra (ctm, sizeof (const struct GNUNET_RECLAIM_Ticket),
- GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
+ GNUNET_MQ_msg_extra (ctm, sizeof (const struct GNUNET_RECLAIM_Ticket),
+ GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
ctm->identity = *identity;
ctm->id = htonl (op->r_id);
*/
struct GNUNET_RECLAIM_TicketIterator *
GNUNET_RECLAIM_ticket_iteration_start (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
- GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
- GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
- GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+ GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
+ GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
+ GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
{
struct GNUNET_RECLAIM_TicketIterator *it;
struct GNUNET_MQ_Envelope *env;
if (NULL != h->mq) {
env =
- GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP);
+ GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP);
msg->id = htonl (it->r_id);
GNUNET_MQ_send (h->mq, env);
}
*/
struct GNUNET_RECLAIM_Operation *
GNUNET_RECLAIM_ticket_revoke (
- struct GNUNET_RECLAIM_Handle *h,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
- const struct GNUNET_RECLAIM_Ticket *ticket,
- GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
+ struct GNUNET_RECLAIM_Handle *h,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
+ const struct GNUNET_RECLAIM_Ticket *ticket,
+ GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
{
struct GNUNET_RECLAIM_Operation *op;
struct RevokeTicketMessage *msg;