From: Marcus Brinkmann Date: Wed, 28 May 2003 01:52:58 +0000 (+0000) Subject: 2003-05-28 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~603 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f6155bcd42513173afc6bb593c97468cb2e8ed00;p=gpgme.git 2003-05-28 Marcus Brinkmann * 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. --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 9b1a17f..10a8e2c 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,28 @@ 2003-05-28 Marcus Brinkmann + * 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. diff --git a/trunk/gpgme/context.h b/trunk/gpgme/context.h index c56e5ac..3942ede 100644 --- a/trunk/gpgme/context.h +++ b/trunk/gpgme/context.h @@ -35,7 +35,7 @@ typedef enum 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 @@ -46,7 +46,7 @@ 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. */ @@ -55,6 +55,7 @@ struct ctx_op_data /* The hook that points to the operation data. */ void *hook; }; +typedef struct ctx_op_data *ctx_op_data_t; /* The context defines an environment in which crypto operations can @@ -65,7 +66,7 @@ struct gpgme_context 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; @@ -87,7 +88,7 @@ struct gpgme_context 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; diff --git a/trunk/gpgme/engine-backend.h b/trunk/gpgme/engine-backend.h index 490a18e..ae7f3ba 100644 --- a/trunk/gpgme/engine-backend.h +++ b/trunk/gpgme/engine-backend.h @@ -37,12 +37,13 @@ struct engine_ops /* 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); diff --git a/trunk/gpgme/engine-gpgsm.c b/trunk/gpgme/engine-gpgsm.c index eb5fd82..1f5105e 100644 --- a/trunk/gpgme/engine-gpgsm.c +++ b/trunk/gpgme/engine-gpgsm.c @@ -70,13 +70,13 @@ struct gpgsm_object_s 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 { @@ -542,7 +542,7 @@ static gpgme_status_code_t parse_status (const char *name); 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; @@ -1051,6 +1051,7 @@ gpgsm_export (void *engine, gpgme_user_id_t uid, gpgme_data_t keydata, cmd[cmdi++] = ' '; strcpy (cmd + cmdi, uid->uid); cmdi += uidlen; + uid = uid->next; } if (err) return err; @@ -1373,7 +1374,7 @@ gpgsm_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text, 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; @@ -1384,7 +1385,7 @@ gpgsm_set_status_handler (void *engine, EngineStatusHandler fnc, 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; diff --git a/trunk/gpgme/engine.c b/trunk/gpgme/engine.c index deee336..1801381 100644 --- a/trunk/gpgme/engine.c +++ b/trunk/gpgme/engine.c @@ -33,7 +33,7 @@ #include "engine-backend.h" -struct engine_object_s +struct engine { struct engine_ops *ops; void *engine; @@ -154,9 +154,9 @@ gpgme_get_engine_info (gpgme_engine_info_t *info) 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; @@ -195,7 +195,7 @@ _gpgme_engine_new (gpgme_protocol_t proto, EngineObject *r_engine) void -_gpgme_engine_release (EngineObject engine) +_gpgme_engine_release (engine_t engine) { if (!engine) return; @@ -207,8 +207,8 @@ _gpgme_engine_release (EngineObject engine) 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; @@ -219,8 +219,9 @@ _gpgme_engine_set_status_handler (EngineObject engine, 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) @@ -233,9 +234,10 @@ _gpgme_engine_set_command_handler (EngineObject 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; @@ -248,7 +250,7 @@ gpgme_error_t _gpgme_engine_set_colon_line_handler (EngineObject engine, } 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) @@ -261,7 +263,7 @@ _gpgme_engine_op_decrypt (EngineObject engine, gpgme_data_t ciph, } 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) @@ -275,7 +277,7 @@ _gpgme_engine_op_delete (EngineObject engine, gpgme_key_t key, 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) @@ -289,7 +291,7 @@ _gpgme_engine_op_edit (EngineObject engine, gpgme_key_t key, gpgme_data_t out, 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) @@ -304,7 +306,7 @@ _gpgme_engine_op_encrypt (EngineObject engine, gpgme_user_id_t recp, 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 */) { @@ -320,7 +322,7 @@ _gpgme_engine_op_encrypt_sign (EngineObject engine, gpgme_user_id_t recp, 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) @@ -334,7 +336,7 @@ _gpgme_engine_op_export (EngineObject engine, gpgme_user_id_t uids, 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) { @@ -350,7 +352,7 @@ _gpgme_engine_op_genkey (EngineObject engine, gpgme_data_t help_data, 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; @@ -363,7 +365,7 @@ _gpgme_engine_op_import (EngineObject engine, gpgme_data_t keydata) 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) @@ -378,7 +380,7 @@ _gpgme_engine_op_keylist (EngineObject engine, const char *pattern, 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) @@ -393,7 +395,7 @@ _gpgme_engine_op_keylist_ext (EngineObject engine, const char *pattern[], 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 */) @@ -410,7 +412,7 @@ _gpgme_engine_op_sign (EngineObject engine, gpgme_data_t in, gpgme_data_t out, 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; @@ -423,7 +425,7 @@ _gpgme_engine_op_trustlist (EngineObject engine, const char *pattern) 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) @@ -437,7 +439,7 @@ _gpgme_engine_op_verify (EngineObject engine, gpgme_data_t sig, 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; @@ -447,7 +449,7 @@ _gpgme_engine_set_io_cbs (EngineObject engine, gpgme_io_cbs_t io_cbs) void -_gpgme_engine_io_event (EngineObject engine, +_gpgme_engine_io_event (engine_t engine, gpgme_event_io_t type, void *type_data) { if (!engine) diff --git a/trunk/gpgme/engine.h b/trunk/gpgme/engine.h index 065c906..d9a71f9 100644 --- a/trunk/gpgme/engine.h +++ b/trunk/gpgme/engine.h @@ -23,81 +23,82 @@ #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 */ diff --git a/trunk/gpgme/op-support.c b/trunk/gpgme/op-support.c index 6a258b9..f104fe3 100644 --- a/trunk/gpgme/op-support.c +++ b/trunk/gpgme/op-support.c @@ -30,7 +30,7 @@ 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; diff --git a/trunk/gpgme/ops.h b/trunk/gpgme/ops.h index 07e602f..f9e1283 100644 --- a/trunk/gpgme/ops.h +++ b/trunk/gpgme/ops.h @@ -46,7 +46,7 @@ gpgme_error_t _gpgme_data_outbound_handler (void *opaque, int fd); /* 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 *)); diff --git a/trunk/gpgme/rungpg.c b/trunk/gpgme/rungpg.c index f9fa4c5..2aaa72c 100644 --- a/trunk/gpgme/rungpg.c +++ b/trunk/gpgme/rungpg.c @@ -83,7 +83,7 @@ struct gpg_object_s char *buffer; size_t readpos; int eof; - EngineStatusHandler fnc; + engine_status_handler_t fnc; void *fnc_value; void *tag; } status; @@ -96,7 +96,7 @@ struct gpg_object_s 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; @@ -113,7 +113,7 @@ struct gpg_object_s 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. */ @@ -402,7 +402,8 @@ gpg_new (void **engine) /* 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; @@ -412,7 +413,7 @@ gpg_set_status_handler (void *engine, EngineStatusHandler fnc, void *fnc_value) /* 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; @@ -473,7 +474,7 @@ command_handler (void *opaque, int fd) 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;