2003-01-30 Marcus Brinkmann <marcus@g10code.de>

* 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.
This commit is contained in:
Marcus Brinkmann 2003-01-30 23:02:14 +00:00
parent 7618b28f1d
commit 83d3b3f449
11 changed files with 91 additions and 86 deletions

View File

@ -1,5 +1,46 @@
2003-01-30 Marcus Brinkmann <marcus@g10code.de> 2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* 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 * engine-gpgsm.c (status_handler): Do not close status fd at end
of function. of function.

View File

@ -1,5 +1,5 @@
# Copyright (C) 2000 Werner Koch (dd9jn) # 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. # This file is part of GPGME.
# #
@ -69,7 +69,7 @@ gpgsm_components =
endif endif
libgpgme_la_SOURCES = \ 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.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
data-compat.c \ data-compat.c \
recipient.c signers.c \ recipient.c signers.c \

View File

@ -22,7 +22,6 @@
#define CONTEXT_H #define CONTEXT_H
#include "gpgme.h" #include "gpgme.h"
#include "types.h"
#include "engine.h" #include "engine.h"
#include "wait.h" #include "wait.h"

View File

@ -20,15 +20,13 @@
#ifndef ENGINE_BACKEND_H #ifndef ENGINE_BACKEND_H
#define ENGINE_BACKEND_H #define ENGINE_BACKEND_H
#include "types.h" #include "engine.h"
/* FIXME: Correct check? */ /* FIXME: Correct check? */
#ifdef GPGSM_PATH #ifdef GPGSM_PATH
#define ENABLE_GPGSM 1 #define ENABLE_GPGSM 1
#endif #endif
struct engine_ops struct engine_ops
{ {
/* Static functions. */ /* Static functions. */
@ -39,12 +37,12 @@ struct engine_ops
/* Member functions. */ /* Member functions. */
void (*release) (void *engine); void (*release) (void *engine);
void (*set_status_handler) (void *engine, GpgmeStatusHandler fnc, void (*set_status_handler) (void *engine, EngineStatusHandler fnc,
void *fnc_value); void *fnc_value);
GpgmeError (*set_command_handler) (void *engine, GpgmeCommandHandler fnc, GpgmeError (*set_command_handler) (void *engine, EngineCommandHandler fnc,
void *fnc_value, GpgmeData data); void *fnc_value, GpgmeData data);
GpgmeError (*set_colon_line_handler) (void *engine, GpgmeError (*set_colon_line_handler) (void *engine,
GpgmeColonLineHandler fnc, EngineColonLineHandler fnc,
void *fnc_value); void *fnc_value);
GpgmeError (*set_verbosity) (void *engine, int verbosity); GpgmeError (*set_verbosity) (void *engine, int verbosity);
GpgmeError (*decrypt) (void *engine, GpgmeData ciph, GpgmeData plain); GpgmeError (*decrypt) (void *engine, GpgmeData ciph, GpgmeData plain);

View File

@ -32,7 +32,6 @@
#include "gpgme.h" #include "gpgme.h"
#include "util.h" #include "util.h"
#include "types.h"
#include "ops.h" #include "ops.h"
#include "wait.h" #include "wait.h"
#include "io.h" #include "io.h"
@ -77,13 +76,13 @@ struct gpgsm_object_s
struct struct
{ {
GpgmeStatusHandler fnc; EngineStatusHandler fnc;
void *fnc_value; void *fnc_value;
} status; } status;
struct struct
{ {
GpgmeColonLineHandler fnc; EngineColonLineHandler fnc;
void *fnc_value; void *fnc_value;
struct struct
{ {
@ -549,7 +548,7 @@ gpgsm_new (void **engine)
static GpgmeStatusCode parse_status (const char *name); static GpgmeStatusCode parse_status (const char *name);
static GpgmeError 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) void *status_fnc_value)
{ {
AssuanError err; AssuanError err;
@ -1391,7 +1390,7 @@ gpgsm_verify (void *engine, GpgmeData sig, GpgmeData signed_text,
static void static void
gpgsm_set_status_handler (void *engine, GpgmeStatusHandler fnc, gpgsm_set_status_handler (void *engine, EngineStatusHandler fnc,
void *fnc_value) void *fnc_value)
{ {
GpgsmObject gpgsm = engine; GpgsmObject gpgsm = engine;
@ -1402,7 +1401,7 @@ gpgsm_set_status_handler (void *engine, GpgmeStatusHandler fnc,
static GpgmeError static GpgmeError
gpgsm_set_colon_line_handler (void *engine, GpgmeColonLineHandler fnc, gpgsm_set_colon_line_handler (void *engine, EngineColonLineHandler fnc,
void *fnc_value) void *fnc_value)
{ {
GpgsmObject gpgsm = engine; GpgsmObject gpgsm = engine;

View File

@ -219,7 +219,7 @@ _gpgme_engine_set_verbosity (EngineObject engine, int verbosity)
void void
_gpgme_engine_set_status_handler (EngineObject engine, _gpgme_engine_set_status_handler (EngineObject engine,
GpgmeStatusHandler fnc, void *fnc_value) EngineStatusHandler fnc, void *fnc_value)
{ {
if (!engine) if (!engine)
return; return;
@ -231,7 +231,7 @@ _gpgme_engine_set_status_handler (EngineObject engine,
GpgmeError GpgmeError
_gpgme_engine_set_command_handler (EngineObject engine, _gpgme_engine_set_command_handler (EngineObject engine,
GpgmeCommandHandler fnc, void *fnc_value, EngineCommandHandler fnc, void *fnc_value,
GpgmeData linked_data) GpgmeData linked_data)
{ {
if (!engine) if (!engine)
@ -245,7 +245,7 @@ _gpgme_engine_set_command_handler (EngineObject engine,
} }
GpgmeError _gpgme_engine_set_colon_line_handler (EngineObject engine, GpgmeError _gpgme_engine_set_colon_line_handler (EngineObject engine,
GpgmeColonLineHandler fnc, EngineColonLineHandler fnc,
void *fnc_value) void *fnc_value)
{ {
if (!engine) if (!engine)

View File

@ -21,22 +21,29 @@
#ifndef ENGINE_H #ifndef ENGINE_H
#define ENGINE_H #define ENGINE_H
#include "types.h" #include "gpgme.h"
struct engine_object_s; struct engine_object_s;
typedef struct engine_object_s *EngineObject; 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); GpgmeError _gpgme_engine_new (GpgmeProtocol proto, EngineObject *r_engine);
void _gpgme_engine_release (EngineObject engine); void _gpgme_engine_release (EngineObject engine);
void _gpgme_engine_set_status_handler (EngineObject engine, void _gpgme_engine_set_status_handler (EngineObject engine,
GpgmeStatusHandler fnc, EngineStatusHandler fnc,
void *fnc_value); void *fnc_value);
GpgmeError _gpgme_engine_set_command_handler (EngineObject engine, GpgmeError _gpgme_engine_set_command_handler (EngineObject engine,
GpgmeCommandHandler fnc, EngineCommandHandler fnc,
void *fnc_value, void *fnc_value,
GpgmeData data); GpgmeData data);
GpgmeError _gpgme_engine_set_colon_line_handler (EngineObject engine, GpgmeError _gpgme_engine_set_colon_line_handler (EngineObject engine,
GpgmeColonLineHandler fnc, EngineColonLineHandler fnc,
void *fnc_value); void *fnc_value);
void _gpgme_engine_set_verbosity (EngineObject engine, int verbosity); void _gpgme_engine_set_verbosity (EngineObject engine, int verbosity);
GpgmeError _gpgme_engine_op_decrypt (EngineObject engine, GpgmeData ciph, GpgmeError _gpgme_engine_op_decrypt (EngineObject engine, GpgmeData ciph,

View File

@ -1,29 +1,26 @@
/* io.h - Interface to the I/O functions. /* io.h - Interface to the I/O functions.
* Copyright (C) 2000 Werner Koch (dd9jn) 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. This file is part of GPGME.
*
* GPGME is free software; you can redistribute it and/or modify GPGME is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. (at your option) any later version.
*
* GPGME is distributed in the hope that it will be useful, GPGME is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. General Public License for more details.
*
* You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software along with GPGME; if not, write to the Free Software Foundation,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
*/
#ifndef IO_H #ifndef IO_H
#define IO_H #define IO_H
#include "types.h"
/* A single file descriptor passed to spawn. For child fds, dup_to /* A single file descriptor passed to spawn. For child fds, dup_to
specifies the fd it should become in the child. */ specifies the fd it should become in the child. */
struct spawn_fd_item_s struct spawn_fd_item_s

View File

@ -1,6 +1,6 @@
/* key.h - Key handling interface. /* key.h - Key handling interface.
Copyright (C) 2000 Werner Koch (dd9jn) 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. This file is part of GPGME.
@ -22,7 +22,6 @@
#define KEY_H #define KEY_H
#include <time.h> #include <time.h>
#include "types.h"
#include "context.h" #include "context.h"

View File

@ -83,7 +83,7 @@ struct gpg_object_s
char *buffer; char *buffer;
size_t readpos; size_t readpos;
int eof; int eof;
GpgmeStatusHandler fnc; EngineStatusHandler fnc;
void *fnc_value; void *fnc_value;
void *tag; void *tag;
} status; } status;
@ -96,7 +96,7 @@ struct gpg_object_s
char *buffer; char *buffer;
size_t readpos; size_t readpos;
int eof; int eof;
GpgmeColonLineHandler fnc; /* this indicate use of this structrue */ EngineColonLineHandler fnc; /* this indicate use of this structrue */
void *fnc_value; void *fnc_value;
void *tag; void *tag;
} colon; } colon;
@ -113,7 +113,7 @@ struct gpg_object_s
GpgmeData cb_data; /* hack to get init the above idx later */ GpgmeData cb_data; /* hack to get init the above idx later */
GpgmeStatusCode code; /* last code */ GpgmeStatusCode code; /* last code */
char *keyword; /* what has been requested (malloced) */ char *keyword; /* what has been requested (malloced) */
GpgmeCommandHandler fnc; EngineCommandHandler fnc;
void *fnc_value; void *fnc_value;
/* The kludges never end. This is used to couple command handlers /* The kludges never end. This is used to couple command handlers
with output data in edit key mode. */ 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 /* Note, that the status_handler is allowed to modifiy the args
value. */ value. */
static void 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; GpgObject gpg = engine;
@ -418,7 +418,7 @@ gpg_set_status_handler (void *engine, GpgmeStatusHandler fnc, void *fnc_value)
/* Kludge to process --with-colon output. */ /* Kludge to process --with-colon output. */
static GpgmeError static GpgmeError
gpg_set_colon_line_handler (void *engine, GpgmeColonLineHandler fnc, gpg_set_colon_line_handler (void *engine, EngineColonLineHandler fnc,
void *fnc_value) void *fnc_value)
{ {
GpgObject gpg = engine; 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 match such a second call to a first call, the returned value from
the first call is passed as keyword. */ the first call is passed as keyword. */
static GpgmeError static GpgmeError
gpg_set_command_handler (void *engine, GpgmeCommandHandler fnc, gpg_set_command_handler (void *engine, EngineCommandHandler fnc,
void *fnc_value, GpgmeData linked_data) void *fnc_value, GpgmeData linked_data)
{ {
GpgObject gpg = engine; GpgObject gpg = engine;

View File

@ -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 */