GckObjectCache

GckObjectCache — An interface which holds attributes for a PKCS#11 object

Synopsis

                    GckObjectCache;
struct              GckObjectCacheIface;
GckAttributes *     gck_object_cache_get_attributes     (GckObjectCache *object);
void                gck_object_cache_set_attributes     (GckObjectCache *object,
                                                         GckAttributes *attrs);
void                gck_object_cache_fill               (GckObjectCache *object,
                                                         GckAttributes *attrs);
GckAttributes *     gck_object_cache_lookup             (GckObject *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                gck_object_cache_lookup_async       (GckObject *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GckAttributes *     gck_object_cache_lookup_finish      (GckObject *object,
                                                         GAsyncResult *result,
                                                         GError **error);
gboolean            gck_object_cache_update             (GckObjectCache *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GError **error);
void                gck_object_cache_update_async       (GckObjectCache *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            gck_object_cache_update_finish      (GckObjectCache *object,
                                                         GAsyncResult *result,
                                                         GError **error);

Object Hierarchy

  GInterface
   +----GckObjectCache

Prerequisites

GckObjectCache requires GckObject.

Properties

  "attributes"               GckAttributes*        : Read / Write

Description

GckObjectCache is an interface implemented by derived classes of GckObject to indicate which attributes they'd like an enumerator to retrieve. These attributes are then cached on the object and can be retrieved through the "attributes" property.

Details

GckObjectCache

typedef struct _GckObjectCache GckObjectCache;

An interface implemented on an GckObject which contains a cache of attributes.


struct GckObjectCacheIface

struct GckObjectCacheIface {
	GTypeInterface interface;

	const gulong *  default_types;
	gint            n_default_types;

	void         (* fill)                              (GckObjectCache *object,
	                                                    GckAttributes *attrs);
};

Interface for GckObjectCache. If the default_types field is set by a implementing class, then the a GckEnumerator which has been setup using gck_enumerator_set_object_type()

The implementation for populate should add the attributes to the cache. It must be thread safe.

GTypeInterface interface;

parent interface

const gulong *default_types;

attribute types that an enumerator should retrieve. [array length=n_default_types]

gint n_default_types;

number of attribute types to be retrieved

fill ()

virtual method to add attributes to the cache

gck_object_cache_get_attributes ()

GckAttributes *     gck_object_cache_get_attributes     (GckObjectCache *object);

Gets the attributes cached on this object.

object :

an object with an attribute cache

Returns :

the attributes. [transfer full][allow-none]

gck_object_cache_set_attributes ()

void                gck_object_cache_set_attributes     (GckObjectCache *object,
                                                         GckAttributes *attrs);

Sets the attributes cached on this object.

If the attrs GckAttributes is floating, it is consumed.

object :

an object with an attribute cache

attrs :

the attributes to set. [allow-none]

gck_object_cache_fill ()

void                gck_object_cache_fill               (GckObjectCache *object,
                                                         GckAttributes *attrs);

Adds the attributes to the set cached on this object. If an attribute is already present in the cache it will be overridden by this value.

This will be done in a thread-safe manner.

If the attrs GckAttributes is floating, it is consumed.

object :

an object with the cache

attrs :

the attributes to cache

gck_object_cache_lookup ()

GckAttributes *     gck_object_cache_lookup             (GckObject *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GError **error);

Lookup attributes in the cache, or retrieve them from the object if necessary.

If object is a GckObjectCache then this will lookup the attributes there first if available, otherwise will read them from the object and update the cache.

If object is not a GckObjectCache, then the attributes will simply be read from the object.

This may block, use the asynchronous version when this is not desirable

object :

the object

attr_types :

the types of attributes to update. [array length=n_attr_types]

n_attr_types :

the number of attribute types

cancellable :

optional cancellation object

error :

location to place an error

Returns :

the attributes retrieved or NULL on failure. [transfer full]

gck_object_cache_lookup_async ()

void                gck_object_cache_lookup_async       (GckObject *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Lookup attributes in the cache, or retrieve them from the object if necessary.

If object is a GckObjectCache then this will lookup the attributes there first if available, otherwise will read them from the object and update the cache.

If object is not a GckObjectCache, then the attributes will simply be read from the object.

This will return immediately and complete asynchronously

object :

the object

attr_types :

the types of attributes to update. [array length=n_attr_types]

n_attr_types :

the number of attribute types

cancellable :

optional cancellation object

callback :

called when the operation completes

user_data :

data to pass to the callback

gck_object_cache_lookup_finish ()

GckAttributes *     gck_object_cache_lookup_finish      (GckObject *object,
                                                         GAsyncResult *result,
                                                         GError **error);

Complete an operation to lookup attributes in the cache or retrieve them from the object if necessary.

object :

the object

result :

the asynchrounous result passed to the callback

error :

location to place an error

Returns :

the attributes retrieved or NULL on failure. [transfer full]

gck_object_cache_update ()

gboolean            gck_object_cache_update             (GckObjectCache *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GError **error);

Update the object cache with given attributes. If an attribute already exists in the cache, it will be updated, and if it doesn't it will be added.

This may block, use the asynchronous version when this is not desirable

object :

the object with the cache

attr_types :

the types of attributes to update. [array length=n_attr_types]

n_attr_types :

the number of attribute types

cancellable :

optional cancellation object

error :

location to place an error

Returns :

whether the cache update was successful

gck_object_cache_update_async ()

void                gck_object_cache_update_async       (GckObjectCache *object,
                                                         const gulong *attr_types,
                                                         gint n_attr_types,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Update the object cache with given attributes. If an attribute already exists in the cache, it will be updated, and if it doesn't it will be added.

This call will return immediately and complete asynchronously.

object :

the object with the cache

attr_types :

the types of attributes to update. [array length=n_attr_types]

n_attr_types :

the number of attribute types

cancellable :

optional cancellation object

callback :

called when the operation completes

user_data :

data to be passed to the callback

gck_object_cache_update_finish ()

gboolean            gck_object_cache_update_finish      (GckObjectCache *object,
                                                         GAsyncResult *result,
                                                         GError **error);

Complete an asynchronous operation to update the object cache with given attributes.

object :

the object with the cache

result :

the asynchronous result passed to the callback

error :

location to place an error

Returns :

whether the cache update was successful

Property Details

The "attributes" property

  "attributes"               GckAttributes*        : Read / Write

The attributes cached on this object.