LCOV - code coverage report
Current view: top level - auditordb - auditordb_plugin.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 14 18 77.8 %
Date: 2022-08-25 06:15:09 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2015, 2016 Taler Systems SA
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify it under the
       6             :   terms of the GNU General Public License as published by the Free Software
       7             :   Foundation; either version 3, or (at your option) any later version.
       8             : 
       9             :   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
      10             :   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
      11             :   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
      12             : 
      13             :   You should have received a copy of the GNU General Public License along with
      14             :   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
      15             : */
      16             : /**
      17             :  * @file auditordb/auditordb_plugin.c
      18             :  * @brief Logic to load database plugin
      19             :  * @author Christian Grothoff
      20             :  * @author Sree Harsha Totakura <sreeharsha@totakura.in>
      21             :  */
      22             : #include "platform.h"
      23             : #include "taler_auditordb_plugin.h"
      24             : #include <ltdl.h>
      25             : 
      26             : 
      27             : struct TALER_AUDITORDB_Plugin *
      28           1 : TALER_AUDITORDB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
      29             : {
      30             :   char *plugin_name;
      31             :   char *lib_name;
      32             :   struct TALER_AUDITORDB_Plugin *plugin;
      33             : 
      34           1 :   if (GNUNET_SYSERR ==
      35           1 :       GNUNET_CONFIGURATION_get_value_string (cfg,
      36             :                                              "auditor",
      37             :                                              "db",
      38             :                                              &plugin_name))
      39             :   {
      40           0 :     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
      41             :                                "auditor",
      42             :                                "db");
      43           0 :     return NULL;
      44             :   }
      45           1 :   (void) GNUNET_asprintf (&lib_name,
      46             :                           "libtaler_plugin_auditordb_%s",
      47             :                           plugin_name);
      48           1 :   GNUNET_free (plugin_name);
      49           1 :   plugin = GNUNET_PLUGIN_load (lib_name,
      50             :                                (void *) cfg);
      51           1 :   if (NULL != plugin)
      52           1 :     plugin->library_name = lib_name;
      53             :   else
      54           0 :     GNUNET_free (lib_name);
      55           1 :   return plugin;
      56             : }
      57             : 
      58             : 
      59             : void
      60           1 : TALER_AUDITORDB_plugin_unload (struct TALER_AUDITORDB_Plugin *plugin)
      61             : {
      62             :   char *lib_name;
      63             : 
      64           1 :   if (NULL == plugin)
      65           0 :     return;
      66           1 :   lib_name = plugin->library_name;
      67           1 :   GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name,
      68             :                                                plugin));
      69           1 :   GNUNET_free (lib_name);
      70             : }
      71             : 
      72             : 
      73             : /* end of auditordb_plugin.c */

Generated by: LCOV version 1.14