1 /* g13.h - Global definitions for G13.
2 * Copyright (C) 2009 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #ifdef GPG_ERR_SOURCE_DEFAULT
24 #error GPG_ERR_SOURCE_DEFAULT already defined
26 #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_G13
27 #include <gpg-error.h>
29 #include "../common/util.h"
30 #include "../common/status.h"
31 #include "../common/estream.h"
32 #include "../common/audit.h"
33 #include "../common/session-env.h"
35 /* A large struct named "opt" to keep global flags. */
38 unsigned int debug
; /* Debug flags (DBG_foo_VALUE). */
39 int verbose
; /* Verbosity level. */
40 int quiet
; /* Be as quiet as possible. */
41 int dry_run
; /* Don't change any persistent data. */
43 const char *homedir
; /* Configuration directory name. */
44 const char *config_filename
; /* Name of the used config file. */
46 /* Filename of the AGENT program. */
47 const char *agent_program
;
49 /* Filename of the GPG program. Unless set via an program option it
50 is initialzed at the first engine startup to the standard gpg
52 const char *gpg_program
;
54 /* Environment variables passed along to the engine. */
61 char *pinentry_user_data
;
62 session_env_t session_env
;
64 /* Name of the output file - FIXME: what is this? */
70 /* Debug values and macros. */
71 #define DBG_MOUNT_VALUE 1 /* Debug mount or device stuff. */
72 #define DBG_CRYPTO_VALUE 4 /* Debug low level crypto. */
73 #define DBG_MEMORY_VALUE 32 /* Debug memory allocation stuff. */
74 #define DBG_MEMSTAT_VALUE 128 /* Show memory statistics. */
75 #define DBG_ASSUAN_VALUE 1024 /* Debug assuan communication. */
77 #define DBG_MOUNT (opt.debug & DBG_MOUNT_VALUE)
78 #define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
79 #define DBG_MEMORY (opt.debug & DBG_MEMORY_VALUE)
80 #define DBG_ASSUAN (opt.debug & DBG_ASSUAN_VALUE)
82 /* Forward declaration for an object defined in server.c. */
83 struct server_local_s
;
85 /* Session control object. This object is passed down to most
86 functions. The default values for it are set by
87 g13_init_default_ctrl(). */
88 struct server_control_s
90 int no_server
; /* We are not running under server control */
91 int status_fd
; /* Only for non-server mode */
92 struct server_local_s
*server_local
;
94 audit_ctx_t audit
; /* NULL or a context for the audit subsystem. */
95 int agent_seen
; /* Flag indicating that the gpg-agent has been
98 int with_colons
; /* Use column delimited output format */
100 /* Type of the current container. See the CONTTYPE_ constants. */
108 void g13_exit (int rc
);
109 void g13_init_default_ctrl (struct server_control_s
*ctrl
);