Add GETINFO --data.
[pwmd.git] / src / common.h
blob191f012ad5cd9f7b0ced00cfb3221336bac42552
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 Ben Kibbey <bjk@luxsci.net>
6 This file is part of pwmd.
8 Pwmd is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 Pwmd is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef COMMON_H
22 #define COMMON_H
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <glib.h>
27 #include <glib/gi18n.h>
28 #include <pthread.h>
29 #include <assuan.h>
31 #ifdef ENABLE_NLS
32 #ifdef HAVE_LOCALE_H
33 #include <locale.h>
34 #endif
35 #endif
37 #ifdef WITH_GNUTLS
38 #include "tls.h"
39 #endif
40 #include "status.h"
41 #include "agent.h"
43 struct client_thread_s {
44 pthread_t tid;
45 gint fd;
46 pthread_mutex_t status_mutex;
47 struct status_msg_s *msg_queue;
48 int status_msg_pipe[2];
49 struct client_s *cl;
50 #ifdef WITH_GNUTLS
51 gboolean remote;
52 struct tls_s *tls;
53 #endif
56 struct client_s {
57 assuan_context_t ctx;
58 gpointer doc; /* xmlDocPtr */
59 gpointer xml_error;
60 gchar *filename;
61 guchar md5file[16];
62 struct client_thread_s *thd;
63 struct crypto_s *crypto;
64 guint32 opts;
65 guint32 flags;
66 gpg_error_t last_rc;
67 gchar *last_error; /* ELOOP element path. */
68 guchar *crc; /* Of the data file. */
71 pthread_key_t thread_name_key;
72 pthread_mutex_t cn_mutex;
73 GSList *cn_thread_list;
74 gchar **debug_level;
76 int assuan_log_cb(assuan_context_t ctx, void *data, unsigned cat,
77 const char *msg);
78 void log_write(const gchar *fmt, ...);
79 gpg_error_t send_error(assuan_context_t ctx, gpg_error_t e);
81 #endif