chiark / gitweb /
gnupg2 (2.1.17-3) unstable; urgency=medium
[gnupg2.git] / tools / gpg-wks.h
1 /* gpg-wks.h - Common definitions for wks server and client.
2  * Copyright (C) 2016 g10 Code GmbH
3  *
4  * This file is part of GnuPG.
5  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <https://www.gnu.org/licenses/>.
18  */
19
20 #ifndef GNUPG_GPG_WKS_H
21 #define GNUPG_GPG_WKS_H
22
23 #include "../common/util.h"
24 #include "../common/strlist.h"
25 #include "mime-maker.h"
26
27 /* We keep all global options in the structure OPT.  */
28 struct
29 {
30   int verbose;
31   unsigned int debug;
32   int quiet;
33   int use_sendmail;
34   const char *output;
35   const char *gpg_program;
36   const char *directory;
37   const char *default_from;
38   strlist_t extra_headers;
39 } opt;
40
41 /* Debug values and macros.  */
42 #define DBG_MIME_VALUE        1 /* Debug the MIME structure.  */
43 #define DBG_PARSER_VALUE      2 /* Debug the Mail parser.  */
44 #define DBG_CRYPTO_VALUE      4 /* Debug low level crypto.  */
45 #define DBG_MEMORY_VALUE     32 /* Debug memory allocation stuff.  */
46 #define DBG_MEMSTAT_VALUE   128 /* Show memory statistics.  */
47 #define DBG_IPC_VALUE      1024 /* Debug assuan communication.  */
48 #define DBG_EXTPROG_VALUE 16384 /* debug external program calls */
49
50 #define DBG_MIME     (opt.debug & DBG_MIME_VALUE)
51 #define DBG_PARSER   (opt.debug & DBG_PARSER_VALUE)
52 #define DBG_CRYPTO   (opt.debug & DBG_CRYPTO_VALUE)
53
54
55 /* The parsed policy flags. */
56 struct policy_flags_s
57 {
58   unsigned int mailbox_only : 1;
59   unsigned int dane_only : 1;
60   unsigned int auth_submit : 1;
61   unsigned int max_pending;      /* Seconds to wait for a confirmation.  */
62 };
63 typedef struct policy_flags_s *policy_flags_t;
64
65
66
67 /*-- wks-util.c --*/
68 void wks_set_status_fd (int fd);
69 void wks_write_status (int no, const char *format, ...) GPGRT_ATTR_PRINTF(2,3);
70 gpg_error_t wks_list_key (estream_t key, char **r_fpr, strlist_t *r_mboxes);
71 gpg_error_t wks_send_mime (mime_maker_t mime);
72 gpg_error_t wks_parse_policy (policy_flags_t flags, estream_t stream,
73                               int ignore_unknown);
74
75 /*-- wks-receive.c --*/
76
77 /* Flag values for the receive callback.  */
78 #define WKS_RECEIVE_DRAFT2 1
79
80 gpg_error_t wks_receive (estream_t fp,
81                          gpg_error_t (*result_cb)(void *opaque,
82                                                   const char *mediatype,
83                                                   estream_t data,
84                                                   unsigned int flags),
85                          void *cb_data);
86
87
88
89 #endif /*GNUPG_GPG_WKS_H*/