## GckModule lists GckModule lists — Dealing with lists of PKCS#11 modules. |

## Synopsis

    GckEnumerator *         gck_modules_enumerate_objects   (GList *modules,
                                                             GckAttributes *attrs,
                                                             guint session_options);
    GckEnumerator *         gck_modules_enumerate_uri       (GList *modules,
                                                             const gchar *uri,
                                                             guint session_options,
                                                             GError **error);
    GList *                 gck_modules_get_slots           (GList *modules,
                                                             gboolean token_present);
    GList *                 gck_modules_initialize_registered
                                                            (guint reserved_options);
    gchar **                gck_modules_list_registered_paths
                                                            (GError **error);
    GckObject *             gck_modules_object_for_uri      (GList *modules,
                                                             const gchar *uri,
                                                             guint session_options,
                                                             GError **error);
    GList *                 gck_modules_objects_for_uri     (GList *modules,
                                                             const gchar *uri,
                                                             guint session_options,
                                                             GError **error);
    GckSlot *               gck_modules_token_for_uri       (GList *modules,
                                                             const gchar *uri,
                                                             GError **error);

## Description

These functions are useful for dealing with lists of modules, and performing operations on all of them.

## Details

### gck_modules_enumerate_objects ()

    GckEnumerator *         gck_modules_enumerate_objects   (GList *modules,
                                                             GckAttributes *attrs,
                                                             guint session_options);

Setup an enumerator for listing matching objects on the modules.

This call will not block but will return an enumerator immediately.

`modules` : | The modules
`attrs` : | Attributes that the objects must have, or empty for all objects
`session_options` : | Options from GckSessionOptions
Returns : | A new enumerator, which should be released with `g_object_unref()`.

### gck_modules_enumerate_uri ()

    GckEnumerator *         gck_modules_enumerate_uri       (GList *modules,
                                                             const gchar *uri,
                                                             guint session_options,
                                                             GError **error);

Enumerate objects that match a URI.

This call will not block. Use the GckEnumerator functions in order to get at the actual objects that match.

`modules` : | The modules
`uri` : | The URI that the enumerator will match
`session_options` : | Options from GckSessionOptions
`error` : | A location to raise an error on failure.
Returns : | A new GckEnumerator, or `NULL` if an error occurs.

### gck_modules_get_slots ()

    GList *                 gck_modules_get_slots           (GList *modules,
                                                             gboolean token_present);

Get a list of slots for across all of the modules.

`modules` : | The modules
`token_present` : | Whether to only list slots with token present
Returns : | A list of GckSlot objects, which should be freed with `gck_list_unref_free()`.

### gck_modules_initialize_registered ()

    GList *                 gck_modules_initialize_registered
                                                            (guint reserved_options);

Initialize all the registered modules.

`reserved_options` : | Module options
Returns : | A list of GckModule objects, which should be freed by `gck_list_unref_free()`.

### gck_modules_list_registered_paths ()

    gchar **                gck_modules_list_registered_paths
                                                            (GError **error);

Get the paths for all registered modules.

`error` : | A location to store an error, on failure
Returns : | An array of module paths, should be freed with `g_strfreev()`.

### gck_modules_object_for_uri ()

    GckObject *             gck_modules_object_for_uri      (GList *modules,
                                                             const gchar *uri,
                                                             guint session_options,
                                                             GError **error);

Find an object that matches a URI.

This call can block. Use `gck_modules_enumerate_uri()` for a non-blocking version.

`modules` : | The modules
`uri` : | The URI the objects must match
`session_options` : | Options from GckSessionOptions
`error` : | A location to raise an error on failure.
Returns : | A new GckObject which should be released with `g_object_unref()`, or `NULL` if no matching object was found.

### gck_modules_objects_for_uri ()

    GList *                 gck_modules_objects_for_uri     (GList *modules,
                                                             const gchar *uri,
                                                             guint session_options,
                                                             GError **error);

Find objects that match a URI.

This call can block. Use `gck_modules_enumerate_uri()` for a non-blocking version.

`modules` : | The modules
`uri` : | The URI the objects must match
`session_options` : | Options from GckSessionOptions
`error` : | A location to raise an error on failure.
Returns : | A list of GckObject which should be released with `gck_list_unref_free()`, or `NULL` if no matching object was found.

### gck_modules_token_for_uri ()

    GckSlot *               gck_modules_token_for_uri       (GList *modules,
                                                             const gchar *uri,
                                                             GError **error);

Lookup a token that matches the URI.

`modules` : | The modules
`uri` : | The URI that the token must match
`error` : | A location to raise an error on failure
Returns : | A newly allocated GckSlot or `NULL` if no such token was found.