* gpg.texi: Reference to --s2k-count in --s2k-mode.
[gnupg.git] / scd / scdaemon.h
blob2d20b0231c6417be56c665437680b3627e671011
1 /* scdaemon.h - Global definitions for the SCdaemon
2 * Copyright (C) 2001, 2002, 2003 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 2 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, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 * USA.
22 #ifndef SCDAEMON_H
23 #define SCDAEMON_H
25 #ifdef GPG_ERR_SOURCE_DEFAULT
26 #error GPG_ERR_SOURCE_DEFAULT already defined
27 #endif
28 #define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_SCD
29 #include <gpg-error.h>
31 #include <time.h>
32 #include <gcrypt.h>
33 #include "../common/util.h"
34 #include "../common/errors.h"
37 /* To convey some special hash algorithms we use algorithm numbers
38 reserved for application use. */
39 #ifndef GCRY_MD_USER
40 #define GCRY_MD_USER 1024
41 #endif
42 #define GCRY_MD_USER_TLS_MD5SHA1 (GCRY_MD_USER+1)
44 /* Maximum length of a digest. */
45 #define MAX_DIGEST_LEN 36
49 /* A large struct name "opt" to keep global flags. */
50 struct
52 unsigned int debug; /* Debug flags (DBG_foo_VALUE). */
53 int verbose; /* Verbosity level. */
54 int quiet; /* Be as quiet as possible. */
55 int dry_run; /* Don't change any persistent data. */
56 int batch; /* Batch mode. */
57 const char *homedir; /* Configuration directory name. */
58 const char *ctapi_driver; /* Library to access the ctAPI. */
59 const char *pcsc_driver; /* Library to access the PC/SC system. */
60 const char *reader_port; /* NULL or reder port to use. */
61 int disable_ccid; /* Disable the use of the internal CCID driver. */
62 int disable_keypad; /* Do not use a keypad. */
63 int allow_admin; /* Allow the use of admin commands for certain
64 cards. */
65 strlist_t disabled_applications; /* Card applications we do not
66 want to use. */
67 } opt;
70 #define DBG_COMMAND_VALUE 1 /* debug commands i/o */
71 #define DBG_MPI_VALUE 2 /* debug mpi details */
72 #define DBG_CRYPTO_VALUE 4 /* debug low level crypto */
73 #define DBG_MEMORY_VALUE 32 /* debug memory allocation stuff */
74 #define DBG_CACHE_VALUE 64 /* debug the caching */
75 #define DBG_MEMSTAT_VALUE 128 /* show memory statistics */
76 #define DBG_HASHING_VALUE 512 /* debug hashing operations */
77 #define DBG_ASSUAN_VALUE 1024
78 #define DBG_CARD_IO_VALUE 2048
80 #define DBG_COMMAND (opt.debug & DBG_COMMAND_VALUE)
81 #define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
82 #define DBG_MEMORY (opt.debug & DBG_MEMORY_VALUE)
83 #define DBG_CACHE (opt.debug & DBG_CACHE_VALUE)
84 #define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
85 #define DBG_ASSUAN (opt.debug & DBG_ASSUAN_VALUE)
86 #define DBG_CARD_IO (opt.debug & DBG_CARD_IO_VALUE)
88 struct server_local_s;
89 struct app_ctx_s;
91 struct server_control_s
93 /* Local data of the server; used only in command.c. */
94 struct server_local_s *server_local;
96 /* Slot of the open reader or -1 if not open. */
97 int reader_slot;
99 /* The application context used with this connection or NULL if none
100 associated. Note that this is shared with the other connections:
101 All connections accessing the same reader are using the same
102 application context. */
103 struct app_ctx_s *app_ctx;
105 /* Helper to store the value we are going to sign */
106 struct
108 unsigned char *value;
109 int valuelen;
110 } in_data;
113 typedef struct server_control_s *ctrl_t;
114 typedef struct app_ctx_s *app_t;
116 /*-- scdaemon.c --*/
117 void scd_exit (int rc);
118 void scd_init_default_ctrl (ctrl_t ctrl);
119 const char *scd_get_socket_name (void);
121 /*-- command.c --*/
122 void scd_command_handler (int);
123 void send_status_info (ctrl_t ctrl, const char *keyword, ...)
124 GNUPG_GCC_A_SENTINEL(1);
125 void scd_update_reader_status_file (void);
128 #endif /*SCDAEMON_H*/