Next: , Up: Handler Functions

4.1 Progress handler

It is often useful to retrieve some feedback while long running operations are performed.

— Data type: gcry_handler_progress_t

Progress handler functions have to be of the type gcry_handler_progress_t, which is defined as:

void (*gcry_handler_progress_t) (void *, const char *, int, int, int)

The following function may be used to register a handler function for this purpose.

— Function: void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data)

This function installs cb as the `Progress handler' function. cb must be defined as follows:

          my_progress_handler (void *cb_data, const char *what,
                               int printchar, int current, int total)
            /* Do something.  */

A description of the arguments of the progress handler function follows.

The argument provided in the call to gcry_set_progress_handler.
A string identifying the type of the progress output. The following values for what are defined:
Not enough entropy is available. total holds the number of required bytes.
Values for printchar:
Prime generated.
Need to refresh the pool of prime numbers.
<, >
Number of bits adjusted.
Searching for a generator.
Fermat test on 10 candidates failed.
Restart with a new random value.
Rabin Miller test passed.