[scd] Memory leak fix.
[gnupg.git] / g13 / g13.h
blob90b6d5013a3b100f2f1cc1003440c34ad6e7bcad
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/>.
20 #ifndef G13_H
21 #define G13_H
23 #ifdef GPG_ERR_SOURCE_DEFAULT
24 #error GPG_ERR_SOURCE_DEFAULT already defined
25 #endif
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/session-env.h"
34 /* A large struct named "opt" to keep global flags. */
35 struct
37 unsigned int debug; /* Debug flags (DBG_foo_VALUE). */
38 int verbose; /* Verbosity level. */
39 int quiet; /* Be as quiet as possible. */
40 int dry_run; /* Don't change any persistent data. */
42 const char *homedir; /* Configuration directory name. */
43 const char *config_filename; /* Name of the used config file. */
45 /* Filename of the AGENT program. */
46 const char *agent_program;
48 /* Filename of the GPG program. Unless set via an program option it
49 is initialzed at the first engine startup to the standard gpg
50 filename. */
51 const char *gpg_program;
53 /* Environment variables passed along to the engine. */
54 char *display;
55 char *ttyname;
56 char *ttytype;
57 char *lc_ctype;
58 char *lc_messages;
59 char *xauthority;
60 char *pinentry_user_data;
61 session_env_t session_env;
63 /* Name of the output file - FIXME: what is this? */
64 const char *outfile;
66 } opt;
69 /* Debug values and macros. */
70 #define DBG_MOUNT_VALUE 1 /* Debug mount or device stuff. */
71 #define DBG_CRYPTO_VALUE 4 /* Debug low level crypto. */
72 #define DBG_MEMORY_VALUE 32 /* Debug memory allocation stuff. */
73 #define DBG_MEMSTAT_VALUE 128 /* Show memory statistics. */
74 #define DBG_ASSUAN_VALUE 1024 /* Debug assuan communication. */
76 #define DBG_MOUNT (opt.debug & DBG_MOUNT_VALUE)
77 #define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
78 #define DBG_MEMORY (opt.debug & DBG_MEMORY_VALUE)
79 #define DBG_ASSUAN (opt.debug & DBG_ASSUAN_VALUE)
81 /* Forward declaration for an object defined in server.c. */
82 struct server_local_s;
84 /* Session control object. This object is passed down to most
85 functions. The default values for it are set by
86 g13_init_default_ctrl(). */
87 struct server_control_s
89 int no_server; /* We are not running under server control */
90 int status_fd; /* Only for non-server mode */
91 struct server_local_s *server_local;
93 int agent_seen; /* Flag indicating that the gpg-agent has been
94 accessed. */
96 int with_colons; /* Use column delimited output format */
98 /* Type of the current container. See the CONTTYPE_ constants. */
99 int conttype;
105 /*-- g13.c --*/
106 void g13_exit (int rc);
107 void g13_init_default_ctrl (struct server_control_s *ctrl);
109 /*-- server.c (commonly used, thus declared here) --*/
110 gpg_error_t g13_status (ctrl_t ctrl, int no, ...) GNUPG_GCC_A_SENTINEL(0);
113 #endif /*G13_H*/