From 83d3b3f449790be314d418eb7edb3d3b0adb01b0 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 30 Jan 2003 23:02:14 +0000 Subject: [PATCH] 2003-01-30 Marcus Brinkmann * types.h: File removed. * Makefile.am (libgpgme_la_SOURCES): Remove types.h. * io.h (struct spawn_fd_item_s): Do not include "types.h". * key.h: Likewise. * context.h: Likewise. * cengine-gpgsm.h: Likewise. * engine.h: Include "gpgme.h" instead "types.h". Add prototypes for EngineStatusHandler, EngineColonLineHandler and EngineCommandHandler. (_gpgme_engine_set_status_handler): Change parameter type from GpgmeStatusHandler to EngineStatusHandler. (_gpgme_engine_set_command_handler): Change parameter type from GpgmeCommandHandler to EngineCommandHandler. (_gpgme_engine_set_colon_line_handler): Change parameter type from GpgmeColonLineHandler to EngineColonLineHandler. * engine-backend.h: Include "engine.h" instead "types.h". (struct engine_ops): Change Gpgme*Handler parameters in members set_command_handler, set_colon_line_handler and set_status_handler to Engine*Handler. * engine.c (_gpgme_engine_set_status_handler): Change parameter type from GpgmeStatusHandler to EngineStatusHandler. (_gpgme_engine_set_command_handler): Change parameter type from GpgmeCommandHandler to EngineCommandHandler. (_gpgme_engine_set_colon_line_handler): Change parameter type from GpgmeColonLineHandler to EngineColonLineHandler. * rungpg.c (struct gpg_object_s): Change type of member status.fnc from GpgmeStatusHandler to EngineStatusHandler. Change type of member colon.fnc from GpgmeColonLineHandler to EngineColonLineHandler. Change type of member cmd.fnc from GpgmeCommandHandler to EngineCommandHandler. * engine-gpgsm.c (struct gpgsm_object_s): Likewise. * rungpg.c (gpg_set_status_handler): Change parameter type from GpgmeStatusHandler to EngineStatusHandler. * engine-gpgsm.c (gpgsm_set_status_handler): Likewise. (assuan_simple_command): Likewise. * rungpg.c (gpg_set_colon_line_handler): Change parameter type from GpgmeColonLineHandler to EngineColonLineHandler. * engine-gpgsm.c (gpgsm_set_colon_line_handler): Likewise. * rungpg.c (gpg_set_command_handler): Change parameter type from GpgmeCommandHandler to EngineCommandHandler. --- gpgme/ChangeLog | 41 +++++++++++++++++++++++++++++++++++++++++ gpgme/Makefile.am | 4 ++-- gpgme/context.h | 1 - gpgme/engine-backend.h | 10 ++++------ gpgme/engine-gpgsm.c | 11 +++++------ gpgme/engine.c | 6 +++--- gpgme/engine.h | 15 +++++++++++---- gpgme/io.h | 39 ++++++++++++++++++--------------------- gpgme/key.h | 3 +-- gpgme/rungpg.c | 12 ++++++------ gpgme/types.h | 35 ----------------------------------- 11 files changed, 91 insertions(+), 86 deletions(-) delete mode 100644 gpgme/types.h diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 2a7e61e..5d1abe9 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,46 @@ 2003-01-30 Marcus Brinkmann + * types.h: File removed. + * Makefile.am (libgpgme_la_SOURCES): Remove types.h. + * io.h (struct spawn_fd_item_s): Do not include "types.h". + * key.h: Likewise. + * context.h: Likewise. + * cengine-gpgsm.h: Likewise. + * engine.h: Include "gpgme.h" instead "types.h". Add prototypes + for EngineStatusHandler, EngineColonLineHandler and + EngineCommandHandler. + (_gpgme_engine_set_status_handler): Change parameter type from + GpgmeStatusHandler to EngineStatusHandler. + (_gpgme_engine_set_command_handler): Change parameter type from + GpgmeCommandHandler to EngineCommandHandler. + (_gpgme_engine_set_colon_line_handler): Change parameter type from + GpgmeColonLineHandler to EngineColonLineHandler. + * engine-backend.h: Include "engine.h" instead "types.h". + (struct engine_ops): Change Gpgme*Handler parameters in members + set_command_handler, set_colon_line_handler and set_status_handler + to Engine*Handler. + * engine.c (_gpgme_engine_set_status_handler): Change parameter + type from GpgmeStatusHandler to EngineStatusHandler. + (_gpgme_engine_set_command_handler): Change parameter type from + GpgmeCommandHandler to EngineCommandHandler. + (_gpgme_engine_set_colon_line_handler): Change parameter type from + GpgmeColonLineHandler to EngineColonLineHandler. + * rungpg.c (struct gpg_object_s): Change type of member status.fnc + from GpgmeStatusHandler to EngineStatusHandler. Change type of + member colon.fnc from GpgmeColonLineHandler to + EngineColonLineHandler. Change type of member cmd.fnc from + GpgmeCommandHandler to EngineCommandHandler. + * engine-gpgsm.c (struct gpgsm_object_s): Likewise. + * rungpg.c (gpg_set_status_handler): Change parameter type from + GpgmeStatusHandler to EngineStatusHandler. + * engine-gpgsm.c (gpgsm_set_status_handler): Likewise. + (assuan_simple_command): Likewise. + * rungpg.c (gpg_set_colon_line_handler): Change parameter type + from GpgmeColonLineHandler to EngineColonLineHandler. + * engine-gpgsm.c (gpgsm_set_colon_line_handler): Likewise. + * rungpg.c (gpg_set_command_handler): Change parameter type from + GpgmeCommandHandler to EngineCommandHandler. + * engine-gpgsm.c (status_handler): Do not close status fd at end of function. diff --git a/gpgme/Makefile.am b/gpgme/Makefile.am index 12d05f1..364897f 100644 --- a/gpgme/Makefile.am +++ b/gpgme/Makefile.am @@ -1,5 +1,5 @@ # Copyright (C) 2000 Werner Koch (dd9jn) -# Copyright (C) 2001, 2002 g10 Code GmbH +# Copyright (C) 2001, 2002, 2003 g10 Code GmbH # # This file is part of GPGME. # @@ -69,7 +69,7 @@ gpgsm_components = endif libgpgme_la_SOURCES = \ - gpgme.h types.h util.h conversion.c context.h ops.h \ + gpgme.h util.h conversion.c context.h ops.h \ data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \ data-compat.c \ recipient.c signers.c \ diff --git a/gpgme/context.h b/gpgme/context.h index 26467ca..a46a292 100644 --- a/gpgme/context.h +++ b/gpgme/context.h @@ -22,7 +22,6 @@ #define CONTEXT_H #include "gpgme.h" -#include "types.h" #include "engine.h" #include "wait.h" diff --git a/gpgme/engine-backend.h b/gpgme/engine-backend.h index c97297d..2a832b3 100644 --- a/gpgme/engine-backend.h +++ b/gpgme/engine-backend.h @@ -20,15 +20,13 @@ #ifndef ENGINE_BACKEND_H #define ENGINE_BACKEND_H -#include "types.h" - +#include "engine.h" /* FIXME: Correct check? */ #ifdef GPGSM_PATH #define ENABLE_GPGSM 1 #endif - struct engine_ops { /* Static functions. */ @@ -39,12 +37,12 @@ struct engine_ops /* Member functions. */ void (*release) (void *engine); - void (*set_status_handler) (void *engine, GpgmeStatusHandler fnc, + void (*set_status_handler) (void *engine, EngineStatusHandler fnc, void *fnc_value); - GpgmeError (*set_command_handler) (void *engine, GpgmeCommandHandler fnc, + GpgmeError (*set_command_handler) (void *engine, EngineCommandHandler fnc, void *fnc_value, GpgmeData data); GpgmeError (*set_colon_line_handler) (void *engine, - GpgmeColonLineHandler fnc, + EngineColonLineHandler fnc, void *fnc_value); GpgmeError (*set_verbosity) (void *engine, int verbosity); GpgmeError (*decrypt) (void *engine, GpgmeData ciph, GpgmeData plain); diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 586bc2c..475d917 100644 --- a/gpgme/engine-gpgsm.c +++ b/gpgme/engine-gpgsm.c @@ -32,7 +32,6 @@ #include "gpgme.h" #include "util.h" -#include "types.h" #include "ops.h" #include "wait.h" #include "io.h" @@ -77,13 +76,13 @@ struct gpgsm_object_s struct { - GpgmeStatusHandler fnc; + EngineStatusHandler fnc; void *fnc_value; } status; struct { - GpgmeColonLineHandler fnc; + EngineColonLineHandler fnc; void *fnc_value; struct { @@ -549,7 +548,7 @@ gpgsm_new (void **engine) static GpgmeStatusCode parse_status (const char *name); static GpgmeError -gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *cmd, GpgmeStatusHandler status_fnc, +gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *cmd, EngineStatusHandler status_fnc, void *status_fnc_value) { AssuanError err; @@ -1391,7 +1390,7 @@ gpgsm_verify (void *engine, GpgmeData sig, GpgmeData signed_text, static void -gpgsm_set_status_handler (void *engine, GpgmeStatusHandler fnc, +gpgsm_set_status_handler (void *engine, EngineStatusHandler fnc, void *fnc_value) { GpgsmObject gpgsm = engine; @@ -1402,7 +1401,7 @@ gpgsm_set_status_handler (void *engine, GpgmeStatusHandler fnc, static GpgmeError -gpgsm_set_colon_line_handler (void *engine, GpgmeColonLineHandler fnc, +gpgsm_set_colon_line_handler (void *engine, EngineColonLineHandler fnc, void *fnc_value) { GpgsmObject gpgsm = engine; diff --git a/gpgme/engine.c b/gpgme/engine.c index fdadef7..f5891b9 100644 --- a/gpgme/engine.c +++ b/gpgme/engine.c @@ -219,7 +219,7 @@ _gpgme_engine_set_verbosity (EngineObject engine, int verbosity) void _gpgme_engine_set_status_handler (EngineObject engine, - GpgmeStatusHandler fnc, void *fnc_value) + EngineStatusHandler fnc, void *fnc_value) { if (!engine) return; @@ -231,7 +231,7 @@ _gpgme_engine_set_status_handler (EngineObject engine, GpgmeError _gpgme_engine_set_command_handler (EngineObject engine, - GpgmeCommandHandler fnc, void *fnc_value, + EngineCommandHandler fnc, void *fnc_value, GpgmeData linked_data) { if (!engine) @@ -245,7 +245,7 @@ _gpgme_engine_set_command_handler (EngineObject engine, } GpgmeError _gpgme_engine_set_colon_line_handler (EngineObject engine, - GpgmeColonLineHandler fnc, + EngineColonLineHandler fnc, void *fnc_value) { if (!engine) diff --git a/gpgme/engine.h b/gpgme/engine.h index a56ec85..25870ba 100644 --- a/gpgme/engine.h +++ b/gpgme/engine.h @@ -21,22 +21,29 @@ #ifndef ENGINE_H #define ENGINE_H -#include "types.h" +#include "gpgme.h" struct engine_object_s; typedef struct engine_object_s *EngineObject; +typedef GpgmeError (*EngineStatusHandler) (void *priv, GpgmeStatusCode code, + char *args); +typedef GpgmeError (*EngineColonLineHandler) (void *priv, char *line); +typedef GpgmeError (*EngineCommandHandler) (void *priv, GpgmeStatusCode code, + const char *keyword, + const char **result); + GpgmeError _gpgme_engine_new (GpgmeProtocol proto, EngineObject *r_engine); void _gpgme_engine_release (EngineObject engine); void _gpgme_engine_set_status_handler (EngineObject engine, - GpgmeStatusHandler fnc, + EngineStatusHandler fnc, void *fnc_value); GpgmeError _gpgme_engine_set_command_handler (EngineObject engine, - GpgmeCommandHandler fnc, + EngineCommandHandler fnc, void *fnc_value, GpgmeData data); GpgmeError _gpgme_engine_set_colon_line_handler (EngineObject engine, - GpgmeColonLineHandler fnc, + EngineColonLineHandler fnc, void *fnc_value); void _gpgme_engine_set_verbosity (EngineObject engine, int verbosity); GpgmeError _gpgme_engine_op_decrypt (EngineObject engine, GpgmeData ciph, diff --git a/gpgme/io.h b/gpgme/io.h index 68d20fd..cb09969 100644 --- a/gpgme/io.h +++ b/gpgme/io.h @@ -1,29 +1,26 @@ /* io.h - Interface to the I/O functions. - * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001, 2002 g10 Code GmbH - * - * This file is part of GPGME. - * - * GPGME is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * GPGME 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 General Public License for more details. - * - * You should have received a copy of the GNU 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 - */ + Copyright (C) 2000 Werner Koch (dd9jn) + Copyright (C) 2001, 2002, 2003 g10 Code GmbH + + This file is part of GPGME. + + GPGME is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + GPGME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef IO_H #define IO_H -#include "types.h" - /* A single file descriptor passed to spawn. For child fds, dup_to specifies the fd it should become in the child. */ struct spawn_fd_item_s diff --git a/gpgme/key.h b/gpgme/key.h index f2c4025..c9e6041 100644 --- a/gpgme/key.h +++ b/gpgme/key.h @@ -1,6 +1,6 @@ /* key.h - Key handling interface. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002 g10 Code GmbH + Copyright (C) 2001, 2002, 2003 g10 Code GmbH This file is part of GPGME. @@ -22,7 +22,6 @@ #define KEY_H #include -#include "types.h" #include "context.h" diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index 2d5a1a7..74723e6 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -83,7 +83,7 @@ struct gpg_object_s char *buffer; size_t readpos; int eof; - GpgmeStatusHandler fnc; + EngineStatusHandler fnc; void *fnc_value; void *tag; } status; @@ -96,7 +96,7 @@ struct gpg_object_s char *buffer; size_t readpos; int eof; - GpgmeColonLineHandler fnc; /* this indicate use of this structrue */ + EngineColonLineHandler fnc; /* this indicate use of this structrue */ void *fnc_value; void *tag; } colon; @@ -113,7 +113,7 @@ struct gpg_object_s GpgmeData cb_data; /* hack to get init the above idx later */ GpgmeStatusCode code; /* last code */ char *keyword; /* what has been requested (malloced) */ - GpgmeCommandHandler fnc; + EngineCommandHandler fnc; void *fnc_value; /* The kludges never end. This is used to couple command handlers with output data in edit key mode. */ @@ -408,7 +408,7 @@ gpg_set_verbosity (void *engine, int verbosity) /* Note, that the status_handler is allowed to modifiy the args value. */ static void -gpg_set_status_handler (void *engine, GpgmeStatusHandler fnc, void *fnc_value) +gpg_set_status_handler (void *engine, EngineStatusHandler fnc, void *fnc_value) { GpgObject gpg = engine; @@ -418,7 +418,7 @@ gpg_set_status_handler (void *engine, GpgmeStatusHandler fnc, void *fnc_value) /* Kludge to process --with-colon output. */ static GpgmeError -gpg_set_colon_line_handler (void *engine, GpgmeColonLineHandler fnc, +gpg_set_colon_line_handler (void *engine, EngineColonLineHandler fnc, void *fnc_value) { GpgObject gpg = engine; @@ -514,7 +514,7 @@ command_cb (void *opaque, char *buffer, size_t length, size_t *nread) match such a second call to a first call, the returned value from the first call is passed as keyword. */ static GpgmeError -gpg_set_command_handler (void *engine, GpgmeCommandHandler fnc, +gpg_set_command_handler (void *engine, EngineCommandHandler fnc, void *fnc_value, GpgmeData linked_data) { GpgObject gpg = engine; diff --git a/gpgme/types.h b/gpgme/types.h deleted file mode 100644 index 8a36c47..0000000 --- a/gpgme/types.h +++ /dev/null @@ -1,35 +0,0 @@ -/* types.h - Type definitions. - Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003 g10 Code GmbH - - This file is part of GPGME. - - GPGME is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GPGME 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 - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GPGME; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef TYPES_H -#define TYPES_H - -#include "gpgme.h" - -/* Declaration of internal objects. */ - -typedef GpgmeError (*GpgmeStatusHandler) (GpgmeCtx, GpgmeStatusCode code, - char *args); -typedef GpgmeError (*GpgmeColonLineHandler) (GpgmeCtx, char *line); -typedef GpgmeError (*GpgmeCommandHandler) (void*, GpgmeStatusCode code, - const char *keyword, const char **result); - - -#endif /* TYPES_H */ -- 2.26.2