Miscellaneous Functions

Miscellaneous Functions — Other miscellaneous functions.

Synopsis

GList *               gck_list_ref_copy                 (GList *reflist);
void                gck_list_unref_free                 (GList *reflist);
gchar *               gck_string_from_chars             (const guchar *data,
                                                         gsize max);
gboolean            gck_value_to_boolean                (gconstpointer value,
                                                         gsize length,
                                                         gboolean *result);
gboolean            gck_value_to_ulong                  (gconstpointer value,
                                                         gsize length,
                                                         gulong *result);
#define             GCK_INVALID

Description

A few supporting functions that come in handy when dealing with the gck library or PKCS11 in general.

Details

gck_list_ref_copy ()

GList *               gck_list_ref_copy                 (GList *reflist);

Copy a list of GObject based pointers. All objects in the list will be reffed and the list will be copied.

reflist :

List of GObject reference counted objects.

Returns :

The copied and reffed list. When done, free it with gck_list_unref_free()

gck_list_unref_free ()

void                gck_list_unref_free                 (GList *reflist);

Free a list of GObject based pointers. All objects in the list will be unreffed and then the list itself will be freed.

reflist :

List of Gobject reference counted pointers.

gck_string_from_chars ()

gchar *               gck_string_from_chars             (const guchar *data,
                                                         gsize max);

Create a string from a set of PKCS#11 characters. This is similar to g_strndup, except for that it also strips trailing spaces. These space padded strings are often used in PKCS#11 structures.

data :

The character data to turn into a null terminated string.

max :

The maximum length of the charater data.

Returns :

The null terminated string.

gck_value_to_boolean ()

gboolean            gck_value_to_boolean                (gconstpointer value,
                                                         gsize length,
                                                         gboolean *result);

Convert CK_BBOOL type memory to a boolean.

value :

memory to convert

length :

length of memory

result :

A location to store the result

Returns :

Whether the conversion was successful.

gck_value_to_ulong ()

gboolean            gck_value_to_ulong                  (gconstpointer value,
                                                         gsize length,
                                                         gulong *result);

Convert CK_ULONG type memory to a boolean.

value :

memory to convert

length :

length of memory

result :

A location to store the result

Returns :

Whether the conversion was successful.

GCK_INVALID

#define GCK_INVALID G_MAXULONG

Used as a terminator at the end of variable argument lists.