summaryrefslogtreecommitdiff
path: root/daemon/gpg-agent/gkd-gpg-agent-private.h
blob: 037582c39238becbe718b3e67d294baeaca3369c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * gnome-keyring
 *
 * Copyright (C) 2010 Stefan Walter
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#ifndef GKDGPGPRIVATE_H_
#define GKDGPGPRIVATE_H_

#include "egg/egg-buffer.h"

#include "pkcs11/pkcs11.h"

#include <gck/gck.h>

#include <glib.h>

typedef struct _GkdGpgAgentCall {
	int sock;
	GckModule *module;
	GIOChannel *channel;
	gboolean terminal_ok;
} GkdGpgAgentCall;

/* -----------------------------------------------------------------------------
 * GPG CONSTANTS
 */


/* Commands */
#define GPG_AGENT_ID      "AGENT_ID"
#define GPG_AGENT_NOP     "NOP"
#define GPG_AGENT_BYE     "BYE"
#define GPG_AGENT_RESET   "RESET"
#define GPG_AGENT_OPTION  "OPTION"
#define GPG_AGENT_GETPASS "GET_PASSPHRASE"
#define GPG_AGENT_CLRPASS "CLEAR_PASSPHRASE"
#define GPG_AGENT_GETINFO "GETINFO"

#define GPG_AGENT_OPT_DISPLAY "display="

/* Options */
#define GPG_AGENT_FLAG_DATA   "data"
#define GPG_AGENT_FLAG_CHECK  "check"
#define GPG_AGENT_FLAG_REPEAT "repeat"

/* Responses */
#define GPG_AGENT_OK      "OK "
#define GPG_AGENT_ERR     "ERR "
#define GPG_AGENT_DATA    "D "

/* -----------------------------------------------------------------------------
 * gkd-gpg-agent-ops.c
 */

/* -----------------------------------------------------------------------------
 * gkd-gpg-agent.c
 */

gboolean              gkd_gpg_agent_initialize_with_module          (GckModule *module);

GckSession*          gkd_gpg_agent_checkout_main_session           (void);

void                  gkd_gpg_agent_checkin_main_session            (GckSession* session);

gboolean              gkd_gpg_agent_send_reply                      (GkdGpgAgentCall *call,
                                                                     gboolean ok,
                                                                     const gchar *response);

gboolean              gkd_gpg_agent_send_data                       (GkdGpgAgentCall *call,
                                                                     const gchar *data);

GSettings*            gkd_gpg_agent_settings                        (void);

/* -----------------------------------------------------------------------------
 * gkd-gpg-agent-ops
 */


gboolean              gkd_gpg_agent_ops_options                     (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_getpass                     (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_clrpass                     (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_getinfo                     (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_nop                         (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_bye                         (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_reset                       (GkdGpgAgentCall *call,
                                                                     gchar *args);

gboolean              gkd_gpg_agent_ops_id                          (GkdGpgAgentCall *call,
                                                                     gchar *args);

#endif /*GKDGPGPRIVATE_H_*/