X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fgnunet_configuration_lib.h;h=a0e73f474667aa1755c43ccc45e45e350b20eeda;hb=6e626937fd5133188d2bd06f280a1b889219eef2;hp=6857011abb9c883bd977c25f5f4b462c87a874ae;hpb=cbd60b5e56aac2d6711e299086383f83357794f8;p=oweals%2Fgnunet.git diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 6857011ab..a0e73f474 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -1,9 +1,9 @@ /* This file is part of GNUnet. - Copyright (C) 2006, 2008, 2009 GNUnet e.V. + Copyright (C) 2006, 2008, 2009, 2018 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published + 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. @@ -11,6 +11,11 @@ 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 */ /** @@ -187,6 +192,35 @@ int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); +/** + * Signature of a function to be run with a configuration. + * + * @param cls closure + * @param cfg the configuration + * @return status code + */ +typedef int +(*GNUNET_CONFIGURATION_Callback)(void *cls, + const struct GNUNET_CONFIGURATION_Handle *cfg); + + +/** + * Parse a configuration file @a filename and run the function + * @a cb with the resulting configuration object. Then free the + * configuration object and return the status value from @a cb. + * + * @param filename configuration to parse, NULL for "default" + * @param cb function to run + * @param cb_cls closure for @a cb + * @return #GNUNET_SYSERR if parsing the configuration failed, + * otherwise return value from @a cb. + */ +int +GNUNET_CONFIGURATION_parse_and_run (const char *filename, + GNUNET_CONFIGURATION_Callback cb, + void *cb_cls); + + /** * Function to iterate over options. *