} iocb_data_t;
-struct gpgsm_object_s
+struct engine_gpgsm
{
ASSUAN_CONTEXT assuan_ctx;
struct gpgme_io_cbs io_cbs;
};
-typedef struct gpgsm_object_s *GpgsmObject;
+typedef struct engine_gpgsm *engine_gpgsm_t;
\f
static const char *
static void
close_notify_handler (int fd, void *opaque)
{
- GpgsmObject gpgsm = opaque;
+ engine_gpgsm_t gpgsm = opaque;
assert (fd != -1);
if (gpgsm->status_cb.fd == fd)
static void
gpgsm_release (void *engine)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
if (!gpgsm)
return;
gpgsm_new (void **engine)
{
gpgme_error_t err = 0;
- GpgsmObject gpgsm;
+ engine_gpgsm_t gpgsm;
char *argv[3];
int fds[2];
int child_fds[4];
{
AssuanError assuan_err;
gpgme_error_t err = 0;
- GpgsmObject gpgsm = opaque;
+ engine_gpgsm_t gpgsm = opaque;
char *line;
size_t linelen;
static gpgme_error_t
-add_io_cb (GpgsmObject gpgsm, iocb_data_t *iocbd, gpgme_io_cb_t handler)
+add_io_cb (engine_gpgsm_t gpgsm, iocb_data_t *iocbd, gpgme_io_cb_t handler)
{
gpgme_error_t err;
static gpgme_error_t
-start (GpgsmObject gpgsm, const char *command)
+start (engine_gpgsm_t gpgsm, const char *command)
{
gpgme_error_t err;
static gpgme_error_t
gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
static gpgme_error_t
gpgsm_delete (void *engine, gpgme_key_t key, int allow_secret)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
char *fpr = key->subkeys ? key->subkeys->fpr : NULL;
char *linep = fpr;
static gpgme_error_t
-set_recipients (GpgsmObject gpgsm, gpgme_user_id_t uid)
+set_recipients (engine_gpgsm_t gpgsm, gpgme_user_id_t uid)
{
gpgme_error_t err;
ASSUAN_CONTEXT ctx = gpgsm->assuan_ctx;
gpgsm_encrypt (void *engine, gpgme_user_id_t recp, gpgme_data_t plain,
gpgme_data_t ciph, int use_armor)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
gpgsm_export (void *engine, gpgme_user_id_t uid, gpgme_data_t keydata,
int use_armor)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err = 0;
char *cmd = NULL;
int cmdi;
gpgsm_genkey (void *engine, gpgme_data_t help_data, int use_armor,
gpgme_data_t pubkey, gpgme_data_t seckey)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm || !pubkey || seckey)
static gpgme_error_t
gpgsm_import (void *engine, gpgme_data_t keydata)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
gpgsm_keylist (void *engine, const char *pattern, int secret_only,
int keylist_mode)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
char *line;
gpgme_error_t err;
gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
int reserved, int keylist_mode)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
char *line;
gpgme_error_t err;
/* Length is "LISTSECRETKEYS " + p + '\0'. */
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
int include_certs, gpgme_ctx_t ctx /* FIXME */)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
char *assuan_cmd;
int i;
gpgsm_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
gpgme_data_t plaintext)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
if (!gpgsm)
gpgsm_set_status_handler (void *engine, engine_status_handler_t fnc,
void *fnc_value)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgsm->status.fnc = fnc;
gpgsm->status.fnc_value = fnc_value;
gpgsm_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc,
void *fnc_value)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgsm->colon.fnc = fnc;
gpgsm->colon.fnc_value = fnc_value;
static void
gpgsm_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
gpgsm->io_cbs = *io_cbs;
}
static void
gpgsm_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{
- GpgsmObject gpgsm = engine;
+ engine_gpgsm_t gpgsm = engine;
if (gpgsm->io_cbs.event)
(*gpgsm->io_cbs.event) (gpgsm->io_cbs.event_priv, type, type_data);
};
-struct gpg_object_s
+struct engine_gpg
{
struct arg_and_data_s *arglist;
struct arg_and_data_s **argtail;
struct gpgme_io_cbs io_cbs;
};
-typedef struct gpg_object_s *GpgObject;
+typedef struct engine_gpg *engine_gpg_t;
\f
static void
gpg_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
if (gpg->io_cbs.event)
(*gpg->io_cbs.event) (gpg->io_cbs.event_priv, type, type_data);
static void
close_notify_handler (int fd, void *opaque)
{
- GpgObject gpg = opaque;
+ engine_gpg_t gpg = opaque;
assert (fd != -1);
if (gpg->status.fd[0] == fd)
}
static gpgme_error_t
-add_arg (GpgObject gpg, const char *arg)
+add_arg (engine_gpg_t gpg, const char *arg)
{
struct arg_and_data_s *a;
}
static gpgme_error_t
-add_data (GpgObject gpg, gpgme_data_t data, int dup_to, int inbound)
+add_data (engine_gpg_t gpg, gpgme_data_t data, int dup_to, int inbound)
{
struct arg_and_data_s *a;
static void
gpg_release (void *engine)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
if (!gpg)
return;
static gpgme_error_t
gpg_new (void **engine)
{
- GpgObject gpg;
+ engine_gpg_t gpg;
int rc = 0;
gpg = calloc (1, sizeof *gpg);
gpg_set_status_handler (void *engine, engine_status_handler_t fnc,
void *fnc_value)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpg->status.fnc = fnc;
gpg->status.fnc_value = fnc_value;
gpg_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc,
void *fnc_value)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpg->colon.bufsize = 1024;
gpg->colon.readpos = 0;
command_handler (void *opaque, int fd)
{
gpgme_error_t err;
- GpgObject gpg = (GpgObject) opaque;
+ engine_gpg_t gpg = (engine_gpg_t) opaque;
assert (gpg->cmd.used);
assert (gpg->cmd.code);
gpg_set_command_handler (void *engine, engine_command_handler_t fnc,
void *fnc_value, gpgme_data_t linked_data)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
add_arg (gpg, "--command-fd");
/* This is a hack. We don't have a real data object. The only
static gpgme_error_t
-build_argv (GpgObject gpg)
+build_argv (engine_gpg_t gpg)
{
struct arg_and_data_s *a;
struct fd_data_map_s *fd_data_map;
static gpgme_error_t
-add_io_cb (GpgObject gpg, int fd, int dir, gpgme_io_cb_t handler, void *data,
+add_io_cb (engine_gpg_t gpg, int fd, int dir, gpgme_io_cb_t handler, void *data,
void **tag)
{
gpgme_error_t err;
with status line code we know about and skip all other stuff
without buffering (i.e. without extending the buffer). */
static gpgme_error_t
-read_status (GpgObject gpg)
+read_status (engine_gpg_t gpg)
{
char *p;
int nread;
static gpgme_error_t
status_handler (void *opaque, int fd)
{
- GpgObject gpg = opaque;
+ engine_gpg_t gpg = opaque;
int err;
assert (fd == gpg->status.fd[0]);
static gpgme_error_t
-read_colon_line (GpgObject gpg)
+read_colon_line (engine_gpg_t gpg)
{
char *p;
int nread;
static gpgme_error_t
colon_line_handler (void *opaque, int fd)
{
- GpgObject gpg = opaque;
+ engine_gpg_t gpg = opaque;
gpgme_error_t rc = 0;
assert (fd == gpg->colon.fd[0]);
static gpgme_error_t
-start (GpgObject gpg)
+start (engine_gpg_t gpg)
{
gpgme_error_t rc;
int i, n;
static gpgme_error_t
gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--decrypt");
static gpgme_error_t
gpg_delete (void *engine, gpgme_key_t key, int allow_secret)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, allow_secret ? "--delete-secret-and-public-key"
static gpgme_error_t
-append_args_from_signers (GpgObject gpg, gpgme_ctx_t ctx /* FIXME */)
+append_args_from_signers (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */)
{
gpgme_error_t err = 0;
int i;
gpg_edit (void *engine, gpgme_key_t key, gpgme_data_t out,
gpgme_ctx_t ctx /* FIXME */)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--with-colons");
static gpgme_error_t
-append_args_from_recipients (GpgObject gpg, gpgme_user_id_t uid)
+append_args_from_recipients (engine_gpg_t gpg, gpgme_user_id_t uid)
{
gpgme_error_t err = 0;
gpg_encrypt (void *engine, gpgme_user_id_t recp, gpgme_data_t plain,
gpgme_data_t ciph, int use_armor)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
int symmetric = !recp;
gpgme_data_t ciph, int use_armor,
gpgme_ctx_t ctx /* FIXME */)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--encrypt");
gpg_export (void *engine, gpgme_user_id_t uids, gpgme_data_t keydata,
int use_armor)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--export");
gpg_genkey (void *engine, gpgme_data_t help_data, int use_armor,
gpgme_data_t pubkey, gpgme_data_t seckey)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
if (!gpg)
static gpgme_error_t
gpg_import (void *engine, gpgme_data_t keydata)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--import");
gpg_keylist (void *engine, const char *pattern, int secret_only,
int keylist_mode)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--with-colons");
gpg_keylist_ext (void *engine, const char *pattern[], int secret_only,
int reserved, int keylist_mode)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
if (reserved)
gpgme_sig_mode_t mode, int use_armor, int use_textmode,
int include_certs, gpgme_ctx_t ctx /* FIXME */)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
if (mode == GPGME_SIG_MODE_CLEAR)
static gpgme_error_t
gpg_trustlist (void *engine, const char *pattern)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--with-colons");
gpg_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
gpgme_data_t plaintext)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpgme_error_t err = 0;
if (plaintext)
static void
gpg_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
{
- GpgObject gpg = engine;
+ engine_gpg_t gpg = engine;
gpg->io_cbs = *io_cbs;
}