* exec.c (make_tempdir) [_WIN32]: Modified to properly handle
[gnupg.git] / g10 / options.h
blob6c69d80aaaf2f07b24521ecec8ed098275e2d1fd
1 /* options.h
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 * 2006 Free Software Foundation, Inc.
5 * This file is part of GnuPG.
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 2 of the License, or
10 * (at your option) any later version.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 * USA.
22 #ifndef G10_OPTIONS_H
23 #define G10_OPTIONS_H
25 #include <sys/types.h>
26 #include <types.h>
27 #include "main.h"
28 #include "packet.h"
30 #ifndef EXTERN_UNLESS_MAIN_MODULE
31 /* Norcraft can't cope with common symbols */
32 #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
33 #define EXTERN_UNLESS_MAIN_MODULE extern
34 #else
35 #define EXTERN_UNLESS_MAIN_MODULE
36 #endif
37 #endif
39 EXTERN_UNLESS_MAIN_MODULE
40 struct
42 int verbose;
43 int quiet;
44 unsigned debug;
45 int armor;
46 char *outfile;
47 off_t max_output;
48 int dry_run;
49 int list_only;
50 int textmode;
51 int expert;
52 const char *def_sig_expire;
53 int ask_sig_expire;
54 const char *def_cert_expire;
55 int ask_cert_expire;
56 int batch; /* run in batch mode */
57 int answer_yes; /* answer yes on most questions */
58 int answer_no; /* answer no on most questions */
59 int check_sigs; /* check key signatures */
60 int with_colons;
61 int with_key_data;
62 int with_fingerprint; /* opt --with-fingerprint active */
63 int fingerprint; /* list fingerprints */
64 int list_sigs; /* list signatures */
65 int no_armor;
66 int list_packets; /* list-packets mode: 1=normal, 2=invoked by command*/
67 int def_cipher_algo;
68 int force_v3_sigs;
69 int force_v4_certs;
70 int force_mdc;
71 int disable_mdc;
72 int def_digest_algo;
73 int cert_digest_algo;
74 int compress_algo;
75 int compress_level;
76 int bz2_compress_level;
77 int bz2_decompress_lowmem;
78 const char *def_secret_key;
79 char *def_recipient;
80 int def_recipient_self;
81 int def_cert_level;
82 int min_cert_level;
83 int ask_cert_level;
84 int no_version;
85 int marginals_needed;
86 int completes_needed;
87 int max_cert_depth;
88 const char *homedir;
90 char *display; /* 5 options to be passed to the gpg-agent */
91 char *ttyname;
92 char *ttytype;
93 char *lc_ctype;
94 char *lc_messages;
96 int skip_verify;
97 int compress_keys;
98 int compress_sigs;
99 /* TM_CLASSIC must be zero to accomodate trustdbs generated before
100 we started storing the trust model inside the trustdb. */
101 enum
103 TM_CLASSIC=0, TM_PGP=1, TM_EXTERNAL=2, TM_ALWAYS, TM_DIRECT, TM_AUTO
104 } trust_model;
105 int force_ownertrust;
106 enum
108 CO_GNUPG=0, CO_RFC2440, CO_RFC1991, CO_PGP2, CO_PGP6, CO_PGP7, CO_PGP8
109 } compliance;
110 enum
112 KF_SHORT, KF_LONG, KF_0xSHORT, KF_0xLONG
113 } keyid_format;
114 int pgp2_workarounds;
115 int shm_coprocess;
116 const char *set_filename;
117 STRLIST comments;
118 int throw_keyid;
119 const char *photo_viewer;
120 int s2k_mode;
121 int s2k_digest_algo;
122 int s2k_cipher_algo;
123 int simple_sk_checksum; /* create the deprecated rfc2440 secret
124 key protection*/
125 int not_dash_escaped;
126 int escape_from;
127 int lock_once;
128 struct keyserver_spec
130 char *uri;
131 char *scheme;
132 char *auth;
133 char *host;
134 char *port;
135 char *path;
136 char *opaque;
137 STRLIST options;
138 struct
140 unsigned int direct_uri:1;
141 } flags;
142 struct keyserver_spec *next;
143 } *keyserver;
144 struct
146 unsigned int options;
147 unsigned int import_options;
148 unsigned int export_options;
149 STRLIST other;
150 } keyserver_options;
151 int exec_disable;
152 int exec_path_set;
153 unsigned int import_options;
154 unsigned int export_options;
155 unsigned int list_options;
156 unsigned int verify_options;
157 char *def_preference_list;
158 prefitem_t *personal_cipher_prefs;
159 prefitem_t *personal_digest_prefs;
160 prefitem_t *personal_compress_prefs;
161 int no_perm_warn;
162 int no_mdc_warn;
163 char *temp_dir;
164 int no_encrypt_to;
165 int interactive;
166 struct notation *sig_notations;
167 struct notation *cert_notations;
168 STRLIST sig_policy_url;
169 STRLIST cert_policy_url;
170 STRLIST sig_keyserver_url;
171 STRLIST cert_subpackets;
172 STRLIST sig_subpackets;
173 int allow_non_selfsigned_uid;
174 int allow_freeform_uid;
175 int no_literal;
176 ulong set_filesize;
177 int fast_list_mode;
178 int fixed_list_mode;
179 int ignore_time_conflict;
180 int ignore_valid_from;
181 int ignore_crc_error;
182 int ignore_mdc_error;
183 int command_fd;
184 const char *override_session_key;
185 int show_session_key;
186 int use_agent;
187 const char *gpg_agent_info;
188 int try_all_secrets;
189 int no_expensive_trust_checks;
190 int no_sig_cache;
191 int no_sig_create_check;
192 int no_auto_check_trustdb;
193 int preserve_permissions;
194 int no_homedir_creation;
195 struct groupitem *grouplist;
196 int strict;
197 int mangle_dos_filenames;
198 int enable_progress_filter;
199 unsigned int screen_columns;
200 unsigned int screen_lines;
201 byte *show_subpackets;
202 int rfc2440_text;
204 /* If true, let write failures on the status-fd exit the process. */
205 int exit_on_status_write_error;
207 /* If > 0, limit the number of card insertion prompts to this
208 value. */
209 int limit_card_insert_tries;
211 #ifdef ENABLE_CARD_SUPPORT
212 const char *ctapi_driver; /* Library to access the ctAPI. */
213 const char *pcsc_driver; /* Library to access the PC/SC system. */
214 int disable_ccid; /* Disable the use of the internal CCID driver. */
215 #endif /*ENABLE_CARD_SUPPORT*/
217 struct
219 /* If set, require an 0x19 backsig to be present on signatures
220 made by signing subkeys. If not set, a missing backsig is not
221 an error (but an invalid backsig still is). */
222 unsigned int require_cross_cert:1;
223 unsigned int use_embedded_filename:1;
224 unsigned int utf8_filename:1;
225 unsigned int dsa2:1;
226 } flags;
228 /* Linked list of ways to find a key if the key isn't on the local
229 keyring. */
230 struct akl
232 enum {AKL_CERT, AKL_PKA, AKL_LDAP, AKL_KEYSERVER, AKL_SPEC} type;
233 struct keyserver_spec *spec;
234 struct akl *next;
235 } *auto_key_locate;
237 /* True if multiple concatenated signatures may be verified. */
238 int allow_multisig_verification;
240 } opt;
242 /* CTRL is used to keep some global variables we currently can't
243 avoid. Future concurrent versions of gpg will put it into a per
244 request structure CTRL. */
245 EXTERN_UNLESS_MAIN_MODULE
246 struct {
247 int in_auto_key_retrieve; /* True if we are doing an
248 auto_key_retrieve. */
249 } glo_ctrl;
251 #define DBG_PACKET_VALUE 1 /* debug packet reading/writing */
252 #define DBG_MPI_VALUE 2 /* debug mpi details */
253 #define DBG_CIPHER_VALUE 4 /* debug cipher handling */
254 /* (may reveal sensitive data) */
255 #define DBG_FILTER_VALUE 8 /* debug internal filter handling */
256 #define DBG_IOBUF_VALUE 16 /* debug iobuf stuff */
257 #define DBG_MEMORY_VALUE 32 /* debug memory allocation stuff */
258 #define DBG_CACHE_VALUE 64 /* debug the cacheing */
259 #define DBG_MEMSTAT_VALUE 128 /* show memory statistics */
260 #define DBG_TRUST_VALUE 256 /* debug the trustdb */
261 #define DBG_HASHING_VALUE 512 /* debug hashing operations */
262 #define DBG_EXTPROG_VALUE 1024 /* debug external program calls */
263 #define DBG_CARD_IO_VALUE 2048 /* debug smart card I/O. */
265 #define DBG_PACKET (opt.debug & DBG_PACKET_VALUE)
266 #define DBG_FILTER (opt.debug & DBG_FILTER_VALUE)
267 #define DBG_CACHE (opt.debug & DBG_CACHE_VALUE)
268 #define DBG_TRUST (opt.debug & DBG_TRUST_VALUE)
269 #define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
270 #define DBG_EXTPROG (opt.debug & DBG_EXTPROG_VALUE)
271 #define DBG_CARD_IO (opt.debug & DBG_CARD_IO_VALUE)
274 #define GNUPG (opt.compliance==CO_GNUPG)
275 #define RFC1991 (opt.compliance==CO_RFC1991 || opt.compliance==CO_PGP2)
276 #define RFC2440 (opt.compliance==CO_RFC2440)
277 #define PGP2 (opt.compliance==CO_PGP2)
278 #define PGP6 (opt.compliance==CO_PGP6)
279 #define PGP7 (opt.compliance==CO_PGP7)
280 #define PGP8 (opt.compliance==CO_PGP8)
282 /* Various option flags. Note that there should be no common string
283 names between the IMPORT_ and EXPORT_ flags as they can be mixed in
284 the keyserver-options option. */
286 #define IMPORT_LOCAL_SIGS (1<<0)
287 #define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
288 #define IMPORT_FAST (1<<2)
289 #define IMPORT_SK2PK (1<<3)
290 #define IMPORT_MERGE_ONLY (1<<4)
291 #define IMPORT_MINIMAL (1<<5)
292 #define IMPORT_CLEAN (1<<6)
294 #define EXPORT_LOCAL_SIGS (1<<0)
295 #define EXPORT_ATTRIBUTES (1<<1)
296 #define EXPORT_SENSITIVE_REVKEYS (1<<2)
297 #define EXPORT_RESET_SUBKEY_PASSWD (1<<3)
298 #define EXPORT_MINIMAL (1<<4)
299 #define EXPORT_CLEAN (1<<5)
301 #define LIST_SHOW_PHOTOS (1<<0)
302 #define LIST_SHOW_POLICY_URLS (1<<1)
303 #define LIST_SHOW_STD_NOTATIONS (1<<2)
304 #define LIST_SHOW_USER_NOTATIONS (1<<3)
305 #define LIST_SHOW_NOTATIONS (LIST_SHOW_STD_NOTATIONS|LIST_SHOW_USER_NOTATIONS)
306 #define LIST_SHOW_KEYSERVER_URLS (1<<4)
307 #define LIST_SHOW_UID_VALIDITY (1<<5)
308 #define LIST_SHOW_UNUSABLE_UIDS (1<<6)
309 #define LIST_SHOW_UNUSABLE_SUBKEYS (1<<7)
310 #define LIST_SHOW_KEYRING (1<<8)
311 #define LIST_SHOW_SIG_EXPIRE (1<<9)
312 #define LIST_SHOW_SIG_SUBPACKETS (1<<10)
314 #define VERIFY_SHOW_PHOTOS (1<<0)
315 #define VERIFY_SHOW_POLICY_URLS (1<<1)
316 #define VERIFY_SHOW_STD_NOTATIONS (1<<2)
317 #define VERIFY_SHOW_USER_NOTATIONS (1<<3)
318 #define VERIFY_SHOW_NOTATIONS (VERIFY_SHOW_STD_NOTATIONS|VERIFY_SHOW_USER_NOTATIONS)
319 #define VERIFY_SHOW_KEYSERVER_URLS (1<<4)
320 #define VERIFY_SHOW_UID_VALIDITY (1<<5)
321 #define VERIFY_SHOW_UNUSABLE_UIDS (1<<6)
322 #define VERIFY_PKA_LOOKUPS (1<<7)
323 #define VERIFY_PKA_TRUST_INCREASE (1<<8)
325 #define KEYSERVER_USE_TEMP_FILES (1<<0)
326 #define KEYSERVER_KEEP_TEMP_FILES (1<<1)
327 #define KEYSERVER_ADD_FAKE_V3 (1<<2)
328 #define KEYSERVER_AUTO_KEY_RETRIEVE (1<<3)
329 #define KEYSERVER_HONOR_KEYSERVER_URL (1<<4)
330 #define KEYSERVER_HONOR_PKA_RECORD (1<<5)
332 #endif /*G10_OPTIONS_H*/