GckEnumerator

## GckEnumerator GckEnumerator — Enumerates through PKCS#11 objects. |

## Synopsis

    struct              GckEnumerator;
    GckObject *         gck_enumerator_next                 (GckEnumerator *self,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                gck_enumerator_next_async           (GckEnumerator *self,
                                                             gint max_objects,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GList *             gck_enumerator_next_finish          (GckEnumerator *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    GList *             gck_enumerator_next_n               (GckEnumerator *self,
                                                             gint max_objects,
                                                             GCancellable *cancellable,
                                                             GError **error);

## Description

A GckEnumerator can be used to enumerate through PKCS#11 objects. It will automatically create sessions as necessary.

Use `gck_modules_enumerate_objects()` or `gck_modules_enumerate_uri()` to create an enumerator. To get the objects use `gck_enumerator_next()` or `gck_enumerator_next_async()` functions.

## Details

### struct GckEnumerator

    struct GckEnumerator {
    	GObject parent;
    };

An object that allows enumerating of objects across modules, tokens.

GObject `parent`; | derived from this.

### gck_enumerator_next ()

    GckObject *         gck_enumerator_next                 (GckEnumerator *self,
                                                             GCancellable *cancellable,
                                                             GError **error);

Get the next object in the enumerator, or `NULL` if there are no more objects.

`NULL` is also returned if the function fails. Use the `error` to determine whether a failure occurred or not.

`self` : | The enumerator
`cancellable` : | A GCancellable or `NULL`
`error` : | A location to store an error on failure
Returns : | The next object, which must be released using g_object_unref, or `NULL`.

### gck_enumerator_next_async ()

    void                gck_enumerator_next_async           (GckEnumerator *self,
                                                             gint max_objects,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Get the next set of objects from the enumerator. This operation completes asynchronously.The maximum number of objects can be specified with `max_objects`. If -1 is specified, then all the remaining objects will be enumerated.

`self` : | An enumerator
`max_objects` : | The maximum number of objects to get
`cancellable` : | A GCancellable or `NULL`
`callback` : | Called when the result is ready
`user_data` : | Data to pass to the callback

### gck_enumerator_next_finish ()

    GList *             gck_enumerator_next_finish          (GckEnumerator *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Complete an operation to enumerate next objects.

`NULL` is also returned if the function fails. Use the `error` to determine whether a failure occurred or not.

`self` : | An enumerator
`result` : | The result passed to the callback
`error` : | A location to raise an error on failure.
Returns : | The list of objects, which should be freed with `gck_list_unref_free()`

### gck_enumerator_next_n ()

    GList *             gck_enumerator_next_n               (GckEnumerator *self,
                                                             gint max_objects,
                                                             GCancellable *cancellable,
                                                             GError **error);

Get the next set of objects from the enumerator. The maximum number of objects can be specified with `max_objects`. If -1 is specified, then all the remaining objects will be returned.

`NULL` is also returned if the function fails. Use the `error` to determine whether a failure occurred or not.

`self` : | An enumerator
`max_objects` : | The maximum amount of objects to enumerate
`cancellable` : | A GCancellable or `NULL`
`error` : | A location to store an error on failure
Returns : | A list of objects, which should be freed using `gck_list_unref_free()`.