chiark / gitweb /
gpg agent lockup fix: Interrupt main loop when active_connections_value==0
[gnupg2.git] / common / asshelp.h
1 /* asshelp.h - Helper functions for Assuan
2  *      Copyright (C) 2004, 2007 Free Software Foundation, Inc.
3  *
4  * This file is part of GnuPG.
5  *
6  * This file is free software; you can redistribute it and/or modify
7  * it under the terms of either
8  *
9  *   - the GNU Lesser General Public License as published by the Free
10  *     Software Foundation; either version 3 of the License, or (at
11  *     your option) any later version.
12  *
13  * or
14  *
15  *   - the GNU General Public License as published by the Free
16  *     Software Foundation; either version 2 of the License, or (at
17  *     your option) any later version.
18  *
19  * or both in parallel, as here.
20  *
21  * This file is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, see <https://www.gnu.org/licenses/>.
28  */
29
30 #ifndef GNUPG_COMMON_ASSHELP_H
31 #define GNUPG_COMMON_ASSHELP_H
32
33 #include <assuan.h>
34 #include <gpg-error.h>
35
36 #include "session-env.h"
37 #include "util.h"
38
39 /*-- asshelp.c --*/
40
41 void setup_libassuan_logging (unsigned int *debug_var_address,
42                               int (*log_monitor)(assuan_context_t ctx,
43                                                  unsigned int cat,
44                                                  const char *msg));
45 void set_libassuan_log_cats (unsigned int newcats);
46
47
48 gpg_error_t
49 send_pinentry_environment (assuan_context_t ctx,
50                            gpg_err_source_t errsource,
51                            const char *opt_lc_ctype,
52                            const char *opt_lc_messages,
53                            session_env_t session_env);
54
55 /* This function is used by the call-agent.c modules to fire up a new
56    agent.  */
57 gpg_error_t
58 start_new_gpg_agent (assuan_context_t *r_ctx,
59                      gpg_err_source_t errsource,
60                      const char *agent_program,
61                      const char *opt_lc_ctype,
62                      const char *opt_lc_messages,
63                      session_env_t session_env,
64                      int autostart, int verbose, int debug,
65                      gpg_error_t (*status_cb)(ctrl_t, int, ...),
66                      ctrl_t status_cb_arg);
67
68 /* This function is used to connect to the dirmngr.  On some platforms
69    the function is able starts a dirmngr process if needed.  */
70 gpg_error_t
71 start_new_dirmngr (assuan_context_t *r_ctx,
72                    gpg_err_source_t errsource,
73                    const char *dirmngr_program,
74                    int autostart, int verbose, int debug,
75                    gpg_error_t (*status_cb)(ctrl_t, int, ...),
76                    ctrl_t status_cb_arg);
77
78 /* Return the version of a server using "GETINFO version".  */
79 gpg_error_t get_assuan_server_version (assuan_context_t ctx,
80                                        int mode, char **r_version);
81
82
83 /*-- asshelp2.c --*/
84
85 /* Helper function to print an assuan status line using a printf
86    format string.  */
87 gpg_error_t print_assuan_status (assuan_context_t ctx,
88                                  const char *keyword,
89                                  const char *format,
90                                  ...) GPGRT_ATTR_PRINTF(3,4);
91 gpg_error_t vprint_assuan_status (assuan_context_t ctx,
92                                   const char *keyword,
93                                   const char *format,
94                                   va_list arg_ptr) GPGRT_ATTR_PRINTF(3,0);
95
96
97 #endif /*GNUPG_COMMON_ASSHELP_H*/