LCOV - code coverage report
Current view: top level - src - gpgconf.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 28 32 87.5 %
Date: 2017-03-02 17:11:10 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /* gpgconf.c - GnuPG Made Easy.
       2             :    Copyright (C) 2007 g10 Code GmbH
       3             : 
       4             :    This file is part of GPGME.
       5             : 
       6             :    GPGME is free software; you can redistribute it and/or modify it
       7             :    under the terms of the GNU Lesser General Public License as
       8             :    published by the Free Software Foundation; either version 2.1 of
       9             :    the License, or (at your option) any later version.
      10             : 
      11             :    GPGME is distributed in the hope that it will be useful, but
      12             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :    Lesser General Public License for more details.
      15             : 
      16             :    You should have received a copy of the GNU Lesser General Public
      17             :    License along with this program; if not, write to the Free Software
      18             :    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
      19             :    02111-1307, USA.  */
      20             : 
      21             : #if HAVE_CONFIG_H
      22             : #include <config.h>
      23             : #endif
      24             : 
      25             : #include "gpgme.h"
      26             : 
      27             : #include "ops.h"
      28             : #include "engine.h"
      29             : #include "debug.h"
      30             : 
      31             : #include "engine-backend.h"
      32             : 
      33             : 
      34             : /* Allocate a new gpgme_conf_arg_t.  */
      35             : gpgme_error_t
      36        1078 : gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
      37             :                     gpgme_conf_type_t type, const void *value)
      38             : {
      39        1078 :   return _gpgme_conf_arg_new (arg_p, type, value);
      40             : }
      41             : 
      42             : 
      43             : /* This also releases all chained argument structures!  */
      44             : void
      45       12525 : gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
      46             : {
      47       12525 :   _gpgme_conf_arg_release (arg, type);
      48       12525 : }
      49             : 
      50             : 
      51             : /* Register a change for the value of OPT to ARG.  */
      52             : gpgme_error_t
      53          40 : gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
      54             : {
      55          40 :   return _gpgme_conf_opt_change (opt, reset, arg);
      56             : }
      57             : 
      58             : 
      59             : 
      60             : /* Public function to release a gpgme_conf_comp list.  */
      61             : void
      62         141 : gpgme_conf_release (gpgme_conf_comp_t conf)
      63             : {
      64         141 :   _gpgme_conf_release (conf);
      65         141 : }
      66             : 
      67             : 
      68             : /* Public function to load a configuration list.  No
      69             :    asynchronous interface for now.  */
      70             : gpgme_error_t
      71          42 : gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
      72             : {
      73             :   gpgme_error_t err;
      74             :   gpgme_protocol_t proto;
      75             : 
      76          42 :   if (!ctx)
      77           0 :     return gpg_error (GPG_ERR_INV_VALUE);
      78             : 
      79          42 :   proto = ctx->protocol;
      80          42 :   ctx->protocol = GPGME_PROTOCOL_GPGCONF;
      81          42 :   err = _gpgme_op_reset (ctx, 1);
      82          42 :   if (err)
      83           0 :     return err;
      84             : 
      85          42 :   err = _gpgme_engine_op_conf_load (ctx->engine, conf_p);
      86          42 :   ctx->protocol = proto;
      87          42 :   return err;
      88             : }
      89             : 
      90             : 
      91             : /* This function does not follow chained components!  */
      92             : gpgme_error_t
      93         140 : gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp)
      94             : {
      95             :   gpgme_error_t err;
      96             :   gpgme_protocol_t proto;
      97             : 
      98         140 :   if (!ctx)
      99           0 :     return gpg_error (GPG_ERR_INV_VALUE);
     100             : 
     101         140 :   proto = ctx->protocol;
     102         140 :   ctx->protocol = GPGME_PROTOCOL_GPGCONF;
     103         140 :   err = _gpgme_op_reset (ctx, 1);
     104         140 :   if (err)
     105           0 :     return err;
     106             : 
     107         140 :   err = _gpgme_engine_op_conf_save (ctx->engine, comp);
     108         140 :   ctx->protocol = proto;
     109         140 :   return err;
     110             : }

Generated by: LCOV version 1.13