From 494af3383d2a5d3402e1f03209cb574af86079a8 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Sun, 14 Apr 2019 15:23:44 +0200 Subject: RECLAIM: bugfixes; add delete attribute API --- src/include/gnunet_protocols.h | 90 ++++++++++++------------- src/include/gnunet_reclaim_plugin.h | 123 ----------------------------------- src/include/gnunet_reclaim_service.h | 19 ++++++ 3 files changed, 62 insertions(+), 170 deletions(-) delete mode 100644 src/include/gnunet_reclaim_plugin.h (limited to 'src/include') diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index f461249eb..e402460c0 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -43,9 +43,8 @@ #define GNUNET_PROTOCOLS_H #ifdef __cplusplus -extern "C" -{ -#if 0 /* keep Emacsens' auto-indent happy */ +extern "C" { +#if 0 /* keep Emacsens' auto-indent happy */ } #endif #endif @@ -252,7 +251,8 @@ extern "C" #define GNUNET_MESSAGE_TYPE_DV_DISCONNECT 50 /** - * P2P DV message telling plugin that a message transmission failed (negative ACK) + * P2P DV message telling plugin that a message transmission failed (negative + * ACK) */ #define GNUNET_MESSAGE_TYPE_DV_SEND_NACK 51 @@ -622,37 +622,37 @@ extern "C" /** * Receive information about transiting GETs */ -#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET 149 +#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET 149 /** * Receive information about transiting GET responses */ -#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP 150 +#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP 150 /** * Receive information about transiting PUTs */ -#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT 151 +#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT 151 /** * Receive information about transiting PUT responses (TODO) */ -#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT_RESP 152 +#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT_RESP 152 /** * Request information about transiting messages */ -#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_START 153 +#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_START 153 /** * Stop information about transiting messages */ -#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP 154 +#define GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP 154 /** * Certain results are already known to the client, filter those. */ -#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN 156 +#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN 156 /** * Further X-VINE DHT messages continued from 880 @@ -829,7 +829,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_DNS_HELPER 214 - /******************************************************************************* * CHAT message types START ******************************************************************************/ @@ -1490,7 +1489,8 @@ extern "C" #define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION 480 /** - * Message to signal the result of #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request + * Message to signal the result of #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS + * request */ #define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT 481 @@ -1600,8 +1600,8 @@ extern "C" #define GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE 524 /** - * Sent by service to client in order to signal a completed consensus conclusion. - * Last message sent in a consensus session. + * Sent by service to client in order to signal a completed consensus + * conclusion. Last message sent in a consensus session. */ #define GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE 525 @@ -1646,7 +1646,8 @@ extern "C" #define GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_HELLO 546 /** - * Report that the peer is synced with the partner after successfuly decoding the invertible bloom filter. + * Report that the peer is synced with the partner after successfuly decoding + * the invertible bloom filter. */ #define GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_SYNCED 547 @@ -1871,7 +1872,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_ACK 601 - /** * Advertise regex capability. */ @@ -2023,9 +2023,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_BOB_CRYPTODATA 652 - - - /******************************************************************************* * PSYCSTORE message types ******************************************************************************/ @@ -2122,8 +2119,10 @@ extern "C" /** S<--C: PSYC message which contains one or more message parts. */ #define GNUNET_MESSAGE_TYPE_PSYC_MESSAGE 691 -/** M<->S<->C: PSYC message which contains a header and one or more message parts. */ -#define GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_HEADER 692 // FIXME: start using this where appropriate +/** M<->S<->C: PSYC message which contains a header and one or more message + * parts. */ +#define GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_HEADER \ + 692 // FIXME: start using this where appropriate /** Message part: method */ #define GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD 693 @@ -2333,7 +2332,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_RESPONSE_END 762 - /******************************************************************************* * SECRETSHARING message types ******************************************************************************/ @@ -2544,7 +2542,7 @@ extern "C" /** * Acknowledge receiving ACT MALICIOUS request */ -#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_ACT_MALICIOUS_OK 894 +#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_ACT_MALICIOUS_OK 894 #endif @@ -2606,23 +2604,22 @@ extern "C" /** * RPS check liveliness message to check liveliness of other peer */ -#define GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE 950 +#define GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE 950 /** * RPS PUSH message to push own ID to another peer */ -#define GNUNET_MESSAGE_TYPE_RPS_PP_PUSH 951 +#define GNUNET_MESSAGE_TYPE_RPS_PP_PUSH 951 /** * RPS PULL REQUEST message to request the local view of another peer */ -#define GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST 952 +#define GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST 952 /** * RPS PULL REPLY message which contains the view of the other peer */ -#define GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY 953 - +#define GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY 953 /* Client-Service Messages */ @@ -2631,25 +2628,25 @@ extern "C" /** * RPS CS SEED Message for the Client to seed peers into rps */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_SEED 954 +#define GNUNET_MESSAGE_TYPE_RPS_CS_SEED 954 #if ENABLE_MALICIOUS /** * Turn RPS service malicious */ -#define GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS 955 +#define GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS 955 #endif /* ENABLE_MALICIOUS */ /** * RPS client-service message to start a sub sampler */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_SUB_START 956 +#define GNUNET_MESSAGE_TYPE_RPS_CS_SUB_START 956 /** * RPS client-service message to stop a sub sampler */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_SUB_STOP 957 +#define GNUNET_MESSAGE_TYPE_RPS_CS_SUB_STOP 957 /* Debugging API continues at 1130 */ @@ -2662,7 +2659,7 @@ extern "C" */ #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE 961 -#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE 962 +#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE 962 #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START 963 @@ -2690,11 +2687,13 @@ extern "C" #define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT 975 +#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 + /************************************************** * * CREDENTIAL MESSAGE TYPES */ -#define GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY 981 +#define GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY 981 #define GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT 982 @@ -2776,7 +2775,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH 1009 - /********************************** Channel *********************************/ /** @@ -2964,7 +2962,8 @@ extern "C" #define GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT 1068 -/* 1080-1109 reserved for TMCG (Heiko Stamer, see gnunet-developers, January 2017) */ +/* 1080-1109 reserved for TMCG (Heiko Stamer, see gnunet-developers, January + * 2017) */ /******************************************************************************/ @@ -2987,7 +2986,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_OUTCOME 1112 - /******************************************************************************/ /********************************* RPS DEBUG ********************************/ /******************************************************************************/ @@ -3000,12 +2998,12 @@ extern "C" /** * @brief Send update of the view */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_REPLY 1131 +#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_REPLY 1131 /** * @brief Cancel getting updates of the view */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_CANCEL 1132 +#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_VIEW_CANCEL 1132 /** @@ -3016,12 +3014,12 @@ extern "C" /** * @brief Send peer of biased stream */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_REPLY 1134 +#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_REPLY 1134 /** * @brief Cancel getting biased strem */ -#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_CANCEL 1135 +#define GNUNET_MESSAGE_TYPE_RPS_CS_DEBUG_STREAM_CANCEL 1135 /******************************************************* @@ -3190,8 +3188,8 @@ extern "C" #define GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL 1301 /** - * Type of the 'struct RequestHelloValidationMessage' send by clients to TRANSPORT - * to trigger validation of addresses. + * Type of the 'struct RequestHelloValidationMessage' send by clients to + * TRANSPORT to trigger validation of addresses. */ #define GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION 1302 @@ -3207,7 +3205,6 @@ extern "C" #define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE 1304 - /* ************** NEW (NG) ATS Messages ************* */ /* NOTE: it is not clear ATS will survive in TNG */ @@ -3286,14 +3283,13 @@ extern "C" */ - /** * Type used to match 'all' message types. */ #define GNUNET_MESSAGE_TYPE_ALL 65535 -#if 0 /* keep Emacsens' auto-indent happy */ +#if 0 /* keep Emacsens' auto-indent happy */ { #endif #ifdef __cplusplus diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h deleted file mode 100644 index 72a4bc218..000000000 --- a/src/include/gnunet_reclaim_plugin.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - This file is part of GNUnet - Copyright (C) 2012, 2013 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 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 . - - SPDX-License-Identifier: AGPL3.0-or-later -*/ - -/** - * @author Martin Schanzenbach - * - * @file - * Plugin API for the idp database backend - * - * @defgroup reclaim-plugin IdP service plugin API - * Plugin API for the idp database backend - * @{ - */ -#ifndef GNUNET_RECLAIM_PLUGIN_H -#define GNUNET_RECLAIM_PLUGIN_H - -#include "gnunet_util_lib.h" -#include "gnunet_reclaim_service.h" - -#ifdef __cplusplus -extern "C" -{ -#if 0 /* keep Emacsens' auto-indent happy */ -} -#endif -#endif - - -/** - * Function called by for each matching ticket. - * - * @param cls closure - * @param ticket the ticket - */ -typedef void (*GNUNET_RECLAIM_TicketIterator) (void *cls, - const struct GNUNET_RECLAIM_Ticket *ticket, - const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); - - -/** - * @brief struct returned by the initialization function of the plugin - */ -struct GNUNET_RECLAIM_PluginFunctions -{ - - /** - * Closure to pass to all plugin functions. - */ - void *cls; - - /** - * Store a ticket in the database. - * - * @param cls closure (internal context for the plugin) - * @param ticket the ticket to store - * @return #GNUNET_OK on success, else #GNUNET_SYSERR - */ - int (*store_ticket) (void *cls, - const struct GNUNET_RECLAIM_Ticket *ticket, - const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); - - /** - * Delete a ticket from the database. - * - * @param cls closure (internal context for the plugin) - * @param ticket the ticket to store - * @return #GNUNET_OK on success, else #GNUNET_SYSERR - */ - int (*delete_ticket) (void *cls, - const struct GNUNET_RECLAIM_Ticket *ticket); - - - - /** - * Iterate over all tickets - * - * @param cls closure (internal context for the plugin) - * @param identity the identity - * @param audience GNUNET_YES if the identity is the audience of the ticket - * else it is considered the issuer - * @param iter function to call with the result - * @param iter_cls closure for @a iter - * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error - */ - int (*iterate_tickets) (void *cls, - const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, - int audience, - uint64_t offset, - GNUNET_RECLAIM_TicketIterator iter, void *iter_cls); - - int (*get_ticket_attributes) (void* cls, - const struct GNUNET_RECLAIM_Ticket *ticket, - GNUNET_RECLAIM_TicketIterator iter, - void *iter_cls); -}; - -#if 0 /* keep Emacsens' auto-indent happy */ -{ -#endif -#ifdef __cplusplus -} -#endif - -#endif - -/** @} */ /* end of group */ diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index d179485bb..fc3d0f920 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h @@ -150,6 +150,25 @@ GNUNET_RECLAIM_attribute_store ( GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); +/** + * Delete an attribute. Tickets used to share this attribute are updated + * accordingly. + * + * @param h handle to the re:claimID service + * @param pkey Private key of the identity to add an attribute to + * @param attr The attribute + * @param cont Continuation to call when done + * @param cont_cls Closure for @a cont + * @return handle Used to to abort the request + */ +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); + + /** * List all attributes for a local identity. * This MUST lock the `struct GNUNET_RECLAIM_Handle` -- cgit v1.2.3