~noskcaj/ubuntu/trusty/gpgme1.0/1.4.3

« back to all changes in this revision

Viewing changes to gpgme/gpgconf.c

  • Committer: Bazaar Package Importer
  • Author(s): Jose Carlos Garcia Sogo
  • Date: 2008-03-08 14:06:34 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080308140634-dom8okim5mdkz22o
Tags: 1.1.6-2
* Bump shlibs info, as this version added some new symbols (Closes: #469534)
* Urgency set to medium, as this package has yet transitioned to lenny.
* debian/control: add Vcs-Browser info 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
30
#ifdef ENABLE_GPGCONF
 
31
/* engine-gpgconf.c.  */
 
32
gpgme_error_t _gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
 
33
                                  gpgme_conf_type_t type, void *value);
 
34
void _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type);
 
35
gpgme_error_t _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset,
 
36
                                      gpgme_conf_arg_t arg);
 
37
void _gpgme_conf_release (gpgme_conf_comp_t conf);
 
38
gpgme_error_t _gpgme_conf_load (void *engine, gpgme_conf_comp_t *conf_p);
 
39
gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
 
40
 
 
41
#endif
 
42
 
 
43
 
 
44
/* Allocate a new gpgme_conf_arg_t.  */
 
45
gpgme_error_t
 
46
gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
 
47
                    gpgme_conf_type_t type, void *value)
 
48
{
 
49
#ifdef ENABLE_GPGCONF
 
50
  return _gpgme_conf_arg_new (arg_p, type, value);
 
51
#else
 
52
  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
 
53
#endif
 
54
}
 
55
 
 
56
 
 
57
/* This also releases all chained argument structures!  */
 
58
void
 
59
gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
 
60
{
 
61
#ifdef ENABLE_GPGCONF
 
62
  return _gpgme_conf_arg_release (arg, type);
 
63
#endif
 
64
}
 
65
 
 
66
 
 
67
/* Register a change for the value of OPT to ARG.  */
 
68
gpgme_error_t
 
69
gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
 
70
{
 
71
#ifdef ENABLE_GPGCONF
 
72
  return _gpgme_conf_opt_change (opt, reset, arg);
 
73
#else
 
74
  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
 
75
#endif
 
76
}
 
77
 
 
78
 
 
79
 
 
80
/* Public function to release a gpgme_conf_comp list.  */
 
81
void
 
82
gpgme_conf_release (gpgme_conf_comp_t conf)
 
83
{
 
84
#ifdef ENABLE_GPGCONF
 
85
  _gpgme_conf_release (conf);
 
86
#endif
 
87
}
 
88
 
 
89
 
 
90
/* Public function to release load a configuration list.  No
 
91
   asynchronous interface for now.  */
 
92
gpgme_error_t
 
93
gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
 
94
{
 
95
#ifdef ENABLE_GPGCONF
 
96
  gpgme_error_t err;
 
97
  gpgme_protocol_t proto = ctx->protocol;
 
98
 
 
99
  ctx->protocol = GPGME_PROTOCOL_GPGCONF;
 
100
  err = _gpgme_op_reset (ctx, 1);
 
101
  if (err)
 
102
    return err;
 
103
 
 
104
  err = _gpgme_engine_op_conf_load (ctx->engine, conf_p);
 
105
  ctx->protocol = proto;
 
106
  return err;
 
107
#else
 
108
  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
 
109
#endif
 
110
}
 
111
 
 
112
 
 
113
/* This function does not follow chained components!  */
 
114
gpgme_error_t
 
115
gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp)
 
116
{
 
117
#ifdef ENABLE_GPGCONF
 
118
  gpgme_error_t err;
 
119
  gpgme_protocol_t proto = ctx->protocol;
 
120
 
 
121
  ctx->protocol = GPGME_PROTOCOL_GPGCONF;
 
122
  err = _gpgme_op_reset (ctx, 1);
 
123
  if (err)
 
124
    return err;
 
125
 
 
126
  err = _gpgme_engine_op_conf_save (ctx->engine, comp);
 
127
  ctx->protocol = proto;
 
128
  return err;
 
129
#else
 
130
  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
 
131
#endif
 
132
}
 
133
 
 
134