2003-05-28 Marcus Brinkmann <marcus@g10code.de>
+ * context.h (struct gpgme_context): Change EngineObject to
+ engine_object_t.
+ (enum ctx_op_data_type): Rename to ctx_op_data_id_t.
+ (ctx_op_data_t): New type.
+ (struct gpgme_context): Use it.
+ * ops.h (_gpgme_op_data_lookup): Use new type name.
+ * op-support.c (_gpgme_op_data_lookup): Likewise.
+ * engine.c: Rename EngineObject to engine_t in the file. Also
+ EngineStatusHandler to engine_status_handler_t,
+ EngineCommandHandler to engine_command_handler_t and
+ EngineColonLineHandler to engine_colon_line_handler.
+ * rungpg.c (start): Likewise.
+ * engine-gpgsm.c: Likewise.
+ * engine-backend.h (struct engine_ops): Likewise
+ * engine.h (struct engine_object_s): Rename to struct engine.
+ (EngineObject): Rename to engine_t. Also everywhere else in the
+ file.
+ (EngineStatusHandler): Rename to engine_status_handler_t.
+ (EngineColonLineHandler): Rename to engine_colon_line_handler_t.
+ (EngineCommandHandler): Rename to engine_command_handler_t.
+
+ * engine-gpgsm.c (gpgsm_export): Fix bug in last change.
+
* Makefile.am (libgpgme_la_SOURCES): Remove recipient.c, add
user-id.c.
* gpgme.h (gpgme_recipients_t): Removed.
OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
OPDATA_VERIFY, OPDATA_TRUSTLIST
- } ctx_op_data_type;
+ } ctx_op_data_id_t;
struct ctx_op_data
/* The type of the hook data, which can be used by a routine to
lookup the hook data. */
- ctx_op_data_type type;
+ ctx_op_data_id_t type;
/* The function to release HOOK and all its associated resources.
Can be NULL if no special dealllocation routine is necessary. */
/* The hook that points to the operation data. */
void *hook;
};
+typedef struct ctx_op_data *ctx_op_data_t;
\f
/* The context defines an environment in which crypto operations can
gpgme_protocol_t protocol;
/* The running engine process. */
- EngineObject engine;
+ engine_t engine;
/* True if armor mode should be used. */
unsigned int use_armor : 1;
gpgme_key_t *signers;
/* The operation data hooked into the context. */
- struct ctx_op_data *op_data;
+ ctx_op_data_t op_data;
/* The user provided passphrase callback and its hook value. */
gpgme_passphrase_cb_t passphrase_cb;
/* Member functions. */
void (*release) (void *engine);
- void (*set_status_handler) (void *engine, EngineStatusHandler fnc,
+ void (*set_status_handler) (void *engine, engine_status_handler_t fnc,
void *fnc_value);
- gpgme_error_t (*set_command_handler) (void *engine, EngineCommandHandler fnc,
+ gpgme_error_t (*set_command_handler) (void *engine,
+ engine_command_handler_t fnc,
void *fnc_value, gpgme_data_t data);
gpgme_error_t (*set_colon_line_handler) (void *engine,
- EngineColonLineHandler fnc,
+ engine_colon_line_handler_t fnc,
void *fnc_value);
gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,
gpgme_data_t plain);
struct
{
- EngineStatusHandler fnc;
+ engine_status_handler_t fnc;
void *fnc_value;
} status;
struct
{
- EngineColonLineHandler fnc;
+ engine_colon_line_handler_t fnc;
void *fnc_value;
struct
{
static gpgme_error_t
gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *cmd,
- EngineStatusHandler status_fnc,
+ engine_status_handler_t status_fnc,
void *status_fnc_value)
{
AssuanError err;
cmd[cmdi++] = ' ';
strcpy (cmd + cmdi, uid->uid);
cmdi += uidlen;
+ uid = uid->next;
}
if (err)
return err;
static void
-gpgsm_set_status_handler (void *engine, EngineStatusHandler fnc,
+gpgsm_set_status_handler (void *engine, engine_status_handler_t fnc,
void *fnc_value)
{
GpgsmObject gpgsm = engine;
static gpgme_error_t
-gpgsm_set_colon_line_handler (void *engine, EngineColonLineHandler fnc,
+gpgsm_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc,
void *fnc_value)
{
GpgsmObject gpgsm = engine;
#include "engine-backend.h"
-struct engine_object_s
+struct engine
{
struct engine_ops *ops;
void *engine;
\f
gpgme_error_t
-_gpgme_engine_new (gpgme_protocol_t proto, EngineObject *r_engine)
+_gpgme_engine_new (gpgme_protocol_t proto, engine_t *r_engine)
{
- EngineObject engine;
+ engine_t engine;
const char *file_name;
const char *version;
void
-_gpgme_engine_release (EngineObject engine)
+_gpgme_engine_release (engine_t engine)
{
if (!engine)
return;
void
-_gpgme_engine_set_status_handler (EngineObject engine,
- EngineStatusHandler fnc, void *fnc_value)
+_gpgme_engine_set_status_handler (engine_t engine,
+ engine_status_handler_t fnc, void *fnc_value)
{
if (!engine)
return;
gpgme_error_t
-_gpgme_engine_set_command_handler (EngineObject engine,
- EngineCommandHandler fnc, void *fnc_value,
+_gpgme_engine_set_command_handler (engine_t engine,
+ engine_command_handler_t fnc,
+ void *fnc_value,
gpgme_data_t linked_data)
{
if (!engine)
fnc, fnc_value, linked_data);
}
-gpgme_error_t _gpgme_engine_set_colon_line_handler (EngineObject engine,
- EngineColonLineHandler fnc,
- void *fnc_value)
+gpgme_error_t
+_gpgme_engine_set_colon_line_handler (engine_t engine,
+ engine_colon_line_handler_t fnc,
+ void *fnc_value)
{
if (!engine)
return GPGME_Invalid_Value;
}
gpgme_error_t
-_gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph,
+_gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph,
gpgme_data_t plain)
{
if (!engine)
}
gpgme_error_t
-_gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key,
+_gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
int allow_secret)
{
if (!engine)
gpgme_error_t
-_gpgme_engine_op_edit (EngineObject engine, gpgme_key_t key, gpgme_data_t out,
+_gpgme_engine_op_edit (engine_t engine, gpgme_key_t key, gpgme_data_t out,
gpgme_ctx_t ctx /* FIXME */)
{
if (!engine)
gpgme_error_t
-_gpgme_engine_op_encrypt (EngineObject engine, gpgme_user_id_t recp,
+_gpgme_engine_op_encrypt (engine_t engine, gpgme_user_id_t recp,
gpgme_data_t plain, gpgme_data_t ciph, int use_armor)
{
if (!engine)
gpgme_error_t
-_gpgme_engine_op_encrypt_sign (EngineObject engine, gpgme_user_id_t recp,
+_gpgme_engine_op_encrypt_sign (engine_t engine, gpgme_user_id_t recp,
gpgme_data_t plain, gpgme_data_t ciph,
int use_armor, gpgme_ctx_t ctx /* FIXME */)
{
gpgme_error_t
-_gpgme_engine_op_export (EngineObject engine, gpgme_user_id_t uids,
+_gpgme_engine_op_export (engine_t engine, gpgme_user_id_t uids,
gpgme_data_t keydata, int use_armor)
{
if (!engine)
gpgme_error_t
-_gpgme_engine_op_genkey (EngineObject engine, gpgme_data_t help_data,
+_gpgme_engine_op_genkey (engine_t engine, gpgme_data_t help_data,
int use_armor, gpgme_data_t pubkey,
gpgme_data_t seckey)
{
gpgme_error_t
-_gpgme_engine_op_import (EngineObject engine, gpgme_data_t keydata)
+_gpgme_engine_op_import (engine_t engine, gpgme_data_t keydata)
{
if (!engine)
return GPGME_Invalid_Value;
gpgme_error_t
-_gpgme_engine_op_keylist (EngineObject engine, const char *pattern,
+_gpgme_engine_op_keylist (engine_t engine, const char *pattern,
int secret_only, int keylist_mode)
{
if (!engine)
gpgme_error_t
-_gpgme_engine_op_keylist_ext (EngineObject engine, const char *pattern[],
+_gpgme_engine_op_keylist_ext (engine_t engine, const char *pattern[],
int secret_only, int reserved, int keylist_mode)
{
if (!engine)
gpgme_error_t
-_gpgme_engine_op_sign (EngineObject engine, gpgme_data_t in, gpgme_data_t out,
+_gpgme_engine_op_sign (engine_t engine, gpgme_data_t in, gpgme_data_t out,
gpgme_sig_mode_t mode, int use_armor,
int use_textmode, int include_certs,
gpgme_ctx_t ctx /* FIXME */)
gpgme_error_t
-_gpgme_engine_op_trustlist (EngineObject engine, const char *pattern)
+_gpgme_engine_op_trustlist (engine_t engine, const char *pattern)
{
if (!engine)
return GPGME_Invalid_Value;
gpgme_error_t
-_gpgme_engine_op_verify (EngineObject engine, gpgme_data_t sig,
+_gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
gpgme_data_t signed_text, gpgme_data_t plaintext)
{
if (!engine)
void
-_gpgme_engine_set_io_cbs (EngineObject engine, gpgme_io_cbs_t io_cbs)
+_gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs)
{
if (!engine)
return;
void
-_gpgme_engine_io_event (EngineObject engine,
+_gpgme_engine_io_event (engine_t engine,
gpgme_event_io_t type, void *type_data)
{
if (!engine)
#include "gpgme.h"
-struct engine_object_s;
-typedef struct engine_object_s *EngineObject;
+struct engine;
+typedef struct engine *engine_t;
-typedef gpgme_error_t (*EngineStatusHandler) (void *priv,
- gpgme_status_code_t code,
- char *args);
-typedef gpgme_error_t (*EngineColonLineHandler) (void *priv, char *line);
-typedef gpgme_error_t (*EngineCommandHandler) (void *priv,
- gpgme_status_code_t code,
- const char *keyword,
- int fd);
+typedef gpgme_error_t (*engine_status_handler_t) (void *priv,
+ gpgme_status_code_t code,
+ char *args);
+typedef gpgme_error_t (*engine_colon_line_handler_t) (void *priv, char *line);
+typedef gpgme_error_t (*engine_command_handler_t) (void *priv,
+ gpgme_status_code_t code,
+ const char *keyword,
+ int fd);
gpgme_error_t _gpgme_engine_new (gpgme_protocol_t proto,
- EngineObject *r_engine);
-void _gpgme_engine_release (EngineObject engine);
-void _gpgme_engine_set_status_handler (EngineObject engine,
- EngineStatusHandler fnc,
+ engine_t *r_engine);
+void _gpgme_engine_release (engine_t engine);
+void _gpgme_engine_set_status_handler (engine_t engine,
+ engine_status_handler_t fnc,
void *fnc_value);
-gpgme_error_t _gpgme_engine_set_command_handler (EngineObject engine,
- EngineCommandHandler fnc,
- void *fnc_value,
- gpgme_data_t data);
-gpgme_error_t _gpgme_engine_set_colon_line_handler (EngineObject engine,
- EngineColonLineHandler fnc,
- void *fnc_value);
-gpgme_error_t _gpgme_engine_op_decrypt (EngineObject engine,
+gpgme_error_t _gpgme_engine_set_command_handler (engine_t engine,
+ engine_command_handler_t fnc,
+ void *fnc_value,
+ gpgme_data_t data);
+gpgme_error_t
+_gpgme_engine_set_colon_line_handler (engine_t engine,
+ engine_colon_line_handler_t fnc,
+ void *fnc_value);
+gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine,
gpgme_data_t ciph,
gpgme_data_t plain);
-gpgme_error_t _gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key,
+gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
int allow_secret);
-gpgme_error_t _gpgme_engine_op_edit (EngineObject engine, gpgme_key_t key,
+gpgme_error_t _gpgme_engine_op_edit (engine_t engine, gpgme_key_t key,
gpgme_data_t out,
gpgme_ctx_t ctx /* FIXME */);
-gpgme_error_t _gpgme_engine_op_encrypt (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_encrypt (engine_t engine,
gpgme_user_id_t recp,
gpgme_data_t plain, gpgme_data_t ciph,
int use_armor);
-gpgme_error_t _gpgme_engine_op_encrypt_sign (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_encrypt_sign (engine_t engine,
gpgme_user_id_t recp,
gpgme_data_t plain,
gpgme_data_t ciph,
int use_armor,
gpgme_ctx_t ctx /* FIXME */);
-gpgme_error_t _gpgme_engine_op_export (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_export (engine_t engine,
gpgme_user_id_t uids,
gpgme_data_t keydata, int use_armor);
-gpgme_error_t _gpgme_engine_op_genkey (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_genkey (engine_t engine,
gpgme_data_t help_data,
int use_armor, gpgme_data_t pubkey,
gpgme_data_t seckey);
-gpgme_error_t _gpgme_engine_op_import (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_import (engine_t engine,
gpgme_data_t keydata);
-gpgme_error_t _gpgme_engine_op_keylist (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_keylist (engine_t engine,
const char *pattern,
int secret_only,
int keylist_mode);
-gpgme_error_t _gpgme_engine_op_keylist_ext (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
const char *pattern[],
int secret_only,
int reserved,
int keylist_mode);
-gpgme_error_t _gpgme_engine_op_sign (EngineObject engine, gpgme_data_t in,
+gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
gpgme_data_t out, gpgme_sig_mode_t mode,
int use_armor, int use_textmode,
int include_certs,
gpgme_ctx_t ctx /* FIXME */);
-gpgme_error_t _gpgme_engine_op_trustlist (EngineObject engine,
+gpgme_error_t _gpgme_engine_op_trustlist (engine_t engine,
const char *pattern);
-gpgme_error_t _gpgme_engine_op_verify (EngineObject engine, gpgme_data_t sig,
+gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
gpgme_data_t signed_text,
gpgme_data_t plaintext);
-void _gpgme_engine_set_io_cbs (EngineObject engine,
+void _gpgme_engine_set_io_cbs (engine_t engine,
gpgme_io_cbs_t io_cbs);
-void _gpgme_engine_io_event (EngineObject engine,
+void _gpgme_engine_io_event (engine_t engine,
gpgme_event_io_t type, void *type_data);
#endif /* ENGINE_H */
\f
gpgme_error_t
-_gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_type type, void **hook,
+_gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type, void **hook,
int size, void (*cleanup) (void *))
{
struct ctx_op_data *data = ctx->op_data;
/* From op-support.c. */
/* Find or create the op data object of type TYPE. */
-gpgme_error_t _gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_type type,
+gpgme_error_t _gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type,
void **hook, int size,
void (*cleanup) (void *));
char *buffer;
size_t readpos;
int eof;
- EngineStatusHandler fnc;
+ engine_status_handler_t fnc;
void *fnc_value;
void *tag;
} status;
char *buffer;
size_t readpos;
int eof;
- EngineColonLineHandler fnc; /* this indicate use of this structrue */
+ engine_colon_line_handler_t fnc; /* this indicate use of this structrue */
void *fnc_value;
void *tag;
} colon;
int idx; /* Index in fd_data_map */
gpgme_status_code_t code; /* last code */
char *keyword; /* what has been requested (malloced) */
- EngineCommandHandler fnc;
+ engine_command_handler_t fnc;
void *fnc_value;
/* The kludges never end. This is used to couple command handlers
with output data in edit key mode. */
/* Note, that the status_handler is allowed to modifiy the args
value. */
static void
-gpg_set_status_handler (void *engine, EngineStatusHandler fnc, void *fnc_value)
+gpg_set_status_handler (void *engine, engine_status_handler_t fnc,
+ void *fnc_value)
{
GpgObject gpg = engine;
/* Kludge to process --with-colon output. */
static gpgme_error_t
-gpg_set_colon_line_handler (void *engine, EngineColonLineHandler fnc,
+gpg_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc,
void *fnc_value)
{
GpgObject gpg = engine;
match such a second call to a first call, the returned value from
the first call is passed as keyword. */
static gpgme_error_t
-gpg_set_command_handler (void *engine, EngineCommandHandler fnc,
+gpg_set_command_handler (void *engine, engine_command_handler_t fnc,
void *fnc_value, gpgme_data_t linked_data)
{
GpgObject gpg = engine;