diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_exchange_service.h | 82 | ||||
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 3 | ||||
-rw-r--r-- | src/include/taler_extensions.h | 68 |
3 files changed, 130 insertions, 23 deletions
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 60a471ab..b0d5e2af 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -1,18 +1,18 @@ /* - This file is part of TALER - Copyright (C) 2014-2021 Taler Systems SA + This file is part of TALER + Copyright (C) 2014-2021 Taler Systems SA - TALER 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, or (at your option) any later version. + TALER 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, or (at your option) any later version. - TALER 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. + TALER 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 - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -*/ + You should have received a copy of the GNU Affero General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ /** * @file include/taler_exchange_service.h * @brief C interface of libtalerexchange, a C library to use exchange's HTTP API @@ -1527,7 +1527,7 @@ typedef void * * @param exchange the exchange handle; the exchange must be ready to operate * @param refresh_data the refresh data as returned from - #TALER_EXCHANGE_refresh_prepare()) + #TALER_EXCHANGE_refresh_prepare()) * @param melt_cb the callback to call with the result * @param melt_cb_cls closure for @a melt_cb * @return a handle for this request; NULL if the argument was invalid. @@ -1593,7 +1593,7 @@ struct TALER_EXCHANGE_RefreshesRevealHandle; * * @param exchange the exchange handle; the exchange must be ready to operate * @param refresh_data the refresh data as returned from - #TALER_EXCHANGE_refresh_prepare()) + #TALER_EXCHANGE_refresh_prepare()) * @param noreveal_index response from the exchange to the * #TALER_EXCHANGE_melt() invocation * @param reveal_cb the callback to call with the final result of the @@ -2615,6 +2615,62 @@ void TALER_EXCHANGE_post_management_keys_cancel ( struct TALER_EXCHANGE_ManagementPostKeysHandle *ph); + +/** + * Information needed for a POST /management/extensions operation. + */ +struct TALER_EXCHANGE_ManagementPostExtensionsData +{ + struct TALER_Extension *extensions; + struct TALER_MasterSignatureP *extension_sigs; + uint32_t num_extensions; +}; + +/** + * Function called with information about the post extensions operation result. + * + * @param cls closure + * @param hr HTTP response data + */ +typedef void +(*TALER_EXCHANGE_ManagementPostExtensionsCallback) ( + void *cls, + const struct TALER_EXCHANGE_HttpResponse *hr); + +/** + * @brief Handle for a POST /management/extensions request. + */ +struct TALER_EXCHANGE_ManagementPostExtensionsHandle; + + +/** + * FIXME-oec: Provide correct explanation of this function. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param pkd signature data to POST + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementPostExtensionsHandle * +TALER_EXCHANGE_management_post_extensions ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_EXCHANGE_ManagementPostExtensionsData *pkd, + TALER_EXCHANGE_ManagementPostExtensionsCallback cb, + void *cb_cls); + +/** + * Cancel #TALER_EXCHANGE_post_management_extensions() operation. + * + * @param ph handle of the operation to cancel + */ +void +TALER_EXCHANGE_post_management_extensions_cancel ( + struct TALER_EXCHANGE_ManagementPostExtensionsHandle *ph); + + /** * Function called with information about the post revocation operation result. * diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index eacc13a9..6796fbac 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -4038,6 +4038,9 @@ struct TALER_EXCHANGEDB_Plugin enum GNUNET_DB_QueryStatus (*delete_revolving_shards)(void *cls); + /** + * TODO-oec: add function for adding extension config + */ }; diff --git a/src/include/taler_extensions.h b/src/include/taler_extensions.h index b02edf68..8f3dd69e 100644 --- a/src/include/taler_extensions.h +++ b/src/include/taler_extensions.h @@ -26,21 +26,70 @@ #define TALER_EXTENSION_SECTION_PREFIX "exchange-extension-" -enum TALER_EXTENSION_ReturnValue +enum TALER_Extension_ReturnValue { - TALER_EXTENSION_OK = 0, - TALER_EXTENSION_ERROR_PARSING = 1, - TALER_EXTENSION_ERROR_INVALID = 2, - TALER_EXTENSION_ERROR_SYS = 3 + TALER_Extension_OK = 0, + TALER_Extension_ERROR_PARSING = 1, + TALER_Extension_ERROR_INVALID = 2, + TALER_Extension_ERROR_SYS = 3 +}; + +enum TALER_Extension_Type +{ + TALER_Extension_Peer2Peer = 0, + TALER_Extension_AgeRestriction = 1, + TALER_Extension_Max = 2 +}; + +struct TALER_Extension +{ + enum TALER_Extension_Type type; + char *name; + bool critical; + void *config; + size_t config_size; +}; + +struct TALER_Peer2Peer_Config +{ + // FIXME +}; + +/** + * TEH_extensions is the global manifest with the list supported extensions, + * sorted by TALER_Extension_Type. + * + * TODO: Mutex? + * + **/ +struct TALER_Extension TEH_extensions[TALER_Extension_Max] = { + [TALER_Extension_Peer2Peer] = { + .type = TALER_Extension_Peer2Peer, + .name = "peer2peer", + .critical = false, + .config_size = sizeof(struct TALER_Peer2Peer_Config), + }, + [TALER_Extension_AgeRestriction] = { + .type = TALER_Extension_AgeRestriction, + .name = "age_restriction", + .critical = false, + .config_size = sizeof(struct TALER_AgeMask), + }, }; /* - * TALER Age Restriction Extensions + * TALER Peer2Peer Extension + * FIXME + */ + + +/* + * TALER Age Restriction Extension */ #define TALER_EXTENSION_SECTION_AGE_RESTRICTION (TALER_EXTENSION_SECTION_PREFIX \ - "agerestriction") + "age_restriction") /** * The default age mask represents the age groups @@ -55,7 +104,7 @@ enum TALER_EXTENSION_ReturnValue * @param[out] mask Mask representation for age restriction. * @return Error, if age groups were invalid, OK otherwise. */ -enum TALER_EXTENSION_ReturnValue +enum TALER_Extension_ReturnValue TALER_parse_age_group_string (char *groups, struct TALER_AgeMask *mask); @@ -66,8 +115,7 @@ TALER_parse_age_group_string (char *groups, * @return Error if extension for age restriction was set but age groups were * invalid, OK otherwise. */ -enum TALER_EXTENSION_ReturnValue +enum TALER_Extension_ReturnValue TALER_get_age_mask (const struct GNUNET_CONFIGURATION_Handle *cfg, struct TALER_AgeMask *mask); - #endif |