From cc7d7707ab2bd43bc9e95c0eeec9ce95cdc0c523 Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Sat, 8 Jan 2022 14:40:20 +0100 Subject: [age restriction] progress 10/n More work towards support for extensions: - Prepared statements and DB-plugin-functions for setting and retrieving configurations from the database added. - primitive "registry" of extensions for age restrictions and peer2peer (stub) - TALER_Extensions now with FP for parsing, setting and converting a configuration. - /management/extensions handler now verifies signature of the (opaque) json object for all extensions. - /management/extensions handler calls the FP in the corrensponding TALER_Extension for parsing and setting the configuration of a particular extension More work towards age restriction: - TALER_Extensions interfaces for config-parser, -setter and converter implemented for age restriction - DB event handler now retrieves config from database, parses it and sets it (the age mask) in the global extension. - load_age_mask now loads age mask from the global extension (and not from the config file) - add age_restricted_denoms to /keys response --- src/util/extensions.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/util/extensions.c (limited to 'src/util/extensions.c') diff --git a/src/util/extensions.c b/src/util/extensions.c new file mode 100644 index 00000000..87dd16b4 --- /dev/null +++ b/src/util/extensions.c @@ -0,0 +1,49 @@ +/* + 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 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + */ +/** + * @file extensions.c + * @brief Utility functions for extensions + * @author Özgür Kesim + */ +#include "platform.h" +#include "taler_util.h" +#include "taler_extensions.h" +#include "stdint.h" + +enum GNUNET_GenericReturnValue +TALER_extension_get_by_name (const char *name, + const struct TALER_Extension **extensions, + const struct TALER_Extension **ext) +{ + + const struct TALER_Extension *it = *extensions; + + for (; NULL != it; it++) + { + if (0 == strncmp (name, + it->name, + strlen (it->name))) + { + *ext = it; + return GNUNET_OK; + } + } + + return GNUNET_NO; +} + + +/* end of extensions.c */ -- cgit v1.2.3