Next: , Previous: I/O Callback Interface, Up: Using External Event Loops


7.7.2.2 Registering I/O Callbacks
— Data type: struct gpgme_io_cb_ts

This structure is used to store the I/O callback interface functions described in the previous section. It has the following members:

gpgme_register_io_cb_t add
This is the function called by GPGME to register an I/O callback handler. It must be specified.
void *add_data
This is passed as the first argument to the add function when it is called by GPGME. For example, it can be used to determine the event loop to which the file descriptor should be added.
gpgme_remove_io_cb_t remove
This is the function called by GPGME to remove an I/O callback handler. It must be specified.
gpgme_event_io_cb_t event
This is the function called by GPGME to signal an event for an operation. It must be specified, because at least the start event must be processed.
void *event_data
This is passed as the first argument to the event function when it is called by GPGME. For example, it can be used to determine the context in which the event has occured.

— Function: void gpgme_set_io_cbs (gpgme_ctx_t ctx, struct gpgme_io_cb_ts *io_cbs)

The function gpgme_set_io_cbs enables the I/O callback interface for the context ctx. The I/O callback functions are specified by io_cbs.

If io_cbs->add is NULL, the I/O callback interface is disabled for the context, and normal operation is restored.

— Function: void gpgme_get_io_cbs (gpgme_ctx_t ctx, struct gpgme_io_cb_ts *io_cbs)

The function gpgme_get_io_cbs returns the I/O callback functions set with gpgme_set_io_cbs in io_cbs.