chiark / gitweb /
asshelp.c: add a lot of debug logging
[gnupg2.git] / g13 / g13-common.h
1 /* g13.h - Global definitions for G13.
2  * Copyright (C) 2009 Free Software Foundation, Inc.
3  * Copyright (C) 2009, 2015 Werner Koch.
4  *
5  * This file is part of GnuPG.
6  *
7  * GnuPG is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * GnuPG is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <https://www.gnu.org/licenses/>.
19  */
20
21 #ifndef G13_COMMON_H
22 #define G13_COMMON_H
23
24 #ifdef GPG_ERR_SOURCE_DEFAULT
25 #error GPG_ERR_SOURCE_DEFAULT already defined
26 #endif
27 #define GPG_ERR_SOURCE_DEFAULT  GPG_ERR_SOURCE_G13
28 #include <gpg-error.h>
29
30 #include "../common/util.h"
31 #include "../common/status.h"
32 #include "../common/session-env.h"
33 #include "../common/strlist.h"
34
35
36 /* Debug values and macros.  */
37 #define DBG_MOUNT_VALUE     1   /* Debug mount or device stuff. */
38 #define DBG_CRYPTO_VALUE    4   /* Debug low level crypto.  */
39 #define DBG_MEMORY_VALUE   32   /* Debug memory allocation stuff.  */
40 #define DBG_MEMSTAT_VALUE 128   /* Show memory statistics.  */
41 #define DBG_IPC_VALUE    1024   /* Debug assuan communication.  */
42
43 #define DBG_MOUNT    (opt.debug & DBG_MOUNT_VALUE)
44 #define DBG_CRYPTO   (opt.debug & DBG_CRYPTO_VALUE)
45 #define DBG_MEMORY   (opt.debug & DBG_MEMORY_VALUE)
46 #define DBG_IPC      (opt.debug & DBG_IPC_VALUE)
47
48 /* A large struct named "opt" to keep global flags.  Note that this
49    struct is used by g13 and g13-syshelp and thus some fields may only
50    make sense for one of them.  */
51 struct
52 {
53   unsigned int debug; /* Debug flags (DBG_foo_VALUE).  */
54   int verbose;        /* Verbosity level.  */
55   int quiet;          /* Be as quiet as possible.  */
56   int dry_run;        /* Don't change any persistent data.  */
57
58   const char *config_filename; /* Name of the used config file.  */
59
60   /* Filename of the AGENT program.  */
61   const char *agent_program;
62
63   /* Filename of the GPG program.  Unless set via an program option it
64      is initialzed at the first engine startup to the standard gpg
65      filename.  */
66   const char *gpg_program;
67
68   /* GPG arguments.  XXX: Currently it is not possible to set them.  */
69   strlist_t gpg_arguments;
70
71   /* Environment variables passed along to the engine.  */
72   char *display;
73   char *ttyname;
74   char *ttytype;
75   char *lc_ctype;
76   char *lc_messages;
77   char *xauthority;
78   char *pinentry_user_data;
79   session_env_t session_env;
80
81   /* Name of the output file - FIXME: what is this?  */
82   const char *outfile;
83
84 } opt;
85
86
87 /*-- g13-common.c --*/
88 void g13_init_signals (void);
89 void g13_install_emergency_cleanup (void);
90 void g13_exit (int rc);
91
92 /*-- server.c and g13-sh-cmd.c --*/
93 gpg_error_t g13_status (ctrl_t ctrl, int no, ...) GPGRT_ATTR_SENTINEL(0);
94
95
96 #endif /*G13_COMMON_H*/