gpgme/src/wait-user.c

134 lines
3.2 KiB
C
Raw Normal View History

/* wait-user.c
* Copyright (C) 2000 Werner Koch (dd9jn)
* Copyright (C) 2001, 2002, 2003, 2004, 2005 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 Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <https://gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <assert.h>
#include "gpgme.h"
#include "context.h"
#include "priv-io.h"
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
#include "wait.h"
#include "ops.h"
#include "debug.h"
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
/* The user event loops are used for all asynchronous operations for
which a user callback is defined. */
/* Internal I/O Callbacks. */
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_error_t
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
_gpgme_user_io_cb_handler (void *data, int fd)
{
gpgme_error_t err = 0;
2009-10-26 Marcus Brinkmann <marcus@g10code.de> * configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0 was development versions only. tests/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * opassuan/t-command.c: Update to new interface. src/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * gpgme.h.in (struct gpgme_io_event_done_data) (gpgme_io_event_done_data_t): New types. (struct _gpgme_op_assuan_result): Deprecate the err member. (gpgme_op_assuan_result): Deprecate (for now). (gpgme_op_assuan_transact_ext): New prototype. (gpgme_op_assuan_transact): Deprecate. (struct _gpgme_op_g13_result): Replace with ... (struct _gpgme_op_vfs_mount_result): ... this. (gpgme_op_g13_mount): Replace with ... (gpgme_op_vfs_mount): ... this. * gpgme.def (gpgme_op_assuan_transact_ext, gpgme_wait_ext) (gpgme_op_vfs_mount_result, gpgme_op_vfs_mount): New. (gpgme_op_g13_mount): Remove. * libgpgme.vers: Likewise. * engine-backend.h (struct engine_ops): Remove RESULT_CB and RESULT_CB_VALUE args in opassuan_transact member. Add CANCEL_OP member. * ops.h (_gpgme_cancel_with_err, _gpgme_wait_on_condition): Add OP_ERR argument. (_gpgme_wait_one_ext): New prototype. * context.h (ctx_op_data_id_t): Add OPDATA_VFS_MOUNT. * engine-g13.c (g13_cancel_op): New function. (parse_status): Remove declaration. (g13_assuan_simple_command): Do nothing with status lines for now. (status_handler): Update opaque value access. (_gpgme_engine_ops_g13): Add new cancel_op member. * gpgme.c (_gpgme_cancel_with_err): Add new parameter OP_ERR. Handle operational errors. (gpgme_cancel, gpgme_io_read, gpgme_io_write): Add debug output. * data.c (_gpgme_data_inbound_handler) (_gpgme_data_outbound_handler): Adjust opaque value access. * engine-gpg.c (command_handler, status_handler) (colon_line_handler): Likewise. * engine-gpgsm.c (status_handler): Likewise. * engine-gpg.c (_gpgme_engine_ops_gpg): Add cancel_op member. * engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise. * g13.c: Rewritten (and will be rewritten again). * engine.h (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameters from prototype. (_gpgme_engine_cancel_op): New prototype. * engine.c (engine_ops) [! ENABLE_ASSUAN]: Add missing comma. (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameter. (_gpgme_engine_cancel_op): New function. * wait.h (_gpgme_run_io_cb): Add new argument OP_ERR. (struct io_cb_data): New struct to pass opaque data and get a op_err return value. Needed because we can't modify I/O callback handler signature because it is exposed to the user. * wait.c (_gpgme_run_io_cb): Add OP_ERR parameter. Handle operational errors. * wait-user.c (_gpgme_user_io_cb_handler): Handle operational errors. * wait-private.c (_gpgme_wait_on_condition): New argument to retrieve the operational result. Handle operational errors in session based protocols. (_gpgme_wait_one_ext): New function. (_gpgme_wait_one): Pass argument in invocation of _gpgme_wait_on_condition. * wait-global.c (struct ctx_list_item): Add member OP_ERR. (ctx_done): New argument OP_ERR. (ctx_wait): New argument OP_ERR. (gpgme_wait_ext): New function based on gpgme_wait but handling operational errors. (gpgme_wait): Implement in term of gpgme_wait_ext. * keylist.c (gpgme_op_keylist_next): Pass argument in invocation of _gpgme_wait_on_condition. * trustlist.c (gpgme_op_trustlist_next): Pass argument in invocation of _gpgme_wait_on_condition. * engine-assuan.c (struct engine_llass): Replace members RESULT_CB and RESULT_CB_VALUE by LAST_OP_ERR. (_gpgme_engine_assuan_last_op_err): Add this hack function. (llass_cancel_op): New function. (_gpgme_engine_llass_ops): Add cancel_op member. (llass_status_handler): Update opaque value access. (llass_transact): Remove RESULT_CB and RESULT_CB_VALUE arguments. * opassuan.c: Move compat hacks to the end of file. (opassuan_start): Do not set OPD->result.err. Do not pass RESULT_Cb and CTX to _gpgme_engine_op_assuan_transact. (gpgme_op_assuan_transact_ext): New function.
2009-10-26 18:52:32 +00:00
gpgme_error_t op_err = 0;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
struct tag *tag = (struct tag *) data;
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_ctx_t ctx;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
(void)fd;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
assert (data);
ctx = tag->ctx;
assert (ctx);
LOCK (ctx->lock);
if (ctx->canceled)
err = gpg_error (GPG_ERR_CANCELED);
UNLOCK (ctx->lock);
if (! err)
2009-10-26 Marcus Brinkmann <marcus@g10code.de> * configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0 was development versions only. tests/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * opassuan/t-command.c: Update to new interface. src/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * gpgme.h.in (struct gpgme_io_event_done_data) (gpgme_io_event_done_data_t): New types. (struct _gpgme_op_assuan_result): Deprecate the err member. (gpgme_op_assuan_result): Deprecate (for now). (gpgme_op_assuan_transact_ext): New prototype. (gpgme_op_assuan_transact): Deprecate. (struct _gpgme_op_g13_result): Replace with ... (struct _gpgme_op_vfs_mount_result): ... this. (gpgme_op_g13_mount): Replace with ... (gpgme_op_vfs_mount): ... this. * gpgme.def (gpgme_op_assuan_transact_ext, gpgme_wait_ext) (gpgme_op_vfs_mount_result, gpgme_op_vfs_mount): New. (gpgme_op_g13_mount): Remove. * libgpgme.vers: Likewise. * engine-backend.h (struct engine_ops): Remove RESULT_CB and RESULT_CB_VALUE args in opassuan_transact member. Add CANCEL_OP member. * ops.h (_gpgme_cancel_with_err, _gpgme_wait_on_condition): Add OP_ERR argument. (_gpgme_wait_one_ext): New prototype. * context.h (ctx_op_data_id_t): Add OPDATA_VFS_MOUNT. * engine-g13.c (g13_cancel_op): New function. (parse_status): Remove declaration. (g13_assuan_simple_command): Do nothing with status lines for now. (status_handler): Update opaque value access. (_gpgme_engine_ops_g13): Add new cancel_op member. * gpgme.c (_gpgme_cancel_with_err): Add new parameter OP_ERR. Handle operational errors. (gpgme_cancel, gpgme_io_read, gpgme_io_write): Add debug output. * data.c (_gpgme_data_inbound_handler) (_gpgme_data_outbound_handler): Adjust opaque value access. * engine-gpg.c (command_handler, status_handler) (colon_line_handler): Likewise. * engine-gpgsm.c (status_handler): Likewise. * engine-gpg.c (_gpgme_engine_ops_gpg): Add cancel_op member. * engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise. * g13.c: Rewritten (and will be rewritten again). * engine.h (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameters from prototype. (_gpgme_engine_cancel_op): New prototype. * engine.c (engine_ops) [! ENABLE_ASSUAN]: Add missing comma. (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameter. (_gpgme_engine_cancel_op): New function. * wait.h (_gpgme_run_io_cb): Add new argument OP_ERR. (struct io_cb_data): New struct to pass opaque data and get a op_err return value. Needed because we can't modify I/O callback handler signature because it is exposed to the user. * wait.c (_gpgme_run_io_cb): Add OP_ERR parameter. Handle operational errors. * wait-user.c (_gpgme_user_io_cb_handler): Handle operational errors. * wait-private.c (_gpgme_wait_on_condition): New argument to retrieve the operational result. Handle operational errors in session based protocols. (_gpgme_wait_one_ext): New function. (_gpgme_wait_one): Pass argument in invocation of _gpgme_wait_on_condition. * wait-global.c (struct ctx_list_item): Add member OP_ERR. (ctx_done): New argument OP_ERR. (ctx_wait): New argument OP_ERR. (gpgme_wait_ext): New function based on gpgme_wait but handling operational errors. (gpgme_wait): Implement in term of gpgme_wait_ext. * keylist.c (gpgme_op_keylist_next): Pass argument in invocation of _gpgme_wait_on_condition. * trustlist.c (gpgme_op_trustlist_next): Pass argument in invocation of _gpgme_wait_on_condition. * engine-assuan.c (struct engine_llass): Replace members RESULT_CB and RESULT_CB_VALUE by LAST_OP_ERR. (_gpgme_engine_assuan_last_op_err): Add this hack function. (llass_cancel_op): New function. (_gpgme_engine_llass_ops): Add cancel_op member. (llass_status_handler): Update opaque value access. (llass_transact): Remove RESULT_CB and RESULT_CB_VALUE arguments. * opassuan.c: Move compat hacks to the end of file. (opassuan_start): Do not set OPD->result.err. Do not pass RESULT_Cb and CTX to _gpgme_engine_op_assuan_transact. (gpgme_op_assuan_transact_ext): New function.
2009-10-26 18:52:32 +00:00
err = _gpgme_run_io_cb (&ctx->fdt.fds[tag->idx], 0, &op_err);
if (err || op_err)
_gpgme_cancel_with_err (ctx, err, op_err);
else
{
unsigned int i;
for (i = 0; i < ctx->fdt.size; i++)
if (ctx->fdt.fds[i].fd != -1)
break;
2009-10-26 Marcus Brinkmann <marcus@g10code.de> * configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0 was development versions only. tests/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * opassuan/t-command.c: Update to new interface. src/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * gpgme.h.in (struct gpgme_io_event_done_data) (gpgme_io_event_done_data_t): New types. (struct _gpgme_op_assuan_result): Deprecate the err member. (gpgme_op_assuan_result): Deprecate (for now). (gpgme_op_assuan_transact_ext): New prototype. (gpgme_op_assuan_transact): Deprecate. (struct _gpgme_op_g13_result): Replace with ... (struct _gpgme_op_vfs_mount_result): ... this. (gpgme_op_g13_mount): Replace with ... (gpgme_op_vfs_mount): ... this. * gpgme.def (gpgme_op_assuan_transact_ext, gpgme_wait_ext) (gpgme_op_vfs_mount_result, gpgme_op_vfs_mount): New. (gpgme_op_g13_mount): Remove. * libgpgme.vers: Likewise. * engine-backend.h (struct engine_ops): Remove RESULT_CB and RESULT_CB_VALUE args in opassuan_transact member. Add CANCEL_OP member. * ops.h (_gpgme_cancel_with_err, _gpgme_wait_on_condition): Add OP_ERR argument. (_gpgme_wait_one_ext): New prototype. * context.h (ctx_op_data_id_t): Add OPDATA_VFS_MOUNT. * engine-g13.c (g13_cancel_op): New function. (parse_status): Remove declaration. (g13_assuan_simple_command): Do nothing with status lines for now. (status_handler): Update opaque value access. (_gpgme_engine_ops_g13): Add new cancel_op member. * gpgme.c (_gpgme_cancel_with_err): Add new parameter OP_ERR. Handle operational errors. (gpgme_cancel, gpgme_io_read, gpgme_io_write): Add debug output. * data.c (_gpgme_data_inbound_handler) (_gpgme_data_outbound_handler): Adjust opaque value access. * engine-gpg.c (command_handler, status_handler) (colon_line_handler): Likewise. * engine-gpgsm.c (status_handler): Likewise. * engine-gpg.c (_gpgme_engine_ops_gpg): Add cancel_op member. * engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise. * g13.c: Rewritten (and will be rewritten again). * engine.h (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameters from prototype. (_gpgme_engine_cancel_op): New prototype. * engine.c (engine_ops) [! ENABLE_ASSUAN]: Add missing comma. (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameter. (_gpgme_engine_cancel_op): New function. * wait.h (_gpgme_run_io_cb): Add new argument OP_ERR. (struct io_cb_data): New struct to pass opaque data and get a op_err return value. Needed because we can't modify I/O callback handler signature because it is exposed to the user. * wait.c (_gpgme_run_io_cb): Add OP_ERR parameter. Handle operational errors. * wait-user.c (_gpgme_user_io_cb_handler): Handle operational errors. * wait-private.c (_gpgme_wait_on_condition): New argument to retrieve the operational result. Handle operational errors in session based protocols. (_gpgme_wait_one_ext): New function. (_gpgme_wait_one): Pass argument in invocation of _gpgme_wait_on_condition. * wait-global.c (struct ctx_list_item): Add member OP_ERR. (ctx_done): New argument OP_ERR. (ctx_wait): New argument OP_ERR. (gpgme_wait_ext): New function based on gpgme_wait but handling operational errors. (gpgme_wait): Implement in term of gpgme_wait_ext. * keylist.c (gpgme_op_keylist_next): Pass argument in invocation of _gpgme_wait_on_condition. * trustlist.c (gpgme_op_trustlist_next): Pass argument in invocation of _gpgme_wait_on_condition. * engine-assuan.c (struct engine_llass): Replace members RESULT_CB and RESULT_CB_VALUE by LAST_OP_ERR. (_gpgme_engine_assuan_last_op_err): Add this hack function. (llass_cancel_op): New function. (_gpgme_engine_llass_ops): Add cancel_op member. (llass_status_handler): Update opaque value access. (llass_transact): Remove RESULT_CB and RESULT_CB_VALUE arguments. * opassuan.c: Move compat hacks to the end of file. (opassuan_start): Do not set OPD->result.err. Do not pass RESULT_Cb and CTX to _gpgme_engine_op_assuan_transact. (gpgme_op_assuan_transact_ext): New function.
2009-10-26 18:52:32 +00:00
if (i == ctx->fdt.size)
2009-10-26 Marcus Brinkmann <marcus@g10code.de> * configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0 was development versions only. tests/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * opassuan/t-command.c: Update to new interface. src/ 2009-10-26 Marcus Brinkmann <marcus@g10code.de> * gpgme.h.in (struct gpgme_io_event_done_data) (gpgme_io_event_done_data_t): New types. (struct _gpgme_op_assuan_result): Deprecate the err member. (gpgme_op_assuan_result): Deprecate (for now). (gpgme_op_assuan_transact_ext): New prototype. (gpgme_op_assuan_transact): Deprecate. (struct _gpgme_op_g13_result): Replace with ... (struct _gpgme_op_vfs_mount_result): ... this. (gpgme_op_g13_mount): Replace with ... (gpgme_op_vfs_mount): ... this. * gpgme.def (gpgme_op_assuan_transact_ext, gpgme_wait_ext) (gpgme_op_vfs_mount_result, gpgme_op_vfs_mount): New. (gpgme_op_g13_mount): Remove. * libgpgme.vers: Likewise. * engine-backend.h (struct engine_ops): Remove RESULT_CB and RESULT_CB_VALUE args in opassuan_transact member. Add CANCEL_OP member. * ops.h (_gpgme_cancel_with_err, _gpgme_wait_on_condition): Add OP_ERR argument. (_gpgme_wait_one_ext): New prototype. * context.h (ctx_op_data_id_t): Add OPDATA_VFS_MOUNT. * engine-g13.c (g13_cancel_op): New function. (parse_status): Remove declaration. (g13_assuan_simple_command): Do nothing with status lines for now. (status_handler): Update opaque value access. (_gpgme_engine_ops_g13): Add new cancel_op member. * gpgme.c (_gpgme_cancel_with_err): Add new parameter OP_ERR. Handle operational errors. (gpgme_cancel, gpgme_io_read, gpgme_io_write): Add debug output. * data.c (_gpgme_data_inbound_handler) (_gpgme_data_outbound_handler): Adjust opaque value access. * engine-gpg.c (command_handler, status_handler) (colon_line_handler): Likewise. * engine-gpgsm.c (status_handler): Likewise. * engine-gpg.c (_gpgme_engine_ops_gpg): Add cancel_op member. * engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise. * g13.c: Rewritten (and will be rewritten again). * engine.h (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameters from prototype. (_gpgme_engine_cancel_op): New prototype. * engine.c (engine_ops) [! ENABLE_ASSUAN]: Add missing comma. (_gpgme_engine_op_assuan_transact): Remove result_cb and result_cb_value parameter. (_gpgme_engine_cancel_op): New function. * wait.h (_gpgme_run_io_cb): Add new argument OP_ERR. (struct io_cb_data): New struct to pass opaque data and get a op_err return value. Needed because we can't modify I/O callback handler signature because it is exposed to the user. * wait.c (_gpgme_run_io_cb): Add OP_ERR parameter. Handle operational errors. * wait-user.c (_gpgme_user_io_cb_handler): Handle operational errors. * wait-private.c (_gpgme_wait_on_condition): New argument to retrieve the operational result. Handle operational errors in session based protocols. (_gpgme_wait_one_ext): New function. (_gpgme_wait_one): Pass argument in invocation of _gpgme_wait_on_condition. * wait-global.c (struct ctx_list_item): Add member OP_ERR. (ctx_done): New argument OP_ERR. (ctx_wait): New argument OP_ERR. (gpgme_wait_ext): New function based on gpgme_wait but handling operational errors. (gpgme_wait): Implement in term of gpgme_wait_ext. * keylist.c (gpgme_op_keylist_next): Pass argument in invocation of _gpgme_wait_on_condition. * trustlist.c (gpgme_op_trustlist_next): Pass argument in invocation of _gpgme_wait_on_condition. * engine-assuan.c (struct engine_llass): Replace members RESULT_CB and RESULT_CB_VALUE by LAST_OP_ERR. (_gpgme_engine_assuan_last_op_err): Add this hack function. (llass_cancel_op): New function. (_gpgme_engine_llass_ops): Add cancel_op member. (llass_status_handler): Update opaque value access. (llass_transact): Remove RESULT_CB and RESULT_CB_VALUE arguments. * opassuan.c: Move compat hacks to the end of file. (opassuan_start): Do not set OPD->result.err. Do not pass RESULT_Cb and CTX to _gpgme_engine_op_assuan_transact. (gpgme_op_assuan_transact_ext): New function.
2009-10-26 18:52:32 +00:00
{
struct gpgme_io_event_done_data done_data;
done_data.err = 0;
done_data.op_err = 0;
_gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &done_data);
}
}
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
return 0;
}
/* Register the file descriptor FD with the handler FNC (which gets
FNC_DATA as its first argument) for the direction DIR. DATA should
be the context for which the fd is added. R_TAG will hold the tag
that can be used to remove the fd. */
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_error_t
_gpgme_wait_user_add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc,
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
void *fnc_data, void **r_tag)
{
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_ctx_t ctx = (gpgme_ctx_t) data;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
struct tag *tag;
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_error_t err;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
assert (ctx);
err = _gpgme_add_io_cb (data, fd, dir, fnc, fnc_data, r_tag);
if (err)
return err;
tag = *r_tag;
assert (tag);
err = (*ctx->io_cbs.add) (ctx->io_cbs.add_priv, fd, dir,
_gpgme_user_io_cb_handler, *r_tag,
&tag->user_tag);
if (err)
_gpgme_remove_io_cb (*r_tag);
return err;
}
void
_gpgme_wait_user_remove_io_cb (void *data)
{
struct tag *tag = (struct tag *) data;
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_ctx_t ctx;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
assert (tag);
ctx = tag->ctx;
(*ctx->io_cbs.remove) (tag->user_tag);
_gpgme_remove_io_cb (data);
}
void
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
_gpgme_wait_user_event_cb (void *data, gpgme_event_io_t type, void *type_data)
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
{
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_ctx_t ctx = data;
doc/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (I/O Callback Interface): Document new even GPGME_EVENT_START. (Waiting For Completion): Document new possible return values. (I/O Callback Interface): Document return type of GpgmeIOCb. gpgme/ 2003-01-29 Marcus Brinkmann <marcus@g10code.de> * context.h (gpgme_context_s): Remove member ERROR. * types.h (GpgmeStatusHandler): Change return type to GpgmeError. (GpgmeCommandHandler): Change return type to GpgmeError and add new argument RESULT. * gpgme.h (GpgmeIOCb): Change return type to GpgmeError. (GpgmeEventIO): New event GPGME_EVENT_START. (GpgmeIdleFunc): Remove type. (gpgme_register_idle): Remove prototype. * data.c: Include <assert.h>. (_gpgme_data_inbound_handler): Change return type to GpgmeError. Return any error instead ignoring it, don't close file descriptor on error. (_gpgme_data_outbound_handler): Likewise. * decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>. (_gpgme_decrypt_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. (gpgme_op_decrypt): Don't work around the old kludge anymore. * decrypt-verify.c (decrypt_verify_status_handler): Change return type to GpgmeError. Return possible errors. * delete.c: Do not include <stdio.h>, <string.h>, <time.h> and <assert.h>. (delete_status_handler): Change return type to GpgmeError. Return error instead setting ctx->error. Return success at end of function. * edit.c: Do not include <stdio.h> and <string.h>. (_gpgme_edit_status_handler): Change type to GpgmeError, make static and rename to ... (edit_status_handler): ... this. Return error directly. (command_handler): Change return type to GpgmeError, add result argument. Return error directly. * encrypt.c (status_handler_finish): Remove function. (_gpgme_encrypt_status_handler): Change return type to GpgmeError. Return error directly. (_gpgme_encrypt_sym_status_handler): Likewise. * encrypt-sign.c (encrypt_sign_status_handler): Likewise. * engine-gpgsm.c (close_notify_handler): Do not signal done event anymore. (status_handler): Change return type to GpgmeError. Diddle things around a bit to return errors directly. (start): Send start event. * export.c: Do not include <stdio.h>, <string.h> and <assert.h>. (export_status_handler): Change return type to GpgmeError. Don't check ctx->error. * genkey.c: Do not include <stdio.h> and <assert.h>. (genkey_status_handler): Change return type to GpgmeError. Don't check ctx->error. Return errors directly. * gpgme.c (_gpgme_release_result): Do not initialize ctx->error. (_gpgme_op_event_cb): Function removed. (_gpgme_op_event_cb_user): Likewise. * import.c: Do not include <stdio.h>, <string.h> and <assert.h>. (import_status_handler): Change return type to GpgmeError. Don't check ctx->error. * keylist.c (keylist_colon_handler, keylist_status_handler, finish_key): Change return type to GpgmeError, return error directly. * Makefile (libgpgme_la_SOURCES): Add wait-global.c, wait-private.c and wait-user.c * ops.h (test_and_allocate_result): Return error instead setting ctx->error. (_gpgme_data_inbound_handler, _gpgme_data_outbound_handler, _gpgme_verify_status_handler, _gpgme_decrypt_status_handler, _gpgme_sign_status_handler, _gpgme_encrypt_staus_handler, _gpgme_passphrase_status_handler, _gpgme_progress_status_handler): Change return type to GpgmeError. (_gpgme_passphease_command_handler): Change return type to GpgmeError and add new argument RESULT. * op-support.c: Use new callback functions, and change private data to ctx everywhere. * passphrase.c (_gpgme_passphrase_status_handler): Change return type to GpgmeError, return error directly. (_gpgme_passphrase_command_handler): Change return type to GpgmeError, add result argument. Return results accordingly. * progress.c (_gpgme_progress_status_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (status_handler): Change return type to GpgmeError. Return error directly. (close_notify_handler): Don't send done event. (colon_line_handler): Change return type to GpgmeError, return errors directly. * rungpg.c (start): Send start event. * sign.c (_gpgme_sign_status_handler): Change return type to GpgmeError, return errors directly. * trustlist.c (trustlist_status_handler): Change return type to GpgmeError. Return 0. (trustlist_colon_handler): Change return type GpgmeError. Return errors directly. * verify.c (add_notation): Change return type to GpgmeError, return errors directly. (_gpgme_verify_status_handler): Likewise. * wait.h (struct fd_table): Remove lock member. (struct wait_item_s): Moved here from wait.c. (struct tag): New structure. (_gpgme_wait_event_cb): Remove prototype. (_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb, _gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb, _gpgme_wait_user_event_io_cb): New prototypes. * wait.c: Don't include <stdio.h>. (ftd_global, ctx_done_list, ctx_done_list_size, ctx_done_list_length, ctx_done_list_lock, idle_function): Remove global variable. (gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove function. (gpgme_wait): Move to file wait-global.c. (_gpgme_add_io_cb): Take ctx as private argument, initialize ctx member in wait item and tag. (_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock. (_gpgme_wait_one, _gpgme_wait_on_condition): Move to wait-private.c. (gpgme_fd_table_init): Don't initialize FDT->lock. (gpgme_fd_table_deinit): Don't destroy FDT->lock. (_gpgme_fd_table_put): Make static and rename to ... (fd_table_put): ... this function. Don't use FDT->lock. (struct wait_item_s): Move to wait.h. * wait-global.c: New file. * wait-private.c: New file. * wait-user.c: New file.
2003-01-29 15:20:58 +00:00
if (ctx->io_cbs.event)
(*ctx->io_cbs.event) (ctx->io_cbs.event_priv, type, type_data);
}